On Tue, Feb 14, 2023 at 12:35 PM Alvaro Herrera <alvherre@xxxxxxxxxxxxxx> wrote:
On 2023-Feb-14, Dominique Devienne wrote:
> Honestly, who expects the same prefix to sort differently based on what
> comes after, in left-to-right languages?
Look, we don't define the collation rules.
Ok, ok, sorry. To you, Laurenz, and everyone.
I obviously disagree with these rules, but I'm a nobody, so who cares :)
> So the "C" collation is fine with general UTF-8 encoding?
> I.e. it will be codepoint ordered OK?
Sure, just make sure to use the definition of C that uses UTF-8 encoding
(I think it's typically called C.UTF-8).
OK, so for new DBs, sounds like we need to
CREATE DATABASE ... WITH LOCALE 'C.UTF-8' ENCODING UTF8
Correct?
But what about existing DBs? Can the collation be changed a posteriori?
ALTER DATABASE does not seem to support the same options.
We don't want to have to sprinkle COLLATE "C" all over the place in the code.
And there are quite a few DBs out there already. What to do about them?