Home Explore Blog CI



postgresql

13th chunk of `doc/src/sgml/catalogs.sgml`
79400aed97c46f373e5fed06c64017804901c4f47d95947e0000000100000fa7
 <structfield>amprocrighttype</structfield> fields
   is that they identify the left and right input types of the operator(s)
   that a particular support function supports.  For some access methods
   these match the input data type(s) of the support function itself, for
   others not.  There is a notion of <quote>default</quote> support functions for
   an index, which are those with <structfield>amproclefttype</structfield> and
   <structfield>amprocrighttype</structfield> both equal to the index operator class's
   <structfield>opcintype</structfield>.
  </para>

 </sect1>


 <sect1 id="catalog-pg-attrdef">
  <title><structname>pg_attrdef</structname></title>

  <indexterm zone="catalog-pg-attrdef">
   <primary>pg_attrdef</primary>
  </indexterm>

  <para>
   The catalog <structname>pg_attrdef</structname> stores column default
   expressions and generation expressions.  The main information about columns
   is stored in <link
   linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.
   Only columns for which a default expression or generation expression has
   been explicitly set will have an entry here.
  </para>

  <table>
   <title><structname>pg_attrdef</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>adrelid</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       The table this column belongs to
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>adnum</structfield> <type>int2</type>
       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
      </para>
      <para>
       The number of the column
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>adbin</structfield> <type>pg_node_tree</type>
      </para>
      <para>
       The column default or generation expression, in <function>nodeToString()</function>
       representation.  Use <literal>pg_get_expr(adbin, adrelid)</literal> to
       convert it to an SQL expression.
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>
 </sect1>


 <sect1 id="catalog-pg-attribute">
  <title><structname>pg_attribute</structname></title>

  <indexterm zone="catalog-pg-attribute">
   <primary>pg_attribute</primary>
  </indexterm>

  <para>
   The catalog <structname>pg_attribute</structname> stores information about
   table columns.  There will be exactly one
   <structname>pg_attribute</structname> row for every column in every
   table in the database.  (There will also be attribute entries for
   indexes, and indeed all objects that have
   <link linkend="catalog-pg-class"><structname>pg_class</structname></link>
   entries.)
  </para>

  <para>
   The term attribute is equivalent to column and is used for
   historical reasons.
  </para>

  <table>
   <title><structname>pg_attribute</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">

Title: pg_attrdef Columns and pg_attribute Introduction
Summary
This section explains the pg_attrdef catalog, which stores column default and generation expressions. It describes its columns: oid (row identifier), adrelid (the table this column belongs to), adnum (the number of the column), and adbin (the column default or generation expression). The section then introduces the pg_attribute catalog, which stores information about table columns, with one row for every column in every table.