pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Travers <chris@metatrontech.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: GROUP BY checks inadequate when set returning functions in column list
Date: Wed, 22 Aug 2012 11:04:39 -0400
Message-ID: <15650.1345647879@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPKNUtf=0XFxYuy79qmoSQz_Q=663yuZTCZWhF-MXSr_UUXS+Q@mail.gmail.com>
References: <CAPKNUtf=0XFxYuy79qmoSQz_Q=663yuZTCZWhF-MXSr_UUXS+Q@mail.gmail.com>

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




view thread (4+ messages)  latest in thread

Message-ID: <15650.1345647879@sss.pgh.pa.us>
Permalink:  ../15650.1345647879@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15650.1345647879@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, chris@metatrontech.com
  Subject: Re: GROUP BY checks inadequate when set returning functions in column list
  In-Reply-To: <15650.1345647879@sss.pgh.pa.us>
  References: <CAPKNUtf=0XFxYuy79qmoSQz_Q=663yuZTCZWhF-MXSr_UUXS+Q@mail.gmail.com> <15650.1345647879@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox