Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 9b6cc37ce608401d44f6535a0c7cb777 > files > 81

postgresql11-docs-11.5-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>52.11. pg_class</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="catalog-pg-cast.html" title="52.10. pg_cast" /><link rel="next" href="catalog-pg-collation.html" title="52.12. pg_collation" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">52.11. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_class</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-cast.html" title="52.10. pg_cast">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 52. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 52. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 11.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-collation.html" title="52.12. pg_collation">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="CATALOG-PG-CLASS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.11. <code class="structname">pg_class</code></h2></div></div></div><a id="id-1.10.4.13.2" class="indexterm"></a><p>
   The catalog <code class="structname">pg_class</code> catalogs tables and most
   everything else that has columns or is otherwise similar to a
   table.  This includes indexes (but see also
   <code class="structname">pg_index</code>), sequences (but see also
   <code class="structname">pg_sequence</code>), views, materialized
   views, composite types, and TOAST tables; see <code class="structfield">relkind</code>.
   Below, when we mean all of these
   kinds of objects we speak of <span class="quote">“<span class="quote">relations</span>”</span>.  Not all
   columns are meaningful for all relation types.
  </p><div class="table" id="id-1.10.4.13.4"><p class="title"><strong>Table 52.11. <code class="structname">pg_class</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_class Columns" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Type</th><th>References</th><th>Description</th></tr></thead><tbody><tr><td><code class="structfield">oid</code></td><td><code class="type">oid</code></td><td> </td><td>Row identifier (hidden attribute; must be explicitly selected)</td></tr><tr><td><code class="structfield">relname</code></td><td><code class="type">name</code></td><td> </td><td>Name of the table, index, view, etc.</td></tr><tr><td><code class="structfield">relnamespace</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-namespace.html" title="52.32. pg_namespace"><code class="structname">pg_namespace</code></a>.oid</code></td><td>
       The OID of the namespace that contains this relation
      </td></tr><tr><td><code class="structfield">reltype</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-type.html" title="52.62. pg_type"><code class="structname">pg_type</code></a>.oid</code></td><td>
       The OID of the data type that corresponds to this table's row type,
       if any (zero for indexes, which have no <code class="structname">pg_type</code> entry)
      </td></tr><tr><td><code class="structfield">reloftype</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-type.html" title="52.62. pg_type"><code class="structname">pg_type</code></a>.oid</code></td><td>
       For typed tables, the OID of the underlying composite type,
       zero for all other relations
      </td></tr><tr><td><code class="structfield">relowner</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-authid.html" title="52.8. pg_authid"><code class="structname">pg_authid</code></a>.oid</code></td><td>Owner of the relation</td></tr><tr><td><code class="structfield">relam</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-am.html" title="52.3. pg_am"><code class="structname">pg_am</code></a>.oid</code></td><td>If this is an index, the access method used (B-tree, hash, etc.)</td></tr><tr><td><code class="structfield">relfilenode</code></td><td><code class="type">oid</code></td><td> </td><td>Name of the on-disk file of this relation; zero means this
       is a <span class="quote">“<span class="quote">mapped</span>”</span> relation whose disk file name is determined
       by low-level state</td></tr><tr><td><code class="structfield">reltablespace</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-tablespace.html" title="52.54. pg_tablespace"><code class="structname">pg_tablespace</code></a>.oid</code></td><td>
       The tablespace in which this relation is stored.  If zero,
       the database's default tablespace is implied.  (Not meaningful
       if the relation has no on-disk file.)
      </td></tr><tr><td><code class="structfield">relpages</code></td><td><code class="type">int4</code></td><td> </td><td>
       Size of the on-disk representation of this table in pages (of size
       <code class="symbol">BLCKSZ</code>).  This is only an estimate used by the
       planner.  It is updated by <code class="command">VACUUM</code>,
       <code class="command">ANALYZE</code>, and a few DDL commands such as
       <code class="command">CREATE INDEX</code>.
      </td></tr><tr><td><code class="structfield">reltuples</code></td><td><code class="type">float4</code></td><td> </td><td>
       Number of live rows in the table.  This is only an estimate used by
       the planner.  It is updated by <code class="command">VACUUM</code>,
       <code class="command">ANALYZE</code>, and a few DDL commands such as
       <code class="command">CREATE INDEX</code>.
      </td></tr><tr><td><code class="structfield">relallvisible</code></td><td><code class="type">int4</code></td><td> </td><td>
       Number of pages that are marked all-visible in the table's
       visibility map.  This is only an estimate used by the
       planner.  It is updated by <code class="command">VACUUM</code>,
       <code class="command">ANALYZE</code>, and a few DDL commands such as
       <code class="command">CREATE INDEX</code>.
      </td></tr><tr><td><code class="structfield">reltoastrelid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>
       OID of the TOAST table associated with this table, 0 if none.  The
       TOAST table stores large attributes <span class="quote">“<span class="quote">out of line</span>”</span> in a
       secondary table.
      </td></tr><tr><td><code class="structfield">relhasindex</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if this is a table and it has (or recently had) any indexes
      </td></tr><tr><td><code class="structfield">relisshared</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if this table is shared across all databases in the cluster.  Only
       certain system catalogs (such as <code class="structname">pg_database</code>)
       are shared.
      </td></tr><tr><td><code class="structfield">relpersistence</code></td><td><code class="type">char</code></td><td> </td><td>
       <code class="literal">p</code> = permanent table, <code class="literal">u</code> = unlogged table,
       <code class="literal">t</code> = temporary table
      </td></tr><tr><td><code class="structfield">relkind</code></td><td><code class="type">char</code></td><td> </td><td>
       <code class="literal">r</code> = ordinary table,
       <code class="literal">i</code> = index,
       <code class="literal">S</code> = sequence,
       <code class="literal">t</code> = TOAST table,
       <code class="literal">v</code> = view,
       <code class="literal">m</code> = materialized view,
       <code class="literal">c</code> = composite type,
       <code class="literal">f</code> = foreign table,
       <code class="literal">p</code> = partitioned table,
       <code class="literal">I</code> = partitioned index
      </td></tr><tr><td><code class="structfield">relnatts</code></td><td><code class="type">int2</code></td><td> </td><td>
       Number of user columns in the relation (system columns not
       counted).  There must be this many corresponding entries in
       <code class="structname">pg_attribute</code>.  See also
       <code class="literal">pg_attribute.attnum</code>.
      </td></tr><tr><td><code class="structfield">relchecks</code></td><td><code class="type">int2</code></td><td> </td><td>
       Number of <code class="literal">CHECK</code> constraints on the table; see
       <a class="link" href="catalog-pg-constraint.html" title="52.13. pg_constraint"><code class="structname">pg_constraint</code></a> catalog
      </td></tr><tr><td><code class="structfield">relhasoids</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if we generate an OID for each row of the relation
      </td></tr><tr><td><code class="structfield">relhasrules</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if table has (or once had) rules; see
       <a class="link" href="catalog-pg-rewrite.html" title="52.44. pg_rewrite"><code class="structname">pg_rewrite</code></a> catalog
      </td></tr><tr><td><code class="structfield">relhastriggers</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if table has (or once had) triggers; see
       <a class="link" href="catalog-pg-trigger.html" title="52.56. pg_trigger"><code class="structname">pg_trigger</code></a> catalog
      </td></tr><tr><td><code class="structfield">relhassubclass</code></td><td><code class="type">bool</code></td><td> </td><td>True if table has (or once had) any inheritance children</td></tr><tr><td><code class="structfield">relrowsecurity</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if table has row level security enabled; see
       <a class="link" href="catalog-pg-policy.html" title="52.38. pg_policy"><code class="structname">pg_policy</code></a> catalog
      </td></tr><tr><td><code class="structfield">relforcerowsecurity</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if row level security (when enabled) will also apply to table owner; see
       <a class="link" href="catalog-pg-policy.html" title="52.38. pg_policy"><code class="structname">pg_policy</code></a> catalog
      </td></tr><tr><td><code class="structfield">relispopulated</code></td><td><code class="type">bool</code></td><td> </td><td>True if relation is populated (this is true for all
       relations other than some materialized views)</td></tr><tr><td><code class="structfield">relreplident</code></td><td><code class="type">char</code></td><td> </td><td>
       Columns used to form <span class="quote">“<span class="quote">replica identity</span>”</span> for rows:
       <code class="literal">d</code> = default (primary key, if any),
       <code class="literal">n</code> = nothing,
       <code class="literal">f</code> = all columns
       <code class="literal">i</code> = index with <code class="structfield">indisreplident</code> set, or default
      </td></tr><tr><td><code class="structfield">relispartition</code></td><td><code class="type">bool</code></td><td> </td><td>True if table or index is a partition</td></tr><tr><td><code class="structfield">relrewrite</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>
       For new relations being written during a DDL operation that requires a
       table rewrite, this contains the OID of the original relation;
       otherwise 0.  That state is only visible internally; this field should
       never contain anything other than 0 for a user-visible relation.
      </td></tr><tr><td><code class="structfield">relfrozenxid</code></td><td><code class="type">xid</code></td><td> </td><td>
       All transaction IDs before this one have been replaced with a permanent
       (<span class="quote">“<span class="quote">frozen</span>”</span>) transaction ID in this table.  This is used to track
       whether the table needs to be vacuumed in order to prevent transaction
       ID wraparound or to allow <code class="literal">pg_xact</code> to be shrunk.  Zero
       (<code class="symbol">InvalidTransactionId</code>) if the relation is not a table.
      </td></tr><tr><td><code class="structfield">relminmxid</code></td><td><code class="type">xid</code></td><td> </td><td>
       All multixact IDs before this one have been replaced by a
       transaction ID in this table.  This is used to track
       whether the table needs to be vacuumed in order to prevent multixact ID
       wraparound or to allow <code class="literal">pg_multixact</code> to be shrunk.  Zero
       (<code class="symbol">InvalidMultiXactId</code>) if the relation is not a table.
      </td></tr><tr><td><code class="structfield">relacl</code></td><td><code class="type">aclitem[]</code></td><td> </td><td>
       Access privileges; see
       <a class="xref" href="sql-grant.html" title="GRANT"><span class="refentrytitle">GRANT</span></a> and
       <a class="xref" href="sql-revoke.html" title="REVOKE"><span class="refentrytitle">REVOKE</span></a>
       for details
      </td></tr><tr><td><code class="structfield">reloptions</code></td><td><code class="type">text[]</code></td><td> </td><td>
       Access-method-specific options, as <span class="quote">“<span class="quote">keyword=value</span>”</span> strings
      </td></tr><tr><td><code class="structfield">relpartbound</code></td><td><code class="type">pg_node_tree</code></td><td> </td><td>
       If table is a partition (see <code class="structfield">relispartition</code>),
       internal representation of the partition bound
      </td></tr></tbody></table></div></div><br class="table-break" /><p>
   Several of the Boolean flags in <code class="structname">pg_class</code> are maintained
   lazily: they are guaranteed to be true if that's the correct state, but
   may not be reset to false immediately when the condition is no longer
   true.  For example, <code class="structfield">relhasindex</code> is set by
   <code class="command">CREATE INDEX</code>, but it is never cleared by
   <code class="command">DROP INDEX</code>.  Instead, <code class="command">VACUUM</code> clears
   <code class="structfield">relhasindex</code> if it finds the table has no indexes.  This
   arrangement avoids race conditions and improves concurrency.
  </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-cast.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-collation.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">52.10. <code class="structname">pg_cast</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 52.12. <code class="structname">pg_collation</code></td></tr></table></div></body></html>