@@ -1017,124 +1017,6 @@ CREATE COLLATION german (provider = libc, locale = 'de_DE');
10171017
10181018 <sect4 id="collation-managing-create-icu">
10191019 <title>ICU Collations</title>
1020-
1021- <<<<<<< HEAD
1022- <para>
1023- ICU allows collations to be customized beyond the basic language+country
1024- set that is preloaded by <command>initdb</command>. Users are encouraged
1025- to define their own collation objects that make use of these facilities to
1026- suit the sorting behavior to their requirements.
1027- See <ulink url="https://unicode-org.github.io/icu/userguide/locale/"></ulink>
1028- and <ulink url="https://unicode-org.github.io/icu/userguide/collation/api.html"></ulink> for
1029- information on ICU locale naming. The set of acceptable names and
1030- attributes depends on the particular ICU version.
1031- </para>
1032-
1033- <para>
1034- Here are some examples:
1035-
1036- <variablelist>
1037- <varlistentry>
1038- <term><literal>CREATE COLLATION "de-u-co-phonebk-x-icu" (provider = icu, locale = 'de-u-co-phonebk');</literal></term>
1039- <term><literal>CREATE COLLATION "de-u-co-phonebk-x-icu" (provider = icu, locale = 'de@collation=phonebook');</literal></term>
1040- <listitem>
1041- <para>German collation with phone book collation type</para>
1042- <para>
1043- The first example selects the ICU locale using a <quote>language
1044- tag</quote> per BCP 47. The second example uses the traditional
1045- ICU-specific locale syntax. The first style is preferred going
1046- forward, but it is not supported by older ICU versions.
1047- </para>
1048- <para>
1049- Note that you can name the collation objects in the SQL environment
1050- anything you want. In this example, we follow the naming style that
1051- the predefined collations use, which in turn also follow BCP 47, but
1052- that is not required for user-defined collations.
1053- </para>
1054- </listitem>
1055- </varlistentry>
1056-
1057- <varlistentry>
1058- <term><literal>CREATE COLLATION "und-u-co-emoji-x-icu" (provider = icu, locale = 'und-u-co-emoji');</literal></term>
1059- <term><literal>CREATE COLLATION "und-u-co-emoji-x-icu" (provider = icu, locale = '@collation=emoji');</literal></term>
1060- <listitem>
1061- <para>
1062- Root collation with Emoji collation type, per Unicode Technical Standard #51
1063- </para>
1064- <para>
1065- Observe how in the traditional ICU locale naming system, the root
1066- locale is selected by an empty string.
1067- </para>
1068- </listitem>
1069- </varlistentry>
1070-
1071- <varlistentry>
1072- <term><literal>CREATE COLLATION latinlast (provider = icu, locale = 'en-u-kr-grek-latn');</literal></term>
1073- <term><literal>CREATE COLLATION latinlast (provider = icu, locale = 'en@colReorder=grek-latn');</literal></term>
1074- <listitem>
1075- <para>
1076- Sort Greek letters before Latin ones. (The default is Latin before Greek.)
1077- </para>
1078- </listitem>
1079- </varlistentry>
1080-
1081- <varlistentry>
1082- <term><literal>CREATE COLLATION upperfirst (provider = icu, locale = 'en-u-kf-upper');</literal></term>
1083- <term><literal>CREATE COLLATION upperfirst (provider = icu, locale = 'en@colCaseFirst=upper');</literal></term>
1084- <listitem>
1085- <para>
1086- Sort upper-case letters before lower-case letters. (The default is
1087- lower-case letters first.)
1088- </para>
1089- </listitem>
1090- </varlistentry>
1091-
1092- <varlistentry>
1093- <term><literal>CREATE COLLATION special (provider = icu, locale = 'en-u-kf-upper-kr-grek-latn');</literal></term>
1094- <term><literal>CREATE COLLATION special (provider = icu, locale = 'en@colCaseFirst=upper;colReorder=grek-latn');</literal></term>
1095- <listitem>
1096- <para>
1097- Combines both of the above options.
1098- </para>
1099- </listitem>
1100- </varlistentry>
1101-
1102- <varlistentry>
1103- <term><literal>CREATE COLLATION numeric (provider = icu, locale = 'en-u-kn-true');</literal></term>
1104- <term><literal>CREATE COLLATION numeric (provider = icu, locale = 'en@colNumeric=yes');</literal></term>
1105- <listitem>
1106- <para>
1107- Numeric ordering, sorts sequences of digits by their numeric value,
1108- for example: <literal>A-21</literal> < <literal>A-123</literal>
1109- (also known as natural sort).
1110- </para>
1111- </listitem>
1112- </varlistentry>
1113- </variablelist>
1114-
1115- See <ulink url="https://www.unicode.org/reports/tr35/tr35-collation.html">Unicode
1116- Technical Standard #35</ulink>
1117- and <ulink url="https://tools.ietf.org/html/bcp47">BCP 47</ulink> for
1118- details. The list of possible collation types (<literal>co</literal>
1119- subtag) can be found in
1120- the <ulink url="https://github.com/unicode-org/cldr/blob/master/common/bcp47/collation.xml">CLDR
1121- repository</ulink>.
1122- </para>
1123-
1124- <para>
1125- Note that while this system allows creating collations that <quote>ignore
1126- case</quote> or <quote>ignore accents</quote> or similar (using the
1127- <literal>ks</literal> key), in order for such collations to act in a
1128- truly case- or accent-insensitive manner, they also need to be declared as not
1129- <firstterm>deterministic</firstterm> in <command>CREATE COLLATION</command>;
1130- see <xref linkend="collation-nondeterministic"/>.
1131- Otherwise, any strings that compare equal according to the collation but
1132- are not byte-wise equal will be sorted according to their byte values.
1133- </para>
1134-
1135- <note>
1136- =======
1137- >>>>>>> REL_16_9
11381020 <para>
11391021 ICU collations can be created like:
11401022
0 commit comments