Re: Order changes in PG16 since ICU introduction - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Order changes in PG16 since ICU introduction
Date
Msg-id 019ee93d8e7052b3a98fb46165e6c96fe312f338.camel@j-davis.com
Whole thread Raw
In response to Re: Order changes in PG16 since ICU introduction  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-hackers
On Fri, 2023-05-26 at 18:24 +0200, Daniel Verite wrote:
> To me initdb is wrong when coming up with the less precise "fr"
> instead of "fr-FR".
>
> I suggest the attached patch to call uloc_getDefault() instead of the
> current code that somehow leaves out the country/region component.

Thank you. I experimented with several ICU versions and different
environmental settings, and it does seem better at preserving the name
that comes from the environment.

There is a warning in the docs: "Do not use unless you know what you
are doing."[1] I don't see a reason for the warning or any major risk
from us using it. Perhaps it's because the result is affected by either
the environment or the last uloc_setDefault() call. We don't use
uloc_setDefault(), and we only call uloc_getDefault() once, so I don't
see a risk here.

The fix seems simple enough. Committed.

Regards,
    Jeff Davis

[1]
https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/uloc_8h.html#a4efa16db7351e62293f8ef0c37aac8d2



pgsql-hackers by date:

Previous
From: Kaiting Chen
Date:
Subject: Re: Is NEW.ctid usable as table_tuple_satisfies_snapshot?
Next
From: Peter Geoghegan
Date:
Subject: Re: Cleaning up nbtree after logical decoding on standby work