Home Explore Blog CI



postgresql

8th chunk of `doc/src/sgml/charset.sgml`
323a4404aac89646028b7e536a373d75e8c47dde107117700000000100000fa0
 options to satisfy a
     variety of uses.
    </para>

    <para>
     To include this additional collation information in a language tag,
     append <literal>-u</literal>, which indicates there are additional
     collation settings, followed by one or more
     <literal>-</literal><replaceable>key</replaceable><literal>-</literal><replaceable>value</replaceable>
     pairs. The <replaceable>key</replaceable> is the key for a <link
     linkend="icu-collation-settings">collation setting</link> and
     <replaceable>value</replaceable> is a valid value for that setting. For
     boolean settings, the <literal>-</literal><replaceable>key</replaceable>
     may be specified without a corresponding
     <literal>-</literal><replaceable>value</replaceable>, which implies a
     value of <literal>true</literal>.
    </para>

    <para>
     For example, the language tag <literal>en-US-u-kn-ks-level2</literal>
     means the locale with the English language in the US region, with
     collation settings <literal>kn</literal> set to <literal>true</literal>
     and <literal>ks</literal> set to <literal>level2</literal>. Those
     settings mean the collation will be case-insensitive and treat a sequence
     of digits as a single number:

<screen>
CREATE COLLATION mycollation5 (provider = icu, deterministic = false, locale = 'en-US-u-kn-ks-level2');
SELECT 'aB' = 'Ab' COLLATE mycollation5 as result;
 result
--------
 t
(1 row)

SELECT 'N-45' &lt; 'N-123' COLLATE mycollation5 as result;
 result
--------
 t
(1 row)
</screen>
    </para>

    <para>
     See <xref linkend="icu-custom-collations"/> for details and additional
     examples of using language tags with custom collation information for the
     locale.
    </para>
   </sect3>
  </sect2>

  <sect2 id="locale-problems">
   <title>Problems</title>

   <para>
    If locale support doesn't work according to the explanation above,
    check that the locale support in your operating system is
    correctly configured.  To check what locales are installed on your
    system, you can use the command <literal>locale -a</literal> if
    your operating system provides it.
   </para>

   <para>
    Check that <productname>PostgreSQL</productname> is actually using the locale
    that you think it is.  The <envar>LC_COLLATE</envar> and <envar>LC_CTYPE</envar>
    settings are determined when a database is created, and cannot be
    changed except by creating a new database.  Other locale
    settings including <envar>LC_MESSAGES</envar> and <envar>LC_MONETARY</envar>
    are initially determined by the environment the server is started
    in, but can be changed on-the-fly.  You can check the active locale
    settings using the <command>SHOW</command> command.
   </para>

   <para>
    The directory <filename>src/test/locale</filename> in the source
    distribution contains a test suite for
    <productname>PostgreSQL</productname>'s locale support.
   </para>

   <para>
    Client applications that handle server-side errors by parsing the
    text of the error message will obviously have problems when the
    server's messages are in a different language.  Authors of such
    applications are advised to make use of the error code scheme
    instead.
   </para>

   <para>
    Maintaining catalogs of message translations requires the on-going
    efforts of many volunteers that want to see
    <productname>PostgreSQL</productname> speak their preferred language well.
    If messages in your language are currently not available or not fully
    translated, your assistance would be appreciated.  If you want to
    help, refer to <xref linkend="nls"/> or write to the developers'
    mailing list.
   </para>
  </sect2>
 </sect1>


 <sect1 id="collation">
  <title>Collation Support</title>

  <indexterm zone="collation"><primary>collation</primary></indexterm>

  <para>
   The collation feature allows specifying the sort order and character
   classification behavior of data per-column, or

Title: Locale Support and Collation
Summary
This section discusses potential problems with locale support in PostgreSQL, including configuration issues and client application limitations. It also provides information on troubleshooting and testing locale support, and invites volunteers to contribute to message translation efforts. Additionally, it introduces the concept of collation support, which enables specifying sort order and character classification behavior per-column.