postgresql/doc/src/sgml/catalogs.sgml

11538 lines
384 KiB
Plaintext

<!-- doc/src/sgml/catalogs.sgml -->
<!--
Documentation of the system catalogs, directed toward PostgreSQL developers
-->
<chapter id="catalogs">
<title>System Catalogs</title>
<para>
The system catalogs are the place where a relational database
management system stores schema metadata, such as information about
tables and columns, and internal bookkeeping information.
<productname>PostgreSQL</productname>'s system catalogs are regular
tables. You can drop and recreate the tables, add columns, insert
and update values, and severely mess up your system that way.
Normally, one should not change the system catalogs by hand, there
are normally SQL commands to do that. (For example, <command>CREATE
DATABASE</command> inserts a row into the
<structname>pg_database</structname> catalog &mdash; and actually
creates the database on disk.) There are some exceptions for
particularly esoteric operations, but many of those have been made
available as SQL commands over time, and so the need for direct manipulation
of the system catalogs is ever decreasing.
</para>
<sect1 id="catalogs-overview">
<title>Overview</title>
<para>
<xref linkend="catalog-table"/> lists the system catalogs.
More detailed documentation of each catalog follows below.
</para>
<para>
Most system catalogs are copied from the template database during
database creation and are thereafter database-specific. A few
catalogs are physically shared across all databases in a cluster;
these are noted in the descriptions of the individual catalogs.
</para>
<table id="catalog-table">
<title>System Catalogs</title>
<tgroup cols="2">
<thead>
<row>
<entry>Catalog Name</entry>
<entry>Purpose</entry>
</row>
</thead>
<tbody>
<row>
<entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
<entry>aggregate functions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
<entry>relation access methods</entry>
</row>
<row>
<entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
<entry>access method operators</entry>
</row>
<row>
<entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
<entry>access method support functions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
<entry>column default values</entry>
</row>
<row>
<entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
<entry>table columns (<quote>attributes</quote>)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
<entry>authorization identifiers (roles)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
<entry>authorization identifier membership relationships</entry>
</row>
<row>
<entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
<entry>casts (data type conversions)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
<entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
<entry>collations (locale information)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
<entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
</row>
<row>
<entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
<entry>encoding conversion information</entry>
</row>
<row>
<entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
<entry>databases within this database cluster</entry>
</row>
<row>
<entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
<entry>per-role and per-database settings</entry>
</row>
<row>
<entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
<entry>default privileges for object types</entry>
</row>
<row>
<entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
<entry>dependencies between database objects</entry>
</row>
<row>
<entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
<entry>descriptions or comments on database objects</entry>
</row>
<row>
<entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
<entry>enum label and value definitions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
<entry>event triggers</entry>
</row>
<row>
<entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
<entry>installed extensions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
<entry>foreign-data wrapper definitions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
<entry>foreign server definitions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
<entry>additional foreign table information</entry>
</row>
<row>
<entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
<entry>additional index information</entry>
</row>
<row>
<entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
<entry>table inheritance hierarchy</entry>
</row>
<row>
<entry><link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link></entry>
<entry>object initial privileges</entry>
</row>
<row>
<entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
<entry>languages for writing functions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
<entry>data pages for large objects</entry>
</row>
<row>
<entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
<entry>metadata for large objects</entry>
</row>
<row>
<entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
<entry>schemas</entry>
</row>
<row>
<entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
<entry>access method operator classes</entry>
</row>
<row>
<entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
<entry>operators</entry>
</row>
<row>
<entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
<entry>access method operator families</entry>
</row>
<row>
<entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
<entry>information about partition key of tables</entry>
</row>
<row>
<entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
<entry>row-security policies</entry>
</row>
<row>
<entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
<entry>functions and procedures</entry>
</row>
<row>
<entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
<entry>publications for logical replication</entry>
</row>
<row>
<entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
<entry>relation to publication mapping</entry>
</row>
<row>
<entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
<entry>information about range types</entry>
</row>
<row>
<entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
<entry>registered replication origins</entry>
</row>
<row>
<entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
<entry>query rewrite rules</entry>
</row>
<row>
<entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
<entry>security labels on database objects</entry>
</row>
<row>
<entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
<entry>information about sequences</entry>
</row>
<row>
<entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
<entry>dependencies on shared objects</entry>
</row>
<row>
<entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
<entry>comments on shared objects</entry>
</row>
<row>
<entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
<entry>security labels on shared database objects</entry>
</row>
<row>
<entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
<entry>planner statistics</entry>
</row>
<row>
<entry><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link></entry>
<entry>extended planner statistics (definition)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link></entry>
<entry>extended planner statistics (built statistics)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
<entry>logical replication subscriptions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-subscription-rel"><structname>pg_subscription_rel</structname></link></entry>
<entry>relation state for subscriptions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
<entry>tablespaces within this database cluster</entry>
</row>
<row>
<entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
<entry>transforms (data type to procedural language conversions)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
<entry>triggers</entry>
</row>
<row>
<entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
<entry>text search configurations</entry>
</row>
<row>
<entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
<entry>text search configurations' token mappings</entry>
</row>
<row>
<entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
<entry>text search dictionaries</entry>
</row>
<row>
<entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
<entry>text search parsers</entry>
</row>
<row>
<entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
<entry>text search templates</entry>
</row>
<row>
<entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
<entry>data types</entry>
</row>
<row>
<entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
<entry>mappings of users to foreign servers</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-aggregate">
<title><structname>pg_aggregate</structname></title>
<indexterm zone="catalog-pg-aggregate">
<primary>pg_aggregate</primary>
</indexterm>
<para>
The catalog <structname>pg_aggregate</structname> stores information about
aggregate functions. An aggregate function is a function that
operates on a set of values (typically one column from each row
that matches a query condition) and returns a single value computed
from all these values. Typical aggregate functions are
<function>sum</function>, <function>count</function>, and
<function>max</function>. Each entry in
<structname>pg_aggregate</structname> is an extension of an entry
in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
entry carries the aggregate's name, input and output data types, and
other information that is similar to ordinary functions.
</para>
<table>
<title><structname>pg_aggregate</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>aggfnoid</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry><structname>pg_proc</structname> OID of the aggregate function</entry>
</row>
<row>
<entry><structfield>aggkind</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>Aggregate kind:
<literal>n</literal> for <quote>normal</quote> aggregates,
<literal>o</literal> for <quote>ordered-set</quote> aggregates, or
<literal>h</literal> for <quote>hypothetical-set</quote> aggregates
</entry>
</row>
<row>
<entry><structfield>aggnumdirectargs</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>Number of direct (non-aggregated) arguments of an ordered-set or
hypothetical-set aggregate, counting a variadic array as one argument.
If equal to <structfield>pronargs</structfield>, the aggregate must be variadic
and the variadic array describes the aggregated arguments as well as
the final direct arguments.
Always zero for normal aggregates.</entry>
</row>
<row>
<entry><structfield>aggtransfn</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Transition function</entry>
</row>
<row>
<entry><structfield>aggfinalfn</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Final function (zero if none)</entry>
</row>
<row>
<entry><structfield>aggcombinefn</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Combine function (zero if none)</entry>
</row>
<row>
<entry><structfield>aggserialfn</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Serialization function (zero if none)</entry>
</row>
<row>
<entry><structfield>aggdeserialfn</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Deserialization function (zero if none)</entry>
</row>
<row>
<entry><structfield>aggmtransfn</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
</row>
<row>
<entry><structfield>aggminvtransfn</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
</row>
<row>
<entry><structfield>aggmfinalfn</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Final function for moving-aggregate mode (zero if none)</entry>
</row>
<row>
<entry><structfield>aggfinalextra</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
</row>
<row>
<entry><structfield>aggmfinalextra</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
</row>
<row>
<entry><structfield>aggfinalmodify</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>Whether <structfield>aggfinalfn</structfield> modifies the
transition state value:
<literal>r</literal> if it is read-only,
<literal>s</literal> if the <structfield>aggtransfn</structfield>
cannot be applied after the <structfield>aggfinalfn</structfield>, or
<literal>w</literal> if it writes on the value
</entry>
</row>
<row>
<entry><structfield>aggmfinalmodify</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>Like <structfield>aggfinalmodify</structfield>, but for
the <structfield>aggmfinalfn</structfield>
</entry>
</row>
<row>
<entry><structfield>aggsortop</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>Associated sort operator (zero if none)</entry>
</row>
<row>
<entry><structfield>aggtranstype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Data type of the aggregate function's internal transition (state) data</entry>
</row>
<row>
<entry><structfield>aggtransspace</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>Approximate average size (in bytes) of the transition state
data, or zero to use a default estimate</entry>
</row>
<row>
<entry><structfield>aggmtranstype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Data type of the aggregate function's internal transition (state)
data for moving-aggregate mode (zero if none)</entry>
</row>
<row>
<entry><structfield>aggmtransspace</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>Approximate average size (in bytes) of the transition state data
for moving-aggregate mode, or zero to use a default estimate</entry>
</row>
<row>
<entry><structfield>agginitval</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
The initial value of the transition state. This is a text
field containing the initial value in its external string
representation. If this field is null, the transition state
value starts out null.
</entry>
</row>
<row>
<entry><structfield>aggminitval</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
The initial value of the transition state for moving-aggregate mode.
This is a text field containing the initial value in its external
string representation. If this field is null, the transition state
value starts out null.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
New aggregate functions are registered with the <xref
linkend="sql-createaggregate"/>
command. See <xref linkend="xaggr"/> for more information about
writing aggregate functions and the meaning of the transition
functions, etc.
</para>
</sect1>
<sect1 id="catalog-pg-am">
<title><structname>pg_am</structname></title>
<indexterm zone="catalog-pg-am">
<primary>pg_am</primary>
</indexterm>
<para>
The catalog <structname>pg_am</structname> stores information about
relation access methods. There is one row for each access method supported
by the system.
Currently, only tables and indexes have access methods. The requirements for table
and index access methods are discussed in detail in <xref linkend="tableam"/> and
<xref linkend="indexam"/> respectively.
</para>
<table>
<title><structname>pg_am</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>amname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the access method</entry>
</row>
<row>
<entry><structfield>amhandler</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
OID of a handler function that is responsible for supplying information
about the access method
</entry>
</row>
<row>
<entry><structfield>amtype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<literal>t</literal> = table (including materialized views),
<literal>i</literal> = index.
</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>
Before <productname>PostgreSQL</productname> 9.6, <structname>pg_am</structname>
contained many additional columns representing properties of index access
methods. That data is now only directly visible at the C code level.
However, <function>pg_index_column_has_property()</function> and related
functions have been added to allow SQL queries to inspect index access
method properties; see <xref linkend="functions-info-catalog-table"/>.
</para>
</note>
</sect1>
<sect1 id="catalog-pg-amop">
<title><structname>pg_amop</structname></title>
<indexterm zone="catalog-pg-amop">
<primary>pg_amop</primary>
</indexterm>
<para>
The catalog <structname>pg_amop</structname> stores information about
operators associated with access method operator families. There is one
row for each operator that is a member of an operator family. A family
member can be either a <firstterm>search</firstterm> operator or an
<firstterm>ordering</firstterm> operator. An operator
can appear in more than one family, but cannot appear in more than one
search position nor more than one ordering position within a family.
(It is allowed, though unlikely, for an operator to be used for both
search and ordering purposes.)
</para>
<table>
<title><structname>pg_amop</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>amopfamily</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
<entry>The operator family this entry is for</entry>
</row>
<row>
<entry><structfield>amoplefttype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Left-hand input data type of operator</entry>
</row>
<row>
<entry><structfield>amoprighttype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Right-hand input data type of operator</entry>
</row>
<row>
<entry><structfield>amopstrategy</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>Operator strategy number</entry>
</row>
<row>
<entry><structfield>amoppurpose</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>Operator purpose, either <literal>s</literal> for search or
<literal>o</literal> for ordering</entry>
</row>
<row>
<entry><structfield>amopopr</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>OID of the operator</entry>
</row>
<row>
<entry><structfield>amopmethod</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
<entry>Index access method operator family is for</entry>
</row>
<row>
<entry><structfield>amopsortfamily</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
<entry>The B-tree operator family this entry sorts according to, if an
ordering operator; zero if a search operator</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
A <quote>search</quote> operator entry indicates that an index of this operator
family can be searched to find all rows satisfying
<literal>WHERE</literal>
<replaceable>indexed_column</replaceable>
<replaceable>operator</replaceable>
<replaceable>constant</replaceable>.
Obviously, such an operator must return <type>boolean</type>, and its left-hand input
type must match the index's column data type.
</para>
<para>
An <quote>ordering</quote> operator entry indicates that an index of this
operator family can be scanned to return rows in the order represented by
<literal>ORDER BY</literal>
<replaceable>indexed_column</replaceable>
<replaceable>operator</replaceable>
<replaceable>constant</replaceable>.
Such an operator could return any sortable data type, though again
its left-hand input type must match the index's column data type.
The exact semantics of the <literal>ORDER BY</literal> are specified by the
<structfield>amopsortfamily</structfield> column, which must reference
a B-tree operator family for the operator's result type.
</para>
<note>
<para>
At present, it's assumed that the sort order for an ordering operator
is the default for the referenced operator family, i.e., <literal>ASC NULLS
LAST</literal>. This might someday be relaxed by adding additional columns
to specify sort options explicitly.
</para>
</note>
<para>
An entry's <structfield>amopmethod</structfield> must match the
<structname>opfmethod</structname> of its containing operator family (including
<structfield>amopmethod</structfield> here is an intentional denormalization of the
catalog structure for performance reasons). Also,
<structfield>amoplefttype</structfield> and <structfield>amoprighttype</structfield> must match
the <structfield>oprleft</structfield> and <structfield>oprright</structfield> fields of the
referenced <structname>pg_operator</structname> entry.
</para>
</sect1>
<sect1 id="catalog-pg-amproc">
<title><structname>pg_amproc</structname></title>
<indexterm zone="catalog-pg-amproc">
<primary>pg_amproc</primary>
</indexterm>
<para>
The catalog <structname>pg_amproc</structname> stores information about
support functions associated with access method operator families. There
is one row for each support function belonging to an operator family.
</para>
<table>
<title><structname>pg_amproc</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>amprocfamily</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
<entry>The operator family this entry is for</entry>
</row>
<row>
<entry><structfield>amproclefttype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Left-hand input data type of associated operator</entry>
</row>
<row>
<entry><structfield>amprocrighttype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Right-hand input data type of associated operator</entry>
</row>
<row>
<entry><structfield>amprocnum</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>Support function number</entry>
</row>
<row>
<entry><structfield>amproc</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the function</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The usual interpretation of the
<structfield>amproclefttype</structfield> and <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
values. The main information about columns is stored in
<link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.
Only columns for which a default value has been explicitly set will have
an entry here.
</para>
<table>
<title><structname>pg_attrdef</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>adrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The table this column belongs to</entry>
</row>
<row>
<entry><structfield>adnum</structfield></entry>
<entry><type>int2</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
<entry>The number of the column</entry>
</row>
<row>
<entry><structfield>adbin</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>The column default value, in <function>nodeToString()</function>
representation. Use <literal>pg_get_expr(adbin, adrelid)</literal> to
convert it to an SQL expression.</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 <structname>pg_class</structname>
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="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>attrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The table this column belongs to</entry>
</row>
<row>
<entry><structfield>attname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>The column name</entry>
</row>
<row>
<entry><structfield>atttypid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>The data type of this column</entry>
</row>
<row>
<entry><structfield>attstattarget</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
<structfield>attstattarget</structfield> controls the level of detail
of statistics accumulated for this column by
<xref linkend="sql-analyze"/>.
A zero value indicates that no statistics should be collected.
A negative value says to use the system default statistics target.
The exact meaning of positive values is data type-dependent.
For scalar data types, <structfield>attstattarget</structfield>
is both the target number of <quote>most common values</quote>
to collect, and the target number of histogram bins to create.
</entry>
</row>
<row>
<entry><structfield>attlen</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>
A copy of <literal>pg_type.typlen</literal> of this column's
type
</entry>
</row>
<row>
<entry><structfield>attnum</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>
The number of the column. Ordinary columns are numbered from 1
up. System columns, such as <structfield>ctid</structfield>,
have (arbitrary) negative numbers.
</entry>
</row>
<row>
<entry><structfield>attndims</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
Number of dimensions, if the column is an array type; otherwise 0.
(Presently, the number of dimensions of an array is not enforced,
so any nonzero value effectively means <quote>it's an array</quote>.)
</entry>
</row>
<row>
<entry><structfield>attcacheoff</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
Always -1 in storage, but when loaded into a row descriptor
in memory this might be updated to cache the offset of the attribute
within the row
</entry>
</row>
<row>
<entry><structfield>atttypmod</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
<structfield>atttypmod</structfield> records type-specific data
supplied at table creation time (for example, the maximum
length of a <type>varchar</type> column). It is passed to
type-specific input functions and length coercion functions.
The value will generally be -1 for types that do not need <structfield>atttypmod</structfield>.
</entry>
</row>
<row>
<entry><structfield>attbyval</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
A copy of <literal>pg_type.typbyval</literal> of this column's type
</entry>
</row>
<row>
<entry><structfield>attstorage</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Normally a copy of <literal>pg_type.typstorage</literal> of this
column's type. For TOAST-able data types, this can be altered
after column creation to control storage policy.
</entry>
</row>
<row>
<entry><structfield>attalign</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
A copy of <literal>pg_type.typalign</literal> of this column's type
</entry>
</row>
<row>
<entry><structfield>attnotnull</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
This represents a not-null constraint.
</entry>
</row>
<row>
<entry><structfield>atthasdef</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
This column has a default expression or generation expression, in which
case there will be a corresponding entry in the
<structname>pg_attrdef</structname> catalog that actually defines the
expression. (Check <structfield>attgenerated</structfield> to
determine whether this is a default or a generation expression.)
</entry>
</row>
<row>
<entry><structfield>atthasmissing</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
This column has a value which is used where the column is entirely
missing from the row, as happens when a column is added with a
non-volatile <literal>DEFAULT</literal> value after the row is created.
The actual value used is stored in the
<structfield>attmissingval</structfield> column.
</entry>
</row>
<row>
<entry><structfield>attidentity</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
If a zero byte (<literal>''</literal>), then not an identity column.
Otherwise, <literal>a</literal> = generated
always, <literal>d</literal> = generated by default.
</entry>
</row>
<row>
<entry><structfield>attgenerated</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
If a zero byte (<literal>''</literal>), then not a generated column.
Otherwise, <literal>s</literal> = stored. (Other values might be added
in the future.)
</entry>
</row>
<row>
<entry><structfield>attisdropped</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
This column has been dropped and is no longer valid. A dropped
column is still physically present in the table, but is
ignored by the parser and so cannot be accessed via SQL.
</entry>
</row>
<row>
<entry><structfield>attislocal</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
This column is defined locally in the relation. Note that a column can
be locally defined and inherited simultaneously.
</entry>
</row>
<row>
<entry><structfield>attinhcount</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
The number of direct ancestors this column has. A column with a
nonzero number of ancestors cannot be dropped nor renamed.
</entry>
</row>
<row>
<entry><structfield>attcollation</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
<entry>
The defined collation of the column, or zero if the column is
not of a collatable data type.
</entry>
</row>
<row>
<entry><structfield>attacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Column-level access privileges, if any have been granted specifically
on this column
</entry>
</row>
<row>
<entry><structfield>attoptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
Attribute-level options, as <quote>keyword=value</quote> strings
</entry>
</row>
<row>
<entry><structfield>attfdwoptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
Attribute-level foreign data wrapper options, as <quote>keyword=value</quote> strings
</entry>
</row>
<row>
<entry><structfield>attmissingval</structfield></entry>
<entry><type>anyarray</type></entry>
<entry></entry>
<entry>
This column has a one element array containing the value used when the
column is entirely missing from the row, as happens when the column is
added with a non-volatile <literal>DEFAULT</literal> value after the
row is created. The value is only used when
<structfield>atthasmissing</structfield> is true. If there is no value
the column is null.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
In a dropped column's <structname>pg_attribute</structname> entry,
<structfield>atttypid</structfield> is reset to zero, but
<structfield>attlen</structfield> and the other fields copied from
<structname>pg_type</structname> are still valid. This arrangement is needed
to cope with the situation where the dropped column's data type was
later dropped, and so there is no <structname>pg_type</structname> row anymore.
<structfield>attlen</structfield> and the other fields can be used
to interpret the contents of a row of the table.
</para>
</sect1>
<sect1 id="catalog-pg-authid">
<title><structname>pg_authid</structname></title>
<indexterm zone="catalog-pg-authid">
<primary>pg_authid</primary>
</indexterm>
<para>
The catalog <structname>pg_authid</structname> contains information about
database authorization identifiers (roles). A role subsumes the concepts
of <quote>users</quote> and <quote>groups</quote>. A user is essentially just a
role with the <structfield>rolcanlogin</structfield> flag set. Any role (with or
without <structfield>rolcanlogin</structfield>) can have other roles as members; see
<link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
</para>
<para>
Since this catalog contains passwords, it must not be publicly readable.
<link linkend="view-pg-roles"><structname>pg_roles</structname></link>
is a publicly readable view on
<structname>pg_authid</structname> that blanks out the password field.
</para>
<para>
<xref linkend="user-manag"/> contains detailed information about user and
privilege management.
</para>
<para>
Because user identities are cluster-wide,
<structname>pg_authid</structname>
is shared across all databases of a cluster: there is only one
copy of <structname>pg_authid</structname> per cluster, not
one per database.
</para>
<table>
<title><structname>pg_authid</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>rolname</structfield></entry>
<entry><type>name</type></entry>
<entry>Role name</entry>
</row>
<row>
<entry><structfield>rolsuper</structfield></entry>
<entry><type>bool</type></entry>
<entry>Role has superuser privileges</entry>
</row>
<row>
<entry><structfield>rolinherit</structfield></entry>
<entry><type>bool</type></entry>
<entry>Role automatically inherits privileges of roles it is a
member of</entry>
</row>
<row>
<entry><structfield>rolcreaterole</structfield></entry>
<entry><type>bool</type></entry>
<entry>Role can create more roles</entry>
</row>
<row>
<entry><structfield>rolcreatedb</structfield></entry>
<entry><type>bool</type></entry>
<entry>Role can create databases</entry>
</row>
<row>
<entry><structfield>rolcanlogin</structfield></entry>
<entry><type>bool</type></entry>
<entry>
Role can log in. That is, this role can be given as the initial
session authorization identifier
</entry>
</row>
<row>
<entry><structfield>rolreplication</structfield></entry>
<entry><type>bool</type></entry>
<entry>
Role is a replication role. A replication role can initiate replication
connections and create and drop replication slots.
</entry>
</row>
<row>
<entry><structfield>rolbypassrls</structfield></entry>
<entry><type>bool</type></entry>
<entry>
Role bypasses every row level security policy, see
<xref linkend="ddl-rowsecurity"/> for more information.
</entry>
</row>
<row>
<entry><structfield>rolconnlimit</structfield></entry>
<entry><type>int4</type></entry>
<entry>
For roles that can log in, this sets maximum number of concurrent
connections this role can make. -1 means no limit.
</entry>
</row>
<row>
<entry><structfield>rolpassword</structfield></entry>
<entry><type>text</type></entry>
<entry>
Password (possibly encrypted); null if none. The format depends
on the form of encryption used.
</entry>
</row>
<row>
<entry><structfield>rolvaliduntil</structfield></entry>
<entry><type>timestamptz</type></entry>
<entry>Password expiry time (only used for password authentication);
null if no expiration</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
For an MD5 encrypted password, <structfield>rolpassword</structfield>
column will begin with the string <literal>md5</literal> followed by a
32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
password concatenated to their user name. For example, if user
<literal>joe</literal> has password <literal>xyzzy</literal>, <productname>PostgreSQL</productname>
will store the md5 hash of <literal>xyzzyjoe</literal>.
</para>
<para>
If the password is encrypted with SCRAM-SHA-256, it has the format:
<synopsis>
SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&lt;salt&gt;</replaceable>$<replaceable>&lt;StoredKey&gt;</replaceable>:<replaceable>&lt;ServerKey&gt;</replaceable>
</synopsis>
where <replaceable>salt</replaceable>, <replaceable>StoredKey</replaceable> and
<replaceable>ServerKey</replaceable> are in Base64 encoded format. This format is
the same as that specified by RFC 5803.
</para>
<para>
A password that does not follow either of those formats is assumed to be
unencrypted.
</para>
</sect1>
<sect1 id="catalog-pg-auth-members">
<title><structname>pg_auth_members</structname></title>
<indexterm zone="catalog-pg-auth-members">
<primary>pg_auth_members</primary>
</indexterm>
<para>
The catalog <structname>pg_auth_members</structname> shows the membership
relations between roles. Any non-circular set of relationships is allowed.
</para>
<para>
Because user identities are cluster-wide,
<structname>pg_auth_members</structname>
is shared across all databases of a cluster: there is only one
copy of <structname>pg_auth_members</structname> per cluster, not
one per database.
</para>
<table>
<title><structname>pg_auth_members</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>roleid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>ID of a role that has a member</entry>
</row>
<row>
<entry><structfield>member</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>ID of a role that is a member of <structfield>roleid</structfield></entry>
</row>
<row>
<entry><structfield>grantor</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>ID of the role that granted this membership</entry>
</row>
<row>
<entry><structfield>admin_option</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if <structfield>member</structfield> can grant membership in
<structfield>roleid</structfield> to others</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-cast">
<title><structname>pg_cast</structname></title>
<indexterm zone="catalog-pg-cast">
<primary>pg_cast</primary>
</indexterm>
<para>
The catalog <structname>pg_cast</structname> stores data type conversion
paths, both built-in and user-defined.
</para>
<para>
It should be noted that <structname>pg_cast</structname> does not represent
every type conversion that the system knows how to perform; only those that
cannot be deduced from some generic rule. For example, casting between a
domain and its base type is not explicitly represented in
<structname>pg_cast</structname>. Another important exception is that
<quote>automatic I/O conversion casts</quote>, those performed using a data
type's own I/O functions to convert to or from <type>text</type> or other
string types, are not explicitly represented in
<structname>pg_cast</structname>.
</para>
<table>
<title><structname>pg_cast</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>castsource</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>OID of the source data type</entry>
</row>
<row>
<entry><structfield>casttarget</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>OID of the target data type</entry>
</row>
<row>
<entry><structfield>castfunc</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
The OID of the function to use to perform this cast. Zero is
stored if the cast method doesn't require a function.
</entry>
</row>
<row>
<entry><structfield>castcontext</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Indicates what contexts the cast can be invoked in.
<literal>e</literal> means only as an explicit cast (using
<literal>CAST</literal> or <literal>::</literal> syntax).
<literal>a</literal> means implicitly in assignment
to a target column, as well as explicitly.
<literal>i</literal> means implicitly in expressions, as well as the
other cases.
</entry>
</row>
<row>
<entry><structfield>castmethod</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Indicates how the cast is performed.
<literal>f</literal> means that the function specified in the <structfield>castfunc</structfield> field is used.
<literal>i</literal> means that the input/output functions are used.
<literal>b</literal> means that the types are binary-coercible, thus no conversion is required.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The cast functions listed in <structname>pg_cast</structname> must
always take the cast source type as their first argument type, and
return the cast destination type as their result type. A cast
function can have up to three arguments. The second argument,
if present, must be type <type>integer</type>; it receives the type
modifier associated with the destination type, or -1
if there is none. The third argument,
if present, must be type <type>boolean</type>; it receives <literal>true</literal>
if the cast is an explicit cast, <literal>false</literal> otherwise.
</para>
<para>
It is legitimate to create a <structname>pg_cast</structname> entry
in which the source and target types are the same, if the associated
function takes more than one argument. Such entries represent
<quote>length coercion functions</quote> that coerce values of the type
to be legal for a particular type modifier value.
</para>
<para>
When a <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> catalogs tables and most
everything else that has columns or is otherwise similar to a
table. This includes indexes (but see also
<structname>pg_index</structname>), sequences (but see also
<structname>pg_sequence</structname>), 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
columns are meaningful for all relation types.
</para>
<table>
<title><structname>pg_class</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>relname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the table, index, view, etc.</entry>
</row>
<row>
<entry><structfield>relnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this relation
</entry>
</row>
<row>
<entry><structfield>reltype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>
The OID of the data type that corresponds to this table's row type,
if any (zero for indexes, which have no <structname>pg_type</structname> entry)
</entry>
</row>
<row>
<entry><structfield>reloftype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>
For typed tables, the OID of the underlying composite type,
zero for all other relations
</entry>
</row>
<row>
<entry><structfield>relowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the relation</entry>
</row>
<row>
<entry><structfield>relam</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
<entry>
If this is a table or an index, the access method used (heap,
B-tree, hash, etc.)
</entry>
</row>
<row>
<entry><structfield>relfilenode</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Name of the on-disk file of this relation; zero means this
is a <quote>mapped</quote> relation whose disk file name is determined
by low-level state</entry>
</row>
<row>
<entry><structfield>reltablespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
<entry>
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.)
</entry>
</row>
<row>
<entry><structfield>relpages</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
Size of the on-disk representation of this table in pages (of size
<symbol>BLCKSZ</symbol>). This is only an estimate used by the
planner. It is updated by <command>VACUUM</command>,
<command>ANALYZE</command>, and a few DDL commands such as
<command>CREATE INDEX</command>.
</entry>
</row>
<row>
<entry><structfield>reltuples</structfield></entry>
<entry><type>float4</type></entry>
<entry></entry>
<entry>
Number of live rows in the table. This is only an estimate used by
the planner. It is updated by <command>VACUUM</command>,
<command>ANALYZE</command>, and a few DDL commands such as
<command>CREATE INDEX</command>.
</entry>
</row>
<row>
<entry><structfield>relallvisible</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
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 <command>VACUUM</command>,
<command>ANALYZE</command>, and a few DDL commands such as
<command>CREATE INDEX</command>.
</entry>
</row>
<row>
<entry><structfield>reltoastrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>
OID of the TOAST table associated with this table, 0 if none. The
TOAST table stores large attributes <quote>out of line</quote> in a
secondary table.
</entry>
</row>
<row>
<entry><structfield>relhasindex</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if this is a table and it has (or recently had) any indexes
</entry>
</row>
<row>
<entry><structfield>relisshared</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if this table is shared across all databases in the cluster. Only
certain system catalogs (such as <structname>pg_database</structname>)
are shared.
</entry>
</row>
<row>
<entry><structfield>relpersistence</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<literal>p</literal> = permanent table, <literal>u</literal> = unlogged table,
<literal>t</literal> = temporary table
</entry>
</row>
<row>
<entry><structfield>relkind</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<literal>r</literal> = ordinary table,
<literal>i</literal> = index,
<literal>S</literal> = sequence,
<literal>t</literal> = TOAST table,
<literal>v</literal> = view,
<literal>m</literal> = materialized view,
<literal>c</literal> = composite type,
<literal>f</literal> = foreign table,
<literal>p</literal> = partitioned table,
<literal>I</literal> = partitioned index
</entry>
</row>
<row>
<entry><structfield>relnatts</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>
Number of user columns in the relation (system columns not
counted). There must be this many corresponding entries in
<structname>pg_attribute</structname>. See also
<literal>pg_attribute.attnum</literal>.
</entry>
</row>
<row>
<entry><structfield>relchecks</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>
Number of <literal>CHECK</literal> constraints on the table; see
<link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
</entry>
</row>
<row>
<entry><structfield>relhasrules</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if table has (or once had) rules; see
<link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
</entry>
</row>
<row>
<entry><structfield>relhastriggers</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if table has (or once had) triggers; see
<link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
</entry>
</row>
<row>
<entry><structfield>relhassubclass</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if table or index has (or once had) any inheritance children
</entry>
</row>
<row>
<entry><structfield>relrowsecurity</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if table has row level security enabled; see
<link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
</entry>
</row>
<row>
<entry><structfield>relforcerowsecurity</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if row level security (when enabled) will also apply to table owner; see
<link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
</entry>
</row>
<row>
<entry><structfield>relispopulated</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if relation is populated (this is true for all
relations other than some materialized views)</entry>
</row>
<row>
<entry><structfield>relreplident</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Columns used to form <quote>replica identity</quote> for rows:
<literal>d</literal> = default (primary key, if any),
<literal>n</literal> = nothing,
<literal>f</literal> = all columns
<literal>i</literal> = index with <structfield>indisreplident</structfield> set, or default
</entry>
</row>
<row>
<entry><structfield>relispartition</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if table or index is a partition</entry>
</row>
<row>
<entry><structfield>relrewrite</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>
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.
</entry>
</row>
<row>
<entry><structfield>relfrozenxid</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</quote>) 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 <literal>pg_xact</literal> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
<row>
<entry><structfield>relminmxid</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>
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 <literal>pg_multixact</literal> to be shrunk. Zero
(<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
</entry>
</row>
<row>
<entry><structfield>relacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
<row>
<entry><structfield>reloptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
Access-method-specific options, as <quote>keyword=value</quote> strings
</entry>
</row>
<row>
<entry><structfield>relpartbound</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>
If table is a partition (see <structfield>relispartition</structfield>),
internal representation of the partition bound
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Several of the Boolean flags in <structname>pg_class</structname> 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, <structfield>relhasindex</structfield> is set by
<command>CREATE INDEX</command>, but it is never cleared by
<command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
<structfield>relhasindex</structfield> if it finds the table has no indexes. This
arrangement avoids race conditions and improves concurrency.
</para>
</sect1>
<sect1 id="catalog-pg-collation">
<title><structname>pg_collation</structname></title>
<indexterm zone="catalog-pg-collation">
<primary>pg_collation</primary>
</indexterm>
<para>
The catalog <structname>pg_collation</structname> describes the
available collations, which are essentially mappings from an SQL
name to operating system locale categories.
See <xref linkend="collation"/> for more information.
</para>
<table>
<title><structname>pg_collation</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>collname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Collation name (unique per namespace and encoding)</entry>
</row>
<row>
<entry><structfield>collnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this collation
</entry>
</row>
<row>
<entry><structfield>collowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the collation</entry>
</row>
<row>
<entry><structfield>collprovider</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>Provider of the collation: <literal>d</literal> = database
default, <literal>c</literal> = libc, <literal>i</literal> = icu</entry>
</row>
<row>
<entry><structfield>collisdeterministic</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Is the collation deterministic?</entry>
</row>
<row>
<entry><structfield>collencoding</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>Encoding in which the collation is applicable, or -1 if it
works for any encoding</entry>
</row>
<row>
<entry><structfield>collcollate</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry><symbol>LC_COLLATE</symbol> for this collation object</entry>
</row>
<row>
<entry><structfield>collctype</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry><symbol>LC_CTYPE</symbol> for this collation object</entry>
</row>
<row>
<entry><structfield>collversion</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
Provider-specific version of the collation. This is recorded when the
collation is created and then checked when it is used, to detect
changes in the collation definition that could lead to data corruption.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Note that the unique key on this catalog is (<structfield>collname</structfield>,
<structfield>collencoding</structfield>, <structfield>collnamespace</structfield>) not just
(<structfield>collname</structfield>, <structfield>collnamespace</structfield>).
<productname>PostgreSQL</productname> generally ignores all
collations that do not have <structfield>collencoding</structfield> equal to
either the current database's encoding or -1, and creation of new entries
with the same name as an entry with <structfield>collencoding</structfield> = -1
is forbidden. Therefore it is sufficient to use a qualified SQL name
(<replaceable>schema</replaceable>.<replaceable>name</replaceable>) to identify a collation,
even though this is not unique according to the catalog definition.
The reason for defining the catalog this way is that
<application>initdb</application> fills it in at cluster initialization time with
entries for all locales available on the system, so it must be able to
hold entries for all encodings that might ever be used in the cluster.
</para>
<para>
In the <literal>template0</literal> database, it could be useful to create
collations whose encoding does not match the database encoding,
since they could match the encodings of databases later cloned from
<literal>template0</literal>. This would currently have to be done manually.
</para>
</sect1>
<sect1 id="catalog-pg-constraint">
<title><structname>pg_constraint</structname></title>
<indexterm zone="catalog-pg-constraint">
<primary>pg_constraint</primary>
</indexterm>
<para>
The catalog <structname>pg_constraint</structname> stores check, primary
key, unique, foreign key, and exclusion constraints on tables.
(Column constraints are not treated specially. Every column constraint is
equivalent to some table constraint.)
Not-null constraints are represented in the <structname>pg_attribute</structname>
catalog, not here.
</para>
<para>
User-defined constraint triggers (created with <command>CREATE CONSTRAINT
TRIGGER</command>) also give rise to an entry in this table.
</para>
<para>
Check constraints on domains are stored here, too.
</para>
<table>
<title><structname>pg_constraint</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>conname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Constraint name (not necessarily unique!)</entry>
</row>
<row>
<entry><structfield>connamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this constraint
</entry>
</row>
<row>
<entry><structfield>contype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<literal>c</literal> = check constraint,
<literal>f</literal> = foreign key constraint,
<literal>p</literal> = primary key constraint,
<literal>u</literal> = unique constraint,
<literal>t</literal> = constraint trigger,
<literal>x</literal> = exclusion constraint
</entry>
</row>
<row>
<entry><structfield>condeferrable</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Is the constraint deferrable?</entry>
</row>
<row>
<entry><structfield>condeferred</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Is the constraint deferred by default?</entry>
</row>
<row>
<entry><structfield>convalidated</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Has the constraint been validated?
Currently, can only be false for foreign keys and CHECK constraints</entry>
</row>
<row>
<entry><structfield>conrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The table this constraint is on; 0 if not a table constraint</entry>
</row>
<row>
<entry><structfield>contypid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>The domain this constraint is on; 0 if not a domain constraint</entry>
</row>
<row>
<entry><structfield>conindid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The index supporting this constraint, if it's a unique, primary
key, foreign key, or exclusion constraint; else 0</entry>
</row>
<row>
<entry><structfield>conparentid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
<entry>The corresponding constraint in the parent partitioned table,
if this is a constraint in a partition; else 0</entry>
</row>
<row>
<entry><structfield>confrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>If a foreign key, the referenced table; else 0</entry>
</row>
<row>
<entry><structfield>confupdtype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>Foreign key update action code:
<literal>a</literal> = no action,
<literal>r</literal> = restrict,
<literal>c</literal> = cascade,
<literal>n</literal> = set null,
<literal>d</literal> = set default
</entry>
</row>
<row>
<entry><structfield>confdeltype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>Foreign key deletion action code:
<literal>a</literal> = no action,
<literal>r</literal> = restrict,
<literal>c</literal> = cascade,
<literal>n</literal> = set null,
<literal>d</literal> = set default
</entry>
</row>
<row>
<entry><structfield>confmatchtype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>Foreign key match type:
<literal>f</literal> = full,
<literal>p</literal> = partial,
<literal>s</literal> = simple
</entry>
</row>
<row>
<entry><structfield>conislocal</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
This constraint is defined locally for the relation. Note that a
constraint can be locally defined and inherited simultaneously.
</entry>
</row>
<row>
<entry><structfield>coninhcount</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
The number of direct inheritance ancestors this constraint has.
A constraint with
a nonzero number of ancestors cannot be dropped nor renamed.
</entry>
</row>
<row>
<entry><structfield>connoinherit</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
This constraint is defined locally for the relation. It is a
non-inheritable constraint.
</entry>
</row>
<row>
<entry><structfield>conkey</structfield></entry>
<entry><type>int2[]</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
<entry>If a table constraint (including foreign keys, but not constraint
triggers), list of the constrained columns</entry>
</row>
<row>
<entry><structfield>confkey</structfield></entry>
<entry><type>int2[]</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
<entry>If a foreign key, list of the referenced columns</entry>
</row>
<row>
<entry><structfield>conpfeqop</structfield></entry>
<entry><type>oid[]</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
</row>
<row>
<entry><structfield>conppeqop</structfield></entry>
<entry><type>oid[]</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
</row>
<row>
<entry><structfield>conffeqop</structfield></entry>
<entry><type>oid[]</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
</row>
<row>
<entry><structfield>conexclop</structfield></entry>
<entry><type>oid[]</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
</row>
<row>
<entry><structfield>conbin</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>If a check constraint, an internal representation of the
expression. (It's recommended to use
<function>pg_get_constraintdef()</function> to extract the definition of
a check constraint.)</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
In the case of an exclusion constraint, <structfield>conkey</structfield>
is only useful for constraint elements that are simple column references.
For other cases, a zero appears in <structfield>conkey</structfield>
and the associated index must be consulted to discover the expression
that is constrained. (<structfield>conkey</structfield> thus has the
same contents as <structname>pg_index</structname>.<structfield>indkey</structfield> for the
index.)
</para>
<note>
<para>
<literal>pg_class.relchecks</literal> needs to agree with the
number of check-constraint entries found in this table for each
relation.
</para>
</note>
</sect1>
<sect1 id="catalog-pg-conversion">
<title><structname>pg_conversion</structname></title>
<indexterm zone="catalog-pg-conversion">
<primary>pg_conversion</primary>
</indexterm>
<para>
The catalog <structname>pg_conversion</structname> describes
encoding conversion functions. See <xref linkend="sql-createconversion"/>
for more information.
</para>
<table>
<title><structname>pg_conversion</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>conname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Conversion name (unique within a namespace)</entry>
</row>
<row>
<entry><structfield>connamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this conversion
</entry>
</row>
<row>
<entry><structfield>conowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the conversion</entry>
</row>
<row>
<entry><structfield>conforencoding</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>Source encoding ID</entry>
</row>
<row>
<entry><structfield>contoencoding</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>Destination encoding ID</entry>
</row>
<row>
<entry><structfield>conproc</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Conversion function</entry>
</row>
<row>
<entry><structfield>condefault</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if this is the default conversion</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-database">
<title><structname>pg_database</structname></title>
<indexterm zone="catalog-pg-database">
<primary>pg_database</primary>
</indexterm>
<para>
The catalog <structname>pg_database</structname> stores information about
the available databases. Databases are created with the <xref
linkend="sql-createdatabase"/> command.
Consult <xref linkend="managing-databases"/> for details about the meaning
of some of the parameters.
</para>
<para>
Unlike most system catalogs, <structname>pg_database</structname>
is shared across all databases of a cluster: there is only one
copy of <structname>pg_database</structname> per cluster, not
one per database.
</para>
<table>
<title><structname>pg_database</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>datname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Database name</entry>
</row>
<row>
<entry><structfield>datdba</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the database, usually the user who created it</entry>
</row>
<row>
<entry><structfield>encoding</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>Character encoding for this database
(<function>pg_encoding_to_char()</function> can translate
this number to the encoding name)</entry>
</row>
<row>
<entry><structfield>datcollate</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>LC_COLLATE for this database</entry>
</row>
<row>
<entry><structfield>datctype</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>LC_CTYPE for this database</entry>
</row>
<row>
<entry><structfield>datistemplate</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
If true, then this database can be cloned by
any user with <literal>CREATEDB</literal> privileges;
if false, then only superusers or the owner of
the database can clone it.
</entry>
</row>
<row>
<entry><structfield>datallowconn</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
If false then no one can connect to this database. This is
used to protect the <literal>template0</literal> database from being altered.
</entry>
</row>
<row>
<entry><structfield>datconnlimit</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
Sets maximum number of concurrent connections that can be made
to this database. -1 means no limit.
</entry>
</row>
<row>
<entry><structfield>datlastsysoid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>
Last system OID in the database; useful
particularly to <application>pg_dump</application>
</entry>
</row>
<row>
<entry><structfield>datfrozenxid</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</quote>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
transaction ID wraparound or to allow <literal>pg_xact</literal> to be shrunk.
It is the minimum of the per-table
<structname>pg_class</structname>.<structfield>relfrozenxid</structfield> values.
</entry>
</row>
<row>
<entry><structfield>datminmxid</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>
All multixact IDs before this one have been replaced with a
transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
multixact ID wraparound or to allow <literal>pg_multixact</literal> to be shrunk.
It is the minimum of the per-table
<structname>pg_class</structname>.<structfield>relminmxid</structfield> values.
</entry>
</row>
<row>
<entry><structfield>dattablespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
<entry>
The default tablespace for the database.
Within this database, all tables for which
<structname>pg_class</structname>.<structfield>reltablespace</structfield> is zero
will be stored in this tablespace; in particular, all the non-shared
system catalogs will be there.
</entry>
</row>
<row>
<entry><structfield>datacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-db-role-setting">
<title><structname>pg_db_role_setting</structname></title>
<indexterm zone="catalog-pg-db-role-setting">
<primary>pg_db_role_setting</primary>
</indexterm>
<para>
The catalog <structname>pg_db_role_setting</structname> records the default
values that have been set for run-time configuration variables,
for each role and database combination.
</para>
<para>
Unlike most system catalogs, <structname>pg_db_role_setting</structname>
is shared across all databases of a cluster: there is only one
copy of <structname>pg_db_role_setting</structname> per cluster, not
one per database.
</para>
<table>
<title><structname>pg_db_role_setting</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>setdatabase</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
<entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
</row>
<row>
<entry><structfield>setrole</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
</row>
<row>
<entry><structfield>setconfig</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>Defaults for run-time configuration variables</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-default-acl">
<title><structname>pg_default_acl</structname></title>
<indexterm zone="catalog-pg-default-acl">
<primary>pg_default_acl</primary>
</indexterm>
<para>
The catalog <structname>pg_default_acl</structname> stores initial
privileges to be assigned to newly created objects.
</para>
<table>
<title><structname>pg_default_acl</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>defaclrole</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>The OID of the role associated with this entry</entry>
</row>
<row>
<entry><structfield>defaclnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>The OID of the namespace associated with this entry,
or 0 if none</entry>
</row>
<row>
<entry><structfield>defaclobjtype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Type of object this entry is for:
<literal>r</literal> = relation (table, view),
<literal>S</literal> = sequence,
<literal>f</literal> = function,
<literal>T</literal> = type,
<literal>n</literal> = schema
</entry>
</row>
<row>
<entry><structfield>defaclacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges that this type of object should have on creation
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
A <structname>pg_default_acl</structname> entry shows the initial privileges to
be assigned to an object belonging to the indicated user. There are
currently two types of entry: <quote>global</quote> entries with
<structfield>defaclnamespace</structfield> = 0, and <quote>per-schema</quote> entries
that reference a particular schema. If a global entry is present then
it <emphasis>overrides</emphasis> the normal hard-wired default privileges
for the object type. A per-schema entry, if present, represents privileges
to be <emphasis>added to</emphasis> the global or hard-wired default privileges.
</para>
<para>
Note that when an ACL entry in another catalog is null, it is taken
to represent the hard-wired default privileges for its object,
<emphasis>not</emphasis> whatever might be in <structname>pg_default_acl</structname>
at the moment. <structname>pg_default_acl</structname> is only consulted during
object creation.
</para>
</sect1>
<sect1 id="catalog-pg-depend">
<title><structname>pg_depend</structname></title>
<indexterm zone="catalog-pg-depend">
<primary>pg_depend</primary>
</indexterm>
<para>
The catalog <structname>pg_depend</structname> records the dependency
relationships between database objects. This information allows
<command>DROP</command> commands to find which other objects must be dropped
by <command>DROP CASCADE</command> or prevent dropping in the <command>DROP
RESTRICT</command> case.
</para>
<para>
See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
which performs a similar function for dependencies involving objects
that are shared across a database cluster.
</para>
<table>
<title><structname>pg_depend</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>classid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog the dependent object is in</entry>
</row>
<row>
<entry><structfield>objid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the specific dependent object</entry>
</row>
<row>
<entry><structfield>objsubid</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
For a table column, this is the column number (the
<structfield>objid</structfield> and <structfield>classid</structfield> refer to the
table itself). For all other object types, this column is
zero.
</entry>
</row>
<row>
<entry><structfield>refclassid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog the referenced object is in</entry>
</row>
<row>
<entry><structfield>refobjid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the specific referenced object</entry>
</row>
<row>
<entry><structfield>refobjsubid</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
For a table column, this is the column number (the
<structfield>refobjid</structfield> and <structfield>refclassid</structfield> refer
to the table itself). For all other object types, this column
is zero.
</entry>
</row>
<row>
<entry><structfield>deptype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
A code defining the specific semantics of this dependency relationship; see text
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
In all cases, a <structname>pg_depend</structname> entry indicates that the
referenced object cannot be dropped without also dropping the dependent
object. However, there are several subflavors identified by
<structfield>deptype</structfield>:
<variablelist>
<varlistentry>
<term><symbol>DEPENDENCY_NORMAL</symbol> (<literal>n</literal>)</term>
<listitem>
<para>
A normal relationship between separately-created objects. The
dependent object can be dropped without affecting the
referenced object. The referenced object can only be dropped
by specifying <literal>CASCADE</literal>, in which case the dependent
object is dropped, too. Example: a table column has a normal
dependency on its data type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>DEPENDENCY_AUTO</symbol> (<literal>a</literal>)</term>
<listitem>
<para>
The dependent object can be dropped separately from the
referenced object, and should be automatically dropped
(regardless of <literal>RESTRICT</literal> or <literal>CASCADE</literal>
mode) if the referenced object is dropped. Example: a named
constraint on a table is made auto-dependent on the table, so
that it will go away if the table is dropped.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>DEPENDENCY_INTERNAL</symbol> (<literal>i</literal>)</term>
<listitem>
<para>
The dependent object was created as part of creation of the
referenced object, and is really just a part of its internal
implementation. A direct <command>DROP</command> of the dependent
object will be disallowed outright (we'll tell the user to issue
a <command>DROP</command> against the referenced object, instead).
A <command>DROP</command> of the referenced object will result in
automatically dropping the dependent object
whether <literal>CASCADE</literal> is specified or not. If the
dependent object has to be dropped due to a dependency on some other
object being removed, its drop is converted to a drop of the referenced
object, so that <literal>NORMAL</literal> and <literal>AUTO</literal>
dependencies of the dependent object behave much like they were
dependencies of the referenced object.
Example: a view's <literal>ON SELECT</literal> rule is made
internally dependent on the view, preventing it from being dropped
while the view remains. Dependencies of the rule (such as tables it
refers to) act as if they were dependencies of the view.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>DEPENDENCY_PARTITION_PRI</symbol> (<literal>P</literal>)</term>
<term><symbol>DEPENDENCY_PARTITION_SEC</symbol> (<literal>S</literal>)</term>
<listitem>
<para>
The dependent object was created as part of creation of the
referenced object, and is really just a part of its internal
implementation; however, unlike <literal>INTERNAL</literal>,
there is more than one such referenced object. The dependent object
must not be dropped unless at least one of these referenced objects
is dropped; if any one is, the dependent object should be dropped
whether or not <literal>CASCADE</literal> is specified. Also
unlike <literal>INTERNAL</literal>, a drop of some other object
that the dependent object depends on does not result in automatic
deletion of any partition-referenced object. Hence, if the drop
does not cascade to at least one of these objects via some other
path, it will be refused. (In most cases, the dependent object
shares all its non-partition dependencies with at least one
partition-referenced object, so that this restriction does not
result in blocking any cascaded delete.)
Primary and secondary partition dependencies behave identically
except that the primary dependency is preferred for use in error
messages; hence, a partition-dependent object should have one
primary partition dependency and one or more secondary partition
dependencies.
Note that partition dependencies are made in addition to, not
instead of, any dependencies the object would normally have. This
simplifies <command>ATTACH/DETACH PARTITION</command> operations:
the partition dependencies need only be added or removed.
Example: a child partitioned index is made partition-dependent
on both the partition table it is on and the parent partitioned
index, so that it goes away if either of those is dropped, but
not otherwise. The dependency on the parent index is primary,
so that if the user tries to drop the child partitioned index,
the error message will suggest dropping the parent index instead
(not the table).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>DEPENDENCY_EXTENSION</symbol> (<literal>e</literal>)</term>
<listitem>
<para>
The dependent object is a member of the <firstterm>extension</firstterm> that is
the referenced object (see
<link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
The dependent object can be dropped only via
<command>DROP EXTENSION</command> on the referenced object.
Functionally this dependency type acts the same as
an <literal>INTERNAL</literal> dependency, but it's kept separate for
clarity and to simplify <application>pg_dump</application>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>DEPENDENCY_AUTO_EXTENSION</symbol> (<literal>x</literal>)</term>
<listitem>
<para>
The dependent object is not a member of the extension that is the
referenced object (and so it should not be ignored
by <application>pg_dump</application>), but it cannot function
without the extension and should be auto-dropped if the extension is.
The dependent object may be dropped on its own as well.
Functionally this dependency type acts the same as
an <literal>AUTO</literal> dependency, but it's kept separate for
clarity and to simplify <application>pg_dump</application>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>DEPENDENCY_PIN</symbol> (<literal>p</literal>)</term>
<listitem>
<para>
There is no dependent object; this type of entry is a signal
that the system itself depends on the referenced object, and so
that object must never be deleted. Entries of this type are
created only by <command>initdb</command>. The columns for the
dependent object contain zeroes.
</para>
</listitem>
</varlistentry>
</variablelist>
Other dependency flavors might be needed in future.
</para>
<para>
Note that it's quite possible for two objects to be linked by more than
one <structname>pg_depend</structname> entry. For example, a child
partitioned index would have both a partition-type dependency on its
associated partition table, and an auto dependency on each column of
that table that it indexes. This sort of situation expresses the union
of multiple dependency semantics. A dependent object can be dropped
without <literal>CASCADE</literal> if any of its dependencies satisfies
its condition for automatic dropping. Conversely, all the
dependencies' restrictions about which objects must be dropped together
must be satisfied.
</para>
</sect1>
<sect1 id="catalog-pg-description">
<title><structname>pg_description</structname></title>
<indexterm zone="catalog-pg-description">
<primary>pg_description</primary>
</indexterm>
<para>
The catalog <structname>pg_description</structname> stores optional descriptions
(comments) for each database object. Descriptions can be manipulated
with the <xref linkend="sql-comment"/> command and viewed with
<application>psql</application>'s <literal>\d</literal> commands.
Descriptions of many built-in system objects are provided in the initial
contents of <structname>pg_description</structname>.
</para>
<para>
See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
which performs a similar function for descriptions involving objects that
are shared across a database cluster.
</para>
<table>
<title><structname>pg_description</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>objoid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the object this description pertains to</entry>
</row>
<row>
<entry><structfield>classoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog this object appears in</entry>
</row>
<row>
<entry><structfield>objsubid</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
For a comment on a table column, this is the column number (the
<structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
the table itself). For all other object types, this column is
zero.
</entry>
</row>
<row>
<entry><structfield>description</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Arbitrary text that serves as the description of this object</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-enum">
<title><structname>pg_enum</structname></title>
<indexterm zone="catalog-pg-enum">
<primary>pg_enum</primary>
</indexterm>
<para>
The <structname>pg_enum</structname> catalog contains entries
showing the values and labels for each enum type. The
internal representation of a given enum value is actually the OID
of its associated row in <structname>pg_enum</structname>.
</para>
<table>
<title><structname>pg_enum</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>enumtypid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>The OID of the <structname>pg_type</structname> entry owning this enum value</entry>
</row>
<row>
<entry><structfield>enumsortorder</structfield></entry>
<entry><type>float4</type></entry>
<entry></entry>
<entry>The sort position of this enum value within its enum type</entry>
</row>
<row>
<entry><structfield>enumlabel</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>The textual label for this enum value</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The OIDs for <structname>pg_enum</structname> rows follow a special
rule: even-numbered OIDs are guaranteed to be ordered in the same way
as the sort ordering of their enum type. That is, if two even OIDs
belong to the same enum type, the smaller OID must have the smaller
<structfield>enumsortorder</structfield> value. Odd-numbered OID values
need bear no relationship to the sort order. This rule allows the
enum comparison routines to avoid catalog lookups in many common cases.
The routines that create and alter enum types attempt to assign even
OIDs to enum values whenever possible.
</para>
<para>
When an enum type is created, its members are assigned sort-order
positions 1..<replaceable>n</replaceable>. But members added later might be given
negative or fractional values of <structfield>enumsortorder</structfield>.
The only requirement on these values is that they be correctly
ordered and unique within each enum type.
</para>
</sect1>
<sect1 id="catalog-pg-event-trigger">
<title><structname>pg_event_trigger</structname></title>
<indexterm zone="catalog-pg-event-trigger">
<primary>pg_event_trigger</primary>
</indexterm>
<para>
The catalog <structname>pg_event_trigger</structname> stores event triggers.
See <xref linkend="event-triggers"/> for more information.
</para>
<table>
<title><structname>pg_event_trigger</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>evtname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Trigger name (must be unique)</entry>
</row>
<row>
<entry><structfield>evtevent</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Identifies the event for which this trigger fires</entry>
</row>
<row>
<entry><structfield>evtowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the event trigger</entry>
</row>
<row>
<entry><structfield>evtfoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>The function to be called</entry>
</row>
<row>
<entry><structfield>evtenabled</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Controls in which <xref linkend="guc-session-replication-role"/> modes
the event trigger fires.
<literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
<literal>D</literal> = trigger is disabled,
<literal>R</literal> = trigger fires in <quote>replica</quote> mode,
<literal>A</literal> = trigger fires always.
</entry>
</row>
<row>
<entry><structfield>evttags</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
Command tags for which this trigger will fire. If NULL, the firing
of this trigger is not restricted on the basis of the command tag.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-extension">
<title><structname>pg_extension</structname></title>
<indexterm zone="catalog-pg-extension">
<primary>pg_extension</primary>
</indexterm>
<para>
The catalog <structname>pg_extension</structname> stores information
about the installed extensions. See <xref linkend="extend-extensions"/>
for details about extensions.
</para>
<table>
<title><structname>pg_extension</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>extname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the extension</entry>
</row>
<row>
<entry><structfield>extowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the extension</entry>
</row>
<row>
<entry><structfield>extnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>Schema containing the extension's exported objects</entry>
</row>
<row>
<entry><structfield>extrelocatable</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if extension can be relocated to another schema</entry>
</row>
<row>
<entry><structfield>extversion</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Version name for the extension</entry>
</row>
<row>
<entry><structfield>extconfig</structfield></entry>
<entry><type>oid[]</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>Array of <type>regclass</type> OIDs for the extension's configuration
table(s), or <literal>NULL</literal> if none</entry>
</row>
<row>
<entry><structfield>extcondition</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>Array of <literal>WHERE</literal>-clause filter conditions for the
extension's configuration table(s), or <literal>NULL</literal> if none</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Note that unlike most catalogs with a <quote>namespace</quote> column,
<structfield>extnamespace</structfield> is not meant to imply
that the extension belongs to that schema. Extension names are never
schema-qualified. Rather, <structfield>extnamespace</structfield>
indicates the schema that contains most or all of the extension's
objects. If <structfield>extrelocatable</structfield> is true, then
this schema must in fact contain all schema-qualifiable objects
belonging to the extension.
</para>
</sect1>
<sect1 id="catalog-pg-foreign-data-wrapper">
<title><structname>pg_foreign_data_wrapper</structname></title>
<indexterm zone="catalog-pg-foreign-data-wrapper">
<primary>pg_foreign_data_wrapper</primary>
</indexterm>
<para>
The catalog <structname>pg_foreign_data_wrapper</structname> stores
foreign-data wrapper definitions. A foreign-data wrapper is the
mechanism by which external data, residing on foreign servers, is
accessed.
</para>
<table>
<title><structname>pg_foreign_data_wrapper</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>fdwname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the foreign-data wrapper</entry>
</row>
<row>
<entry><structfield>fdwowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the foreign-data wrapper</entry>
</row>
<row>
<entry><structfield>fdwhandler</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
References a handler function that is responsible for
supplying execution routines for the foreign-data wrapper.
Zero if no handler is provided
</entry>
</row>
<row>
<entry><structfield>fdwvalidator</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
References a validator function that is responsible for
checking the validity of the options given to the
foreign-data wrapper, as well as options for foreign servers and user
mappings using the foreign-data wrapper. Zero if no validator
is provided
</entry>
</row>
<row>
<entry><structfield>fdwacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
<row>
<entry><structfield>fdwoptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
Foreign-data wrapper specific options, as <quote>keyword=value</quote> strings
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-foreign-server">
<title><structname>pg_foreign_server</structname></title>
<indexterm zone="catalog-pg-foreign-server">
<primary>pg_foreign_server</primary>
</indexterm>
<para>
The catalog <structname>pg_foreign_server</structname> stores
foreign server definitions. A foreign server describes a source
of external data, such as a remote server. Foreign
servers are accessed via foreign-data wrappers.
</para>
<table>
<title><structname>pg_foreign_server</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>srvname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the foreign server</entry>
</row>
<row>
<entry><structfield>srvowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the foreign server</entry>
</row>
<row>
<entry><structfield>srvfdw</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
<entry>OID of the foreign-data wrapper of this foreign server</entry>
</row>
<row>
<entry><structfield>srvtype</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Type of the server (optional)</entry>
</row>
<row>
<entry><structfield>srvversion</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Version of the server (optional)</entry>
</row>
<row>
<entry><structfield>srvacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
<row>
<entry><structfield>srvoptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
Foreign server specific options, as <quote>keyword=value</quote> strings
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-foreign-table">
<title><structname>pg_foreign_table</structname></title>
<indexterm zone="catalog-pg-foreign-table">
<primary>pg_foreign_table</primary>
</indexterm>
<para>
The catalog <structname>pg_foreign_table</structname> contains
auxiliary information about foreign tables. A foreign table is
primarily represented by a <structname>pg_class</structname> entry,
just like a regular table. Its <structname>pg_foreign_table</structname>
entry contains the information that is pertinent only to foreign tables
and not any other kind of relation.
</para>
<table>
<title><structname>pg_foreign_table</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>ftrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>OID of the <structname>pg_class</structname> entry for this foreign table</entry>
</row>
<row>
<entry><structfield>ftserver</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
<entry>OID of the foreign server for this foreign table</entry>
</row>
<row>
<entry><structfield>ftoptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
Foreign table options, as <quote>keyword=value</quote> strings
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-index">
<title><structname>pg_index</structname></title>
<indexterm zone="catalog-pg-index">
<primary>pg_index</primary>
</indexterm>
<para>
The catalog <structname>pg_index</structname> contains part of the information
about indexes. The rest is mostly in
<structname>pg_class</structname>.
</para>
<table>
<title><structname>pg_index</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>indexrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the <structname>pg_class</structname> entry for this index</entry>
</row>
<row>
<entry><structfield>indrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the <structname>pg_class</structname> entry for the table this index is for</entry>
</row>
<row>
<entry><structfield>indnatts</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>The total number of columns in the index (duplicates
<literal>pg_class.relnatts</literal>); this number includes both key and included attributes</entry>
</row>
<row>
<entry><structfield>indnkeyatts</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>The number of <firstterm>key columns</firstterm> in the index,
not counting any <firstterm>included columns</firstterm>, which are
merely stored and do not participate in the index semantics</entry>
</row>
<row>
<entry><structfield>indisunique</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, this is a unique index</entry>
</row>
<row>
<entry><structfield>indisprimary</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, this index represents the primary key of the table
(<structfield>indisunique</structfield> should always be true when this is true)</entry>
</row>
<row>
<entry><structfield>indisexclusion</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, this index supports an exclusion constraint</entry>
</row>
<row>
<entry><structfield>indimmediate</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, the uniqueness check is enforced immediately on
insertion
(irrelevant if <structfield>indisunique</structfield> is not true)</entry>
</row>
<row>
<entry><structfield>indisclustered</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, the table was last clustered on this index</entry>
</row>
<row>
<entry><structfield>indisvalid</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
If true, the index is currently valid for queries. False means the
index is possibly incomplete: it must still be modified by
<command>INSERT</command>/<command>UPDATE</command> operations, but it cannot safely
be used for queries. If it is unique, the uniqueness property is not
guaranteed true either.
</entry>
</row>
<row>
<entry><structfield>indcheckxmin</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
If true, queries must not use the index until the <structfield>xmin</structfield>
of this <structname>pg_index</structname> row is below their <symbol>TransactionXmin</symbol>
event horizon, because the table may contain broken HOT chains with
incompatible rows that they can see
</entry>
</row>
<row>
<entry><structfield>indisready</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
If true, the index is currently ready for inserts. False means the
index must be ignored by <command>INSERT</command>/<command>UPDATE</command>
operations.
</entry>
</row>
<row>
<entry><structfield>indislive</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
If false, the index is in process of being dropped, and should be
ignored for all purposes (including HOT-safety decisions)
</entry>
</row>
<row>
<entry><structfield>indisreplident</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
If true this index has been chosen as <quote>replica identity</quote>
using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
...</command>
</entry>
</row>
<row>
<entry><structfield>indkey</structfield></entry>
<entry><type>int2vector</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
<entry>
This is an array of <structfield>indnatts</structfield> values that
indicate which table columns this index indexes. For example a value
of <literal>1 3</literal> would mean that the first and the third table
columns make up the index entries. Key columns come before non-key
(included) columns. A zero in this array indicates that the
corresponding index attribute is an expression over the table columns,
rather than a simple column reference.
</entry>
</row>
<row>
<entry><structfield>indcollation</structfield></entry>
<entry><type>oidvector</type></entry>
<entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
<entry>
For each column in the index key
(<structfield>indnkeyatts</structfield> values), this contains the OID
of the collation to use for the index, or zero if the column is not of
a collatable data type.
</entry>
</row>
<row>
<entry><structfield>indclass</structfield></entry>
<entry><type>oidvector</type></entry>
<entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
<entry>
For each column in the index key
(<structfield>indnkeyatts</structfield> values), this contains the OID
of the operator class to use. See
<link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
</entry>
</row>
<row>
<entry><structfield>indoption</structfield></entry>
<entry><type>int2vector</type></entry>
<entry></entry>
<entry>
This is an array of <structfield>indnkeyatts</structfield> values that
store per-column flag bits. The meaning of the bits is defined by
the index's access method.
</entry>
</row>
<row>
<entry><structfield>indexprs</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>
Expression trees (in <function>nodeToString()</function>
representation) for index attributes that are not simple column
references. This is a list with one element for each zero
entry in <structfield>indkey</structfield>. Null if all index attributes
are simple references.
</entry>
</row>
<row>
<entry><structfield>indpred</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>
Expression tree (in <function>nodeToString()</function>
representation) for partial index predicate. Null if not a
partial index.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-inherits">
<title><structname>pg_inherits</structname></title>
<indexterm zone="catalog-pg-inherits">
<primary>pg_inherits</primary>
</indexterm>
<para>
The catalog <structname>pg_inherits</structname> records information about
table inheritance hierarchies. There is one entry for each direct
parent-child table relationship in the database. (Indirect inheritance can be determined
by following chains of entries.)
</para>
<table>
<title><structname>pg_inherits</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>inhrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>
The OID of the child table
</entry>
</row>
<row>
<entry><structfield>inhparent</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>
The OID of the parent table
</entry>
</row>
<row>
<entry><structfield>inhseqno</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
If there is more than one direct parent for a child table (multiple
inheritance), this number tells the order in which the
inherited columns are to be arranged. The count starts at 1.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-init-privs">
<title><structname>pg_init_privs</structname></title>
<indexterm zone="catalog-pg-init-privs">
<primary>pg_init_privs</primary>
</indexterm>
<para>
The catalog <structname>pg_init_privs</structname> records information about
the initial privileges of objects in the system. There is one entry
for each object in the database which has a non-default (non-NULL)
initial set of privileges.
</para>
<para>
Objects can have initial privileges either by having those privileges set
when the system is initialized (by <application>initdb</application>) or when the
object is created during a <command>CREATE EXTENSION</command> and the
extension script sets initial privileges using the <command>GRANT</command>
system. Note that the system will automatically handle recording of the
privileges during the extension script and that extension authors need
only use the <command>GRANT</command> and <command>REVOKE</command>
statements in their script to have the privileges recorded. The
<literal>privtype</literal> column indicates if the initial privilege was
set by <application>initdb</application> or during a
<command>CREATE EXTENSION</command> command.
</para>
<para>
Objects which have initial privileges set by <application>initdb</application> will
have entries where <literal>privtype</literal> is
<literal>'i'</literal>, while objects which have initial privileges set
by <command>CREATE EXTENSION</command> will have entries where
<literal>privtype</literal> is <literal>'e'</literal>.
</para>
<table>
<title><structname>pg_init_privs</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>objoid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the specific object</entry>
</row>
<row>
<entry><structfield>classoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog the object is in</entry>
</row>
<row>
<entry><structfield>objsubid</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
For a table column, this is the column number (the
<structfield>objoid</structfield> and <structfield>classoid</structfield> refer to the
table itself). For all other object types, this column is
zero.
</entry>
</row>
<row>
<entry><structfield>privtype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
A code defining the type of initial privilege of this object; see text
</entry>
</row>
<row>
<entry><structfield>initprivs</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
The initial access privileges; see
<xref linkend="ddl-priv"/> for details
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-language">
<title><structname>pg_language</structname></title>
<indexterm zone="catalog-pg-language">
<primary>pg_language</primary>
</indexterm>
<para>
The catalog <structname>pg_language</structname> registers
languages in which you can write functions or stored procedures.
See <xref linkend="sql-createlanguage"/>
and <xref linkend="xplang"/> for more information about language handlers.
</para>
<table>
<title><structname>pg_language</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>lanname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the language</entry>
</row>
<row>
<entry><structfield>lanowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the language</entry>
</row>
<row>
<entry><structfield>lanispl</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
This is false for internal languages (such as
<acronym>SQL</acronym>) and true for user-defined languages.
Currently, <application>pg_dump</application> still uses this
to determine which languages need to be dumped, but this might be
replaced by a different mechanism in the future.
</entry>
</row>
<row>
<entry><structfield>lanpltrusted</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if this is a trusted language, which means that it is believed
not to grant access to anything outside the normal SQL execution
environment. Only superusers can create functions in untrusted
languages.
</entry>
</row>
<row>
<entry><structfield>lanplcallfoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
For noninternal languages this references the language
handler, which is a special function that is responsible for
executing all functions that are written in the particular
language
</entry>
</row>
<row>
<entry><structfield>laninline</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
This references a function that is responsible for executing
<quote>inline</quote> anonymous code blocks
(<xref linkend="sql-do"/> blocks).
Zero if inline blocks are not supported.
</entry>
</row>
<row>
<entry><structfield>lanvalidator</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
This references a language validator function that is responsible
for checking the syntax and validity of new functions when they
are created. Zero if no validator is provided.
</entry>
</row>
<row>
<entry><structfield>lanacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-largeobject">
<title><structname>pg_largeobject</structname></title>
<indexterm zone="catalog-pg-largeobject">
<primary>pg_largeobject</primary>
</indexterm>
<para>
The catalog <structname>pg_largeobject</structname> holds the data making up
<quote>large objects</quote>. A large object is identified by an OID
assigned when it is created. Each large object is broken into
segments or <quote>pages</quote> small enough to be conveniently stored as rows
in <structname>pg_largeobject</structname>.
The amount of data per page is defined to be <symbol>LOBLKSIZE</symbol> (which is currently
<literal>BLCKSZ/4</literal>, or typically 2 kB).
</para>
<para>
Prior to <productname>PostgreSQL</productname> 9.0, there was no permission structure
associated with large objects. As a result,
<structname>pg_largeobject</structname> was publicly readable and could be
used to obtain the OIDs (and contents) of all large objects in the system.
This is no longer the case; use
<link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>
to obtain a list of large object OIDs.
</para>
<table>
<title><structname>pg_largeobject</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>loid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
<entry>Identifier of the large object that includes this page</entry>
</row>
<row>
<entry><structfield>pageno</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>Page number of this page within its large object
(counting from zero)</entry>
</row>
<row>
<entry><structfield>data</structfield></entry>
<entry><type>bytea</type></entry>
<entry></entry>
<entry>
Actual data stored in the large object.
This will never be more than <symbol>LOBLKSIZE</symbol> bytes and might be less.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Each row of <structname>pg_largeobject</structname> holds data
for one page of a large object, beginning at
byte offset (<literal>pageno * LOBLKSIZE</literal>) within the object. The implementation
allows sparse storage: pages might be missing, and might be shorter than
<literal>LOBLKSIZE</literal> bytes even if they are not the last page of the object.
Missing regions within a large object read as zeroes.
</para>
</sect1>
<sect1 id="catalog-pg-largeobject-metadata">
<title><structname>pg_largeobject_metadata</structname></title>
<indexterm zone="catalog-pg-largeobject-metadata">
<primary>pg_largeobject_metadata</primary>
</indexterm>
<para>
The catalog <structname>pg_largeobject_metadata</structname>
holds metadata associated with large objects. The actual large object
data is stored in
<link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link>.
</para>
<table>
<title><structname>pg_largeobject_metadata</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>lomowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the large object</entry>
</row>
<row>
<entry><structfield>lomacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-namespace">
<title><structname>pg_namespace</structname></title>
<indexterm zone="catalog-pg-namespace">
<primary>pg_namespace</primary>
</indexterm>
<para>
The catalog <structname>pg_namespace</structname> stores namespaces.
A namespace is the structure underlying SQL schemas: each namespace
can have a separate collection of relations, types, etc. without name
conflicts.
</para>
<table>
<title><structname>pg_namespace</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>nspname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the namespace</entry>
</row>
<row>
<entry><structfield>nspowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the namespace</entry>
</row>
<row>
<entry><structfield>nspacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-opclass">
<title><structname>pg_opclass</structname></title>
<indexterm zone="catalog-pg-opclass">
<primary>pg_opclass</primary>
</indexterm>
<para>
The catalog <structname>pg_opclass</structname> defines
index access method operator classes. Each operator class defines
semantics for index columns of a particular data type and a particular
index access method. An operator class essentially specifies that a
particular operator family is applicable to a particular indexable column
data type. The set of operators from the family that are actually usable
with the indexed column are whichever ones accept the column's data type
as their left-hand input.
</para>
<para>
Operator classes are described at length in <xref linkend="xindex"/>.
</para>
<table>
<title><structname>pg_opclass</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>opcmethod</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
<entry>Index access method operator class is for</entry>
</row>
<row>
<entry><structfield>opcname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of this operator class</entry>
</row>
<row>
<entry><structfield>opcnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>Namespace of this operator class</entry>
</row>
<row>
<entry><structfield>opcowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the operator class</entry>
</row>
<row>
<entry><structfield>opcfamily</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
<entry>Operator family containing the operator class</entry>
</row>
<row>
<entry><structfield>opcintype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Data type that the operator class indexes</entry>
</row>
<row>
<entry><structfield>opcdefault</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if this operator class is the default for <structfield>opcintype</structfield></entry>
</row>
<row>
<entry><structfield>opckeytype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Type of data stored in index, or zero if same as <structfield>opcintype</structfield></entry>
</row>
</tbody>
</tgroup>
</table>
<para>
An operator class's <structfield>opcmethod</structfield> must match the
<structname>opfmethod</structname> of its containing operator family.
Also, there must be no more than one <structname>pg_opclass</structname>
row having <structname>opcdefault</structname> true for any given combination of
<structname>opcmethod</structname> and <structname>opcintype</structname>.
</para>
</sect1>
<sect1 id="catalog-pg-operator">
<title><structname>pg_operator</structname></title>
<indexterm zone="catalog-pg-operator">
<primary>pg_operator</primary>
</indexterm>
<para>
The catalog <structname>pg_operator</structname> stores information about operators.
See <xref linkend="sql-createoperator"/>
and <xref linkend="xoper"/> for more information.
</para>
<table>
<title><structname>pg_operator</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oprname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the operator</entry>
</row>
<row>
<entry><structfield>oprnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this operator
</entry>
</row>
<row>
<entry><structfield>oprowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the operator</entry>
</row>
<row>
<entry><structfield>oprkind</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<literal>b</literal> = infix (<quote>both</quote>), <literal>l</literal> = prefix
(<quote>left</quote>), <literal>r</literal> = postfix (<quote>right</quote>)
</entry>
</row>
<row>
<entry><structfield>oprcanmerge</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>This operator supports merge joins</entry>
</row>
<row>
<entry><structfield>oprcanhash</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>This operator supports hash joins</entry>
</row>
<row>
<entry><structfield>oprleft</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Type of the left operand</entry>
</row>
<row>
<entry><structfield>oprright</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Type of the right operand</entry>
</row>
<row>
<entry><structfield>oprresult</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Type of the result</entry>
</row>
<row>
<entry><structfield>oprcom</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>Commutator of this operator, if any</entry>
</row>
<row>
<entry><structfield>oprnegate</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>Negator of this operator, if any</entry>
</row>
<row>
<entry><structfield>oprcode</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Function that implements this operator</entry>
</row>
<row>
<entry><structfield>oprrest</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Restriction selectivity estimation function for this operator</entry>
</row>
<row>
<entry><structfield>oprjoin</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Join selectivity estimation function for this operator</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Unused column contain zeroes. For example, <structfield>oprleft</structfield>
is zero for a prefix operator.
</para>
</sect1>
<sect1 id="catalog-pg-opfamily">
<title><structname>pg_opfamily</structname></title>
<indexterm zone="catalog-pg-opfamily">
<primary>pg_opfamily</primary>
</indexterm>
<para>
The catalog <structname>pg_opfamily</structname> defines operator families.
Each operator family is a collection of operators and associated
support routines that implement the semantics specified for a particular
index access method. Furthermore, the operators in a family are all
<quote>compatible</quote>, in a way that is specified by the access method.
The operator family concept allows cross-data-type operators to be used
with indexes and to be reasoned about using knowledge of access method
semantics.
</para>
<para>
Operator families are described at length in <xref linkend="xindex"/>.
</para>
<table>
<title><structname>pg_opfamily</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>opfmethod</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
<entry>Index access method operator family is for</entry>
</row>
<row>
<entry><structfield>opfname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of this operator family</entry>
</row>
<row>
<entry><structfield>opfnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>Namespace of this operator family</entry>
</row>
<row>
<entry><structfield>opfowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the operator family</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The majority of the information defining an operator family is not in its
<structname>pg_opfamily</structname> row, but in the associated rows in
<link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
<link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
and
<link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
</para>
</sect1>
<sect1 id="catalog-pg-partitioned-table">
<title><structname>pg_partitioned_table</structname></title>
<indexterm zone="catalog-pg-partitioned-table">
<primary>pg_partitioned_table</primary>
</indexterm>
<para>
The catalog <structname>pg_partitioned_table</structname> stores
information about how tables are partitioned.
</para>
<table>
<title><structname>pg_partitioned_table</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>partrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the <structname>pg_class</structname> entry for this partitioned table</entry>
</row>
<row>
<entry><structfield>partstrat</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Partitioning strategy; <literal>h</literal> = hash partitioned table,
<literal>l</literal> = list partitioned table, <literal>r</literal> = range partitioned table
</entry>
</row>
<row>
<entry><structfield>partnatts</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>The number of columns in partition key</entry>
</row>
<row>
<entry><structfield>partdefid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>
The OID of the <structname>pg_class</structname> entry for the default partition
of this partitioned table, or zero if this partitioned table does not
have a default partition.
</entry>
</row>
<row>
<entry><structfield>partattrs</structfield></entry>
<entry><type>int2vector</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
<entry>
This is an array of <structfield>partnatts</structfield> values that
indicate which table columns are part of the partition key. For
example, a value of <literal>1 3</literal> would mean that the first
and the third table columns make up the partition key. A zero in this
array indicates that the corresponding partition key column is an
expression, rather than a simple column reference.
</entry>
</row>
<row>
<entry><structfield>partclass</structfield></entry>
<entry><type>oidvector</type></entry>
<entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
<entry>
For each column in the partition key, this contains the OID of the
operator class to use. See
<link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
</entry>
</row>
<row>
<entry><structfield>partcollation</structfield></entry>
<entry><type>oidvector</type></entry>
<entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
<entry>
For each column in the partition key, this contains the OID of the
collation to use for partitioning, or zero if the column is not
of a collatable data type.
</entry>
</row>
<row>
<entry><structfield>partexprs</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>
Expression trees (in <function>nodeToString()</function>
representation) for partition key columns that are not simple column
references. This is a list with one element for each zero
entry in <structfield>partattrs</structfield>. Null if all partition key columns
are simple references.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-policy">
<title><structname>pg_policy</structname></title>
<indexterm zone="catalog-pg-policy">
<primary>pg_policy</primary>
</indexterm>
<para>
The catalog <structname>pg_policy</structname> stores row level
security policies for tables. A policy includes the kind of
command that it applies to (possibly all commands), the roles that it
applies to, the expression to be added as a security-barrier
qualification to queries that include the table, and the expression
to be added as a <literal>WITH CHECK</literal> option for queries that attempt to
add new records to the table.
</para>
<table>
<title><structname>pg_policy</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>polname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>The name of the policy</entry>
</row>
<row>
<entry><structfield>polrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The table to which the policy applies</entry>
</row>
<row>
<entry><structfield>polcmd</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>The command type to which the policy is applied:
<literal>r</literal> for <command>SELECT</command>,
<literal>a</literal> for <command>INSERT</command>,
<literal>w</literal> for <command>UPDATE</command>,
<literal>d</literal> for <command>DELETE</command>,
or <literal>*</literal> for all</entry>
</row>
<row>
<entry><structfield>polpermissive</structfield></entry>
<entry><type>boolean</type></entry>
<entry></entry>
<entry>Is the policy permissive or restrictive?</entry>
</row>
<row>
<entry><structfield>polroles</structfield></entry>
<entry><type>oid[]</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>The roles to which the policy is applied</entry>
</row>
<row>
<entry><structfield>polqual</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
</row>
<row>
<entry><structfield>polwithcheck</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>
Policies stored in <structname>pg_policy</structname> are applied only when
<structname>pg_class</structname>.<structfield>relrowsecurity</structfield> is set for
their table.
</para>
</note>
</sect1>
<sect1 id="catalog-pg-proc">
<title><structname>pg_proc</structname></title>
<indexterm zone="catalog-pg-proc">
<primary>pg_proc</primary>
</indexterm>
<para>
The catalog <structname>pg_proc</structname> stores information about
functions, procedures, aggregate functions, and window functions
(collectively also known as routines). See <xref
linkend="sql-createfunction"/>, <xref linkend="sql-createprocedure"/>, and
<xref linkend="xfunc"/> for more information.
</para>
<para>
If <structfield>prokind</structfield> indicates that the entry is for an
aggregate function, there should be a matching row in
<structfield>pg_aggregate</structfield>.
</para>
<table>
<title><structname>pg_proc</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>proname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the function</entry>
</row>
<row>
<entry><structfield>pronamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this function
</entry>
</row>
<row>
<entry><structfield>proowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the function</entry>
</row>
<row>
<entry><structfield>prolang</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
<entry>Implementation language or call interface of this function</entry>
</row>
<row>
<entry><structfield>procost</structfield></entry>
<entry><type>float4</type></entry>
<entry></entry>
<entry>Estimated execution cost (in units of
<xref linkend="guc-cpu-operator-cost"/>); if <structfield>proretset</structfield>,
this is cost per row returned</entry>
</row>
<row>
<entry><structfield>prorows</structfield></entry>
<entry><type>float4</type></entry>
<entry></entry>
<entry>Estimated number of result rows (zero if not <structfield>proretset</structfield>)</entry>
</row>
<row>
<entry><structfield>provariadic</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Data type of the variadic array parameter's elements,
or zero if the function does not have a variadic parameter</entry>
</row>
<row>
<entry><structfield>prosupport</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Optional planner support function for this function
(see <xref linkend="xfunc-optimization"/>)</entry>
</row>
<row>
<entry><structfield>prokind</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry><literal>f</literal> for a normal function, <literal>p</literal>
for a procedure, <literal>a</literal> for an aggregate function, or
<literal>w</literal> for a window function</entry>
</row>
<row>
<entry><structfield>prosecdef</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Function is a security definer (i.e., a <quote>setuid</quote>
function)</entry>
</row>
<row>
<entry><structfield>proleakproof</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
The function has no side effects. No information about the
arguments is conveyed except via the return value. Any function
that might throw an error depending on the values of its arguments
is not leak-proof.
</entry>
</row>
<row>
<entry><structfield>proisstrict</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
Function returns null if any call argument is null. In that
case the function won't actually be called at all. Functions
that are not <quote>strict</quote> must be prepared to handle
null inputs.
</entry>
</row>
<row>
<entry><structfield>proretset</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Function returns a set (i.e., multiple values of the specified
data type)</entry>
</row>
<row>
<entry><structfield>provolatile</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<structfield>provolatile</structfield> tells whether the function's
result depends only on its input arguments, or is affected by outside
factors.
It is <literal>i</literal> for <quote>immutable</quote> functions,
which always deliver the same result for the same inputs.
It is <literal>s</literal> for <quote>stable</quote> functions,
whose results (for fixed inputs) do not change within a scan.
It is <literal>v</literal> for <quote>volatile</quote> functions,
whose results might change at any time. (Use <literal>v</literal> also
for functions with side-effects, so that calls to them cannot get
optimized away.)
</entry>
</row>
<row>
<entry><structfield>proparallel</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<structfield>proparallel</structfield> tells whether the function
can be safely run in parallel mode.
It is <literal>s</literal> for functions which are safe to run in
parallel mode without restriction.
It is <literal>r</literal> for functions which can be run in parallel
mode, but their execution is restricted to the parallel group leader;
parallel worker processes cannot invoke these functions.
It is <literal>u</literal> for functions which are unsafe in parallel
mode; the presence of such a function forces a serial execution plan.
</entry>
</row>
<row>
<entry><structfield>pronargs</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>Number of input arguments</entry>
</row>
<row>
<entry><structfield>pronargdefaults</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>Number of arguments that have defaults</entry>
</row>
<row>
<entry><structfield>prorettype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Data type of the return value</entry>
</row>
<row>
<entry><structfield>proargtypes</structfield></entry>
<entry><type>oidvector</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>
An array with the data types of the function arguments. This includes
only input arguments (including <literal>INOUT</literal> and
<literal>VARIADIC</literal> arguments), and thus represents
the call signature of the function.
</entry>
</row>
<row>
<entry><structfield>proallargtypes</structfield></entry>
<entry><type>oid[]</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>
An array with the data types of the function arguments. This includes
all arguments (including <literal>OUT</literal> and
<literal>INOUT</literal> arguments); however, if all the
arguments are <literal>IN</literal> arguments, this field will be null.
Note that subscripting is 1-based, whereas for historical reasons
<structfield>proargtypes</structfield> is subscripted from 0.
</entry>
</row>
<row>
<entry><structfield>proargmodes</structfield></entry>
<entry><type>char[]</type></entry>
<entry></entry>
<entry>
An array with the modes of the function arguments, encoded as
<literal>i</literal> for <literal>IN</literal> arguments,
<literal>o</literal> for <literal>OUT</literal> arguments,
<literal>b</literal> for <literal>INOUT</literal> arguments,
<literal>v</literal> for <literal>VARIADIC</literal> arguments,
<literal>t</literal> for <literal>TABLE</literal> arguments.
If all the arguments are <literal>IN</literal> arguments,
this field will be null.
Note that subscripts correspond to positions of
<structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
</entry>
</row>
<row>
<entry><structfield>proargnames</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
An array with the names of the function arguments.
Arguments without a name are set to empty strings in the array.
If none of the arguments have a name, this field will be null.
Note that subscripts correspond to positions of
<structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
</entry>
</row>
<row>
<entry><structfield>proargdefaults</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>
Expression trees (in <function>nodeToString()</function> representation)
for default values. This is a list with
<structfield>pronargdefaults</structfield> elements, corresponding to the last
<replaceable>N</replaceable> <emphasis>input</emphasis> arguments (i.e., the last
<replaceable>N</replaceable> <structfield>proargtypes</structfield> positions).
If none of the arguments have defaults, this field will be null.
</entry>
</row>
<row>
<entry><structfield>protrftypes</structfield></entry>
<entry><type>oid[]</type></entry>
<entry></entry>
<entry>
Data type OIDs for which to apply transforms.
</entry>
</row>
<row>
<entry><structfield>prosrc</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
This tells the function handler how to invoke the function. It
might be the actual source code of the function for interpreted
languages, a link symbol, a file name, or just about anything
else, depending on the implementation language/call convention.
</entry>
</row>
<row>
<entry><structfield>probin</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
Additional information about how to invoke the function.
Again, the interpretation is language-specific.
</entry>
</row>
<row>
<entry><structfield>proconfig</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>Function's local settings for run-time configuration variables</entry>
</row>
<row>
<entry><structfield>proacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
For compiled functions, both built-in and dynamically loaded,
<structfield>prosrc</structfield> contains the function's C-language
name (link symbol). For all other currently-known language types,
<structfield>prosrc</structfield> contains the function's source
text. <structfield>probin</structfield> is unused except for
dynamically-loaded C functions, for which it gives the name of the
shared library file containing the function.
</para>
</sect1>
<sect1 id="catalog-pg-publication">
<title><structname>pg_publication</structname></title>
<indexterm zone="catalog-pg-publication">
<primary>pg_publication</primary>
</indexterm>
<para>
The catalog <structname>pg_publication</structname> contains all
publications created in the database. For more on publications see
<xref linkend="logical-replication-publication"/>.
</para>
<table>
<title><structname>pg_publication</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>pubname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the publication</entry>
</row>
<row>
<entry><structfield>pubowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the publication</entry>
</row>
<row>
<entry><structfield>puballtables</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, this publication automatically includes all tables
in the database, including any that will be created in the future.
</entry>
</row>
<row>
<entry><structfield>pubinsert</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, <command>INSERT</command> operations are replicated for
tables in the publication.</entry>
</row>
<row>
<entry><structfield>pubupdate</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, <command>UPDATE</command> operations are replicated for
tables in the publication.</entry>
</row>
<row>
<entry><structfield>pubdelete</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, <command>DELETE</command> operations are replicated for
tables in the publication.</entry>
</row>
<row>
<entry><structfield>pubtruncate</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, <command>TRUNCATE</command> operations are replicated for
tables in the publication.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-publication-rel">
<title><structname>pg_publication_rel</structname></title>
<indexterm zone="catalog-pg-publication-rel">
<primary>pg_publication_rel</primary>
</indexterm>
<para>
The catalog <structname>pg_publication_rel</structname> contains the
mapping between relations and publications in the database. This is a
many-to-many mapping. See also <xref linkend="view-pg-publication-tables"/>
for a more user-friendly view of this information.
</para>
<table>
<title><structname>pg_publication_rel</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>prpubid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
<entry>Reference to publication</entry>
</row>
<row>
<entry><structfield>prrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>Reference to relation</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-range">
<title><structname>pg_range</structname></title>
<indexterm zone="catalog-pg-range">
<primary>pg_range</primary>
</indexterm>
<para>
The catalog <structname>pg_range</structname> stores information about
range types. This is in addition to the types' entries in
<link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
</para>
<table>
<title><structname>pg_range</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>rngtypid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>OID of the range type</entry>
</row>
<row>
<entry><structfield>rngsubtype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>OID of the element type (subtype) of this range type</entry>
</row>
<row>
<entry><structfield>rngcollation</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
<entry>OID of the collation used for range comparisons, or 0 if none</entry>
</row>
<row>
<entry><structfield>rngsubopc</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
<entry>OID of the subtype's operator class used for range comparisons</entry>
</row>
<row>
<entry><structfield>rngcanonical</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the function to convert a range value into canonical form,
or 0 if none</entry>
</row>
<row>
<entry><structfield>rngsubdiff</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the function to return the difference between two element
values as <type>double precision</type>, or 0 if none</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
<structfield>rngsubopc</structfield> (plus <structfield>rngcollation</structfield>, if the
element type is collatable) determines the sort ordering used by the range
type. <structfield>rngcanonical</structfield> is used when the element type is
discrete. <structfield>rngsubdiff</structfield> is optional but should be supplied to
improve performance of GiST indexes on the range type.
</para>
</sect1>
<sect1 id="catalog-pg-replication-origin">
<title><structname>pg_replication_origin</structname></title>
<indexterm zone="catalog-pg-replication-origin">
<primary>pg_replication_origin</primary>
</indexterm>
<para>
The <structname>pg_replication_origin</structname> catalog contains
all replication origins created. For more on replication origins
see <xref linkend="replication-origins"/>.
</para>
<para>
Unlike most system catalogs, <structname>pg_replication_origin</structname>
is shared across all databases of a cluster: there is only one copy
of <structname>pg_replication_origin</structname> per cluster, not one per
database.
</para>
<table>
<title><structname>pg_replication_origin</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>roident</structfield></entry>
<entry><type>Oid</type></entry>
<entry></entry>
<entry>A unique, cluster-wide identifier for the replication
origin. Should never leave the system.</entry>
</row>
<row>
<entry><structfield>roname</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The external, user defined, name of a replication
origin.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-rewrite">
<title><structname>pg_rewrite</structname></title>
<indexterm zone="catalog-pg-rewrite">
<primary>pg_rewrite</primary>
</indexterm>
<para>
The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
</para>
<table>
<title><structname>pg_rewrite</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>rulename</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Rule name</entry>
</row>
<row>
<entry><structfield>ev_class</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The table this rule is for</entry>
</row>
<row>
<entry><structfield>ev_type</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Event type that the rule is for: 1 = <command>SELECT</command>, 2 =
<command>UPDATE</command>, 3 = <command>INSERT</command>, 4 =
<command>DELETE</command>
</entry>
</row>
<row>
<entry><structfield>ev_enabled</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Controls in which <xref linkend="guc-session-replication-role"/> modes
the rule fires.
<literal>O</literal> = rule fires in <quote>origin</quote> and <quote>local</quote> modes,
<literal>D</literal> = rule is disabled,
<literal>R</literal> = rule fires in <quote>replica</quote> mode,
<literal>A</literal> = rule fires always.
</entry>
</row>
<row>
<entry><structfield>is_instead</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
</row>
<row>
<entry><structfield>ev_qual</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>
Expression tree (in the form of a
<function>nodeToString()</function> representation) for the
rule's qualifying condition
</entry>
</row>
<row>
<entry><structfield>ev_action</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>
Query tree (in the form of a
<function>nodeToString()</function> representation) for the
rule's action
</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>
<literal>pg_class.relhasrules</literal>
must be true if a table has any rules in this catalog.
</para>
</note>
</sect1>
<sect1 id="catalog-pg-seclabel">
<title><structname>pg_seclabel</structname></title>
<indexterm zone="catalog-pg-seclabel">
<primary>pg_seclabel</primary>
</indexterm>
<para>
The catalog <structname>pg_seclabel</structname> stores security
labels on database objects. Security labels can be manipulated
with the <xref linkend="sql-security-label"/> command. For an easier
way to view security labels, see <xref linkend="view-pg-seclabels"/>.
</para>
<para>
See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
which performs a similar function for security labels of database objects
that are shared across a database cluster.
</para>
<table>
<title><structname>pg_seclabel</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>objoid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the object this security label pertains to</entry>
</row>
<row>
<entry><structfield>classoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog this object appears in</entry>
</row>
<row>
<entry><structfield>objsubid</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
For a security label on a table column, this is the column number (the
<structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
the table itself). For all other object types, this column is
zero.
</entry>
</row>
<row>
<entry><structfield>provider</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The label provider associated with this label.</entry>
</row>
<row>
<entry><structfield>label</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The security label applied to this object.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-sequence">
<title><structname>pg_sequence</structname></title>
<indexterm zone="catalog-pg-sequence">
<primary>pg_sequence</primary>
</indexterm>
<para>
The catalog <structname>pg_sequence</structname> contains information about
sequences. Some of the information about sequences, such as the name and
the schema, is in <structname>pg_class</structname>.
</para>
<table>
<title><structname>pg_sequence</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>seqrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the <structname>pg_class</structname> entry for this sequence</entry>
</row>
<row>
<entry><structfield>seqtypid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Data type of the sequence</entry>
</row>
<row>
<entry><structfield>seqstart</structfield></entry>
<entry><type>int8</type></entry>
<entry></entry>
<entry>Start value of the sequence</entry>
</row>
<row>
<entry><structfield>seqincrement</structfield></entry>
<entry><type>int8</type></entry>
<entry></entry>
<entry>Increment value of the sequence</entry>
</row>
<row>
<entry><structfield>seqmax</structfield></entry>
<entry><type>int8</type></entry>
<entry></entry>
<entry>Maximum value of the sequence</entry>
</row>
<row>
<entry><structfield>seqmin</structfield></entry>
<entry><type>int8</type></entry>
<entry></entry>
<entry>Minimum value of the sequence</entry>
</row>
<row>
<entry><structfield>seqcache</structfield></entry>
<entry><type>int8</type></entry>
<entry></entry>
<entry>Cache size of the sequence</entry>
</row>
<row>
<entry><structfield>seqcycle</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Whether the sequence cycles</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-shdepend">
<title><structname>pg_shdepend</structname></title>
<indexterm zone="catalog-pg-shdepend">
<primary>pg_shdepend</primary>
</indexterm>
<para>
The catalog <structname>pg_shdepend</structname> records the
dependency relationships between database objects and shared objects,
such as roles. This information allows
<productname>PostgreSQL</productname> to ensure that those objects are
unreferenced before attempting to delete them.
</para>
<para>
See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
which performs a similar function for dependencies involving objects
within a single database.
</para>
<para>
Unlike most system catalogs, <structname>pg_shdepend</structname>
is shared across all databases of a cluster: there is only one
copy of <structname>pg_shdepend</structname> per cluster, not
one per database.
</para>
<table>
<title><structname>pg_shdepend</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>dbid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
<entry>The OID of the database the dependent object is in,
or zero for a shared object</entry>
</row>
<row>
<entry><structfield>classid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog the dependent object is in</entry>
</row>
<row>
<entry><structfield>objid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the specific dependent object</entry>
</row>
<row>
<entry><structfield>objsubid</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
For a table column, this is the column number (the
<structfield>objid</structfield> and <structfield>classid</structfield> refer to the
table itself). For all other object types, this column is zero.
</entry>
</row>
<row>
<entry><structfield>refclassid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog the referenced object is in
(must be a shared catalog)</entry>
</row>
<row>
<entry><structfield>refobjid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the specific referenced object</entry>
</row>
<row>
<entry><structfield>deptype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
A code defining the specific semantics of this dependency relationship; see text
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
In all cases, a <structname>pg_shdepend</structname> entry indicates that
the referenced object cannot be dropped without also dropping the dependent
object. However, there are several subflavors identified by
<structfield>deptype</structfield>:
<variablelist>
<varlistentry>
<term><symbol>SHARED_DEPENDENCY_OWNER</symbol> (<literal>o</literal>)</term>
<listitem>
<para>
The referenced object (which must be a role) is the owner of the
dependent object.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>SHARED_DEPENDENCY_ACL</symbol> (<literal>a</literal>)</term>
<listitem>
<para>
The referenced object (which must be a role) is mentioned in the
ACL (access control list, i.e., privileges list) of the
dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</symbol> entry is
not made for the owner of the object, since the owner will have
a <symbol>SHARED_DEPENDENCY_OWNER</symbol> entry anyway.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>SHARED_DEPENDENCY_POLICY</symbol> (<literal>r</literal>)</term>
<listitem>
<para>
The referenced object (which must be a role) is mentioned as the
target of a dependent policy object.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>SHARED_DEPENDENCY_PIN</symbol> (<literal>p</literal>)</term>
<listitem>
<para>
There is no dependent object; this type of entry is a signal
that the system itself depends on the referenced object, and so
that object must never be deleted. Entries of this type are
created only by <command>initdb</command>. The columns for the
dependent object contain zeroes.
</para>
</listitem>
</varlistentry>
</variablelist>
Other dependency flavors might be needed in future. Note in particular
that the current definition only supports roles as referenced objects.
</para>
</sect1>
<sect1 id="catalog-pg-shdescription">
<title><structname>pg_shdescription</structname></title>
<indexterm zone="catalog-pg-shdescription">
<primary>pg_shdescription</primary>
</indexterm>
<para>
The catalog <structname>pg_shdescription</structname> stores optional
descriptions (comments) for shared database objects. Descriptions can be
manipulated with the <xref linkend="sql-comment"/> command and viewed with
<application>psql</application>'s <literal>\d</literal> commands.
</para>
<para>
See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
which performs a similar function for descriptions involving objects
within a single database.
</para>
<para>
Unlike most system catalogs, <structname>pg_shdescription</structname>
is shared across all databases of a cluster: there is only one
copy of <structname>pg_shdescription</structname> per cluster, not
one per database.
</para>
<table>
<title><structname>pg_shdescription</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>objoid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the object this description pertains to</entry>
</row>
<row>
<entry><structfield>classoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog this object appears in</entry>
</row>
<row>
<entry><structfield>description</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Arbitrary text that serves as the description of this object</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-shseclabel">
<title><structname>pg_shseclabel</structname></title>
<indexterm zone="catalog-pg-shseclabel">
<primary>pg_shseclabel</primary>
</indexterm>
<para>
The catalog <structname>pg_shseclabel</structname> stores security
labels on shared database objects. Security labels can be manipulated
with the <xref linkend="sql-security-label"/> command. For an easier
way to view security labels, see <xref linkend="view-pg-seclabels"/>.
</para>
<para>
See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
which performs a similar function for security labels involving objects
within a single database.
</para>
<para>
Unlike most system catalogs, <structname>pg_shseclabel</structname>
is shared across all databases of a cluster: there is only one
copy of <structname>pg_shseclabel</structname> per cluster, not
one per database.
</para>
<table>
<title><structname>pg_shseclabel</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>objoid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the object this security label pertains to</entry>
</row>
<row>
<entry><structfield>classoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog this object appears in</entry>
</row>
<row>
<entry><structfield>provider</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The label provider associated with this label.</entry>
</row>
<row>
<entry><structfield>label</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The security label applied to this object.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-statistic">
<title><structname>pg_statistic</structname></title>
<indexterm zone="catalog-pg-statistic">
<primary>pg_statistic</primary>
</indexterm>
<para>
The catalog <structname>pg_statistic</structname> stores
statistical data about the contents of the database. Entries are
created by <xref linkend="sql-analyze"/>
and subsequently used by the query planner. Note that all the
statistical data is inherently approximate, even assuming that it
is up-to-date.
</para>
<para>
Normally there is one entry, with <structfield>stainherit</structfield> =
<literal>false</literal>, for each table column that has been analyzed.
If the table has inheritance children, a second entry with
<structfield>stainherit</structfield> = <literal>true</literal> is also created. This row
represents the column's statistics over the inheritance tree, i.e.,
statistics for the data you'd see with
<literal>SELECT <replaceable>column</replaceable> FROM <replaceable>table</replaceable>*</literal>,
whereas the <structfield>stainherit</structfield> = <literal>false</literal> row represents
the results of
<literal>SELECT <replaceable>column</replaceable> FROM ONLY <replaceable>table</replaceable></literal>.
</para>
<para>
<structname>pg_statistic</structname> also stores statistical data about
the values of index expressions. These are described as if they were
actual data columns; in particular, <structfield>starelid</structfield>
references the index. No entry is made for an ordinary non-expression
index column, however, since it would be redundant with the entry
for the underlying table column. Currently, entries for index expressions
always have <structfield>stainherit</structfield> = <literal>false</literal>.
</para>
<para>
Since different kinds of statistics might be appropriate for different
kinds of data, <structname>pg_statistic</structname> is designed not
to assume very much about what sort of statistics it stores. Only
extremely general statistics (such as nullness) are given dedicated
columns in <structname>pg_statistic</structname>. Everything else
is stored in <quote>slots</quote>, which are groups of associated columns
whose content is identified by a code number in one of the slot's columns.
For more information see
<filename>src/include/catalog/pg_statistic.h</filename>.
</para>
<para>
<structname>pg_statistic</structname> should not be readable by the
public, since even statistical information about a table's contents
might be considered sensitive. (Example: minimum and maximum values
of a salary column might be quite interesting.)
<link linkend="view-pg-stats"><structname>pg_stats</structname></link>
is a publicly readable view on
<structname>pg_statistic</structname> that only exposes information
about those tables that are readable by the current user.
</para>
<table>
<title><structname>pg_statistic</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>starelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The table or index that the described column belongs to</entry>
</row>
<row>
<entry><structfield>staattnum</structfield></entry>
<entry><type>int2</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
<entry>The number of the described column</entry>
</row>
<row>
<entry><structfield>stainherit</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, the stats include inheritance child columns, not just the
values in the specified relation</entry>
</row>
<row>
<entry><structfield>stanullfrac</structfield></entry>
<entry><type>float4</type></entry>
<entry></entry>
<entry>The fraction of the column's entries that are null</entry>
</row>
<row>
<entry><structfield>stawidth</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>The average stored width, in bytes, of nonnull entries</entry>
</row>
<row>
<entry><structfield>stadistinct</structfield></entry>
<entry><type>float4</type></entry>
<entry></entry>
<entry>The number of distinct nonnull data values in the column.
A value greater than zero is the actual number of distinct values.
A value less than zero is the negative of a multiplier for the number
of rows in the table; for example, a column in which about 80% of the
values are nonnull and each nonnull value appears about twice on
average could be represented by <structfield>stadistinct</structfield> = -0.4.
A zero value means the number of distinct values is unknown.
</entry>
</row>
<row>
<entry><structfield>stakind<replaceable>N</replaceable></structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>
A code number indicating the kind of statistics stored in the
<replaceable>N</replaceable>th <quote>slot</quote> of the
<structname>pg_statistic</structname> row.
</entry>
</row>
<row>
<entry><structfield>staop<replaceable>N</replaceable></structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
<entry>
An operator used to derive the statistics stored in the
<replaceable>N</replaceable>th <quote>slot</quote>. For example, a
histogram slot would show the <literal>&lt;</literal> operator
that defines the sort order of the data.
</entry>
</row>
<row>
<entry><structfield>stacoll<replaceable>N</replaceable></structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
<entry>
The collation used to derive the statistics stored in the
<replaceable>N</replaceable>th <quote>slot</quote>. For example, a
histogram slot for a collatable column would show the collation that
defines the sort order of the data. Zero for noncollatable data.
</entry>
</row>
<row>
<entry><structfield>stanumbers<replaceable>N</replaceable></structfield></entry>
<entry><type>float4[]</type></entry>
<entry></entry>
<entry>
Numerical statistics of the appropriate kind for the
<replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
kind does not involve numerical values
</entry>
</row>
<row>
<entry><structfield>stavalues<replaceable>N</replaceable></structfield></entry>
<entry><type>anyarray</type></entry>
<entry></entry>
<entry>
Column data values of the appropriate kind for the
<replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
kind does not store any data values. Each array's element
values are actually of the specific column's data type, or a related
type such as an array's element type, so there is no way to define
these columns' type more specifically than <type>anyarray</type>.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-statistic-ext">
<title><structname>pg_statistic_ext</structname></title>
<indexterm zone="catalog-pg-statistic-ext">
<primary>pg_statistic_ext</primary>
</indexterm>
<para>
The catalog <structname>pg_statistic_ext</structname>
holds definitions of extended planner statistics.
Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
created with <xref linkend="sql-createstatistics"/>.
</para>
<table>
<title><structname>pg_statistic_ext</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>stxrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>Table containing the columns described by this object</entry>
</row>
<row>
<entry><structfield>stxname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the statistics object</entry>
</row>
<row>
<entry><structfield>stxnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this statistics object
</entry>
</row>
<row>
<entry><structfield>stxowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the statistics object</entry>
</row>
<row>
<entry><structfield>stxkeys</structfield></entry>
<entry><type>int2vector</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
<entry>
An array of attribute numbers, indicating which table columns are
covered by this statistics object;
for example a value of <literal>1 3</literal> would
mean that the first and the third table columns are covered
</entry>
</row>
<row>
<entry><structfield>stxkind</structfield></entry>
<entry><type>char[]</type></entry>
<entry></entry>
<entry>
An array containing codes for the enabled statistic kinds;
valid values are:
<literal>d</literal> for n-distinct statistics,
<literal>f</literal> for functional dependency statistics, and
<literal>m</literal> for most common values (MCV) list statistics
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <structname>pg_statistic_ext</structname> entry is filled in
completely during <command>CREATE STATISTICS</command>, but the actual
statistical values are not computed then.
Subsequent <command>ANALYZE</command> commands compute the desired values
and populate an entry in the
<link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
catalog.
</para>
</sect1>
<sect1 id="catalog-pg-statistic-ext-data">
<title><structname>pg_statistic_ext_data</structname></title>
<indexterm zone="catalog-pg-statistic-ext">
<primary>pg_statistic_ext_data</primary>
</indexterm>
<para>
The catalog <structname>pg_statistic_ext_data</structname>
holds data for extended planner statistics defined in <structname>pg_statistic_ext</structname>.
Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
created with <xref linkend="sql-createstatistics"/>.
</para>
<para>
Like <structname>pg_statistic</structname>,
<structname>pg_statistic_ext_data</structname> should not be
readable by the public, since the contents might be considered sensitive.
(Example: most common combinations of values in columns might be quite
interesting.)
<link linkend="view-pg-stats-ext"><structname>pg_stats_ext</structname></link>
is a publicly readable view
on <structname>pg_statistic_ext_data</structname> (after joining
with <structname>pg_statistic_ext</structname>) that only exposes
information about those tables and columns that are readable by the
current user.
</para>
<table>
<title><structname>pg_statistic_ext_data</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>stxoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.oid</literal></entry>
<entry>Extended statistic object containing the definition for this data</entry>
</row>
<row>
<entry><structfield>stxdndistinct</structfield></entry>
<entry><type>pg_ndistinct</type></entry>
<entry></entry>
<entry>
N-distinct counts, serialized as <structname>pg_ndistinct</structname> type
</entry>
</row>
<row>
<entry><structfield>stxddependencies</structfield></entry>
<entry><type>pg_dependencies</type></entry>
<entry></entry>
<entry>
Functional dependency statistics, serialized
as <structname>pg_dependencies</structname> type
</entry>
</row>
<row>
<entry><structfield>stxdmcv</structfield></entry>
<entry><type>pg_mcv_list</type></entry>
<entry></entry>
<entry>
MCV (most-common values) list statistics, serialized as
<structname>pg_mcv_list</structname> type
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-subscription">
<title><structname>pg_subscription</structname></title>
<indexterm zone="catalog-pg-subscription">
<primary>pg_subscription</primary>
</indexterm>
<para>
The catalog <structname>pg_subscription</structname> contains all existing
logical replication subscriptions. For more information about logical
replication see <xref linkend="logical-replication"/>.
</para>
<para>
Unlike most system catalogs, <structname>pg_subscription</structname> is
shared across all databases of a cluster: there is only one copy
of <structname>pg_subscription</structname> per cluster, not one per
database.
</para>
<para>
Access to the column <structfield>subconninfo</structfield> is revoked from
normal users, because it could contain plain-text passwords.
</para>
<table>
<title><structname>pg_subscription</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>subdbid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
<entry>OID of the database which the subscription resides in</entry>
</row>
<row>
<entry><structfield>subname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the subscription</entry>
</row>
<row>
<entry><structfield>subowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the subscription</entry>
</row>
<row>
<entry><structfield>subenabled</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, the subscription is enabled and should be replicating.</entry>
</row>
<row>
<entry><structfield>subsynccommit</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
Contains the value of the <varname>synchronous_commit</varname>
setting for the subscription workers.
</entry>
</row>
<row>
<entry><structfield>subconninfo</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Connection string to the upstream database</entry>
</row>
<row>
<entry><structfield>subslotname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the replication slot in the upstream database. Also used
for local replication origin name.</entry>
</row>
<row>
<entry><structfield>subpublications</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>Array of subscribed publication names. These reference the
publications on the publisher server. For more on publications
see <xref linkend="logical-replication-publication"/>.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-subscription-rel">
<title><structname>pg_subscription_rel</structname></title>
<indexterm zone="catalog-pg-subscription-rel">
<primary>pg_subscription_rel</primary>
</indexterm>
<para>
The catalog <structname>pg_subscription_rel</structname> contains the
state for each replicated relation in each subscription. This is a
many-to-many mapping.
</para>
<para>
This catalog only contains tables known to the subscription after running
either <command>CREATE SUBSCRIPTION</command> or
<command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command>.
</para>
<table>
<title><structname>pg_subscription_rel</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>srsubid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.oid</literal></entry>
<entry>Reference to subscription</entry>
</row>
<row>
<entry><structfield>srrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>Reference to relation</entry>
</row>
<row>
<entry><structfield>srsubstate</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
State code:
<literal>i</literal> = initialize,
<literal>d</literal> = data is being copied,
<literal>s</literal> = synchronized,
<literal>r</literal> = ready (normal replication)
</entry>
</row>
<row>
<entry><structfield>srsublsn</structfield></entry>
<entry><type>pg_lsn</type></entry>
<entry></entry>
<entry>
End LSN for <literal>s</literal> and <literal>r</literal> states.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-tablespace">
<title><structname>pg_tablespace</structname></title>
<indexterm zone="catalog-pg-tablespace">
<primary>pg_tablespace</primary>
</indexterm>
<para>
The catalog <structname>pg_tablespace</structname> stores information
about the available tablespaces. Tables can be placed in particular
tablespaces to aid administration of disk layout.
</para>
<para>
Unlike most system catalogs, <structname>pg_tablespace</structname>
is shared across all databases of a cluster: there is only one
copy of <structname>pg_tablespace</structname> per cluster, not
one per database.
</para>
<table>
<title><structname>pg_tablespace</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>spcname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Tablespace name</entry>
</row>
<row>
<entry><structfield>spcowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the tablespace, usually the user who created it</entry>
</row>
<row>
<entry><structfield>spcacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
<row>
<entry><structfield>spcoptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
Tablespace-level options, as <quote>keyword=value</quote> strings
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-transform">
<title><structname>pg_transform</structname></title>
<indexterm zone="catalog-pg-transform">
<primary>pg_transform</primary>
</indexterm>
<para>
The catalog <structname>pg_transform</structname> stores information about
transforms, which are a mechanism to adapt data types to procedural
languages. See <xref linkend="sql-createtransform"/> for more information.
</para>
<table>
<title><structname>pg_transform</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>trftype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>OID of the data type this transform is for</entry>
</row>
<row>
<entry><structfield>trflang</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
<entry>OID of the language this transform is for</entry>
</row>
<row>
<entry><structfield>trffromsql</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
The OID of the function to use when converting the data type for input
to the procedural language (e.g., function parameters). Zero is stored
if this operation is not supported.
</entry>
</row>
<row>
<entry><structfield>trftosql</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>
The OID of the function to use when converting output from the
procedural language (e.g., return values) to the data type. Zero is
stored if this operation is not supported.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-trigger">
<title><structname>pg_trigger</structname></title>
<indexterm zone="catalog-pg-trigger">
<primary>pg_trigger</primary>
</indexterm>
<para>
The catalog <structname>pg_trigger</structname> stores triggers on tables
and views.
See <xref linkend="sql-createtrigger"/>
for more information.
</para>
<table>
<title><structname>pg_trigger</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>tgrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The table this trigger is on</entry>
</row>
<row>
<entry><structfield>tgname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Trigger name (must be unique among triggers of same table)</entry>
</row>
<row>
<entry><structfield>tgfoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>The function to be called</entry>
</row>
<row>
<entry><structfield>tgtype</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>Bit mask identifying trigger firing conditions</entry>
</row>
<row>
<entry><structfield>tgenabled</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Controls in which <xref linkend="guc-session-replication-role"/> modes
the trigger fires.
<literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
<literal>D</literal> = trigger is disabled,
<literal>R</literal> = trigger fires in <quote>replica</quote> mode,
<literal>A</literal> = trigger fires always.
</entry>
</row>
<row>
<entry><structfield>tgisinternal</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if trigger is internally generated (usually, to enforce
the constraint identified by <structfield>tgconstraint</structfield>)</entry>
</row>
<row>
<entry><structfield>tgconstrrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The table referenced by a referential integrity constraint</entry>
</row>
<row>
<entry><structfield>tgconstrindid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The index supporting a unique, primary key, referential integrity,
or exclusion constraint</entry>
</row>
<row>
<entry><structfield>tgconstraint</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
<entry>The <structname>pg_constraint</structname> entry associated with the trigger, if any</entry>
</row>
<row>
<entry><structfield>tgdeferrable</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if constraint trigger is deferrable</entry>
</row>
<row>
<entry><structfield>tginitdeferred</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>True if constraint trigger is initially deferred</entry>
</row>
<row>
<entry><structfield>tgnargs</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>Number of argument strings passed to trigger function</entry>
</row>
<row>
<entry><structfield>tgattr</structfield></entry>
<entry><type>int2vector</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
<entry>Column numbers, if trigger is column-specific; otherwise an
empty array</entry>
</row>
<row>
<entry><structfield>tgargs</structfield></entry>
<entry><type>bytea</type></entry>
<entry></entry>
<entry>Argument strings to pass to trigger, each NULL-terminated</entry>
</row>
<row>
<entry><structfield>tgqual</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry>Expression tree (in <function>nodeToString()</function>
representation) for the trigger's <literal>WHEN</literal> condition, or null
if none</entry>
</row>
<row>
<entry><structfield>tgoldtable</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry><literal>REFERENCING</literal> clause name for <literal>OLD TABLE</literal>,
or null if none</entry>
</row>
<row>
<entry><structfield>tgnewtable</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry><literal>REFERENCING</literal> clause name for <literal>NEW TABLE</literal>,
or null if none</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Currently, column-specific triggering is supported only for
<literal>UPDATE</literal> events, and so <structfield>tgattr</structfield> is relevant
only for that event type. <structfield>tgtype</structfield> might
contain bits for other event types as well, but those are presumed
to be table-wide regardless of what is in <structfield>tgattr</structfield>.
</para>
<note>
<para>
When <structfield>tgconstraint</structfield> is nonzero,
<structfield>tgconstrrelid</structfield>, <structfield>tgconstrindid</structfield>,
<structfield>tgdeferrable</structfield>, and <structfield>tginitdeferred</structfield> are
largely redundant with the referenced <structname>pg_constraint</structname> entry.
However, it is possible for a non-deferrable trigger to be associated
with a deferrable constraint: foreign key constraints can have some
deferrable and some non-deferrable triggers.
</para>
</note>
<note>
<para>
<literal>pg_class.relhastriggers</literal>
must be true if a relation has any triggers in this catalog.
</para>
</note>
</sect1>
<sect1 id="catalog-pg-ts-config">
<title><structname>pg_ts_config</structname></title>
<indexterm zone="catalog-pg-ts-config">
<primary>pg_ts_config</primary>
</indexterm>
<para>
The <structname>pg_ts_config</structname> catalog contains entries
representing text search configurations. A configuration specifies
a particular text search parser and a list of dictionaries to use
for each of the parser's output token types. The parser is shown
in the <structname>pg_ts_config</structname> entry, but the
token-to-dictionary mapping is defined by subsidiary entries in <link
linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
</para>
<para>
<productname>PostgreSQL</productname>'s text search features are
described at length in <xref linkend="textsearch"/>.
</para>
<table>
<title><structname>pg_ts_config</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>cfgname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Text search configuration name</entry>
</row>
<row>
<entry><structfield>cfgnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this configuration
</entry>
</row>
<row>
<entry><structfield>cfgowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the configuration</entry>
</row>
<row>
<entry><structfield>cfgparser</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
<entry>The OID of the text search parser for this configuration</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-ts-config-map">
<title><structname>pg_ts_config_map</structname></title>
<indexterm zone="catalog-pg-ts-config-map">
<primary>pg_ts_config_map</primary>
</indexterm>
<para>
The <structname>pg_ts_config_map</structname> catalog contains entries
showing which text search dictionaries should be consulted, and in
what order, for each output token type of each text search configuration's
parser.
</para>
<para>
<productname>PostgreSQL</productname>'s text search features are
described at length in <xref linkend="textsearch"/>.
</para>
<table>
<title><structname>pg_ts_config_map</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>mapcfg</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
<entry>The OID of the <structname>pg_ts_config</structname> entry owning this map entry</entry>
</row>
<row>
<entry><structfield>maptokentype</structfield></entry>
<entry><type>integer</type></entry>
<entry></entry>
<entry>A token type emitted by the configuration's parser</entry>
</row>
<row>
<entry><structfield>mapseqno</structfield></entry>
<entry><type>integer</type></entry>
<entry></entry>
<entry>Order in which to consult this entry (lower
<structfield>mapseqno</structfield>s first)</entry>
</row>
<row>
<entry><structfield>mapdict</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
<entry>The OID of the text search dictionary to consult</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-ts-dict">
<title><structname>pg_ts_dict</structname></title>
<indexterm zone="catalog-pg-ts-dict">
<primary>pg_ts_dict</primary>
</indexterm>
<para>
The <structname>pg_ts_dict</structname> catalog contains entries
defining text search dictionaries. A dictionary depends on a text
search template, which specifies all the implementation functions
needed; the dictionary itself provides values for the user-settable
parameters supported by the template. This division of labor allows
dictionaries to be created by unprivileged users. The parameters
are specified by a text string <structfield>dictinitoption</structfield>,
whose format and meaning vary depending on the template.
</para>
<para>
<productname>PostgreSQL</productname>'s text search features are
described at length in <xref linkend="textsearch"/>.
</para>
<table>
<title><structname>pg_ts_dict</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>dictname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Text search dictionary name</entry>
</row>
<row>
<entry><structfield>dictnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this dictionary
</entry>
</row>
<row>
<entry><structfield>dictowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the dictionary</entry>
</row>
<row>
<entry><structfield>dicttemplate</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
<entry>The OID of the text search template for this dictionary</entry>
</row>
<row>
<entry><structfield>dictinitoption</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Initialization option string for the template</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-ts-parser">
<title><structname>pg_ts_parser</structname></title>
<indexterm zone="catalog-pg-ts-parser">
<primary>pg_ts_parser</primary>
</indexterm>
<para>
The <structname>pg_ts_parser</structname> catalog contains entries
defining text search parsers. A parser is responsible for splitting
input text into lexemes and assigning a token type to each lexeme.
Since a parser must be implemented by C-language-level functions,
creation of new parsers is restricted to database superusers.
</para>
<para>
<productname>PostgreSQL</productname>'s text search features are
described at length in <xref linkend="textsearch"/>.
</para>
<table>
<title><structname>pg_ts_parser</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>prsname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Text search parser name</entry>
</row>
<row>
<entry><structfield>prsnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this parser
</entry>
</row>
<row>
<entry><structfield>prsstart</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the parser's startup function</entry>
</row>
<row>
<entry><structfield>prstoken</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the parser's next-token function</entry>
</row>
<row>
<entry><structfield>prsend</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the parser's shutdown function</entry>
</row>
<row>
<entry><structfield>prsheadline</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the parser's headline function</entry>
</row>
<row>
<entry><structfield>prslextype</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the parser's lextype function</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-ts-template">
<title><structname>pg_ts_template</structname></title>
<indexterm zone="catalog-pg-ts-template">
<primary>pg_ts_template</primary>
</indexterm>
<para>
The <structname>pg_ts_template</structname> catalog contains entries
defining text search templates. A template is the implementation
skeleton for a class of text search dictionaries.
Since a template must be implemented by C-language-level functions,
creation of new templates is restricted to database superusers.
</para>
<para>
<productname>PostgreSQL</productname>'s text search features are
described at length in <xref linkend="textsearch"/>.
</para>
<table>
<title><structname>pg_ts_template</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>tmplname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Text search template name</entry>
</row>
<row>
<entry><structfield>tmplnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this template
</entry>
</row>
<row>
<entry><structfield>tmplinit</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the template's initialization function</entry>
</row>
<row>
<entry><structfield>tmpllexize</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the template's lexize function</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-type">
<title><structname>pg_type</structname></title>
<indexterm zone="catalog-pg-type">
<primary>pg_type</primary>
</indexterm>
<para>
The catalog <structname>pg_type</structname> stores information about data
types. Base types and enum types (scalar types) are created with
<xref linkend="sql-createtype"/>, and
domains with
<xref linkend="sql-createdomain"/>.
A composite type is automatically created for each table in the database, to
represent the row structure of the table. It is also possible to create
composite types with <command>CREATE TYPE AS</command>.
</para>
<table>
<title><structname>pg_type</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>typname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Data type name</entry>
</row>
<row>
<entry><structfield>typnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace that contains this type
</entry>
</row>
<row>
<entry><structfield>typowner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the type</entry>
</row>
<row>
<entry><structfield>typlen</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>
For a fixed-size type, <structfield>typlen</structfield> is the number
of bytes in the internal representation of the type. But for a
variable-length type, <structfield>typlen</structfield> is negative.
-1 indicates a <quote>varlena</quote> type (one that has a length word),
-2 indicates a null-terminated C string.
</entry>
</row>
<row>
<entry><structfield>typbyval</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
<structfield>typbyval</structfield> determines whether internal
routines pass a value of this type by value or by reference.
<structfield>typbyval</structfield> had better be false if
<structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
where Datum is 8 bytes).
Variable-length types are always passed by reference. Note that
<structfield>typbyval</structfield> can be false even if the
length would allow pass-by-value.
</entry>
</row>
<row>
<entry><structfield>typtype</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<structfield>typtype</structfield> is
<literal>b</literal> for a base type,
<literal>c</literal> for a composite type (e.g., a table's row type),
<literal>d</literal> for a domain,
<literal>e</literal> for an enum type,
<literal>p</literal> for a pseudo-type, or
<literal>r</literal> for a range type.
See also <structfield>typrelid</structfield> and
<structfield>typbasetype</structfield>.
</entry>
</row>
<row>
<entry><structfield>typcategory</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
<structfield>typcategory</structfield> is an arbitrary classification
of data types that is used by the parser to determine which implicit
casts should be <quote>preferred</quote>.
See <xref linkend="catalog-typcategory-table"/>.
</entry>
</row>
<row>
<entry><structfield>typispreferred</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if the type is a preferred cast target within its
<structfield>typcategory</structfield>
</entry>
</row>
<row>
<entry><structfield>typisdefined</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
True if the type is defined, false if this is a placeholder
entry for a not-yet-defined type. When
<structfield>typisdefined</structfield> is false, nothing
except the type name, namespace, and OID can be relied on.
</entry>
</row>
<row>
<entry><structfield>typdelim</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry>
Character that separates two values of this type when parsing
array input. Note that the delimiter is associated with the array
element data type, not the array data type.
</entry>
</row>
<row>
<entry><structfield>typrelid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>
If this is a composite type (see
<structfield>typtype</structfield>), then this column points to
the <structname>pg_class</structname> entry that defines the
corresponding table. (For a free-standing composite type, the
<structname>pg_class</structname> entry doesn't really represent
a table, but it is needed anyway for the type's
<structname>pg_attribute</structname> entries to link to.)
Zero for non-composite types.
</entry>
</row>
<row>
<entry><structfield>typelem</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>
If <structfield>typelem</structfield> is not 0 then it
identifies another row in <structname>pg_type</structname>.
The current type can then be subscripted like an array yielding
values of type <structfield>typelem</structfield>. A
<quote>true</quote> array type is variable length
(<structfield>typlen</structfield> = -1),
but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
also have nonzero <structfield>typelem</structfield>, for example
<type>name</type> and <type>point</type>.
If a fixed-length type has a <structfield>typelem</structfield> then
its internal representation must be some number of values of the
<structfield>typelem</structfield> data type with no other data.
Variable-length array types have a header defined by the array
subroutines.
</entry>
</row>
<row>
<entry><structfield>typarray</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>
If <structfield>typarray</structfield> is not 0 then it
identifies another row in <structname>pg_type</structname>, which
is the <quote>true</quote> array type having this type as element
</entry>
</row>
<row>
<entry><structfield>typinput</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Input conversion function (text format)</entry>
</row>
<row>
<entry><structfield>typoutput</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Output conversion function (text format)</entry>
</row>
<row>
<entry><structfield>typreceive</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Input conversion function (binary format), or 0 if none</entry>
</row>
<row>
<entry><structfield>typsend</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Output conversion function (binary format), or 0 if none</entry>
</row>
<row>
<entry><structfield>typmodin</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Type modifier input function, or 0 if type does not support modifiers</entry>
</row>
<row>
<entry><structfield>typmodout</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Type modifier output function, or 0 to use the standard format</entry>
</row>
<row>
<entry><structfield>typanalyze</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
</row>
<row>
<entry><structfield>typalign</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry><para>
<structfield>typalign</structfield> is the alignment required
when storing a value of this type. It applies to storage on
disk as well as most representations of the value inside
<productname>PostgreSQL</productname>.
When multiple values are stored consecutively, such
as in the representation of a complete row on disk, padding is
inserted before a datum of this type so that it begins on the
specified boundary. The alignment reference is the beginning
of the first datum in the sequence.
</para>
<para>
Possible values are:
<itemizedlist>
<listitem>
<para><literal>c</literal> = <type>char</type> alignment, i.e., no alignment needed.</para>
</listitem>
<listitem>
<para><literal>s</literal> = <type>short</type> alignment (2 bytes on most machines).</para>
</listitem>
<listitem>
<para><literal>i</literal> = <type>int</type> alignment (4 bytes on most machines).</para>
</listitem>
<listitem>
<para><literal>d</literal> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
</listitem>
</itemizedlist>
</para><note>
<para>
For types used in system tables, it is critical that the size
and alignment defined in <structname>pg_type</structname>
agree with the way that the compiler will lay out the column in
a structure representing a table row.
</para>
</note></entry>
</row>
<row>
<entry><structfield>typstorage</structfield></entry>
<entry><type>char</type></entry>
<entry></entry>
<entry><para>
<structfield>typstorage</structfield> tells for varlena
types (those with <structfield>typlen</structfield> = -1) if
the type is prepared for toasting and what the default strategy
for attributes of this type should be.
Possible values are
<itemizedlist>
<listitem>
<para><literal>p</literal>: Value must always be stored plain.</para>
</listitem>
<listitem>
<para>
<literal>e</literal>: Value can be stored in a <quote>secondary</quote>
relation (if relation has one, see
<literal>pg_class.reltoastrelid</literal>).
</para>
</listitem>
<listitem>
<para><literal>m</literal>: Value can be stored compressed inline.</para>
</listitem>
<listitem>
<para><literal>x</literal>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
</listitem>
</itemizedlist>
Note that <literal>m</literal> columns can also be moved out to secondary
storage, but only as a last resort (<literal>e</literal> and <literal>x</literal> columns are
moved first).
</para></entry>
</row>
<row>
<entry><structfield>typnotnull</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry><para>
<structfield>typnotnull</structfield> represents a not-null
constraint on a type. Used for domains only.
</para></entry>
</row>
<row>
<entry><structfield>typbasetype</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
<entry><para>
If this is a domain (see <structfield>typtype</structfield>), then
<structfield>typbasetype</structfield> identifies the type that this
one is based on. Zero if this type is not a domain.
</para></entry>
</row>
<row>
<entry><structfield>typtypmod</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry><para>
Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</literal>
to be applied to their base type (-1 if base type does not use a
<literal>typmod</literal>). -1 if this type is not a domain.
</para></entry>
</row>
<row>
<entry><structfield>typndims</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry><para>
<structfield>typndims</structfield> is the number of array dimensions
for a domain over an array (that is, <structfield>typbasetype</structfield> is
an array type).
Zero for types other than domains over array types.
</para></entry>
</row>
<row>
<entry><structfield>typcollation</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
<entry><para>
<structfield>typcollation</structfield> specifies the collation
of the type. If the type does not support collations, this will
be zero. A base type that supports collations will have a nonzero
value here, typically <symbol>DEFAULT_COLLATION_OID</symbol>.
A domain over a collatable type can have a collation OID different
from its base type's, if one was specified for the domain.
</para></entry>
</row>
<row>
<entry><structfield>typdefaultbin</structfield></entry>
<entry><type>pg_node_tree</type></entry>
<entry></entry>
<entry><para>
If <structfield>typdefaultbin</structfield> is not null, it is the
<function>nodeToString()</function>
representation of a default expression for the type. This is
only used for domains.
</para></entry>
</row>
<row>
<entry><structfield>typdefault</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry><para>
<structfield>typdefault</structfield> is null if the type has no associated
default value. If <structfield>typdefaultbin</structfield> is not null,
<structfield>typdefault</structfield> must contain a human-readable version of the
default expression represented by <structfield>typdefaultbin</structfield>. If
<structfield>typdefaultbin</structfield> is null and <structfield>typdefault</structfield> is
not, then <structfield>typdefault</structfield> is the external representation of
the type's default value, which can be fed to the type's input
converter to produce a constant.
</para></entry>
</row>
<row>
<entry><structfield>typacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
<entry>
Access privileges; see <xref linkend="ddl-priv"/> for details
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
<xref linkend="catalog-typcategory-table"/> lists the system-defined values
of <structfield>typcategory</structfield>. Any future additions to this list will
also be upper-case ASCII letters. All other ASCII characters are reserved
for user-defined categories.
</para>
<table id="catalog-typcategory-table">
<title><structfield>typcategory</structfield> Codes</title>
<tgroup cols="2">
<thead>
<row>
<entry>Code</entry>
<entry>Category</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>A</literal></entry>
<entry>Array types</entry>
</row>
<row>
<entry><literal>B</literal></entry>
<entry>Boolean types</entry>
</row>
<row>
<entry><literal>C</literal></entry>
<entry>Composite types</entry>
</row>
<row>
<entry><literal>D</literal></entry>
<entry>Date/time types</entry>
</row>
<row>
<entry><literal>E</literal></entry>
<entry>Enum types</entry>
</row>
<row>
<entry><literal>G</literal></entry>
<entry>Geometric types</entry>
</row>
<row>
<entry><literal>I</literal></entry>
<entry>Network address types</entry>
</row>
<row>
<entry><literal>N</literal></entry>
<entry>Numeric types</entry>
</row>
<row>
<entry><literal>P</literal></entry>
<entry>Pseudo-types</entry>
</row>
<row>
<entry><literal>R</literal></entry>
<entry>Range types</entry>
</row>
<row>
<entry><literal>S</literal></entry>
<entry>String types</entry>
</row>
<row>
<entry><literal>T</literal></entry>
<entry>Timespan types</entry>
</row>
<row>
<entry><literal>U</literal></entry>
<entry>User-defined types</entry>
</row>
<row>
<entry><literal>V</literal></entry>
<entry>Bit-string types</entry>
</row>
<row>
<entry><literal>X</literal></entry>
<entry><type>unknown</type> type</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-user-mapping">
<title><structname>pg_user_mapping</structname></title>
<indexterm zone="catalog-pg-user-mapping">
<primary>pg_user_mapping</primary>
</indexterm>
<para>
The catalog <structname>pg_user_mapping</structname> stores
the mappings from local user to remote. Access to this catalog is
restricted from normal users, use the view
<link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
instead.
</para>
<table>
<title><structname>pg_user_mapping</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
<entry>Row identifier</entry>
</row>
<row>
<entry><structfield>umuser</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
</row>
<row>
<entry><structfield>umserver</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
<entry>
The OID of the foreign server that contains this mapping
</entry>
</row>
<row>
<entry><structfield>umoptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
User mapping specific options, as <quote>keyword=value</quote> strings
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="views-overview">
<title>System Views</title>
<para>
In addition to the system catalogs, <productname>PostgreSQL</productname>
provides a number of built-in views. Some system views provide convenient
access to some commonly used queries on the system catalogs. Other views
provide access to internal server state.
</para>
<para>
The information schema (<xref linkend="information-schema"/>) provides
an alternative set of views which overlap the functionality of the system
views. Since the information schema is SQL-standard whereas the views
described here are <productname>PostgreSQL</productname>-specific,
it's usually better to use the information schema if it provides all
the information you need.
</para>
<para>
<xref linkend="view-table"/> lists the system views described here.
More detailed documentation of each view follows below.
There are some additional views that provide access to the results of
the statistics collector; they are described in <xref
linkend="monitoring-stats-views-table"/>.
</para>
<para>
Except where noted, all the views described here are read-only.
</para>
<table id="view-table">
<title>System Views</title>
<tgroup cols="2">
<thead>
<row>
<entry>View Name</entry>
<entry>Purpose</entry>
</row>
</thead>
<tbody>
<row>
<entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
<entry>available extensions</entry>
</row>
<row>
<entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
<entry>available versions of extensions</entry>
</row>
<row>
<entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
<entry>compile-time configuration parameters</entry>
</row>
<row>
<entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
<entry>open cursors</entry>
</row>
<row>
<entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
<entry>summary of configuration file contents</entry>
</row>
<row>
<entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
<entry>groups of database users</entry>
</row>
<row>
<entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
<entry>summary of client authentication configuration file contents</entry>
</row>
<row>
<entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
<entry>indexes</entry>
</row>
<row>
<entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
<entry>locks currently held or awaited</entry>
</row>
<row>
<entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
<entry>materialized views</entry>
</row>
<row>
<entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
<entry>policies</entry>
</row>
<row>
<entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
<entry>prepared statements</entry>
</row>
<row>
<entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
<entry>prepared transactions</entry>
</row>
<row>
<entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
<entry>publications and their associated tables</entry>
</row>
<row>
<entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
<entry>information about replication origins, including replication progress</entry>
</row>
<row>
<entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
<entry>replication slot information</entry>
</row>
<row>
<entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
<entry>database roles</entry>
</row>
<row>
<entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
<entry>rules</entry>
</row>
<row>
<entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
<entry>security labels</entry>
</row>
<row>
<entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
<entry>sequences</entry>
</row>
<row>
<entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
<entry>parameter settings</entry>
</row>
<row>
<entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
<entry>database users</entry>
</row>
<row>
<entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
<entry>planner statistics</entry>
</row>
<row>
<entry><link linkend="view-pg-shmem-allocations"><structname>pg_shmem_allocations</structname></link></entry>
<entry>shared memory allocations</entry>
</row>
<row>
<entry><link linkend="view-pg-stats-ext"><structname>pg_stats_ext</structname></link></entry>
<entry>extended planner statistics</entry>
</row>
<row>
<entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
<entry>tables</entry>
</row>
<row>
<entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
<entry>time zone abbreviations</entry>
</row>
<row>
<entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
<entry>time zone names</entry>
</row>
<row>
<entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
<entry>database users</entry>
</row>
<row>
<entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
<entry>user mappings</entry>
</row>
<row>
<entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
<entry>views</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-available-extensions">
<title><structname>pg_available_extensions</structname></title>
<indexterm zone="view-pg-available-extensions">
<primary>pg_available_extensions</primary>
</indexterm>
<para>
The <structname>pg_available_extensions</structname> view lists the
extensions that are available for installation.
See also the
<link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
catalog, which shows the extensions currently installed.
</para>
<table>
<title><structname>pg_available_extensions</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>name</structfield></entry>
<entry><type>name</type></entry>
<entry>Extension name</entry>
</row>
<row>
<entry><structfield>default_version</structfield></entry>
<entry><type>text</type></entry>
<entry>Name of default version, or <literal>NULL</literal> if none is
specified</entry>
</row>
<row>
<entry><structfield>installed_version</structfield></entry>
<entry><type>text</type></entry>
<entry>Currently installed version of the extension,
or <literal>NULL</literal> if not installed</entry>
</row>
<row>
<entry><structfield>comment</structfield></entry>
<entry><type>text</type></entry>
<entry>Comment string from the extension's control file</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <structname>pg_available_extensions</structname> view is read only.
</para>
</sect1>
<sect1 id="view-pg-available-extension-versions">
<title><structname>pg_available_extension_versions</structname></title>
<indexterm zone="view-pg-available-extension-versions">
<primary>pg_available_extension_versions</primary>
</indexterm>
<para>
The <structname>pg_available_extension_versions</structname> view lists the
specific extension versions that are available for installation.
See also the <link
linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
catalog, which shows the extensions currently installed.
</para>
<table>
<title><structname>pg_available_extension_versions</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>name</structfield></entry>
<entry><type>name</type></entry>
<entry>Extension name</entry>
</row>
<row>
<entry><structfield>version</structfield></entry>
<entry><type>text</type></entry>
<entry>Version name</entry>
</row>
<row>
<entry><structfield>installed</structfield></entry>
<entry><type>bool</type></entry>
<entry>True if this version of this extension is currently
installed</entry>
</row>
<row>
<entry><structfield>superuser</structfield></entry>
<entry><type>bool</type></entry>
<entry>True if only superusers are allowed to install this extension
(but see <structfield>trusted</structfield>)</entry>
</row>
<row>
<entry><structfield>trusted</structfield></entry>
<entry><type>bool</type></entry>
<entry>True if the extension can be installed by non-superusers
with appropriate privileges</entry>
</row>
<row>
<entry><structfield>relocatable</structfield></entry>
<entry><type>bool</type></entry>
<entry>True if extension can be relocated to another schema</entry>
</row>
<row>
<entry><structfield>schema</structfield></entry>
<entry><type>name</type></entry>
<entry>Name of the schema that the extension must be installed into,
or <literal>NULL</literal> if partially or fully relocatable</entry>
</row>
<row>
<entry><structfield>requires</structfield></entry>
<entry><type>name[]</type></entry>
<entry>Names of prerequisite extensions,
or <literal>NULL</literal> if none</entry>
</row>
<row>
<entry><structfield>comment</structfield></entry>
<entry><type>text</type></entry>
<entry>Comment string from the extension's control file</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <structname>pg_available_extension_versions</structname> view is read
only.
</para>
</sect1>
<sect1 id="view-pg-config">
<title><structname>pg_config</structname></title>
<indexterm zone="view-pg-config">
<primary>pg_config</primary>
</indexterm>
<para>
The view <structname>pg_config</structname> describes the
compile-time configuration parameters of the currently installed
version of <productname>PostgreSQL</productname>. It is intended, for example, to
be used by software packages that want to interface to
<productname>PostgreSQL</productname> to facilitate finding the required header
files and libraries. It provides the same basic information as the
<xref linkend="app-pgconfig"/> <productname>PostgreSQL</productname> client
application.
</para>
<para>
By default, the <structname>pg_config</structname> view can be read
only by superusers.
</para>
<table>
<title><structname>pg_config</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>name</structfield></entry>
<entry><type>text</type></entry>
<entry>The parameter name</entry>
</row>
<row>
<entry><structfield>setting</structfield></entry>
<entry><type>text</type></entry>
<entry>The parameter value</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-cursors">
<title><structname>pg_cursors</structname></title>
<indexterm zone="view-pg-cursors">
<primary>pg_cursors</primary>
</indexterm>
<para>
The <structname>pg_cursors</structname> view lists the cursors that
are currently available. Cursors can be defined in several ways:
<itemizedlist>
<listitem>
<para>
via the <xref linkend="sql-declare"/>
statement in SQL
</para>
</listitem>
<listitem>
<para>
via the Bind message in the frontend/backend protocol, as
described in <xref linkend="protocol-flow-ext-query"/>
</para>
</listitem>
<listitem>
<para>
via the Server Programming Interface (SPI), as described in
<xref linkend="spi-interface"/>
</para>
</listitem>
</itemizedlist>
The <structname>pg_cursors</structname> view displays cursors
created by any of these means. Cursors only exist for the duration
of the transaction that defines them, unless they have been
declared <literal>WITH HOLD</literal>. Therefore non-holdable
cursors are only present in the view until the end of their
creating transaction.
<note>
<para>
Cursors are used internally to implement some of the components
of <productname>PostgreSQL</productname>, such as procedural languages.
Therefore, the <structname>pg_cursors</structname> view might include cursors
that have not been explicitly created by the user.
</para>
</note>
</para>
<table>
<title><structname>pg_cursors</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>name</structfield></entry>
<entry><type>text</type></entry>
<entry>The name of the cursor</entry>
</row>
<row>
<entry><structfield>statement</structfield></entry>
<entry><type>text</type></entry>
<entry>The verbatim query string submitted to declare this cursor</entry>
</row>
<row>
<entry><structfield>is_holdable</structfield></entry>
<entry><type>boolean</type></entry>
<entry>
<literal>true</literal> if the cursor is holdable (that is, it
can be accessed after the transaction that declared the cursor
has committed); <literal>false</literal> otherwise
</entry>
</row>
<row>
<entry><structfield>is_binary</structfield></entry>
<entry><type>boolean</type></entry>
<entry>
<literal>true</literal> if the cursor was declared
<literal>BINARY</literal>; <literal>false</literal>
otherwise
</entry>
</row>
<row>
<entry><structfield>is_scrollable</structfield></entry>
<entry><type>boolean</type></entry>
<entry>
<literal>true</literal> if the cursor is scrollable (that is, it
allows rows to be retrieved in a nonsequential manner);
<literal>false</literal> otherwise
</entry>
</row>
<row>
<entry><structfield>creation_time</structfield></entry>
<entry><type>timestamptz</type></entry>
<entry>The time at which the cursor was declared</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <structname>pg_cursors</structname> view is read only.
</para>
</sect1>
<sect1 id="view-pg-file-settings">
<title><structname>pg_file_settings</structname></title>
<indexterm zone="view-pg-file-settings">
<primary>pg_file_settings</primary>
</indexterm>
<para>
The view <structname>pg_file_settings</structname> provides a summary of
the contents of the server's configuration file(s). A row appears in
this view for each <quote>name = value</quote> entry appearing in the files,
with annotations indicating whether the value could be applied
successfully. Additional row(s) may appear for problems not linked to
a <quote>name = value</quote> entry, such as syntax errors in the files.
</para>
<para>
This view is helpful for checking whether planned changes in the
configuration files will work, or for diagnosing a previous failure.
Note that this view reports on the <emphasis>current</emphasis> contents of the
files, not on what was last applied by the server. (The
<link linkend="view-pg-settings"><structname>pg_settings</structname></link>
view is usually sufficient to determine that.)
</para>
<para>
By default, the <structname>pg_file_settings</structname> view can be read
only by superusers.
</para>
<table>
<title><structname>pg_file_settings</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>sourcefile</structfield></entry>
<entry><structfield>text</structfield></entry>
<entry>Full path name of the configuration file</entry>
</row>
<row>
<entry><structfield>sourceline</structfield></entry>
<entry><structfield>integer</structfield></entry>
<entry>
Line number within the configuration file where the entry appears
</entry>
</row>
<row>
<entry><structfield>seqno</structfield></entry>
<entry><structfield>integer</structfield></entry>
<entry>Order in which the entries are processed (1..<replaceable>n</replaceable>)</entry>
</row>
<row>
<entry><structfield>name</structfield></entry>
<entry><structfield>text</structfield></entry>
<entry>Configuration parameter name</entry>
</row>
<row>
<entry><structfield>setting</structfield></entry>
<entry><structfield>text</structfield></entry>
<entry>Value to be assigned to the parameter</entry>
</row>
<row>
<entry><structfield>applied</structfield></entry>
<entry><structfield>boolean</structfield></entry>
<entry>True if the value can be applied successfully</entry>
</row>
<row>
<entry><structfield>error</structfield></entry>
<entry><structfield>text</structfield></entry>
<entry>If not null, an error message indicating why this entry could
not be applied</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
If the configuration file contains syntax errors or invalid parameter
names, the server will not attempt to apply any settings from it, and
therefore all the <structfield>applied</structfield> fields will read as false.
In such a case there will be one or more rows with
non-null <structfield>error</structfield> fields indicating the
problem(s). Otherwise, individual settings will be applied if possible.
If an individual setting cannot be applied (e.g., invalid value, or the
setting cannot be changed after server start) it will have an appropriate
message in the <structfield>error</structfield> field. Another way that
an entry might have <structfield>applied</structfield> = false is that it is
overridden by a later entry for the same parameter name; this case is not
considered an error so nothing appears in
the <structfield>error</structfield> field.
</para>
<para>
See <xref linkend="config-setting"/> for more information about the various
ways to change run-time parameters.
</para>
</sect1>
<sect1 id="view-pg-group">
<title><structname>pg_group</structname></title>
<indexterm zone="view-pg-group">
<primary>pg_group</primary>
</indexterm>
<para>
The view <structname>pg_group</structname> exists for backwards
compatibility: it emulates a catalog that existed in
<productname>PostgreSQL</productname> before version 8.1.
It shows the names and members of all roles that are marked as not
<structfield>rolcanlogin</structfield>, which is an approximation to the set
of roles that are being used as groups.
</para>
<table>
<title><structname>pg_group</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>groname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
<entry>Name of the group</entry>
</row>
<row>
<entry><structfield>grosysid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>ID of this group</entry>
</row>
<row>
<entry><structfield>grolist</structfield></entry>
<entry><type>oid[]</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>An array containing the IDs of the roles in this group</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-hba-file-rules">
<title><structname>pg_hba_file_rules</structname></title>
<indexterm zone="view-pg-hba-file-rules">
<primary>pg_hba_file_rules</primary>
</indexterm>
<para>
The view <structname>pg_hba_file_rules</structname> provides a summary of
the contents of the client authentication configuration
file, <filename>pg_hba.conf</filename>. A row appears in this view for each
non-empty, non-comment line in the file, with annotations indicating
whether the rule could be applied successfully.
</para>
<para>
This view can be helpful for checking whether planned changes in the
authentication configuration file will work, or for diagnosing a previous
failure. Note that this view reports on the <emphasis>current</emphasis> contents
of the file, not on what was last loaded by the server.
</para>
<para>
By default, the <structname>pg_hba_file_rules</structname> view can be read
only by superusers.
</para>
<table>
<title><structname>pg_hba_file_rules</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>line_number</structfield></entry>
<entry><structfield>integer</structfield></entry>
<entry>
Line number of this rule in <filename>pg_hba.conf</filename>
</entry>
</row>
<row>
<entry><structfield>type</structfield></entry>
<entry><structfield>text</structfield></entry>
<entry>Type of connection</entry>
</row>
<row>
<entry><structfield>database</structfield></entry>
<entry><structfield>text[]</structfield></entry>
<entry>List of database name(s) to which this rule applies</entry>
</row>
<row>
<entry><structfield>user_name</structfield></entry>
<entry><structfield>text[]</structfield></entry>
<entry>List of user and group name(s) to which this rule applies</entry>
</row>
<row>
<entry><structfield>address</structfield></entry>
<entry><structfield>text</structfield></entry>
<entry>
Host name or IP address, or one
of <literal>all</literal>, <literal>samehost</literal>,
or <literal>samenet</literal>, or null for local connections
</entry>
</row>
<row>
<entry><structfield>netmask</structfield></entry>
<entry><structfield>text</structfield></entry>
<entry>IP address mask, or null if not applicable</entry>
</row>
<row>
<entry><structfield>auth_method</structfield></entry>
<entry><type>text</type></entry>
<entry>Authentication method</entry>
</row>
<row>
<entry><structfield>options</structfield></entry>
<entry><type>text[]</type></entry>
<entry>Options specified for authentication method, if any</entry>
</row>
<row>
<entry><structfield>error</structfield></entry>
<entry><structfield>text</structfield></entry>
<entry>
If not null, an error message indicating why this
line could not be processed
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Usually, a row reflecting an incorrect entry will have values for only
the <structfield>line_number</structfield> and <structfield>error</structfield> fields.
</para>
<para>
See <xref linkend="client-authentication"/> for more information about
client authentication configuration.
</para>
</sect1>
<sect1 id="view-pg-indexes">
<title><structname>pg_indexes</structname></title>
<indexterm zone="view-pg-indexes">
<primary>pg_indexes</primary>
</indexterm>
<para>
The view <structname>pg_indexes</structname> provides access to
useful information about each index in the database.
</para>
<table>
<title><structname>pg_indexes</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing table and index</entry>
</row>
<row>
<entry><structfield>tablename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of table the index is for</entry>
</row>
<row>
<entry><structfield>indexname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of index</entry>
</row>
<row>
<entry><structfield>tablespace</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
<entry>Name of tablespace containing index (null if default for database)</entry>
</row>
<row>
<entry><structfield>indexdef</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Index definition (a reconstructed <command>CREATE INDEX</command>
command)</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-locks">
<title><structname>pg_locks</structname></title>
<indexterm zone="view-pg-locks">
<primary>pg_locks</primary>
</indexterm>
<para>
The view <structname>pg_locks</structname> provides access to
information about the locks held by active processes within the
database server. See <xref linkend="mvcc"/> for more discussion
of locking.
</para>
<para>
<structname>pg_locks</structname> contains one row per active lockable
object, requested lock mode, and relevant process. Thus, the same
lockable object might
appear many times, if multiple processes are holding or waiting
for locks on it. However, an object that currently has no locks on it
will not appear at all.
</para>
<para>
There are several distinct types of lockable objects:
whole relations (e.g., tables), individual pages of relations,
individual tuples of relations,
transaction IDs (both virtual and permanent IDs),
and general database objects (identified by class OID and object OID,
in the same way as in <structname>pg_description</structname> or
<structname>pg_depend</structname>). Also, the right to extend a
relation is represented as a separate lockable object.
Also, <quote>advisory</quote> locks can be taken on numbers that have
user-defined meanings.
</para>
<table>
<title><structname>pg_locks</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>locktype</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
Type of the lockable object:
<literal>relation</literal>,
<literal>extend</literal>,
<literal>page</literal>,
<literal>tuple</literal>,
<literal>transactionid</literal>,
<literal>virtualxid</literal>,
<literal>object</literal>,
<literal>userlock</literal>, or
<literal>advisory</literal>
</entry>
</row>
<row>
<entry><structfield>database</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
<entry>
OID of the database in which the lock target exists, or
zero if the target is a shared object, or
null if the target is a transaction ID
</entry>
</row>
<row>
<entry><structfield>relation</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>
OID of the relation targeted by the lock, or null if the target is not
a relation or part of a relation
</entry>
</row>
<row>
<entry><structfield>page</structfield></entry>
<entry><type>integer</type></entry>
<entry></entry>
<entry>
Page number targeted by the lock within the relation,
or null if the target is not a relation page or tuple
</entry>
</row>
<row>
<entry><structfield>tuple</structfield></entry>
<entry><type>smallint</type></entry>
<entry></entry>
<entry>
Tuple number targeted by the lock within the page,
or null if the target is not a tuple
</entry>
</row>
<row>
<entry><structfield>virtualxid</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
Virtual ID of the transaction targeted by the lock,
or null if the target is not a virtual transaction ID
</entry>
</row>
<row>
<entry><structfield>transactionid</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>
ID of the transaction targeted by the lock,
or null if the target is not a transaction ID
</entry>
</row>
<row>
<entry><structfield>classid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>
OID of the system catalog containing the lock target, or null if the
target is not a general database object
</entry>
</row>
<row>
<entry><structfield>objid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>
OID of the lock target within its system catalog, or null if the
target is not a general database object
</entry>
</row>
<row>
<entry><structfield>objsubid</structfield></entry>
<entry><type>smallint</type></entry>
<entry></entry>
<entry>
Column number targeted by the lock (the
<structfield>classid</structfield> and <structfield>objid</structfield> refer to the
table itself),
or zero if the target is some other general database object,
or null if the target is not a general database object
</entry>
</row>
<row>
<entry><structfield>virtualtransaction</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
Virtual ID of the transaction that is holding or awaiting this lock
</entry>
</row>
<row>
<entry><structfield>pid</structfield></entry>
<entry><type>integer</type></entry>
<entry></entry>
<entry>
Process ID of the server process holding or awaiting this
lock, or null if the lock is held by a prepared transaction
</entry>
</row>
<row>
<entry><structfield>mode</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Name of the lock mode held or desired by this process (see <xref
linkend="locking-tables"/> and <xref linkend="xact-serializable"/>)</entry>
</row>
<row>
<entry><structfield>granted</structfield></entry>
<entry><type>boolean</type></entry>
<entry></entry>
<entry>True if lock is held, false if lock is awaited</entry>
</row>
<row>
<entry><structfield>fastpath</structfield></entry>
<entry><type>boolean</type></entry>
<entry></entry>
<entry>True if lock was taken via fast path, false if taken via main
lock table</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
<structfield>granted</structfield> is true in a row representing a lock
held by the indicated process. False indicates that this process is
currently waiting to acquire this lock, which implies that at least one
other process is holding or waiting for a conflicting lock mode on the same
lockable object. The waiting process will sleep until the other lock is
released (or a deadlock situation is detected). A single process can be
waiting to acquire at most one lock at a time.
</para>
<para>
Throughout running a transaction, a server process holds an exclusive lock
on the transaction's virtual transaction ID. If a permanent ID is assigned
to the transaction (which normally happens only if the transaction changes
the state of the database), it also holds an exclusive lock on the
transaction's permanent transaction ID until it ends. When a process finds
it necessary to wait specifically for another transaction to end, it does
so by attempting to acquire share lock on the other transaction's ID
(either virtual or permanent ID depending on the situation). That will
succeed only when the other transaction terminates and releases its locks.
</para>
<para>
Although tuples are a lockable type of object,
information about row-level locks is stored on disk, not in memory,
and therefore row-level locks normally do not appear in this view.
If a process is waiting for a
row-level lock, it will usually appear in the view as waiting for the
permanent transaction ID of the current holder of that row lock.
</para>
<para>
Advisory locks can be acquired on keys consisting of either a single
<type>bigint</type> value or two integer values.
A <type>bigint</type> key is displayed with its
high-order half in the <structfield>classid</structfield> column, its low-order half
in the <structfield>objid</structfield> column, and <structfield>objsubid</structfield> equal
to 1. The original <type>bigint</type> value can be reassembled with the
expression <literal>(classid::bigint &lt;&lt; 32) |
objid::bigint</literal>. Integer keys are displayed with the
first key in the
<structfield>classid</structfield> column, the second key in the <structfield>objid</structfield>
column, and <structfield>objsubid</structfield> equal to 2. The actual meaning of
the keys is up to the user. Advisory locks are local to each database,
so the <structfield>database</structfield> column is meaningful for an advisory lock.
</para>
<para>
<structname>pg_locks</structname> provides a global view of all locks
in the database cluster, not only those relevant to the current database.
Although its <structfield>relation</structfield> column can be joined
against <structname>pg_class</structname>.<structfield>oid</structfield> to identify locked
relations, this will only work correctly for relations in the current
database (those for which the <structfield>database</structfield> column
is either the current database's OID or zero).
</para>
<para>
The <structfield>pid</structfield> column can be joined to the
<structfield>pid</structfield> column of the <link
linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
view to get more
information on the session holding or awaiting each lock,
for example
<programlisting>
SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
ON pl.pid = psa.pid;
</programlisting>
Also, if you are using prepared transactions, the
<structfield>virtualtransaction</structfield> column can be joined to the
<structfield>transaction</structfield> column of the <link
linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
view to get more information on prepared transactions that hold locks.
(A prepared transaction can never be waiting for a lock,
but it continues to hold the locks it acquired while running.)
For example:
<programlisting>
SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
ON pl.virtualtransaction = '-1/' || ppx.transaction;
</programlisting>
</para>
<para>
While it is possible to obtain information about which processes block
which other processes by joining <structname>pg_locks</structname> against
itself, this is very difficult to get right in detail. Such a query would
have to encode knowledge about which lock modes conflict with which
others. Worse, the <structname>pg_locks</structname> view does not expose
information about which processes are ahead of which others in lock wait
queues, nor information about which processes are parallel workers running
on behalf of which other client sessions. It is better to use
the <function>pg_blocking_pids()</function> function
(see <xref linkend="functions-info-session-table"/>) to identify which
process(es) a waiting process is blocked behind.
</para>
<para>
The <structname>pg_locks</structname> view displays data from both the
regular lock manager and the predicate lock manager, which are
separate systems; in addition, the regular lock manager subdivides its
locks into regular and <firstterm>fast-path</firstterm> locks.
This data is not guaranteed to be entirely consistent.
When the view is queried,
data on fast-path locks (with <structfield>fastpath</structfield> = <literal>true</literal>)
is gathered from each backend one at a time, without freezing the state of
the entire lock manager, so it is possible for locks to be taken or
released while information is gathered. Note, however, that these locks are
known not to conflict with any other lock currently in place. After
all backends have been queried for fast-path locks, the remainder of the
regular lock manager is locked as a unit, and a consistent snapshot of all
remaining locks is collected as an atomic action. After unlocking the
regular lock manager, the predicate lock manager is similarly locked and all
predicate locks are collected as an atomic action. Thus, with the exception
of fast-path locks, each lock manager will deliver a consistent set of
results, but as we do not lock both lock managers simultaneously, it is
possible for locks to be taken or released after we interrogate the regular
lock manager and before we interrogate the predicate lock manager.
</para>
<para>
Locking the regular and/or predicate lock manager could have some
impact on database performance if this view is very frequently accessed.
The locks are held only for the minimum amount of time necessary to
obtain data from the lock managers, but this does not completely eliminate
the possibility of a performance impact.
</para>
</sect1>
<sect1 id="view-pg-matviews">
<title><structname>pg_matviews</structname></title>
<indexterm zone="view-pg-matviews">
<primary>pg_matviews</primary>
</indexterm>
<indexterm zone="view-pg-matviews">
<primary>materialized views</primary>
</indexterm>
<para>
The view <structname>pg_matviews</structname> provides access to
useful information about each materialized view in the database.
</para>
<table>
<title><structname>pg_matviews</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing materialized view</entry>
</row>
<row>
<entry><structfield>matviewname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of materialized view</entry>
</row>
<row>
<entry><structfield>matviewowner</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
<entry>Name of materialized view's owner</entry>
</row>
<row>
<entry><structfield>tablespace</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
<entry>Name of tablespace containing materialized view (null if default for database)</entry>
</row>
<row>
<entry><structfield>hasindexes</structfield></entry>
<entry><type>boolean</type></entry>
<entry></entry>
<entry>True if materialized view has (or recently had) any indexes</entry>
</row>
<row>
<entry><structfield>ispopulated</structfield></entry>
<entry><type>boolean</type></entry>
<entry></entry>
<entry>True if materialized view is currently populated</entry>
</row>
<row>
<entry><structfield>definition</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-policies">
<title><structname>pg_policies</structname></title>
<indexterm zone="view-pg-policies">
<primary>pg_policies</primary>
</indexterm>
<para>
The view <structname>pg_policies</structname> provides access to
useful information about each row-level security policy in the database.
</para>
<table>
<title><structname>pg_policies</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing table policy is on</entry>
</row>
<row>
<entry><structfield>tablename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of table policy is on</entry>
</row>
<row>
<entry><structfield>policyname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
<entry>Name of policy</entry>
</row>
<row>
<entry><structfield>polpermissive</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Is the policy permissive or restrictive?</entry>
</row>
<row>
<entry><structfield>roles</structfield></entry>
<entry><type>name[]</type></entry>
<entry></entry>
<entry>The roles to which this policy applies</entry>
</row>
<row>
<entry><structfield>cmd</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The command type to which the policy is applied</entry>
</row>
<row>
<entry><structfield>qual</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The expression added to the security barrier qualifications for
queries that this policy applies to</entry>
</row>
<row>
<entry><structfield>with_check</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The expression added to the WITH CHECK qualifications for
queries that attempt to add rows to this table</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-prepared-statements">
<title><structname>pg_prepared_statements</structname></title>
<indexterm zone="view-pg-prepared-statements">
<primary>pg_prepared_statements</primary>
</indexterm>
<para>
The <structname>pg_prepared_statements</structname> view displays
all the prepared statements that are available in the current
session. See <xref linkend="sql-prepare"/> for more information about prepared
statements.
</para>
<para>
<structname>pg_prepared_statements</structname> contains one row
for each prepared statement. Rows are added to the view when a new
prepared statement is created and removed when a prepared statement
is released (for example, via the <xref linkend="sql-deallocate"/> command).
</para>
<table>
<title><structname>pg_prepared_statements</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>name</structfield></entry>
<entry><type>text</type></entry>
<entry>
The identifier of the prepared statement
</entry>
</row>
<row>
<entry><structfield>statement</structfield></entry>
<entry><type>text</type></entry>
<entry>
The query string submitted by the client to create this
prepared statement. For prepared statements created via SQL,
this is the <command>PREPARE</command> statement submitted by
the client. For prepared statements created via the
frontend/backend protocol, this is the text of the prepared
statement itself.
</entry>
</row>
<row>
<entry><structfield>prepare_time</structfield></entry>
<entry><type>timestamptz</type></entry>
<entry>
The time at which the prepared statement was created
</entry>
</row>
<row>
<entry><structfield>parameter_types</structfield></entry>
<entry><type>regtype[]</type></entry>
<entry>
The expected parameter types for the prepared statement in the
form of an array of <type>regtype</type>. The OID corresponding
to an element of this array can be obtained by casting the
<type>regtype</type> value to <type>oid</type>.
</entry>
</row>
<row>
<entry><structfield>from_sql</structfield></entry>
<entry><type>boolean</type></entry>
<entry>
<literal>true</literal> if the prepared statement was created
via the <command>PREPARE</command> SQL command;
<literal>false</literal> if the statement was prepared via the
frontend/backend protocol
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <structname>pg_prepared_statements</structname> view is read only.
</para>
</sect1>
<sect1 id="view-pg-prepared-xacts">
<title><structname>pg_prepared_xacts</structname></title>
<indexterm zone="view-pg-prepared-xacts">
<primary>pg_prepared_xacts</primary>
</indexterm>
<para>
The view <structname>pg_prepared_xacts</structname> displays
information about transactions that are currently prepared for two-phase
commit (see <xref linkend="sql-prepare-transaction"/> for details).
</para>
<para>
<structname>pg_prepared_xacts</structname> contains one row per prepared
transaction. An entry is removed when the transaction is committed or
rolled back.
</para>
<table>
<title><structname>pg_prepared_xacts</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>transaction</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>
Numeric transaction identifier of the prepared transaction
</entry>
</row>
<row>
<entry><structfield>gid</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
Global transaction identifier that was assigned to the transaction
</entry>
</row>
<row>
<entry><structfield>prepared</structfield></entry>
<entry><type>timestamp with time zone</type></entry>
<entry></entry>
<entry>
Time at which the transaction was prepared for commit
</entry>
</row>
<row>
<entry><structfield>owner</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
<entry>
Name of the user that executed the transaction
</entry>
</row>
<row>
<entry><structfield>database</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
<entry>
Name of the database in which the transaction was executed
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
When the <structname>pg_prepared_xacts</structname> view is accessed, the
internal transaction manager data structures are momentarily locked, and
a copy is made for the view to display. This ensures that the
view produces a consistent set of results, while not blocking
normal operations longer than necessary. Nonetheless
there could be some impact on database performance if this view is
frequently accessed.
</para>
</sect1>
<sect1 id="view-pg-publication-tables">
<title><structname>pg_publication_tables</structname></title>
<indexterm zone="view-pg-publication-tables">
<primary>pg_publication_tables</primary>
</indexterm>
<para>
The view <structname>pg_publication_tables</structname> provides
information about the mapping between publications and the tables they
contain. Unlike the underlying
catalog <structname>pg_publication_rel</structname>, this view expands
publications defined as <literal>FOR ALL TABLES</literal>, so for such
publications there will be a row for each eligible table.
</para>
<table>
<title><structname>pg_publication_tables</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>pubname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
<entry>Name of publication</entry>
</row>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing table</entry>
</row>
<row>
<entry><structfield>tablename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of table</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-replication-origin-status">
<title><structname>pg_replication_origin_status</structname></title>
<indexterm zone="view-pg-replication-origin-status">
<primary>pg_replication_origin_status</primary>
</indexterm>
<para>
The <structname>pg_replication_origin_status</structname> view
contains information about how far replay for a certain origin has
progressed. For more on replication origins
see <xref linkend="replication-origins"/>.
</para>
<table>
<title><structname>pg_replication_origin_status</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>local_id</structfield></entry>
<entry><type>Oid</type></entry>
<entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
<entry>internal node identifier</entry>
</row>
<row>
<entry><structfield>external_id</structfield></entry>
<entry><type>text</type></entry>
<entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
<entry>external node identifier</entry>
</row>
<row>
<entry><structfield>remote_lsn</structfield></entry>
<entry><type>pg_lsn</type></entry>
<entry></entry>
<entry>The origin node's LSN up to which data has been replicated.</entry>
</row>
<row>
<entry><structfield>local_lsn</structfield></entry>
<entry><type>pg_lsn</type></entry>
<entry></entry>
<entry>
This node's LSN at which <literal>remote_lsn</literal> has
been replicated. Used to flush commit records before persisting
data to disk when using asynchronous commits.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-replication-slots">
<title><structname>pg_replication_slots</structname></title>
<indexterm zone="view-pg-replication-slots">
<primary>pg_replication_slots</primary>
</indexterm>
<para>
The <structname>pg_replication_slots</structname> view provides a listing
of all replication slots that currently exist on the database cluster,
along with their current state.
</para>
<para>
For more on replication slots,
see <xref linkend="streaming-replication-slots"/> and <xref linkend="logicaldecoding"/>.
</para>
<table>
<title><structname>pg_replication_slots</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>slot_name</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>A unique, cluster-wide identifier for the replication slot</entry>
</row>
<row>
<entry><structfield>plugin</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
</row>
<row>
<entry><structfield>slot_type</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>The slot type: <literal>physical</literal> or <literal>logical</literal></entry>
</row>
<row>
<entry><structfield>datoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
<entry>The OID of the database this slot is associated with, or
null. Only logical slots have an associated database.</entry>
</row>
<row>
<entry><structfield>database</structfield></entry>
<entry><type>text</type></entry>
<entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
<entry>The name of the database this slot is associated with, or
null. Only logical slots have an associated database.</entry>
</row>
<row>
<entry><structfield>temporary</structfield></entry>
<entry><type>boolean</type></entry>
<entry></entry>
<entry>True if this is a temporary replication slot. Temporary slots are
not saved to disk and are automatically dropped on error or when
the session has finished.</entry>
</row>
<row>
<entry><structfield>active</structfield></entry>
<entry><type>boolean</type></entry>
<entry></entry>
<entry>True if this slot is currently actively being used</entry>
</row>
<row>
<entry><structfield>active_pid</structfield></entry>
<entry><type>integer</type></entry>
<entry></entry>
<entry>The process ID of the session using this slot if the slot
is currently actively being used. <literal>NULL</literal> if
inactive.
</entry>
</row>
<row>
<entry><structfield>xmin</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>The oldest transaction that this slot needs the database to
retain. <literal>VACUUM</literal> cannot remove tuples deleted
by any later transaction.
</entry>
</row>
<row>
<entry><structfield>catalog_xmin</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>The oldest transaction affecting the system catalogs that this
slot needs the database to retain. <literal>VACUUM</literal> cannot
remove catalog tuples deleted by any later transaction.
</entry>
</row>
<row>
<entry><structfield>restart_lsn</structfield></entry>
<entry><type>pg_lsn</type></entry>
<entry></entry>
<entry>The address (<literal>LSN</literal>) of oldest WAL which still
might be required by the consumer of this slot and thus won't be
automatically removed during checkpoints. <literal>NULL</literal>
if the <literal>LSN</literal> of this slot has never been reserved.
</entry>
</row>
<row>
<entry><structfield>confirmed_flush_lsn</structfield></entry>
<entry><type>pg_lsn</type></entry>
<entry></entry>
<entry>The address (<literal>LSN</literal>) up to which the logical
slot's consumer has confirmed receiving data. Data older than this is
not available anymore. <literal>NULL</literal> for physical slots.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-roles">
<title><structname>pg_roles</structname></title>
<indexterm zone="view-pg-roles">
<primary>pg_roles</primary>
</indexterm>
<para>
The view <structname>pg_roles</structname> provides access to
information about database roles. This is simply a publicly
readable view of
<link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
that blanks out the password field.
</para>
<table>
<title><structname>pg_roles</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>rolname</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Role name</entry>
</row>
<row>
<entry><structfield>rolsuper</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Role has superuser privileges</entry>
</row>
<row>
<entry><structfield>rolinherit</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Role automatically inherits privileges of roles it is a
member of</entry>
</row>
<row>
<entry><structfield>rolcreaterole</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Role can create more roles</entry>
</row>
<row>
<entry><structfield>rolcreatedb</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Role can create databases</entry>
</row>
<row>
<entry><structfield>rolcanlogin</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
Role can log in. That is, this role can be given as the initial
session authorization identifier
</entry>
</row>
<row>
<entry><structfield>rolreplication</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
Role is a replication role. A replication role can initiate replication
connections and create and drop replication slots.
</entry>
</row>
<row>
<entry><structfield>rolconnlimit</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
For roles that can log in, this sets maximum number of concurrent
connections this role can make. -1 means no limit.
</entry>
</row>
<row>
<entry><structfield>rolpassword</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Not the password (always reads as <literal>********</literal>)</entry>
</row>
<row>
<entry><structfield>rolvaliduntil</structfield></entry>
<entry><type>timestamptz</type></entry>
<entry></entry>
<entry>Password expiry time (only used for password authentication);
null if no expiration</entry>
</row>
<row>
<entry><structfield>rolbypassrls</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
Role bypasses every row level security policy, see
<xref linkend="ddl-rowsecurity"/> for more information.
</entry>
</row>
<row>
<entry><structfield>rolconfig</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>Role-specific defaults for run-time configuration variables</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>ID of role</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-rules">
<title><structname>pg_rules</structname></title>
<indexterm zone="view-pg-rules">
<primary>pg_rules</primary>
</indexterm>
<para>
The view <structname>pg_rules</structname> provides access to
useful information about query rewrite rules.
</para>
<table>
<title><structname>pg_rules</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing table</entry>
</row>
<row>
<entry><structfield>tablename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of table the rule is for</entry>
</row>
<row>
<entry><structfield>rulename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
<entry>Name of rule</entry>
</row>
<row>
<entry><structfield>definition</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Rule definition (a reconstructed creation command)</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The <structname>pg_rules</structname> view excludes the <literal>ON SELECT</literal> rules
of views and materialized views; those can be seen in
<structname>pg_views</structname> and <structname>pg_matviews</structname>.
</para>
</sect1>
<sect1 id="view-pg-seclabels">
<title><structname>pg_seclabels</structname></title>
<indexterm zone="view-pg-seclabels">
<primary>pg_seclabels</primary>
</indexterm>
<para>
The view <structname>pg_seclabels</structname> provides information about
security labels. It as an easier-to-query version of the
<link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link> catalog.
</para>
<table>
<title><structname>pg_seclabels</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>objoid</structfield></entry>
<entry><type>oid</type></entry>
<entry>any OID column</entry>
<entry>The OID of the object this security label pertains to</entry>
</row>
<row>
<entry><structfield>classoid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
<entry>The OID of the system catalog this object appears in</entry>
</row>
<row>
<entry><structfield>objsubid</structfield></entry>
<entry><type>int4</type></entry>
<entry></entry>
<entry>
For a security label on a table column, this is the column number (the
<structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
the table itself). For all other object types, this column is
zero.
</entry>
</row>
<row>
<entry><structfield>objtype</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
The type of object to which this label applies, as text.
</entry>
</row>
<row>
<entry><structfield>objnamespace</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
<entry>
The OID of the namespace for this object, if applicable;
otherwise NULL.
</entry>
</row>
<row>
<entry><structfield>objname</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>
The name of the object to which this label applies, as text.
</entry>
</row>
<row>
<entry><structfield>provider</structfield></entry>
<entry><type>text</type></entry>
<entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
<entry>The label provider associated with this label.</entry>
</row>
<row>
<entry><structfield>label</structfield></entry>
<entry><type>text</type></entry>
<entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
<entry>The security label applied to this object.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-sequences">
<title><structname>pg_sequences</structname></title>
<indexterm zone="view-pg-sequences">
<primary>pg_sequences</primary>
</indexterm>
<para>
The view <structname>pg_sequences</structname> provides access to
useful information about each sequence in the database.
</para>
<table>
<title><structname>pg_sequences</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing sequence</entry>
</row>
<row>
<entry><structfield>sequencename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of sequence</entry>
</row>
<row>
<entry><structfield>sequenceowner</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
<entry>Name of sequence's owner</entry>
</row>
<row>
<entry><structfield>data_type</structfield></entry>
<entry><type>regtype</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_type</structname></link>.oid</literal></entry>
<entry>Data type of the sequence</entry>
</row>
<row>
<entry><structfield>start_value</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
<entry>Start value of the sequence</entry>
</row>
<row>
<entry><structfield>min_value</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
<entry>Minimum value of the sequence</entry>
</row>
<row>
<entry><structfield>max_value</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
<entry>Maximum value of the sequence</entry>
</row>
<row>
<entry><structfield>increment_by</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
<entry>Increment value of the sequence</entry>
</row>
<row>
<entry><structfield>cycle</structfield></entry>
<entry><type>boolean</type></entry>
<entry></entry>
<entry>Whether the sequence cycles</entry>
</row>
<row>
<entry><structfield>cache_size</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
<entry>Cache size of the sequence</entry>
</row>
<row>
<entry><structfield>last_value</structfield></entry>
<entry><type>bigint</type></entry>
<entry></entry>
<entry>The last sequence value written to disk. If caching is used,
this value can be greater than the last value handed out from the
sequence. Null if the sequence has not been read from yet. Also, if
the current user does not have <literal>USAGE</literal>
or <literal>SELECT</literal> privilege on the sequence, the value is
null.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-settings">
<title><structname>pg_settings</structname></title>
<indexterm zone="view-pg-settings">
<primary>pg_settings</primary>
</indexterm>
<para>
The view <structname>pg_settings</structname> provides access to
run-time parameters of the server. It is essentially an alternative
interface to the <xref linkend="sql-show"/>
and <xref linkend="sql-set"/> commands.
It also provides access to some facts about each parameter that are
not directly available from <command>SHOW</command>, such as minimum and
maximum values.
</para>
<table>
<title><structname>pg_settings</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>name</structfield></entry>
<entry><type>text</type></entry>
<entry>Run-time configuration parameter name</entry>
</row>
<row>
<entry><structfield>setting</structfield></entry>
<entry><type>text</type></entry>
<entry>Current value of the parameter</entry>
</row>
<row>
<entry><structfield>unit</structfield></entry>
<entry><type>text</type></entry>
<entry>Implicit unit of the parameter</entry>
</row>
<row>
<entry><structfield>category</structfield></entry>
<entry><type>text</type></entry>
<entry>Logical group of the parameter</entry>
</row>
<row>
<entry><structfield>short_desc</structfield></entry>
<entry><type>text</type></entry>
<entry>A brief description of the parameter</entry>
</row>
<row>
<entry><structfield>extra_desc</structfield></entry>
<entry><type>text</type></entry>
<entry>Additional, more detailed, description of the parameter</entry>
</row>
<row>
<entry><structfield>context</structfield></entry>
<entry><type>text</type></entry>
<entry>Context required to set the parameter's value (see below)</entry>
</row>
<row>
<entry><structfield>vartype</structfield></entry>
<entry><type>text</type></entry>
<entry>Parameter type (<literal>bool</literal>, <literal>enum</literal>,
<literal>integer</literal>, <literal>real</literal>, or <literal>string</literal>)
</entry>
</row>
<row>
<entry><structfield>source</structfield></entry>
<entry><type>text</type></entry>
<entry>Source of the current parameter value</entry>
</row>
<row>
<entry><structfield>min_val</structfield></entry>
<entry><type>text</type></entry>
<entry>Minimum allowed value of the parameter (null for non-numeric
values)</entry>
</row>
<row>
<entry><structfield>max_val</structfield></entry>
<entry><type>text</type></entry>
<entry>Maximum allowed value of the parameter (null for non-numeric
values)</entry>
</row>
<row>
<entry><structfield>enumvals</structfield></entry>
<entry><type>text[]</type></entry>
<entry>Allowed values of an enum parameter (null for non-enum
values)</entry>
</row>
<row>
<entry><structfield>boot_val</structfield></entry>
<entry><type>text</type></entry>
<entry>Parameter value assumed at server startup if the parameter is
not otherwise set</entry>
</row>
<row>
<entry><structfield>reset_val</structfield></entry>
<entry><type>text</type></entry>
<entry>Value that <command>RESET</command> would reset the parameter to
in the current session</entry>
</row>
<row>
<entry><structfield>sourcefile</structfield></entry>
<entry><type>text</type></entry>
<entry>Configuration file the current value was set in (null for
values set from sources other than configuration files, or when
examined by a user who is neither a superuser or a member of
<literal>pg_read_all_settings</literal>); helpful when using
<literal>include</literal> directives in configuration files</entry>
</row>
<row>
<entry><structfield>sourceline</structfield></entry>
<entry><type>integer</type></entry>
<entry>Line number within the configuration file the current value was
set at (null for values set from sources other than configuration files,
or when examined by a user who is neither a superuser or a member of
<literal>pg_read_all_settings</literal>).
</entry>
</row>
<row>
<entry><structfield>pending_restart</structfield></entry>
<entry><type>boolean</type></entry>
<entry><literal>true</literal> if the value has been changed in the
configuration file but needs a restart; or <literal>false</literal>
otherwise.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
There are several possible values of <structfield>context</structfield>.
In order of decreasing difficulty of changing the setting, they are:
</para>
<variablelist>
<varlistentry>
<!-- PGC_INTERNAL -->
<term><literal>internal</literal></term>
<listitem>
<para>
These settings cannot be changed directly; they reflect internally
determined values. Some of them may be adjustable by rebuilding the
server with different configuration options, or by changing options
supplied to <command>initdb</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<!-- PGC_POSTMASTER -->
<term><literal>postmaster</literal></term>
<listitem>
<para>
These settings can only be applied when the server starts, so any change
requires restarting the server. Values for these settings are typically
stored in the <filename>postgresql.conf</filename> file, or passed on
the command line when starting the server. Of course, settings with any
of the lower <structfield>context</structfield> types can also be
set at server start time.
</para>
</listitem>
</varlistentry>
<varlistentry>
<!-- PGC_SIGHUP -->
<term><literal>sighup</literal></term>
<listitem>
<para>
Changes to these settings can be made in
<filename>postgresql.conf</filename> without restarting the server.
Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
cause it to re-read <filename>postgresql.conf</filename> and apply
the changes. The postmaster will also forward the
<systemitem>SIGHUP</systemitem> signal to its child processes so that
they all pick up the new value.
</para>
</listitem>
</varlistentry>
<varlistentry>
<!-- PGC_SU_BACKEND -->
<term><literal>superuser-backend</literal></term>
<listitem>
<para>
Changes to these settings can be made in
<filename>postgresql.conf</filename> without restarting the server.
They can also be set for a particular session in the connection request
packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
environment variable), but only if the connecting user is a superuser.
However, these settings never change in a session after it is started.
If you change them in <filename>postgresql.conf</filename>, send a
<systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
re-read <filename>postgresql.conf</filename>. The new values will only
affect subsequently-launched sessions.
</para>
</listitem>
</varlistentry>
<varlistentry>
<!-- PGC_BACKEND -->
<term><literal>backend</literal></term>
<listitem>
<para>
Changes to these settings can be made in
<filename>postgresql.conf</filename> without restarting the server.
They can also be set for a particular session in the connection request
packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
environment variable); any user can make such a change for their session.
However, these settings never change in a session after it is started.
If you change them in <filename>postgresql.conf</filename>, send a
<systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
re-read <filename>postgresql.conf</filename>. The new values will only
affect subsequently-launched sessions.
</para>
</listitem>
</varlistentry>
<varlistentry>
<!-- PGC_SUSET -->
<term><literal>superuser</literal></term>
<listitem>
<para>
These settings can be set from <filename>postgresql.conf</filename>,
or within a session via the <command>SET</command> command; but only superusers
can change them via <command>SET</command>. Changes in
<filename>postgresql.conf</filename> will affect existing sessions
only if no session-local value has been established with <command>SET</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<!-- PGC_USERSET -->
<term><literal>user</literal></term>
<listitem>
<para>
These settings can be set from <filename>postgresql.conf</filename>,
or within a session via the <command>SET</command> command. Any user is
allowed to change their session-local value. Changes in
<filename>postgresql.conf</filename> will affect existing sessions
only if no session-local value has been established with <command>SET</command>.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
See <xref linkend="config-setting"/> for more information about the various
ways to change these parameters.
</para>
<para>
The <structname>pg_settings</structname> view cannot be inserted into or
deleted from, but it can be updated. An <command>UPDATE</command> applied
to a row of <structname>pg_settings</structname> is equivalent to executing
the <xref linkend="sql-set"/> command on that named
parameter. The change only affects the value used by the current
session. If an <command>UPDATE</command> is issued within a transaction
that is later aborted, the effects of the <command>UPDATE</command> command
disappear when the transaction is rolled back. Once the surrounding
transaction is committed, the effects will persist until the end of the
session, unless overridden by another <command>UPDATE</command> or
<command>SET</command>.
</para>
</sect1>
<sect1 id="view-pg-shadow">
<title><structname>pg_shadow</structname></title>
<indexterm zone="view-pg-shadow">
<primary>pg_shadow</primary>
</indexterm>
<para>
The view <structname>pg_shadow</structname> exists for backwards
compatibility: it emulates a catalog that existed in
<productname>PostgreSQL</productname> before version 8.1.
It shows properties of all roles that are marked as
<structfield>rolcanlogin</structfield> in
<link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
</para>
<para>
The name stems from the fact that this table
should not be readable by the public since it contains passwords.
<link linkend="view-pg-user"><structname>pg_user</structname></link>
is a publicly readable view on
<structname>pg_shadow</structname> that blanks out the password field.
</para>
<table>
<title><structname>pg_shadow</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>usename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
<entry>User name</entry>
</row>
<row>
<entry><structfield>usesysid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>ID of this user</entry>
</row>
<row>
<entry><structfield>usecreatedb</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>User can create databases</entry>
</row>
<row>
<entry><structfield>usesuper</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>User is a superuser</entry>
</row>
<row>
<entry><structfield>userepl</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
User can initiate streaming replication and put the system in and
out of backup mode.
</entry>
</row>
<row>
<entry><structfield>usebypassrls</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>
User bypasses every row level security policy, see
<xref linkend="ddl-rowsecurity"/> for more information.
</entry>
</row>
<row>
<entry><structfield>passwd</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>Password (possibly encrypted); null if none. See
<link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
for details of how encrypted passwords are stored.</entry>
</row>
<row>
<entry><structfield>valuntil</structfield></entry>
<entry><type>timestamptz</type></entry>
<entry></entry>
<entry>Password expiry time (only used for password authentication)</entry>
</row>
<row>
<entry><structfield>useconfig</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>Session defaults for run-time configuration variables</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-shmem-allocations">
<title><structname>pg_shmem_allocations</structname></title>
<indexterm zone="view-pg-shmem-allocations">
<primary>pg_shmem_allocations</primary>
</indexterm>
<para>
The <structname>pg_shmem_allocations</structname> view shows allocations
made from the server's main shared memory segment. This includes both
memory allocated by <productname>postgres</productname> itself and memory
allocated by extensions using the mechanisms detailed in
<xref linkend="xfunc-shared-addin" />.
</para>
<para>
Note that this view does not include memory allocated using the dynamic
shared memory infrastructure.
</para>
<table>
<title><structname>pg_shmem_allocations</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>name</structfield></entry>
<entry><type>text</type></entry>
<entry>The name of the shared memory allocation. NULL for unused memory
and <literal>&lt;anonymous&gt;</literal> for anonymous
allocations.</entry>
</row>
<row>
<entry><structfield>off</structfield></entry>
<entry><type>bigint</type></entry>
<entry>The offset at which the allocation starts. NULL for anonymous
allocations and unused memory.</entry>
</row>
<row>
<entry><structfield>size</structfield></entry>
<entry><type>bigint</type></entry>
<entry>Size of the allocation</entry>
</row>
<row>
<entry><structfield>allocated_size</structfield></entry>
<entry><type>bigint</type></entry>
<entry>Size of the allocation including padding. For anonymous
allocations, no information about padding is available, so the
<literal>size</literal> and <literal>allocated_size</literal> columns
will always be equal. Padding is not meaningful for free memory, so
the columns will be equal in that case also.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Anonymous allocations are allocations that have been made
with <literal>ShmemAlloc()</literal> directly, rather than via
<literal>ShmemInitStruct()</literal> or
<literal>ShmemInitHash()</literal>.
</para>
<para>
By default, the <structname>pg_shmem_allocations</structname> view can be
read only by superusers.
</para>
</sect1>
<sect1 id="view-pg-stats">
<title><structname>pg_stats</structname></title>
<indexterm zone="view-pg-stats">
<primary>pg_stats</primary>
</indexterm>
<para>
The view <structname>pg_stats</structname> provides access to
the information stored in the <link
linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
catalog. This view allows access only to rows of
<structname>pg_statistic</structname> that correspond to tables the
user has permission to read, and therefore it is safe to allow public
read access to this view.
</para>
<para>
<structname>pg_stats</structname> is also designed to present the
information in a more readable format than the underlying catalog
&mdash; at the cost that its schema must be extended whenever new slot types
are defined for <structname>pg_statistic</structname>.
</para>
<table>
<title><structname>pg_stats</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing table</entry>
</row>
<row>
<entry><structfield>tablename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of table</entry>
</row>
<row>
<entry><structfield>attname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
<entry>Name of the column described by this row</entry>
</row>
<row>
<entry><structfield>inherited</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>If true, this row includes inheritance child columns, not just the
values in the specified table</entry>
</row>
<row>
<entry><structfield>null_frac</structfield></entry>
<entry><type>real</type></entry>
<entry></entry>
<entry>Fraction of column entries that are null</entry>
</row>
<row>
<entry><structfield>avg_width</structfield></entry>
<entry><type>integer</type></entry>
<entry></entry>
<entry>Average width in bytes of column's entries</entry>
</row>
<row>
<entry><structfield>n_distinct</structfield></entry>
<entry><type>real</type></entry>
<entry></entry>
<entry>
If greater than zero, the estimated number of distinct values in the
column. If less than zero, the negative of the number of distinct
values divided by the number of rows. (The negated form is used when
<command>ANALYZE</command> believes that the number of distinct values is
likely to increase as the table grows; the positive form is used when
the column seems to have a fixed number of possible values.) For
example, -1 indicates a unique column in which the number of distinct
values is the same as the number of rows.
</entry>
</row>
<row>
<entry><structfield>most_common_vals</structfield></entry>
<entry><type>anyarray</type></entry>
<entry></entry>
<entry>
A list of the most common values in the column. (Null if
no values seem to be more common than any others.)
</entry>
</row>
<row>
<entry><structfield>most_common_freqs</structfield></entry>
<entry><type>real[]</type></entry>
<entry></entry>
<entry>
A list of the frequencies of the most common values,
i.e., number of occurrences of each divided by total number of rows.
(Null when <structfield>most_common_vals</structfield> is.)
</entry>
</row>
<row>
<entry><structfield>histogram_bounds</structfield></entry>
<entry><type>anyarray</type></entry>
<entry></entry>
<entry>
A list of values that divide the column's values into groups of
approximately equal population. The values in
<structfield>most_common_vals</structfield>, if present, are omitted from this
histogram calculation. (This column is null if the column data type
does not have a <literal>&lt;</literal> operator or if the
<structfield>most_common_vals</structfield> list accounts for the entire
population.)
</entry>
</row>
<row>
<entry><structfield>correlation</structfield></entry>
<entry><type>real</type></entry>
<entry></entry>
<entry>
Statistical correlation between physical row ordering and
logical ordering of the column values. This ranges from -1 to +1.
When the value is near -1 or +1, an index scan on the column will
be estimated to be cheaper than when it is near zero, due to reduction
of random access to the disk. (This column is null if the column data
type does not have a <literal>&lt;</literal> operator.)
</entry>
</row>
<row>
<entry><structfield>most_common_elems</structfield></entry>
<entry><type>anyarray</type></entry>
<entry></entry>
<entry>
A list of non-null element values most often appearing within values of
the column. (Null for scalar types.)
</entry>
</row>
<row>
<entry><structfield>most_common_elem_freqs</structfield></entry>
<entry><type>real[]</type></entry>
<entry></entry>
<entry>
A list of the frequencies of the most common element values, i.e., the
fraction of rows containing at least one instance of the given value.
Two or three additional values follow the per-element frequencies;
these are the minimum and maximum of the preceding per-element
frequencies, and optionally the frequency of null elements.
(Null when <structfield>most_common_elems</structfield> is.)
</entry>
</row>
<row>
<entry><structfield>elem_count_histogram</structfield></entry>
<entry><type>real[]</type></entry>
<entry></entry>
<entry>
A histogram of the counts of distinct non-null element values within the
values of the column, followed by the average number of distinct
non-null elements. (Null for scalar types.)
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The maximum number of entries in the array fields can be controlled on a
column-by-column basis using the <command>ALTER TABLE SET STATISTICS</command>
command, or globally by setting the
<xref linkend="guc-default-statistics-target"/> run-time parameter.
</para>
</sect1>
<sect1 id="view-pg-stats-ext">
<title><structname>pg_stats_ext</structname></title>
<indexterm zone="view-pg-stats-ext">
<primary>pg_stats_ext</primary>
</indexterm>
<para>
The view <structname>pg_stats_ext</structname> provides access to
the information stored in the <link
linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>
and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
catalogs. This view allows access only to rows of
<structname>pg_statistic_ext</structname> and <structname>pg_statistic_ext_data</structname>
that correspond to tables the user has permission to read, and therefore
it is safe to allow public read access to this view.
</para>
<para>
<structname>pg_stats_ext</structname> is also designed to present the
information in a more readable format than the underlying catalogs
&mdash; at the cost that its schema must be extended whenever new types
of extended statistics are added to <structname>pg_statistic_ext</structname>.
</para>
<table>
<title><structname>pg_stats_ext</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing table</entry>
</row>
<row>
<entry><structfield>tablename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of table</entry>
</row>
<row>
<entry><structfield>statistics_schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing extended statistic</entry>
</row>
<row>
<entry><structfield>statistics_name</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.stxname</literal></entry>
<entry>Name of extended statistics</entry>
</row>
<row>
<entry><structfield>statistics_owner</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>Owner of the extended statistics</entry>
</row>
<row>
<entry><structfield>attnames</structfield></entry>
<entry><type>name[]</type></entry>
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
<entry>Names of the columns the extended statistics is defined on</entry>
</row>
<row>
<entry><structfield>kinds</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>Types of extended statistics enabled for this record</entry>
</row>
<row>
<entry><structfield>n_distinct</structfield></entry>
<entry><type>pg_ndistinct</type></entry>
<entry></entry>
<entry>N-distinct counts for combinations of column values. If greater
than zero, the estimated number of distinct values in the combination.
If less than zero, the negative of the number of distinct values divided
by the number of rows.
(The negated form is used when <command>ANALYZE</command> believes that
the number of distinct values is likely to increase as the table grows;
the positive form is used when the column seems to have a fixed number
of possible values.) For example, -1 indicates a unique combination of
columns in which the number of distinct combinations is the same as the
number of rows.
</entry>
</row>
<row>
<entry><structfield>dependencies</structfield></entry>
<entry><type>pg_dependencies</type></entry>
<entry></entry>
<entry>Functional dependency statistics</entry>
</row>
<row>
<entry><structfield>most_common_vals</structfield></entry>
<entry><type>anyarray</type></entry>
<entry></entry>
<entry>
A list of the most common combinations of values in the columns.
(Null if no combinations seem to be more common than any others.)
</entry>
</row>
<row>
<entry><structfield>most_common_val_nulls</structfield></entry>
<entry><type>anyarray</type></entry>
<entry></entry>
<entry>
A list of NULL flags for the most common combinations of values.
(Null when <structfield>most_common_vals</structfield> is.)
</entry>
</row>
<row>
<entry><structfield>most_common_freqs</structfield></entry>
<entry><type>real[]</type></entry>
<entry></entry>
<entry>
A list of the frequencies of the most common combinations,
i.e., number of occurrences of each divided by total number of rows.
(Null when <structfield>most_common_vals</structfield> is.)
</entry>
</row>
<row>
<entry><structfield>most_common_base_freqs</structfield></entry>
<entry><type>real[]</type></entry>
<entry></entry>
<entry>
A list of the base frequencies of the most common combinations,
i.e., product of per-value frequencies.
(Null when <structfield>most_common_vals</structfield> is.)
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The maximum number of entries in the array fields can be controlled on a
column-by-column basis using the <command>ALTER TABLE SET STATISTICS</command>
command, or globally by setting the
<xref linkend="guc-default-statistics-target"/> run-time parameter.
</para>
</sect1>
<sect1 id="view-pg-tables">
<title><structname>pg_tables</structname></title>
<indexterm zone="view-pg-tables">
<primary>pg_tables</primary>
</indexterm>
<para>
The view <structname>pg_tables</structname> provides access to
useful information about each table in the database.
</para>
<table>
<title><structname>pg_tables</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing table</entry>
</row>
<row>
<entry><structfield>tablename</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of table</entry>
</row>
<row>
<entry><structfield>tableowner</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
<entry>Name of table's owner</entry>
</row>
<row>
<entry><structfield>tablespace</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
<entry>Name of tablespace containing table (null if default for database)</entry>
</row>
<row>
<entry><structfield>hasindexes</structfield></entry>
<entry><type>boolean</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
<entry>True if table has (or recently had) any indexes</entry>
</row>
<row>
<entry><structfield>hasrules</structfield></entry>
<entry><type>boolean</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
<entry>True if table has (or once had) rules</entry>
</row>
<row>
<entry><structfield>hastriggers</structfield></entry>
<entry><type>boolean</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
<entry>True if table has (or once had) triggers</entry>
</row>
<row>
<entry><structfield>rowsecurity</structfield></entry>
<entry><type>boolean</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
<entry>True if row security is enabled on the table</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-timezone-abbrevs">
<title><structname>pg_timezone_abbrevs</structname></title>
<indexterm zone="view-pg-timezone-abbrevs">
<primary>pg_timezone_abbrevs</primary>
</indexterm>
<para>
The view <structname>pg_timezone_abbrevs</structname> provides a list
of time zone abbreviations that are currently recognized by the datetime
input routines. The contents of this view change when the
<xref linkend="guc-timezone-abbreviations"/> run-time parameter is modified.
</para>
<table>
<title><structname>pg_timezone_abbrevs</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>abbrev</structfield></entry>
<entry><type>text</type></entry>
<entry>Time zone abbreviation</entry>
</row>
<row>
<entry><structfield>utc_offset</structfield></entry>
<entry><type>interval</type></entry>
<entry>Offset from UTC (positive means east of Greenwich)</entry>
</row>
<row>
<entry><structfield>is_dst</structfield></entry>
<entry><type>boolean</type></entry>
<entry>True if this is a daylight-savings abbreviation</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
While most timezone abbreviations represent fixed offsets from UTC,
there are some that have historically varied in value
(see <xref linkend="datetime-config-files"/> for more information).
In such cases this view presents their current meaning.
</para>
</sect1>
<sect1 id="view-pg-timezone-names">
<title><structname>pg_timezone_names</structname></title>
<indexterm zone="view-pg-timezone-names">
<primary>pg_timezone_names</primary>
</indexterm>
<para>
The view <structname>pg_timezone_names</structname> provides a list
of time zone names that are recognized by <command>SET TIMEZONE</command>,
along with their associated abbreviations, UTC offsets,
and daylight-savings status. (Technically,
<productname>PostgreSQL</productname> does not use UTC because leap
seconds are not handled.)
Unlike the abbreviations shown in <link
linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
date rules. Therefore, the associated information changes across local DST
boundaries. The displayed information is computed based on the current
value of <function>CURRENT_TIMESTAMP</function>.
</para>
<table>
<title><structname>pg_timezone_names</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>name</structfield></entry>
<entry><type>text</type></entry>
<entry>Time zone name</entry>
</row>
<row>
<entry><structfield>abbrev</structfield></entry>
<entry><type>text</type></entry>
<entry>Time zone abbreviation</entry>
</row>
<row>
<entry><structfield>utc_offset</structfield></entry>
<entry><type>interval</type></entry>
<entry>Offset from UTC (positive means east of Greenwich)</entry>
</row>
<row>
<entry><structfield>is_dst</structfield></entry>
<entry><type>boolean</type></entry>
<entry>True if currently observing daylight savings</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-user">
<title><structname>pg_user</structname></title>
<indexterm zone="view-pg-user">
<primary>pg_user</primary>
</indexterm>
<para>
The view <structname>pg_user</structname> provides access to
information about database users. This is simply a publicly
readable view of
<link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
that blanks out the password field.
</para>
<table>
<title><structname>pg_user</structname> Columns</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>usename</structfield></entry>
<entry><type>name</type></entry>
<entry>User name</entry>
</row>
<row>
<entry><structfield>usesysid</structfield></entry>
<entry><type>oid</type></entry>
<entry>ID of this user</entry>
</row>
<row>
<entry><structfield>usecreatedb</structfield></entry>
<entry><type>bool</type></entry>
<entry>User can create databases</entry>
</row>
<row>
<entry><structfield>usesuper</structfield></entry>
<entry><type>bool</type></entry>
<entry>User is a superuser</entry>
</row>
<row>
<entry><structfield>userepl</structfield></entry>
<entry><type>bool</type></entry>
<entry>
User can initiate streaming replication and put the system in and
out of backup mode.
</entry>
</row>
<row>
<entry><structfield>usebypassrls</structfield></entry>
<entry><type>bool</type></entry>
<entry>
User bypasses every row level security policy, see
<xref linkend="ddl-rowsecurity"/> for more information.
</entry>
</row>
<row>
<entry><structfield>passwd</structfield></entry>
<entry><type>text</type></entry>
<entry>Not the password (always reads as <literal>********</literal>)</entry>
</row>
<row>
<entry><structfield>valuntil</structfield></entry>
<entry><type>timestamptz</type></entry>
<entry>Password expiry time (only used for password authentication)</entry>
</row>
<row>
<entry><structfield>useconfig</structfield></entry>
<entry><type>text[]</type></entry>
<entry>Session defaults for run-time configuration variables</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-user-mappings">
<title><structname>pg_user_mappings</structname></title>
<indexterm zone="view-pg-user-mappings">
<primary>pg_user_mappings</primary>
</indexterm>
<para>
The view <structname>pg_user_mappings</structname> provides access
to information about user mappings. This is essentially a publicly
readable view of
<link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
that leaves out the options field if the user has no rights to use
it.
</para>
<table>
<title><structname>pg_user_mappings</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>umid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
<entry>OID of the user mapping</entry>
</row>
<row>
<entry><structfield>srvid</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
<entry>
The OID of the foreign server that contains this mapping
</entry>
</row>
<row>
<entry><structfield>srvname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
<entry>
Name of the foreign server
</entry>
</row>
<row>
<entry><structfield>umuser</structfield></entry>
<entry><type>oid</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
<entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
</row>
<row>
<entry><structfield>usename</structfield></entry>
<entry><type>name</type></entry>
<entry></entry>
<entry>Name of the local user to be mapped</entry>
</row>
<row>
<entry><structfield>umoptions</structfield></entry>
<entry><type>text[]</type></entry>
<entry></entry>
<entry>
User mapping specific options, as <quote>keyword=value</quote> strings
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
To protect password information stored as a user mapping option,
the <structfield>umoptions</structfield> column will read as null
unless one of the following applies:
<itemizedlist>
<listitem>
<para>
current user is the user being mapped, and owns the server or
holds <literal>USAGE</literal> privilege on it
</para>
</listitem>
<listitem>
<para>
current user is the server owner and mapping is for <literal>PUBLIC</literal>
</para>
</listitem>
<listitem>
<para>
current user is a superuser
</para>
</listitem>
</itemizedlist>
</para>
</sect1>
<sect1 id="view-pg-views">
<title><structname>pg_views</structname></title>
<indexterm zone="view-pg-views">
<primary>pg_views</primary>
</indexterm>
<para>
The view <structname>pg_views</structname> provides access to
useful information about each view in the database.
</para>
<table>
<title><structname>pg_views</structname> Columns</title>
<tgroup cols="4">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><structfield>schemaname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
<entry>Name of schema containing view</entry>
</row>
<row>
<entry><structfield>viewname</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
<entry>Name of view</entry>
</row>
<row>
<entry><structfield>viewowner</structfield></entry>
<entry><type>name</type></entry>
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
<entry>Name of view's owner</entry>
</row>
<row>
<entry><structfield>definition</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
<entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
</chapter>