From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: postgres-hape@gmx.de
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: group by can use alias from select list
Date: Wed, 06 Sep 2023 20:01:30 -0400
Message-ID: <1591985.1694044890@sss.pgh.pa.us> (raw)
In-Reply-To: <ZPkQhuV8I6ijH+y3@momjian.us>
References: <168871536004.379168.9352636188330923805@wrigleys.postgresql.org>
<25b70e6ec7bef81acac508dc61dfa01e72c96252.camel@cybertec.at>
<CAKFQuwYALfM-yamV7GCPG_WZvi_qK5O8rJPOGkD40ShDd9M_GQ@mail.gmail.com>
<ZPkQhuV8I6ijH+y3@momjian.us>
Bruce Momjian <bruce@momjian.us> writes:
> On Tue, Jul 11, 2023 at 07:31:26AM -0700, David G. Johnston wrote:
>> I think the complaint is that someone seeing the behavior in the wild comes to
>> this order-of-operations and doesn't see that the observed behavior is
>> documented.
> How is the attached patch?
Maybe better "Although query output columns are nominally computed in the
next step, they can also be referenced (by name or by ordinal number)
as <literal>GROUP BY</literal> elements".
You could go further and add "Such references cannot be parts of
<literal>GROUP BY</literal> expressions, however." Not sure if we
cover that explicitly anywhere else.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: tgl@sss.pgh.pa.us, bruce@momjian.us, david.g.johnston@gmail.com, laurenz.albe@cybertec.at, postgres-hape@gmx.de, pgsql-docs@lists.postgresql.org
Subject: Re: group by can use alias from select list
In-Reply-To: <1591985.1694044890@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