Home Explore Blog CI



postgresql

19th chunk of `doc/src/sgml/charset.sgml`
1346b61cef28afc19b442ed57d9de09017da435f7602be4a0000000100000fb7
 <entry>level3</entry>
         <entry>Case/Variants</entry>
         <entry><literal>true</literal></entry>
         <entry><literal>true</literal></entry>
         <entry><literal>true</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
        </row>
        <row>
         <entry>level4</entry>
         <entry>Punctuation<footnote><para>only with
         <literal>ka-shifted</literal>; see <xref
         linkend="icu-collation-settings-table"/></para></footnote></entry>
         <entry><literal>true</literal></entry>
         <entry><literal>true</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
        </row>
        <row>
         <entry>identic</entry>
         <entry>All</entry>
         <entry><literal>true</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
         <entry><literal>false</literal></entry>
        </row>
       </tbody>
      </tgroup>
     </table>

    <para>
     At every level, even with full normalization off, basic normalization is
     performed. For example, <literal>'á'</literal> may be composed of the
     code points <literal>U&amp;'\0061\0301'</literal> or the single code
     point <literal>U&amp;'\00E1'</literal>, and those sequences will be
     considered equal even at the <literal>identic</literal> level. To treat
     any difference in code point representation as distinct, use a collation
     created with <symbol>deterministic</symbol> set to
     <literal>true</literal>.
    </para>

    <sect4 id="icu-collation-level-examples">
     <title>Collation Level Examples</title>

<programlisting>
CREATE COLLATION level3 (provider = icu, deterministic = false, locale = 'und-u-ka-shifted-ks-level3');
CREATE COLLATION level4 (provider = icu, deterministic = false, locale = 'und-u-ka-shifted-ks-level4');
CREATE COLLATION identic (provider = icu, deterministic = false, locale = 'und-u-ka-shifted-ks-identic');

-- invisible separator ignored at all levels except identic
SELECT 'ab' = U&amp;'a\2063b' COLLATE level4; -- true
SELECT 'ab' = U&amp;'a\2063b' COLLATE identic; -- false

-- punctuation ignored at level3 but not at level 4
SELECT 'x-y' = 'x_y' COLLATE level3; -- true
SELECT 'x-y' = 'x_y' COLLATE level4; -- false
</programlisting>

    </sect4>
   </sect3>

   <sect3 id="icu-collation-settings">
    <title>Collation Settings for an ICU Locale</title>

    <para>
     <xref linkend="icu-collation-settings-table"/> shows the available
     collation settings, which can be used as part of a language tag to
     customize a collation.
    </para>

     <table id="icu-collation-settings-table">
      <title>ICU Collation Settings</title>
      <tgroup cols="4">
       <colspec colname="col1" colwidth="1*"/>
       <colspec colname="col2" colwidth="2*"/>
       <colspec colname="col3" colwidth="2*"/>
       <colspec colname="col4" colwidth="5*"/>

       <thead>
        <row>
         <entry>Key</entry>
         <entry>Values</entry>
         <entry>Default</entry>
         <entry>Description</entry>
        </row>
       </thead>

       <tbody>
        <row>
         <entry><literal>co</literal></entry>
         <entry><literal>emoji</literal>, <literal>phonebk</literal>, <literal>standard</literal>, <replaceable>...</replaceable></entry>
         <entry><literal>standard</literal></entry>
         <entry>
          Collation type. See <xref linkend="icu-external-references"/> for additional options and details.
         </entry>
        </row>

        <row>
         <entry><literal>ka</literal></entry>
         <entry><literal>noignore</literal>, <literal>shifted</literal></entry>

Title: ICU Collation Settings and Examples
Summary
The ICU collation process uses various levels to compare strings, including base characters, accents, case, and punctuation, and provides customizable settings, such as collation type and ignore options, which can be used to create specific collations, as demonstrated in examples with level3, level4, and identic collations.