Home Explore Blog CI



postgresql

23th chunk of `doc/src/sgml/catalogs.sgml`
c7aa889dbb05e2639df34f856656529afceacef7cd1d33120000000100000fd4
 <structname>pg_cast</structname> entry has different source and
   target types and a function that takes more than one argument, it
   represents converting from one type to another and applying a length
   coercion in a single step.  When no such entry is available, coercion
   to a type that uses a type modifier involves two steps, one to
   convert between data types and a second to apply the modifier.
  </para>
 </sect1>

 <sect1 id="catalog-pg-class">
  <title><structname>pg_class</structname></title>

  <indexterm zone="catalog-pg-class">
   <primary>pg_class</primary>
  </indexterm>

  <para>
   The catalog <structname>pg_class</structname> describes tables and
   other objects that have columns or are otherwise similar to a
   table.  This includes indexes (but see also <link
   linkend="catalog-pg-index"><structname>pg_index</structname></link>),
   sequences (but see also <link
   linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link>),
   views, materialized views, composite types, and TOAST tables;
   see <structfield>relkind</structfield>.
   Below, when we mean all of these kinds of objects we speak of
   <quote>relations</quote>.  Not all of <structname>pg_class</structname>'s
   columns are meaningful for all relation kinds.
  </para>

  <table>
   <title><structname>pg_class</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>relname</structfield> <type>name</type>
      </para>
      <para>
       Name of the table, index, view, etc.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>relnamespace</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 relation
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>reltype</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       The OID of the data type that corresponds to this table's row type,
       if any; zero for indexes, sequences, and toast tables, which have
       no <structname>pg_type</structname> entry
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>reloftype</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       For typed tables, the OID of the underlying composite type;
       zero for all other relations
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>relowner</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       Owner of the relation
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>relam</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)

Title: pg_class Catalog Table Definition
Summary
This section introduces the pg_class catalog, which describes tables and other table-like objects such as indexes, sequences, views, materialized views, composite types, and TOAST tables. It then lists and describes the columns of the pg_class table, including oid (row identifier), relname (name of the relation), relnamespace (namespace OID), reltype (data type OID), reloftype (underlying composite type OID), relowner (owner OID), and relam (access method OID).