Home Explore Blog CI



postgresql

24th chunk of `doc/src/sgml/information_schema.sgml`
8247b71d46515571346d78a13a106bd81cd9ad57fed326800000000100000fc0
  The columns <literal>udt_name</literal>,
   <literal>udt_schema</literal>, and <literal>udt_catalog</literal>
   always identify the underlying data type of the column, even if the
   column is based on a domain.  (Since
   <productname>PostgreSQL</productname> treats built-in types like
   user-defined types, built-in types appear here as well.  This is an
   extension of the SQL standard.)  These columns should be used if an
   application wants to process data differently according to the
   type, because in that case it wouldn't matter if the column is
   really based on a domain.  If the column is based on a domain, the
   identity of the domain is stored in the columns
   <literal>domain_name</literal>, <literal>domain_schema</literal>,
   and <literal>domain_catalog</literal>.  If you want to pair up
   columns with their associated data types and treat domains as
   separate types, you could write <literal>coalesce(domain_name,
   udt_name)</literal>, etc.
  </para>
 </sect1>

 <sect1 id="infoschema-constraint-column-usage">
  <title><literal>constraint_column_usage</literal></title>

  <para>
   The view <literal>constraint_column_usage</literal> identifies all
   columns in the current database that are used by some constraint.
   Only those columns are shown that are contained in a table owned by
   a currently enabled role.  For a check constraint, this view
   identifies the columns that are used in the check expression.  For a
   not-null constraint, this view identifies the column that the constraint is
   defined on.  For
   a foreign key constraint, this view identifies the columns that the
   foreign key references.  For a unique or primary key constraint,
   this view identifies the constrained columns.
  </para>

  <table>
   <title><structname>constraint_column_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 contains the
       column 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 contains the
       column 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 contains the column 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

Title: Constraint Column Usage View
Summary
The constraint_column_usage view identifies columns in the current database that are used by constraints, including check, not-null, foreign key, unique, and primary key constraints, and provides information about the tables and constraints that use these columns.