Re: pgsql: Add option to use ICU as global locale provider

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-committers@lists.postgresql.org
Date: 2022-03-18T02:01:11Z
Lists: pgsql-hackers
Hi Peter,

On Thu, Mar 17, 2022 at 10:22:32AM +0000, Peter Eisentraut wrote:
> Add option to use ICU as global locale provider
> 
> This adds the option to use ICU as the default locale provider for
> either the whole cluster or a database.  New options for initdb,
> createdb, and CREATE DATABASE are used to select this.
> 
> Since some (legacy) code still uses the libc locale facilities
> directly, we still need to set the libc global locale settings even if
> ICU is otherwise selected.  So pg_database now has three
> locale-related fields: the existing datcollate and datctype, which are
> always set, and a new daticulocale, which is only set if ICU is
> selected.  A similar change is made in pg_collation for consistency,
> but in that case, only the libc-related fields or the ICU-related
> field is set, never both.

FYI, prion is complaining here:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prion&dt=2022-03-18%2001%3A43%3A13

Some details:
#   Failed test 'fails for invalid ICU locale: matches'
#   at t/001_initdb.pl line 107.
#                   '2022-03-18 01:54:58.563 UTC [504] FATAL:  could
#   not open collator for locale "@colNumeric=lower":
#   U_ILLEGAL_ARGUMENT_ERROR
--
Michael

Commits

  1. psql: fix \l display for pre-v15 databases.

  2. Fix global ICU collations for ICU < 54

  3. Add option to use ICU as global locale provider

  4. Add support for collation attributes on older ICU versions