Re: group by can use alias from select list

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, postgres-hape(at)gmx(dot)de, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: group by can use alias from select list
Date: 2023-09-26 21:31:30
Message-ID: ZRNNssAV/470sBZD@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, Sep 7, 2023 at 10:11:00AM -0400, Bruce Momjian wrote:
> We do farther down the docs in the GROUP BY section:
>
> https://www.postgresql.org/docs/devel/sql-select.html
>
> GROUP BY will condense into a single row all selected rows that share
> the same values for the grouped expressions. An expression used inside a
> grouping_element can be an input column name, or the name or ordinal
> number of an output column (SELECT list item), or an arbitrary
> expression formed from input-column values. In case of ambiguity, a
> ------------------------
> GROUP BY name will be interpreted as an input-column name rather than an
> output column name.
>
> It says
>
> * input column name
> * output column name or ordinal number
> * expression formed from input-column values
>
> Is this too subtle?

Patch applied back to PG 11.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2023-09-26 23:24:22 Re: Incorrect/confusing information about timetz
Previous Message Bruce Momjian 2023-09-26 20:26:05 Re: pg_upgrade doc uses inconsistent versions within the doc.