pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.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: Tue, 26 Sep 2023 17:31:30 -0400
Message-ID: <ZRNNssAV/470sBZD@momjian.us> (raw)
In-Reply-To: <ZPnZ9ILOZcWaqoY0@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>
	<1591985.1694044890@sss.pgh.pa.us>
	<ZPnZ9ILOZcWaqoY0@momjian.us>

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@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.





view thread (7+ messages)

Message-ID: <ZRNNssAV/470sBZD@momjian.us>
Permalink:  ../ZRNNssAV%2F470sBZD@momjian.us/
Also on:    postgresql.org/message-id/ZRNNssAV/470sBZD@momjian.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 using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, tgl@sss.pgh.pa.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: <ZRNNssAV/470sBZD@momjian.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