Home Explore Blog CI



postgresql

9th chunk of `doc/src/sgml/charset.sgml`
08a2abfc5607d384d11cbc22fec37f9796d419ab835eff410000000100000fb6
 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 even per-operation.
   This alleviates the restriction that the
   <symbol>LC_COLLATE</symbol> and <symbol>LC_CTYPE</symbol> settings
   of a database cannot be changed after its creation.
  </para>

  <sect2 id="collation-concepts">
   <title>Concepts</title>

   <para>
    Conceptually, every expression of a collatable data type has a
    collation.  (The built-in collatable data types are
    <type>text</type>, <type>varchar</type>, and <type>char</type>.
    User-defined base types can also be marked collatable, and of course
    a <glossterm linkend="glossary-domain">domain</glossterm> over a
    collatable data type is collatable.)  If the
    expression is a column reference, the collation of the expression is the
    defined collation of the column.  If the expression is a constant, the
    collation is the default collation of the data type of the
    constant.  The collation of a more complex expression is derived
    from the collations of its inputs, as described below.
   </para>

   <para>
    The collation of an expression can be the <quote>default</quote>
    collation, which means the locale settings defined for the
    database.  It is also possible for an expression's collation to be
    indeterminate.  In such cases, ordering operations and other
    operations that need to know the collation will fail.
   </para>

   <para>
    When the database system has to perform an ordering or a character
    classification, it uses the collation of the input expression.  This
    happens, for example, with <literal>ORDER BY</literal> clauses
    and function or operator calls such as <literal>&lt;</literal>.
    The collation to apply for an <literal>ORDER BY</literal> clause
    is simply the collation of the sort key.  The collation to apply for a
    function or operator call is derived from the arguments, as described
    below.  In addition to comparison operators, collations are taken into
    account by functions that convert between lower and upper case
    letters, such as <function>lower</function>, <function>upper</function>, and
    <function>initcap</function>; by pattern matching operators; and by
    <function>to_char</function> and related functions.
   </para>

   <para>
    For a function or operator call, the collation that is derived by
    examining the argument collations is used at run time for performing
    the specified operation.  If the result of the function or operator
    call is of a collatable data type, the collation is also used at parse
    time as the defined collation of the function or operator expression,
    in case there is a surrounding expression that requires knowledge of
    its collation.
   </para>

   <para>
    The <firstterm>collation derivation</firstterm> of an expression can be
    implicit or explicit.  This distinction affects how collations are
    combined when multiple different collations appear in an
    expression.  An explicit collation derivation occurs when a
    <literal>COLLATE</literal>

Title: Collation Support Concepts
Summary
This section discusses the concepts of collation support in PostgreSQL, including how collations are assigned to expressions, how they are derived from input expressions, and how they affect ordering and character classification operations. It also explains the difference between implicit and explicit collation derivation and how collations are combined in expressions with multiple collations.