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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Travers <chris(at)metatrontech(dot)com>
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:04:39
Message-ID: 15650.1345647879@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Chris Travers 2012-08-22 15:20:31 Re: GROUP BY checks inadequate when set returning functions in column list
Previous Message Chris Travers 2012-08-22 14:51:47 GROUP BY checks inadequate when set returning functions in column list