Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W31Iy-0001x0-8C for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Jan 2014 10:33:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W31Ix-00045g-O9 for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Jan 2014 10:33:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W31Iv-00045S-R6 for pgsql-bugs@postgresql.org; Tue, 14 Jan 2014 10:33:05 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W31It-0000Ua-79 for pgsql-bugs@postgresql.org; Tue, 14 Jan 2014 10:33:05 +0000 MIME-Version: 1.0 Subject: BUG #8830: Query with a subquery failes to execute if this subquery does not contain references to own table To: pgsql-bugs@postgresql.org From: valgog@gmail.com Date: Tue, 14 Jan 2014 10:32:19 +0000 Message-ID: <20140114103219.30126.61565@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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@gmail.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? -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs