Introduce "builtin" collation provider.
authorJeff Davis <[email protected]>
Thu, 14 Mar 2024 06:33:44 +0000 (23:33 -0700)
committerJeff Davis <[email protected]>
Thu, 14 Mar 2024 06:33:44 +0000 (23:33 -0700)
commit2d819a08a1cbc11364e36f816b02e33e8dcc030b
tree1a8d3b459866d7df936faffa0e64f5e339e6a6c2
parent6ab2e8385d55e0b73bb8bbc41d9c286f5f7f357f
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
25 files changed:
doc/src/sgml/charset.sgml
doc/src/sgml/ref/create_collation.sgml
doc/src/sgml/ref/create_database.sgml
doc/src/sgml/ref/createdb.sgml
doc/src/sgml/ref/initdb.sgml
src/backend/catalog/pg_collation.c
src/backend/commands/collationcmds.c
src/backend/commands/dbcommands.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/pg_locale.c
src/backend/utils/init/postinit.c
src/bin/initdb/initdb.c
src/bin/initdb/t/001_initdb.pl
src/bin/pg_dump/pg_dump.c
src/bin/pg_upgrade/t/002_pg_upgrade.pl
src/bin/psql/describe.c
src/bin/scripts/createdb.c
src/bin/scripts/t/020_createdb.pl
src/include/catalog/catversion.h
src/include/catalog/pg_collation.dat
src/include/catalog/pg_collation.h
src/include/utils/pg_locale.h
src/test/icu/t/010_database.pl
src/test/regress/expected/collate.out
src/test/regress/sql/collate.sql