Re: BUG #17232: DISTINCT ON does not allow AS

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "kyle(at)lahnakoski(dot)com" <kyle(at)lahnakoski(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17232: DISTINCT ON does not allow AS
Date: 2021-10-15 23:01:08
Message-ID: CAKFQuwauxdgK=0gRiMUbMprcs83-NVgpZNvRkkNOKn_uF12Sjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Friday, October 15, 2021, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 17232
> Logged by: Kyle Lahnakoski
> Email address: kyle(at)lahnakoski(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2021-10-16 14:59:15 Re: BUG #17232: DISTINCT ON does not allow AS
Previous Message PG Bug reporting form 2021-10-15 22:41:35 BUG #17232: DISTINCT ON does not allow AS