Re: group by can use alias from select list - Mailing list pgsql-docs

From Tom Lane
Subject Re: group by can use alias from select list
Date
Msg-id 1591985.1694044890@sss.pgh.pa.us
Whole thread Raw
In response to Re: group by can use alias from select list  (Bruce Momjian <bruce@momjian.us>)
Responses Re: group by can use alias from select list
List pgsql-docs
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



pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: group by can use alias from select list
Next
From: Bruce Momjian
Date:
Subject: Re: group by can use alias from select list