📄 catalogs.sgml
字号:
the set. So the <structfield>atttypid</structfield> (see above) refers to the type returned by this query, but the actual length of this attribute is the length (size) of an <type>oid</type>. --- At least this is the theory. All this is probably quite broken these days. </entry> </row> <row> <entry><structfield>attalign</structfield></entry> <entry><type>char</type></entry> <entry></entry> <entry> A copy of <literal>pg_type.typalign</> 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. It is possible to change this column to enable or disable the constraint. </entry> </row> <row> <entry><structfield>atthasdef</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry> This column has a default value, in which case there will be a corresponding entry in the <structname>pg_attrdef</structname> catalog that actually defines the value. </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 may 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> </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 paths and those defined with <command>CREATE CAST</command>. </para> <table> <title><structfield>pg_cast</> 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>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 data types are binary compatible (that is, no run-time operation is needed to perform the cast). </entry> </row> <row> <entry><structfield>castcontext</structfield></entry> <entry><type>char</type></entry> <entry></entry> <entry> Indicates what contexts the cast may be invoked in. <literal>e</> means only as an explicit cast (using <literal>CAST</>, <literal>::</>, or function-call syntax). <literal>a</> means implicitly in assignment to a target column, as well as explicitly. <literal>i</> means implicitly in expressions, as well as the other cases. </entry> </row> </tbody> </tgroup> </table> </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, views, and some kinds of special relation; see <structfield>relkind</>. 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</> 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>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, if any (zero for indexes, which have no <structname>pg_type</> entry) </entry> </row> <row> <entry><structfield>relowner</structfield></entry> <entry><type>int4</type></entry> <entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usesysid</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 an index, the access method used (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; 0 if none</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 (size <symbol>BLCKSZ</symbol>). This is only an estimate used by the planner. It is updated by <command>VACUUM</command>, <command>ANALYZE</command>, and <command>CREATE INDEX</command>. </entry> </row> <row> <entry><structfield>reltuples</structfield></entry> <entry><type>float4</type></entry> <entry></entry> <entry> Number of rows in the table. This is only an estimate used by the planner. It is updated by <command>VACUUM</command>, <command>ANALYZE</command>, and <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>reltoastidxid</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry> <entry> For a TOAST table, the OID of its index. 0 if not a TOAST 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. This is set by <command>CREATE INDEX</command>, but not cleared immediately by <command>DROP INDEX</command>. <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the table has no 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>relkind</structfield></entry> <entry><type>char</type></entry> <entry></entry> <entry> <literal>r</> = ordinary table, <literal>i</> = index, <literal>S</> = sequence, <literal>v</> = view, <literal>c</> = composite type, <literal>s</> = special, <literal>t</> = TOAST table </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 check constraints on the table; see <structname>pg_constraint</structname> catalog </entry> </row> <row> <entry><structfield>reltriggers</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry> Number of triggers on the table; see <structname>pg_trigger</structname> catalog </entry> </row> <row> <entry><structfield>relukeys</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry>unused (<emphasis>not</emphasis> the number of unique keys)</entry> </row> <row> <entry><structfield>relfkeys</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry>unused (<emphasis>not</emphasis> the number of foreign keys on the table)</entry> </row> <row> <entry><structfield>relrefs</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry>unused</entry> </row> <row> <entry><structfield>relhasoids</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry> True if we generate an OID for each row of the relation. </entry> </row> <row> <entry><structfield>relhaspkey</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry> True if the table has (or once had) a primary key. </entry> </row> <row> <entry><structfield>relhasrules</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry>Table has rules; see <structname>pg_rewrite</structname> catalog </entry> </row> <row> <entry><structfield>relhassubclass</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry>At least one table inherits from this one</entry> </row> <row> <entry><structfield>relacl</structfield></entry> <entry><type>aclitem[]</type></entry> <entry></entry> <entry> Access privileges; see the descriptions of <command>GRANT</command> and <command>REVOKE</command> for details. </entry> </row> </tbody> </tgroup> </table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -