Re: Order changes in PG16 since ICU introduction

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Sandro Santilli <strk(at)kbt(dot)io>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Regina Obe <lr(at)pcorp(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Order changes in PG16 since ICU introduction
Date: 2023-04-26 01:15:21
Message-ID: 2aed8f5955ce1ab884ef3ee2adca0d65ac8e7218.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2023-04-21 at 22:35 +0100, Andrew Gierth wrote:
> > > > >
> Can lc_collate_is_c() be taught to check whether an ICU locale is
> using
> POSIX collation?

Attached are a few small patches:

0001: don't convert C to en-US-u-va-posix
0002: handle locale C the same regardless of the provider, as you
suggest above
0003: make LOCALE (or --locale) apply to everything including ICU

As far as I can tell, any libc locale has a reasonable match in ICU, so
setting LOCALE to either C or a libc locale name should be fine. Some
locales are only valid in ICU, e.g. '@colStrength=primary', or a
language tag representation, so if you do something like:

create database foo locale 'en_US(at)colStrenghth=primary'
template template0;

You'll get a decent error like:

ERROR: invalid LC_COLLATE locale name: "en_US(at)colStrenghth=primary"
HINT: If the locale name is specific to ICU, use ICU_LOCALE.

Overall, I think it works out nicely. Let me know if there are still
some confusing cases. I tried a few variations and this one seemed the
best, but I may have missed something.

Regards,
Jeff Davis

Attachment Content-Type Size
v2-0001-ICU-do-not-convert-locale-C-to-en-US-u-va-posix.patch text/x-patch 6.9 KB
v2-0002-ICU-support-locale-C-with-the-same-behavior-as-li.patch text/x-patch 12.2 KB
v2-0003-Make-LOCALE-apply-to-ICU_LOCALE-for-CREATE-DATABA.patch text/x-patch 16.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Junwang Zhao 2023-04-26 01:51:13 [pg_rewind] use the passing callback instead of global function
Previous Message Thomas Munro 2023-04-25 23:37:55 Re: could not extend file "base/5/3501" with FileFallocate(): Interrupted system call