Re: Wrong result: count(DISTINCT x COLLATE "C") with GROUP BY x on a nondeterministic collation

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Nidal FAKIH <nidal(dot)fakih(at)soptimal(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Wrong result: count(DISTINCT x COLLATE "C") with GROUP BY x on a nondeterministic collation
Date: 2026-11-04 21:33:26
Message-ID: CAApHDvpG59OW-NGgDSsg1HHfLe80BhOPUHcA+DVn+wTxGDm4yQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 4 Nov 2026 at 22:34, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> See attached for a draft patch. I'll look at committing this tomorrow
> as it's a bit late here right now.

Now pushed and backpatched to v15. v15 did limit the Datum sort to
only byval columns, and I don't believe we have any built-in byval
types that could have caused issues here, but I pushed the fix to v15
anyway, as it might not be impossible for someone to dream up a custom
type that's collatable and byval. v15 also doesn't have the presorted
aggregate optimisation, so it might not be affected at all, depending
on if that's the only method of triggering this.

Thanks again for the report.

David

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message shihao zhong 2026-11-04 21:05:33 Re: set_config(‘search_path’) does not truncate names over 63 bytes, unlike SET