mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +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:
@@ -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>
|
||||
|
Reference in New Issue
Block a user