BUG #8830: Query with a subquery failes to execute if this subquery does not contain references to own table

From: valgog(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8830: Query with a subquery failes to execute if this subquery does not contain references to own table
Date: 2014-01-14 10:32:19
Message-ID: 20140114103219.30126.61565@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 8830
Logged by: Query with a subquery failes to execute if a subquery does not contain
references to inner table
Email address: valgog(at)gmail(dot)com
PostgreSQL version: 9.3.2
Operating system: Linux
Description:

select 'key.' || md5( s.i::text ) as key,
'value.' || ( select string_agg( md5( (s.i + g.j)::text), '' )
from generate_series(1, 10) as g(j)
) as value
from generate_series(1, 100) as s(i);

works fine.

select 'key.' || md5( s.i::text ) as key,
'value.' || ( select string_agg( md5( (s.i)::text), '' )
from generate_series(1, 20) as g(j)
) as value
from generate_series(1, 100) as s(i);

fails with:

ERROR: column "s.i" must appear in the GROUP BY clause or be used in an
aggregate function
LINE 2: select 'key.' || md5( s.i::text ) as key,

Is it a bug or a feature?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Oskari Saarenmaa 2014-01-14 12:43:05 Re: BUG #8470: 9.3 locking/subtransaction performance regression
Previous Message Jeevan Chalke 2014-01-14 07:24:18 Re: [BUGS] surprising to_timestamp behavior