Home Explore Blog CI



postgresql

25th chunk of `doc/src/sgml/information_schema.sgml`
66d860a275f1bbe7b92f5db5689f3e0bd4ee1e4585b164d90000000100000fa9
 that is used by some
       constraint
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>column_name</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the column that is used by some constraint
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>constraint_catalog</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the database that contains the constraint (always the current database)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>constraint_schema</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the schema that contains the constraint
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>constraint_name</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the constraint
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>
 </sect1>

 <sect1 id="infoschema-constraint-table-usage">
  <title><literal>constraint_table_usage</literal></title>

  <para>
   The view <literal>constraint_table_usage</literal> identifies all
   tables in the current database that are used by some constraint and
   are owned by a currently enabled role.  (This is different from the
   view <literal>table_constraints</literal>, which identifies all
   table constraints along with the table they are defined on.)  For a
   foreign key constraint, this view identifies the table that the
   foreign key references.  For a unique or primary key constraint,
   this view simply identifies the table the constraint belongs to.
   Check constraints and not-null constraints are not included in this
   view.
  </para>

  <table>
   <title><structname>constraint_table_usage</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>table_catalog</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the database that contains the table that is used by
       some constraint (always the current database)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>table_schema</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the schema that contains the table that is used by some
       constraint
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>table_name</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the table that is used by some constraint
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>constraint_catalog</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the database that contains the constraint (always the current database)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>constraint_schema</structfield> <type>sql_identifier</type>
      </para>
      <para>
       Name of the schema that contains the constraint
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>constraint_name</structfield> <type>sql_identifier</type>

Title: Constraint Table Usage View
Summary
The constraint_table_usage view identifies tables in the current database that are used by constraints, such as foreign key, unique, and primary key constraints, and provides information about the tables and constraints that use them, excluding check and not-null constraints.