Bruce Momjian <br...@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