From 30a53b792959b36f07200dae246067b3adbcc0b9 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 8 Mar 2023 16:35:42 +0100 Subject: Allow tailoring of ICU locales with custom rules This exposes the ICU facility to add custom collation rules to a standard collation. New options are added to CREATE COLLATION, CREATE DATABASE, createdb, and initdb to set the rules. Reviewed-by: Laurenz Albe Reviewed-by: Daniel Verite Discussion: https://www.postgresql.org/message-id/flat/821c71a4-6ef0-d366-9acf-bb8e367f739f@enterprisedb.com --- doc/src/sgml/catalogs.sgml | 18 ++++++++++++++++++ doc/src/sgml/ref/create_collation.sgml | 22 ++++++++++++++++++++++ doc/src/sgml/ref/create_database.sgml | 14 ++++++++++++++ doc/src/sgml/ref/createdb.sgml | 10 ++++++++++ doc/src/sgml/ref/initdb.sgml | 10 ++++++++++ 5 files changed, 74 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index c1e4048054e..746baf50538 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -2428,6 +2428,15 @@ SCRAM-SHA-256$<iteration count>:&l + + + collicurules text + + + ICU collation rules for this collation object + + + collversion text @@ -3106,6 +3115,15 @@ SCRAM-SHA-256$<iteration count>:&l + + + daticurules text + + + ICU collation rules for this database + + + datcollversion text diff --git a/doc/src/sgml/ref/create_collation.sgml b/doc/src/sgml/ref/create_collation.sgml index 136976165c2..289f8147f14 100644 --- a/doc/src/sgml/ref/create_collation.sgml +++ b/doc/src/sgml/ref/create_collation.sgml @@ -27,6 +27,7 @@ CREATE COLLATION [ IF NOT EXISTS ] name ( [ LC_CTYPE = lc_ctype, ] [ PROVIDER = provider, ] [ DETERMINISTIC = boolean, ] + [ RULES = rules, ] [ VERSION = version ] ) CREATE COLLATION [ IF NOT EXISTS ] name FROM existing_collation @@ -149,6 +150,19 @@ CREATE COLLATION [ IF NOT EXISTS ] name FROM + + rules + + + + Specifies additional collation rules to customize the behavior of the + collation. This is supported for ICU only. See + for details on the syntax. + + + + version @@ -228,6 +242,14 @@ CREATE COLLATION german_phonebook (provider = icu, locale = 'de-u-co-phonebk'); + + To create a collation using the ICU provider, based on the English ICU + locale, with custom rules: + + + + + To create a collation from an existing collation: diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml index 57d13e34c26..13793bb6b79 100644 --- a/doc/src/sgml/ref/create_database.sgml +++ b/doc/src/sgml/ref/create_database.sgml @@ -30,6 +30,7 @@ CREATE DATABASE name [ LC_COLLATE [=] lc_collate ] [ LC_CTYPE [=] lc_ctype ] [ ICU_LOCALE [=] icu_locale ] + [ ICU_RULES [=] icu_rules ] [ LOCALE_PROVIDER [=] locale_provider ] [ COLLATION_VERSION = collation_version ] [ TABLESPACE [=] tablespace_name ] @@ -192,6 +193,19 @@ CREATE DATABASE name + + icu_rules + + + Specifies additional collation rules to customize the behavior of the + default collation of this database. This is supported for ICU only. + See + for details on the syntax. + + + + locale_provider diff --git a/doc/src/sgml/ref/createdb.sgml b/doc/src/sgml/ref/createdb.sgml index 671cd362d94..e23419ba6cb 100644 --- a/doc/src/sgml/ref/createdb.sgml +++ b/doc/src/sgml/ref/createdb.sgml @@ -157,6 +157,16 @@ PostgreSQL documentation + + + + + Specifies additional collation rules to customize the behavior of the + default collation of this database. This is supported for ICU only. + + + + diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml index 5b2bdac1015..c96164195d4 100644 --- a/doc/src/sgml/ref/initdb.sgml +++ b/doc/src/sgml/ref/initdb.sgml @@ -239,6 +239,16 @@ PostgreSQL documentation + + + + + Specifies additional collation rules to customize the behavior of the + default collation. This is supported for ICU only. + + + + -- cgit v1.2.3