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

From Chris Travers
Subject Re: GROUP BY checks inadequate when set returning functions in column list
Date
Msg-id CAPKNUtcxGUpjRmbm6rQiEa91Kmvsk2T54S3nWeosUe7HDkg6Pw@mail.gmail.com
Whole thread Raw
In response to Re: GROUP BY checks inadequate when set returning functions in column list  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: GROUP BY checks inadequate when set returning functions in column list  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Wed, Aug 22, 2012 at 8:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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.

Yeah, that was my point.  I don't know if it is worth fixing but
always better to report.
>
> Beyond that, though, using a SRF in the target list this way is a bad
> idea because the semantics are very ill-defined.

Yeah.  It looks like when you pair it with a general set in a from
clause you get an implicit cross join.

I have been avoiding it because I don't like implicit cross joins.

I will be following the LATERAL feature with interest.   Thanks for that.

Best Wishes,
Chris Travers

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: GROUP BY checks inadequate when set returning functions in column list
Next
From: "Kevin Grittner"
Date:
Subject: Re: additional message to the bug #7499