Skip site navigation (1) Skip section navigation (2)

Re: GROUP BY checks inadequate when set returning functions in column list

From: Chris Travers <chris(at)metatrontech(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: GROUP BY checks inadequate when set returning functions in column list
Date: 2012-08-22 15:20:31
Message-ID: CAPKNUtcxGUpjRmbm6rQiEa91Kmvsk2T54S3nWeosUe7HDkg6Pw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Wed, Aug 22, 2012 at 8:04 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Chris Travers <chris(at)metatrontech(dot)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


In response to

Responses

pgsql-bugs by date

Next:From: Kevin GrittnerDate: 2012-08-22 15:34:09
Subject: Re: additional message to the bug #7499
Previous:From: Tom LaneDate: 2012-08-22 15:04:39
Subject: Re: GROUP BY checks inadequate when set returning functions in column list

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group