Pavel Stehule <pavel.steh...@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