Home Explore Blog CI



postgresql

31th chunk of `doc/src/sgml/catalogs.sgml`
437a72a1efb3f0b33158d0b95e223854220de12082be46150000000100000fa1
 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.)
  </para>

  <para>
   User-defined constraint triggers (created with <link linkend="sql-createtrigger">
   <command>CREATE CONSTRAINT TRIGGER</command></link>) also give rise to an entry in this table.
  </para>

  <para>
   Check constraints on domains are stored here, too.
  </para>

  <table>
   <title><structname>pg_constraint</structname> Columns</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>oid</structfield> <type>oid</type>
      </para>
      <para>
       Row identifier
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>conname</structfield> <type>name</type>
      </para>
      <para>
       Constraint name (not necessarily unique!)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>connamespace</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       The OID of the namespace that contains this constraint
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>contype</structfield> <type>char</type>
      </para>
      <para>
       <literal>c</literal> = check constraint,
       <literal>f</literal> = foreign key constraint,
       <literal>n</literal> = not-null constraint,
       <literal>p</literal> = primary key constraint,
       <literal>u</literal> = unique constraint,
       <literal>t</literal> = constraint trigger,
       <literal>x</literal> = exclusion constraint
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>condeferrable</structfield> <type>bool</type>
      </para>
      <para>
       Is the constraint deferrable?
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>condeferred</structfield> <type>bool</type>
      </para>
      <para>
       Is the constraint deferred by default?
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>conenforced</structfield> <type>bool</type>
      </para>
      <para>
       Is the constraint enforced?
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>convalidated</structfield> <type>bool</type>
      </para>
      <para>
       Has the constraint been

Title: pg_constraint Catalog: Overview and Columns
Summary
This section discusses the pg_constraint catalog, which stores information about check, not-null, primary key, unique, foreign key, and exclusion constraints, including those on domains and user-defined constraint triggers. It then details the columns of the pg_constraint catalog, including oid, conname, connamespace, contype (constraint type), condeferrable, condeferred, conenforced, and convalidated.