Re: Ordering behavior for aggregates - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Ordering behavior for aggregates
Date
Msg-id 2350864.1670952139@sss.pgh.pa.us
Whole thread Raw
In response to Re: Ordering behavior for aggregates  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Ordering behavior for aggregates
List pgsql-hackers
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> I'm more keen on the idea of having the system understand when an ORDER BY
> is missing - that seems like what users are more likely to actually do.

That side of it could perhaps be useful, but not if it's an unintelligent
analysis.  If someone has a perfectly safe query written according to
the old-school method:

    SELECT string_agg(...) FROM (SELECT ... ORDER BY ...) ss;

they are not going to be too pleased with a nanny-ish warning (much
less an error) saying that the aggregate's input ordering is
underspecified.

I also wonder whether we'd accept any ORDER BY whatsoever, or try
to require one that produces a sufficiently-unique input ordering.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: New strategies for freezing, advancing relfrozenxid early
Next
From: Jacob Champion
Date:
Subject: Re: Remove SHA256_HMAC_B from scram-common.h