Re: Column aliases in GROUP BY and HAVING - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: Column aliases in GROUP BY and HAVING
Date
Msg-id 20201012170352.GA16328@hjp.at
Whole thread Raw
In response to Re: Column aliases in GROUP BY and HAVING  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 2020-10-12 10:40:03 -0400, Tom Lane wrote:
> "Peter J. Holzer" <hjp-pgsql@hjp.at> writes:
> > In the GROUP BY clause I can use the alias year which was defined
> > earlier in SELECT.
>
> This is a pretty unfortunate legacy thing that we support because
> backwards compatibility (and because "GROUP BY 1" is so frequently
> a handy shortcut).
[...]
> I think SQL versions newer than SQL92 disallow these references entirely.
>
> (I'm being fairly brief here, but this has all been litigated multiple
> times before.  See the archives.)

That's ok, you've answered my question. Thanks.

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Any interest in adding match_recognize?
Next
From: John the Scott
Date:
Subject: Re: rum index supported on pg13?