Re: BUG #17232: DISTINCT ON does not allow AS - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #17232: DISTINCT ON does not allow AS
Date
Msg-id CAKFQuwauxdgK=0gRiMUbMprcs83-NVgpZNvRkkNOKn_uF12Sjg@mail.gmail.com
Whole thread Raw
In response to BUG #17232: DISTINCT ON does not allow AS  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Friday, October 15, 2021, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      17232
Logged by:          Kyle Lahnakoski
Email address:      kyle@lahnakoski.com
PostgreSQL version: 14.0
Operating system:   windows
Description:       

The following SQL has an unexpected syntax error

    SELECT DISTINCT ON (col) AS col, col2 FROM test

The AS clause is usually used to indicate alias, but it does not work in
this case

No it doesn’t.  Why do you think it should?  The columns in the ON parens are not output so they don’t ned aliases.

David J. 

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17232: DISTINCT ON does not allow AS
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #17232: DISTINCT ON does not allow AS