mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
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 <laurenz.albe@cybertec.at> Reviewed-by: Daniel Verite <daniel@manitou-mail.org> Discussion: https://www.postgresql.org/message-id/flat/821c71a4-6ef0-d366-9acf-bb8e367f739f@enterprisedb.com
This commit is contained in:
@ -2428,6 +2428,15 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>collicurules</structfield> <type>text</type>
|
||||
</para>
|
||||
<para>
|
||||
ICU collation rules for this collation object
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>collversion</structfield> <type>text</type>
|
||||
@ -3106,6 +3115,15 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>daticurules</structfield> <type>text</type>
|
||||
</para>
|
||||
<para>
|
||||
ICU collation rules for this database
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>datcollversion</structfield> <type>text</type>
|
||||
|
@ -27,6 +27,7 @@ CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> (
|
||||
[ LC_CTYPE = <replaceable>lc_ctype</replaceable>, ]
|
||||
[ PROVIDER = <replaceable>provider</replaceable>, ]
|
||||
[ DETERMINISTIC = <replaceable>boolean</replaceable>, ]
|
||||
[ RULES = <replaceable>rules</replaceable>, ]
|
||||
[ VERSION = <replaceable>version</replaceable> ]
|
||||
)
|
||||
CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> FROM <replaceable>existing_collation</replaceable>
|
||||
@ -149,6 +150,19 @@ CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> FROM <replace
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable>rules</replaceable></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies additional collation rules to customize the behavior of the
|
||||
collation. This is supported for ICU only. See <ulink
|
||||
url="https://unicode-org.github.io/icu/userguide/collation/customization/"/>
|
||||
for details on the syntax.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable>version</replaceable></term>
|
||||
|
||||
@ -228,6 +242,14 @@ CREATE COLLATION german_phonebook (provider = icu, locale = 'de-u-co-phonebk');
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To create a collation using the ICU provider, based on the English ICU
|
||||
locale, with custom rules:
|
||||
<programlisting>
|
||||
<![CDATA[CREATE COLLATION en_custom (provider = icu, locale = 'en', rules = '&a < g');]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To create a collation from an existing collation:
|
||||
<programlisting>
|
||||
|
@ -30,6 +30,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
|
||||
[ LC_COLLATE [=] <replaceable class="parameter">lc_collate</replaceable> ]
|
||||
[ LC_CTYPE [=] <replaceable class="parameter">lc_ctype</replaceable> ]
|
||||
[ ICU_LOCALE [=] <replaceable class="parameter">icu_locale</replaceable> ]
|
||||
[ ICU_RULES [=] <replaceable class="parameter">icu_rules</replaceable> ]
|
||||
[ LOCALE_PROVIDER [=] <replaceable class="parameter">locale_provider</replaceable> ]
|
||||
[ COLLATION_VERSION = <replaceable>collation_version</replaceable> ]
|
||||
[ TABLESPACE [=] <replaceable class="parameter">tablespace_name</replaceable> ]
|
||||
@ -192,6 +193,19 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="create-database-icu-rules">
|
||||
<term><replaceable class="parameter">icu_rules</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies additional collation rules to customize the behavior of the
|
||||
default collation of this database. This is supported for ICU only.
|
||||
See <ulink
|
||||
url="https://unicode-org.github.io/icu/userguide/collation/customization/"/>
|
||||
for details on the syntax.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="create-database-locale-provider">
|
||||
<term><replaceable>locale_provider</replaceable></term>
|
||||
|
||||
|
@ -157,6 +157,16 @@ PostgreSQL documentation
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--icu-rules=<replaceable class="parameter">rules</replaceable></option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies additional collation rules to customize the behavior of the
|
||||
default collation of this database. This is supported for ICU only.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--locale-provider={<literal>libc</literal>|<literal>icu</literal>}</option></term>
|
||||
<listitem>
|
||||
|
@ -239,6 +239,16 @@ PostgreSQL documentation
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="app-initdb-icu-rules">
|
||||
<term><option>--icu-rules=<replaceable>rules</replaceable></option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies additional collation rules to customize the behavior of the
|
||||
default collation. This is supported for ICU only.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="app-initdb-data-checksums" xreflabel="data checksums">
|
||||
<term><option>-k</option></term>
|
||||
<term><option>--data-checksums</option></term>
|
||||
|
Reference in New Issue
Block a user