Re: [patch] bit XOR aggregate functions
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Vik Fearing <vik@postgresfriends.org>,
"David G. Johnston" <david.g.johnston@gmail.com>,
David Fetter <david@fetter.org>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>,
"bashtanov@imap.cc" <bashtanov@imap.cc>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-03-07T16:31:57Z
Lists: pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes: > But this is offtopic in this discussion :) The whole topic is off-topic. As a general rule, things that depend on input order shouldn't be declared as aggregates --- they should be window functions or ordered-set aggregates, for which the syntax forces you to specify input order. All of the standard aggregates, and most of our custom ones (including BIT_XOR) do not depend on input order (... mumble floating-point roundoff error mumble ...), so forcing users to write an ordering clause would be useless, not to mention being a SQL spec violation. There are a small minority like array_agg that do have such a dependency, but as far as I recall our docs for each of those warn about the need to sort the input for reproducible results. I think that's sufficient. Who's to say whether a particular query actually requires reproducible results? Seeing that we don't provide reproducible row ordering without an ORDER BY, I'm not sure why we should apply a different standard to array_agg. regards, tom lane
Commits
-
Add bit_xor aggregate function
- f9a0392e1cf3 14.0 landed