On Sat, 6 Jan 2024 at 16:22, David G. Johnston
<david.g.johnston@gmail.com> wrote:
> On Sat, Jan 6, 2024 at 8:38 AM Geoff Winkless <pgsqladmin@geoff.dj> wrote:
>> because when gp_conc is 0, it should be ordering by the concat() value.
>
> Something does seem off here with the interaction between grouping sets and order by.
> I'm inclined to believe that using grouping in the order by simply is an unsupported
> concept we fail to prohibit.
That's disappointing.
> You can get the desired result with a much less convoluted order by clause -
> so long as you understand where your nulls are coming from - with:
> ORDER BY
> n nulls first , x nulls first
Ahh, well, yes, that's fine in this instance which (as you may
remember) was a minimal example of the behaviour, but wouldn't be
useful in the real-world situation, where we can have many
potentially-conflicting grouping sets, each set needing to be ordered
consistently internally.
Geoff