📄 catalogs.sgml
字号:
relationships between database objects. This information allows <command>DROP</> commands to find which other objects must be dropped by <command>DROP CASCADE</> or prevent dropping in the <command>DROP RESTRICT</> case. </para> <table> <title><structname>pg_depend</> 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</> and <structfield>classid</> 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</> and <structfield>refclassid</> 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 may not be dropped without also dropping the dependent object. However, there are several subflavors identified by <structfield>deptype</>: <variablelist> <varlistentry> <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term> <listitem> <para> A normal relationship between separately-created objects. The dependent object may be dropped without affecting the referenced object. The referenced object may only be dropped by specifying <literal>CASCADE</>, 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</> (<literal>a</>)</term> <listitem> <para> The dependent object can be dropped separately from the referenced object, and should be automatically dropped (regardless of <literal>RESTRICT</> or <literal>CASCADE</> mode) if the referenced object is dropped. Example: a named constraint on a table is made autodependent on the table, so that it will go away if the table is dropped. </para> </listitem> </varlistentry> <varlistentry> <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</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 <command>DROP</> of the dependent object will be disallowed outright (we'll tell the user to issue a <command>DROP</> against the referenced object, instead). A <command>DROP</> of the referenced object will be propagated through to drop the dependent object whether <command>CASCADE</> is specified or not. Example: a trigger that's created to enforce a foreign-key constraint is made internally dependent on the constraint's <structname>pg_constraint</> entry. </para> </listitem> </varlistentry> <varlistentry> <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</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 may be needed in future. </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</> can store an optional description or comment for each database object. Descriptions can be manipulated with the <command>COMMENT</command> 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> <table> <title><structname>pg_description</> 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</> and <structfield>classoid</> 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-group"> <title><structname>pg_group</structname></title> <indexterm zone="catalog-pg-group"> <primary>pg_group</primary> </indexterm> <para> The catalog <structname>pg_group</structname> defines groups and stores what users belong to what groups. Groups are created with the <command>CREATE GROUP</command> command. Consult <xref linkend="user-manag"> for information about user privilege management. </para> <para> Because user and group identities are cluster-wide, <structname>pg_group</structname> is shared across all databases of a cluster: there is only one copy of <structname>pg_group</structname> per cluster, not one per database. </para> <table> <title><structname>pg_group</> 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></entry> <entry>Name of the group</entry> </row> <row> <entry><structfield>grosysid</structfield></entry> <entry><type>int4</type></entry> <entry></entry> <entry>An arbitrary number to identify this group</entry> </row> <row> <entry><structfield>grolist</structfield></entry> <entry><type>int4[]</type></entry> <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</literal></entry> <entry>An array containing the IDs of the users in this group</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</> 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</> 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</> entry for the table this index is for</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> (up to <symbol>INDEX_MAX_KEYS</symbol>) 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 key. 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>indclass</structfield></entry> <entry><type>oidvector</type></entry> <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</entry> <entry> For each column in the index key this contains the OID of the operator class to use. See <structname>pg_opclass</structname> for details. </entry> </row> <row> <entry><structfield>indnatts</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry>The number of columns in the index (duplicates <literal>pg_class.relnatts</literal>)</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</> should always be true when this is 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>indexprs</structfield></entry> <entry><type>text</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</>. Null if all index attributes are simple references.</entry> </row> <row> <entry><structfield>indpred</structfield></entry> <entry><type>text</type></entry> <entr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -