Re: ANY_VALUE aggregate

From: Pantelis Theodosiou <ypercube(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Vik Fearing <vik(at)postgresfriends(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ANY_VALUE aggregate
Date: 2022-12-07 08:58:44
Message-ID: CAE3TBxzBvf+mqUtG=4BF=xt0Wg_dkx1Ohq2Wa=FAr5te24KbYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 6, 2022 at 4:57 AM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
...
>
>
> I'm referring to the query:
>
> select any_value(v order by v) from (values (2),(1),(3)) as vals (v);
> // produces 1, per the documented implementation-defined behavior.
>
> Someone writing:
>
> select any_value(v) from (values (2),(1),(3)) as vals (v) order by v;
>
> Is not presently, nor am I saying, promised the value 1.
>

Shouldn't the 2nd query be producing an error, as it has an implied
GROUP BY () - so column v cannot appear (unless aggregated) in SELECT
and ORDER BY?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2022-12-07 09:00:25 Re: Minimal logical decoding on standbys
Previous Message Melih Mutlu 2022-12-07 08:55:24 Re: Improve tab completion for ALTER FUNCTION/PROCEDURE/ROUTINE