Re: GROUP BY checks inadequate when set returning functions in column list - Mailing list pgsql-bugs

From Tom Lane
Subject Re: GROUP BY checks inadequate when set returning functions in column list
Date
Msg-id 15650.1345647879@sss.pgh.pa.us
Whole thread Raw
In response to GROUP BY checks inadequate when set returning functions in column list  (Chris Travers <chris@metatrontech.com>)
Responses Re: GROUP BY checks inadequate when set returning functions in column list
List pgsql-bugs
Chris Travers <chris@metatrontech.com> writes:
> It's when we add group by that things appear broken.  Note it starts
> returning 196 (14 x 14) records, which suggests a cross join against
> itself.

> mtech_test=# explain analyze select (account_heading__list()).* group by accno
> mtech_test-# ;

Hm, that really ought to throw an error, since you have ungrouped
columns in the result.  Not sure why it doesn't.

Beyond that, though, using a SRF in the target list this way is a bad
idea because the semantics are very ill-defined.  Stick to using it
in FROM.  (The upcoming LATERAL feature will remove the functional
limitations associated with that, so we're very unlikely to do anything
towards changing the existing behavior of SRFs-in-target-lists, no
matter how wacko they might appear.)

            regards, tom lane

pgsql-bugs by date:

Previous
From: Chris Travers
Date:
Subject: GROUP BY checks inadequate when set returning functions in column list
Next
From: Chris Travers
Date:
Subject: Re: GROUP BY checks inadequate when set returning functions in column list