Home Explore Blog CI



postgresql

30th chunk of `doc/src/sgml/catalogs.sgml`
22ba5c3e1c6b6239da688d607b14bb23dad3b8c43015c6b60000000100000fa0
       <structfield>collcollate</structfield> <type>text</type>
      </para>
      <para>
       <symbol>LC_COLLATE</symbol> for this collation object. If the provider is
       not <literal>libc</literal>, <structfield>collcollate</structfield> is
       <literal>NULL</literal> and <structfield>colllocale</structfield> is
       used instead.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>collctype</structfield> <type>text</type>
      </para>
      <para>
       <symbol>LC_CTYPE</symbol> for this collation object. If the provider is
       not <literal>libc</literal>, <structfield>collctype</structfield> is
       <literal>NULL</literal> and <structfield>colllocale</structfield> is
       used instead.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>colllocale</structfield> <type>text</type>
      </para>
      <para>
       Collation provider locale name for this collation object. If the
       provider is <literal>libc</literal>,
       <structfield>colllocale</structfield> is <literal>NULL</literal>;
       <structfield>collcollate</structfield> and
       <structfield>collctype</structfield> are used instead.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>collicurules</structfield> <type>text</type>
      </para>
      <para>
       ICU collation rules for this collation object
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>collversion</structfield> <type>text</type>
      </para>
      <para>
       Provider-specific version of the collation.  This is recorded when the
       collation is created and then checked when it is used, to detect
       changes in the collation definition that could lead to data corruption.
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

  <para>
   Note that the unique key on this catalog is (<structfield>collname</structfield>,
   <structfield>collencoding</structfield>, <structfield>collnamespace</structfield>) not just
   (<structfield>collname</structfield>, <structfield>collnamespace</structfield>).
   <productname>PostgreSQL</productname> generally ignores all
   collations that do not have <structfield>collencoding</structfield> equal to
   either the current database's encoding or -1, and creation of new entries
   with the same name as an entry with <structfield>collencoding</structfield> = -1
   is forbidden.  Therefore it is sufficient to use a qualified SQL name
   (<replaceable>schema</replaceable>.<replaceable>name</replaceable>) to identify a collation,
   even though this is not unique according to the catalog definition.
   The reason for defining the catalog this way is that
   <application>initdb</application> fills it in at cluster initialization time with
   entries for all locales available on the system, so it must be able to
   hold entries for all encodings that might ever be used in the cluster.
  </para>

  <para>
   In the <literal>template0</literal> database, it could be useful to create
   collations whose encoding does not match the database encoding,
   since they could match the encodings of databases later cloned from
   <literal>template0</literal>.  This would currently have to be done manually.
  </para>
 </sect1>

 <sect1 id="catalog-pg-constraint">
  <title><structname>pg_constraint</structname></title>

  <indexterm zone="catalog-pg-constraint">
   <primary>pg_constraint</primary>
  </indexterm>

  <para>
   The catalog <structname>pg_constraint</structname> stores check, not-null,
   primary key, unique, foreign key, and exclusion constraints on tables.
   (Column constraints are not treated specially.  Every column constraint is
   equivalent to some table constraint.)

Title: pg_collation Catalog Columns (cont.) and Uniqueness Constraints
Summary
This section continues describing the columns of the pg_collation catalog, including colllocale (collation provider locale name), collicurules (ICU collation rules), and collversion (provider-specific version). It also notes that the unique key for the catalog is a combination of collname, collencoding, and collnamespace. The section also briefly discusses collation creation in the template0 database. Finally, introduces the pg_constraint catalog.