pgsql: Introduce "builtin" collation provider.

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Introduce "builtin" collation provider.
Date: 2024-03-14 06:39:05
Message-ID: E1rkek5-003irT-3s@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Introduce "builtin" collation provider.

New provider for collations, like "libc" or "icu", but without any
external dependency.

Initially, the only locale supported by the builtin provider is "C",
which is identical to the libc provider's "C" locale. The libc
provider's "C" locale has always been treated as a special case that
uses an internal implementation, without using libc at all -- so the
new builtin provider uses the same implementation.

The builtin provider's locale is independent of the server environment
variables LC_COLLATE and LC_CTYPE. Using the builtin provider, the
database collation locale can be "C" while LC_COLLATE and LC_CTYPE are
set to "en_US", which is impossible with the libc provider.

By offering a new builtin provider, it clarifies that the semantics of
a collation using this provider will never depend on libc, and makes
it easier to document the behavior.

Discussion: https://postgr.es/m/ab925f69-5f9d-f85e-b87c-bd2a44798659@joeconway.com
Discussion: https://postgr.es/m/dd9261f4-7a98-4565-93ec-336c1c110d90@manitou-mail.org
Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com
Reviewed-by: Daniel Vérité, Peter Eisentraut, Jeremy Schneider

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2d819a08a1cbc11364e36f816b02e33e8dcc030b

Modified Files
--------------
doc/src/sgml/charset.sgml | 90 ++++++++++++++++++-----
doc/src/sgml/ref/create_collation.sgml | 11 ++-
doc/src/sgml/ref/create_database.sgml | 7 +-
doc/src/sgml/ref/createdb.sgml | 2 +-
doc/src/sgml/ref/initdb.sgml | 17 ++++-
src/backend/catalog/pg_collation.c | 5 +-
src/backend/commands/collationcmds.c | 74 +++++++++++++++----
src/backend/commands/dbcommands.c | 129 +++++++++++++++++++++++++--------
src/backend/utils/adt/formatting.c | 6 ++
src/backend/utils/adt/pg_locale.c | 123 ++++++++++++++++++++++++++-----
src/backend/utils/init/postinit.c | 20 ++++-
src/bin/initdb/initdb.c | 53 ++++++++++----
src/bin/initdb/t/001_initdb.pl | 40 +++++++++-
src/bin/pg_dump/pg_dump.c | 23 +++++-
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 81 ++++++++++++++++-----
src/bin/psql/describe.c | 4 +-
src/bin/scripts/createdb.c | 19 ++++-
src/bin/scripts/t/020_createdb.pl | 60 +++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_collation.dat | 6 +-
src/include/catalog/pg_collation.h | 3 +
src/include/utils/pg_locale.h | 5 ++
src/test/icu/t/010_database.pl | 22 +++---
src/test/regress/expected/collate.out | 19 ++++-
src/test/regress/sql/collate.sql | 8 ++
25 files changed, 671 insertions(+), 158 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2024-03-14 06:49:57 pgsql: Fix typos in reorderbuffer.c.
Previous Message Peter Eisentraut 2024-03-14 06:15:38 pgsql: Put genbki.pl output into src/include/catalog/ directly

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-03-14 06:54:00 Re: Introduce XID age and inactive timeout based replication slot invalidation
Previous Message Peter Eisentraut 2024-03-14 06:27:40 Re: Put genbki.pl output into src/include/catalog/ directly