1 <!-- doc/src/sgml/catalogs.sgml -->
3 Documentation of the system catalogs, directed toward PostgreSQL developers
6 <chapter id="catalogs">
7 <title>System Catalogs</title>
10 The system catalogs are the place where a relational database
11 management system stores schema metadata, such as information about
12 tables and columns, and internal bookkeeping information.
13 <productname>PostgreSQL</productname>'s system catalogs are regular
14 tables. You can drop and recreate the tables, add columns, insert
15 and update values, and severely mess up your system that way.
16 Normally, one should not change the system catalogs by hand, there
17 are always SQL commands to do that. (For example, <command>CREATE
18 DATABASE</command> inserts a row into the
19 <structname>pg_database</structname> catalog — and actually
20 creates the database on disk.) There are some exceptions for
21 particularly esoteric operations, such as adding index access methods.
24 <sect1 id="catalogs-overview">
25 <title>Overview</title>
28 <xref linkend="catalog-table"> lists the system catalogs.
29 More detailed documentation of each catalog follows below.
33 Most system catalogs are copied from the template database during
34 database creation and are thereafter database-specific. A few
35 catalogs are physically shared across all databases in a cluster;
36 these are noted in the descriptions of the individual catalogs.
39 <table id="catalog-table">
40 <title>System Catalogs</title>
45 <entry>Catalog Name</entry>
46 <entry>Purpose</entry>
52 <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
53 <entry>aggregate functions</entry>
57 <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
58 <entry>index access methods</entry>
62 <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
63 <entry>access method operators</entry>
67 <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
68 <entry>access method support procedures</entry>
72 <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
73 <entry>column default values</entry>
77 <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
78 <entry>table columns (<quote>attributes</quote>)</entry>
82 <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
83 <entry>authorization identifiers (roles)</entry>
87 <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
88 <entry>authorization identifier membership relationships</entry>
92 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
93 <entry>casts (data type conversions)</entry>
97 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
98 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
102 <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
103 <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
107 <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
108 <entry>collations (locale information)</entry>
112 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
113 <entry>encoding conversion information</entry>
117 <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
118 <entry>databases within this database cluster</entry>
122 <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
123 <entry>per-role and per-database settings</entry>
127 <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
128 <entry>default privileges for object types</entry>
132 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
133 <entry>dependencies between database objects</entry>
137 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
138 <entry>descriptions or comments on database objects</entry>
142 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
143 <entry>enum label and value definitions</entry>
147 <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
148 <entry>installed extensions</entry>
152 <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
153 <entry>foreign-data wrapper definitions</entry>
157 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
158 <entry>foreign server definitions</entry>
162 <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
163 <entry>additional foreign table information</entry>
167 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
168 <entry>additional index information</entry>
172 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
173 <entry>table inheritance hierarchy</entry>
177 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
178 <entry>languages for writing functions</entry>
182 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
183 <entry>data pages for large objects</entry>
187 <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
188 <entry>metadata for large objects</entry>
192 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
193 <entry>schemas</entry>
197 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
198 <entry>access method operator classes</entry>
202 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
203 <entry>operators</entry>
207 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
208 <entry>access method operator families</entry>
212 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
213 <entry>template data for procedural languages</entry>
217 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
218 <entry>functions and procedures</entry>
222 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
223 <entry>query rewrite rules</entry>
227 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
228 <entry>security labels on database objects</entry>
232 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
233 <entry>dependencies on shared objects</entry>
237 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
238 <entry>comments on shared objects</entry>
242 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
243 <entry>planner statistics</entry>
247 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
248 <entry>tablespaces within this database cluster</entry>
252 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
253 <entry>triggers</entry>
257 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
258 <entry>text search configurations</entry>
262 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
263 <entry>text search configurations' token mappings</entry>
267 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
268 <entry>text search dictionaries</entry>
272 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
273 <entry>text search parsers</entry>
277 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
278 <entry>text search templates</entry>
282 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
283 <entry>data types</entry>
287 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
288 <entry>mappings of users to foreign servers</entry>
296 <sect1 id="catalog-pg-aggregate">
297 <title><structname>pg_aggregate</structname></title>
299 <indexterm zone="catalog-pg-aggregate">
300 <primary>pg_aggregate</primary>
304 The catalog <structname>pg_aggregate</structname> stores information about
305 aggregate functions. An aggregate function is a function that
306 operates on a set of values (typically one column from each row
307 that matches a query condition) and returns a single value computed
308 from all these values. Typical aggregate functions are
309 <function>sum</function>, <function>count</function>, and
310 <function>max</function>. Each entry in
311 <structname>pg_aggregate</structname> is an extension of an entry
312 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
313 entry carries the aggregate's name, input and output data types, and
314 other information that is similar to ordinary functions.
318 <title><structname>pg_aggregate</> Columns</title>
325 <entry>References</entry>
326 <entry>Description</entry>
331 <entry><structfield>aggfnoid</structfield></entry>
332 <entry><type>regproc</type></entry>
333 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
334 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
337 <entry><structfield>aggtransfn</structfield></entry>
338 <entry><type>regproc</type></entry>
339 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
340 <entry>Transition function</entry>
343 <entry><structfield>aggfinalfn</structfield></entry>
344 <entry><type>regproc</type></entry>
345 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
346 <entry>Final function (zero if none)</entry>
349 <entry><structfield>aggsortop</structfield></entry>
350 <entry><type>oid</type></entry>
351 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
352 <entry>Associated sort operator (zero if none)</entry>
355 <entry><structfield>aggtranstype</structfield></entry>
356 <entry><type>oid</type></entry>
357 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
358 <entry>Data type of the aggregate function's internal transition (state) data</entry>
361 <entry><structfield>agginitval</structfield></entry>
362 <entry><type>text</type></entry>
365 The initial value of the transition state. This is a text
366 field containing the initial value in its external string
367 representation. If this field is null, the transition state
368 value starts out null.
376 New aggregate functions are registered with the <xref
377 linkend="sql-createaggregate">
378 command. See <xref linkend="xaggr"> for more information about
379 writing aggregate functions and the meaning of the transition
386 <sect1 id="catalog-pg-am">
387 <title><structname>pg_am</structname></title>
389 <indexterm zone="catalog-pg-am">
390 <primary>pg_am</primary>
394 The catalog <structname>pg_am</structname> stores information about index
395 access methods. There is one row for each index access method supported by
396 the system. The contents of this catalog are discussed in detail in
397 <xref linkend="indexam">.
401 <title><structname>pg_am</> Columns</title>
408 <entry>References</entry>
409 <entry>Description</entry>
415 <entry><structfield>amname</structfield></entry>
416 <entry><type>name</type></entry>
418 <entry>Name of the access method</entry>
422 <entry><structfield>amstrategies</structfield></entry>
423 <entry><type>int2</type></entry>
425 <entry>Number of operator strategies for this access method,
426 or zero if access method does not have a fixed set of operator
431 <entry><structfield>amsupport</structfield></entry>
432 <entry><type>int2</type></entry>
434 <entry>Number of support routines for this access method</entry>
438 <entry><structfield>amcanorder</structfield></entry>
439 <entry><type>bool</type></entry>
441 <entry>Does the access method support ordered scans sorted by the
442 indexed column's value?</entry>
446 <entry><structfield>amcanorderbyop</structfield></entry>
447 <entry><type>bool</type></entry>
449 <entry>Does the access method support ordered scans sorted by the result
450 of an operator on the indexed column?</entry>
454 <entry><structfield>amcanbackward</structfield></entry>
455 <entry><type>bool</type></entry>
457 <entry>Does the access method support backward scanning?</entry>
461 <entry><structfield>amcanunique</structfield></entry>
462 <entry><type>bool</type></entry>
464 <entry>Does the access method support unique indexes?</entry>
468 <entry><structfield>amcanmulticol</structfield></entry>
469 <entry><type>bool</type></entry>
471 <entry>Does the access method support multicolumn indexes?</entry>
475 <entry><structfield>amoptionalkey</structfield></entry>
476 <entry><type>bool</type></entry>
478 <entry>Does the access method support a scan without any constraint
479 for the first index column?</entry>
483 <entry><structfield>amsearchnulls</structfield></entry>
484 <entry><type>bool</type></entry>
486 <entry>Does the access method support <literal>IS NULL</>/<literal>NOT NULL</> searches?</entry>
490 <entry><structfield>amstorage</structfield></entry>
491 <entry><type>bool</type></entry>
493 <entry>Can index storage data type differ from column data type?</entry>
497 <entry><structfield>amclusterable</structfield></entry>
498 <entry><type>bool</type></entry>
500 <entry>Can an index of this type be clustered on?</entry>
504 <entry><structfield>ampredlocks</structfield></entry>
505 <entry><type>bool</type></entry>
507 <entry>Does an index of this type manage fine-grained predicate locks?</entry>
511 <entry><structfield>amkeytype</structfield></entry>
512 <entry><type>oid</type></entry>
513 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
514 <entry>Type of data stored in index, or zero if not a fixed type</entry>
518 <entry><structfield>aminsert</structfield></entry>
519 <entry><type>regproc</type></entry>
520 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
521 <entry><quote>Insert this tuple</quote> function</entry>
525 <entry><structfield>ambeginscan</structfield></entry>
526 <entry><type>regproc</type></entry>
527 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
528 <entry><quote>Prepare for index scan</quote> function</entry>
532 <entry><structfield>amgettuple</structfield></entry>
533 <entry><type>regproc</type></entry>
534 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
535 <entry><quote>Next valid tuple</quote> function, or zero if none</entry>
539 <entry><structfield>amgetbitmap</structfield></entry>
540 <entry><type>regproc</type></entry>
541 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
542 <entry><quote>Fetch all valid tuples</quote> function, or zero if none</entry>
546 <entry><structfield>amrescan</structfield></entry>
547 <entry><type>regproc</type></entry>
548 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
549 <entry><quote>(Re)start index scan</quote> function</entry>
553 <entry><structfield>amendscan</structfield></entry>
554 <entry><type>regproc</type></entry>
555 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
556 <entry><quote>Clean up after index scan</quote> function</entry>
560 <entry><structfield>ammarkpos</structfield></entry>
561 <entry><type>regproc</type></entry>
562 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
563 <entry><quote>Mark current scan position</quote> function</entry>
567 <entry><structfield>amrestrpos</structfield></entry>
568 <entry><type>regproc</type></entry>
569 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
570 <entry><quote>Restore marked scan position</quote> function</entry>
574 <entry><structfield>ambuild</structfield></entry>
575 <entry><type>regproc</type></entry>
576 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
577 <entry><quote>Build new index</quote> function</entry>
581 <entry><structfield>ambuildempty</structfield></entry>
582 <entry><type>regproc</type></entry>
583 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
584 <entry><quote>Build empty index</quote> function</entry>
588 <entry><structfield>ambulkdelete</structfield></entry>
589 <entry><type>regproc</type></entry>
590 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
591 <entry>Bulk-delete function</entry>
595 <entry><structfield>amvacuumcleanup</structfield></entry>
596 <entry><type>regproc</type></entry>
597 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
598 <entry>Post-<command>VACUUM</command> cleanup function</entry>
602 <entry><structfield>amcostestimate</structfield></entry>
603 <entry><type>regproc</type></entry>
604 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
605 <entry>Function to estimate cost of an index scan</entry>
609 <entry><structfield>amoptions</structfield></entry>
610 <entry><type>regproc</type></entry>
611 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
612 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
622 <sect1 id="catalog-pg-amop">
623 <title><structname>pg_amop</structname></title>
625 <indexterm zone="catalog-pg-amop">
626 <primary>pg_amop</primary>
630 The catalog <structname>pg_amop</structname> stores information about
631 operators associated with access method operator families. There is one
632 row for each operator that is a member of an operator family. A family
633 member can be either a <firstterm>search</> operator or an
634 <firstterm>ordering</> operator. An operator
635 can appear in more than one family, but cannot appear in more than one
636 search position nor more than one ordering position within a family.
637 (It is allowed, though unlikely, for an operator to be used for both
638 search and ordering purposes.)
642 <title><structname>pg_amop</> Columns</title>
649 <entry>References</entry>
650 <entry>Description</entry>
656 <entry><structfield>amopfamily</structfield></entry>
657 <entry><type>oid</type></entry>
658 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
659 <entry>The operator family this entry is for</entry>
663 <entry><structfield>amoplefttype</structfield></entry>
664 <entry><type>oid</type></entry>
665 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
666 <entry>Left-hand input data type of operator</entry>
670 <entry><structfield>amoprighttype</structfield></entry>
671 <entry><type>oid</type></entry>
672 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
673 <entry>Right-hand input data type of operator</entry>
677 <entry><structfield>amopstrategy</structfield></entry>
678 <entry><type>int2</type></entry>
680 <entry>Operator strategy number</entry>
684 <entry><structfield>amoppurpose</structfield></entry>
685 <entry><type>char</type></entry>
687 <entry>Operator purpose, either <literal>s</> for search or
688 <literal>o</> for ordering</entry>
692 <entry><structfield>amopopr</structfield></entry>
693 <entry><type>oid</type></entry>
694 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
695 <entry>OID of the operator</entry>
699 <entry><structfield>amopmethod</structfield></entry>
700 <entry><type>oid</type></entry>
701 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
702 <entry>Index access method operator family is for</entry>
706 <entry><structfield>amopsortfamily</structfield></entry>
707 <entry><type>oid</type></entry>
708 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
709 <entry>The btree operator family this entry sorts according to, if an
710 ordering operator; zero if a search operator</entry>
718 A <quote>search</> operator entry indicates that an index of this operator
719 family can be searched to find all rows satisfying
721 <replaceable>indexed_column</>
722 <replaceable>operator</>
723 <replaceable>constant</>.
724 Obviously, such an operator must return boolean, and its left-hand input
725 type must match the index's column data type.
729 An <quote>ordering</> operator entry indicates that an index of this
730 operator family can be scanned to return rows in the order represented by
732 <replaceable>indexed_column</>
733 <replaceable>operator</>
734 <replaceable>constant</>.
735 Such an operator could return any sortable data type, though again
736 its left-hand input type must match the index's column data type.
737 The exact semantics of the <literal>ORDER BY</> are specified by the
738 <structfield>amopsortfamily</structfield> column, which must reference
739 a btree operator family for the operator's result type.
744 At present, it's assumed that the sort order for an ordering operator
745 is the default for the referenced opfamily, i.e., <literal>ASC NULLS
746 LAST</>. This might someday be relaxed by adding additional columns
747 to specify sort options explicitly.
752 An entry's <structfield>amopmethod</> must match the
753 <structname>opfmethod</> of its containing operator family (including
754 <structfield>amopmethod</> here is an intentional denormalization of the
755 catalog structure for performance reasons). Also,
756 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
757 the <structfield>oprleft</> and <structfield>oprright</> fields of the
758 referenced <structname>pg_operator</> entry.
764 <sect1 id="catalog-pg-amproc">
765 <title><structname>pg_amproc</structname></title>
767 <indexterm zone="catalog-pg-amproc">
768 <primary>pg_amproc</primary>
772 The catalog <structname>pg_amproc</structname> stores information about
773 support procedures associated with access method operator families. There
774 is one row for each support procedure belonging to an operator family.
778 <title><structname>pg_amproc</structname> Columns</title>
785 <entry>References</entry>
786 <entry>Description</entry>
792 <entry><structfield>amprocfamily</structfield></entry>
793 <entry><type>oid</type></entry>
794 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
795 <entry>The operator family this entry is for</entry>
799 <entry><structfield>amproclefttype</structfield></entry>
800 <entry><type>oid</type></entry>
801 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
802 <entry>Left-hand input data type of associated operator</entry>
806 <entry><structfield>amprocrighttype</structfield></entry>
807 <entry><type>oid</type></entry>
808 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
809 <entry>Right-hand input data type of associated operator</entry>
813 <entry><structfield>amprocnum</structfield></entry>
814 <entry><type>int2</type></entry>
816 <entry>Support procedure number</entry>
820 <entry><structfield>amproc</structfield></entry>
821 <entry><type>regproc</type></entry>
822 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
823 <entry>OID of the procedure</entry>
831 The usual interpretation of the
832 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
833 is that they identify the left and right input types of the operator(s)
834 that a particular support procedure supports. For some access methods
835 these match the input data type(s) of the support procedure itself, for
836 others not. There is a notion of <quote>default</> support procedures for
837 an index, which are those with <structfield>amproclefttype</> and
838 <structfield>amprocrighttype</> both equal to the index opclass's
839 <structfield>opcintype</>.
845 <sect1 id="catalog-pg-attrdef">
846 <title><structname>pg_attrdef</structname></title>
848 <indexterm zone="catalog-pg-attrdef">
849 <primary>pg_attrdef</primary>
853 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
854 about columns is stored in <structname>pg_attribute</structname>
855 (see below). Only columns that explicitly specify a default value
856 (when the table is created or the column is added) will have an
861 <title><structname>pg_attrdef</> Columns</title>
868 <entry>References</entry>
869 <entry>Description</entry>
875 <entry><structfield>adrelid</structfield></entry>
876 <entry><type>oid</type></entry>
877 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
878 <entry>The table this column belongs to</entry>
882 <entry><structfield>adnum</structfield></entry>
883 <entry><type>int2</type></entry>
884 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
885 <entry>The number of the column</entry>
889 <entry><structfield>adbin</structfield></entry>
890 <entry><type>pg_node_tree</type></entry>
892 <entry>The internal representation of the column default value</entry>
896 <entry><structfield>adsrc</structfield></entry>
897 <entry><type>text</type></entry>
899 <entry>A human-readable representation of the default value</entry>
906 The <structfield>adsrc</structfield> field is historical, and is best
907 not used, because it does not track outside changes that might affect
908 the representation of the default value. Reverse-compiling the
909 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
910 example) is a better way to display the default value.
916 <sect1 id="catalog-pg-attribute">
917 <title><structname>pg_attribute</structname></title>
919 <indexterm zone="catalog-pg-attribute">
920 <primary>pg_attribute</primary>
924 The catalog <structname>pg_attribute</structname> stores information about
925 table columns. There will be exactly one
926 <structname>pg_attribute</structname> row for every column in every
927 table in the database. (There will also be attribute entries for
928 indexes, and indeed all objects that have <structname>pg_class</structname>
933 The term attribute is equivalent to column and is used for
938 <title><structname>pg_attribute</> Columns</title>
945 <entry>References</entry>
946 <entry>Description</entry>
952 <entry><structfield>attrelid</structfield></entry>
953 <entry><type>oid</type></entry>
954 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
955 <entry>The table this column belongs to</entry>
959 <entry><structfield>attname</structfield></entry>
960 <entry><type>name</type></entry>
962 <entry>The column name</entry>
966 <entry><structfield>atttypid</structfield></entry>
967 <entry><type>oid</type></entry>
968 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
969 <entry>The data type of this column</entry>
973 <entry><structfield>attstattarget</structfield></entry>
974 <entry><type>int4</type></entry>
977 <structfield>attstattarget</structfield> controls the level of detail
978 of statistics accumulated for this column by
979 <xref linkend="sql-analyze">.
980 A zero value indicates that no statistics should be collected.
981 A negative value says to use the system default statistics target.
982 The exact meaning of positive values is data type-dependent.
983 For scalar data types, <structfield>attstattarget</structfield>
984 is both the target number of <quote>most common values</quote>
985 to collect, and the target number of histogram bins to create.
990 <entry><structfield>attlen</structfield></entry>
991 <entry><type>int2</type></entry>
994 A copy of <literal>pg_type.typlen</literal> of this column's
1000 <entry><structfield>attnum</structfield></entry>
1001 <entry><type>int2</type></entry>
1004 The number of the column. Ordinary columns are numbered from 1
1005 up. System columns, such as <structfield>oid</structfield>,
1006 have (arbitrary) negative numbers.
1011 <entry><structfield>attndims</structfield></entry>
1012 <entry><type>int4</type></entry>
1015 Number of dimensions, if the column is an array type; otherwise 0.
1016 (Presently, the number of dimensions of an array is not enforced,
1017 so any nonzero value effectively means <quote>it's an array</>.)
1022 <entry><structfield>attcacheoff</structfield></entry>
1023 <entry><type>int4</type></entry>
1026 Always -1 in storage, but when loaded into a row descriptor
1027 in memory this might be updated to cache the offset of the attribute
1033 <entry><structfield>atttypmod</structfield></entry>
1034 <entry><type>int4</type></entry>
1037 <structfield>atttypmod</structfield> records type-specific data
1038 supplied at table creation time (for example, the maximum
1039 length of a <type>varchar</type> column). It is passed to
1040 type-specific input functions and length coercion functions.
1041 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1046 <entry><structfield>attbyval</structfield></entry>
1047 <entry><type>bool</type></entry>
1050 A copy of <literal>pg_type.typbyval</> of this column's type
1055 <entry><structfield>attstorage</structfield></entry>
1056 <entry><type>char</type></entry>
1059 Normally a copy of <literal>pg_type.typstorage</> of this
1060 column's type. For TOAST-able data types, this can be altered
1061 after column creation to control storage policy.
1066 <entry><structfield>attalign</structfield></entry>
1067 <entry><type>char</type></entry>
1070 A copy of <literal>pg_type.typalign</> of this column's type
1075 <entry><structfield>attnotnull</structfield></entry>
1076 <entry><type>bool</type></entry>
1079 This represents a not-null constraint. It is possible to
1080 change this column to enable or disable the constraint.
1085 <entry><structfield>atthasdef</structfield></entry>
1086 <entry><type>bool</type></entry>
1089 This column has a default value, in which case there will be a
1090 corresponding entry in the <structname>pg_attrdef</structname>
1091 catalog that actually defines the value.
1096 <entry><structfield>attisdropped</structfield></entry>
1097 <entry><type>bool</type></entry>
1100 This column has been dropped and is no longer valid. A dropped
1101 column is still physically present in the table, but is
1102 ignored by the parser and so cannot be accessed via SQL.
1107 <entry><structfield>attislocal</structfield></entry>
1108 <entry><type>bool</type></entry>
1111 This column is defined locally in the relation. Note that a column can
1112 be locally defined and inherited simultaneously.
1117 <entry><structfield>attinhcount</structfield></entry>
1118 <entry><type>int4</type></entry>
1121 The number of direct ancestors this column has. A column with a
1122 nonzero number of ancestors cannot be dropped nor renamed.
1127 <entry><structfield>attcollation</structfield></entry>
1128 <entry><type>oid</type></entry>
1129 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1131 The defined collation of the column, zero if the column does
1132 not have a collatable type.
1137 <entry><structfield>attacl</structfield></entry>
1138 <entry><type>aclitem[]</type></entry>
1141 Column-level access privileges, if any have been granted specifically
1147 <entry><structfield>attoptions</structfield></entry>
1148 <entry><type>text[]</type></entry>
1151 Attribute-level options, as <quote>keyword=value</> strings
1160 In a dropped column's <structname>pg_attribute</structname> entry,
1161 <structfield>atttypid</structfield> is reset to zero, but
1162 <structfield>attlen</structfield> and the other fields copied from
1163 <structname>pg_type</> are still valid. This arrangement is needed
1164 to cope with the situation where the dropped column's data type was
1165 later dropped, and so there is no <structname>pg_type</> row anymore.
1166 <structfield>attlen</structfield> and the other fields can be used
1167 to interpret the contents of a row of the table.
1172 <sect1 id="catalog-pg-authid">
1173 <title><structname>pg_authid</structname></title>
1175 <indexterm zone="catalog-pg-authid">
1176 <primary>pg_authid</primary>
1180 The catalog <structname>pg_authid</structname> contains information about
1181 database authorization identifiers (roles). A role subsumes the concepts
1182 of <quote>users</> and <quote>groups</>. A user is essentially just a
1183 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1184 without <structfield>rolcanlogin</>) can have other roles as members; see
1185 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1189 Since this catalog contains passwords, it must not be publicly readable.
1190 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1191 is a publicly readable view on
1192 <structname>pg_authid</structname> that blanks out the password field.
1196 <xref linkend="user-manag"> contains detailed information about user and
1197 privilege management.
1201 Because user identities are cluster-wide,
1202 <structname>pg_authid</structname>
1203 is shared across all databases of a cluster: there is only one
1204 copy of <structname>pg_authid</structname> per cluster, not
1209 <title><structname>pg_authid</> Columns</title>
1216 <entry>Description</entry>
1222 <entry><structfield>rolname</structfield></entry>
1223 <entry><type>name</type></entry>
1224 <entry>Role name</entry>
1228 <entry><structfield>rolsuper</structfield></entry>
1229 <entry><type>bool</type></entry>
1230 <entry>Role has superuser privileges</entry>
1234 <entry><structfield>rolinherit</structfield></entry>
1235 <entry><type>bool</type></entry>
1236 <entry>Role automatically inherits privileges of roles it is a
1241 <entry><structfield>rolcreaterole</structfield></entry>
1242 <entry><type>bool</type></entry>
1243 <entry>Role can create more roles</entry>
1247 <entry><structfield>rolcreatedb</structfield></entry>
1248 <entry><type>bool</type></entry>
1249 <entry>Role can create databases</entry>
1253 <entry><structfield>rolcatupdate</structfield></entry>
1254 <entry><type>bool</type></entry>
1256 Role can update system catalogs directly. (Even a superuser cannot do
1257 this unless this column is true)
1262 <entry><structfield>rolcanlogin</structfield></entry>
1263 <entry><type>bool</type></entry>
1265 Role can log in. That is, this role can be given as the initial
1266 session authorization identifier.
1271 <entry><structfield>rolreplication</structfield></entry>
1272 <entry><type>bool</type></entry>
1274 Role is a replication role. That is, this role can initiate streaming
1275 replication (see <xref linkend="streaming-replication">) and set/unset
1276 the system backup mode using <function>pg_start_backup</> and
1277 <function>pg_stop_backup</>.
1282 <entry><structfield>rolconnlimit</structfield></entry>
1283 <entry><type>int4</type></entry>
1285 For roles that can log in, this sets maximum number of concurrent
1286 connections this role can make. -1 means no limit.
1291 <entry><structfield>rolpassword</structfield></entry>
1292 <entry><type>text</type></entry>
1294 Password (possibly encrypted); null if none. If the password
1295 is encrypted, this column will begin with the string <literal>md5</>
1296 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1297 will be of the user's password concatenated to their username.
1298 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1299 <productname>PostgreSQL</> will store the md5 hash of
1300 <literal>xyzzyjoe</>. A password that does not follow that
1301 format is assumed to be unencrypted.
1306 <entry><structfield>rolvaliduntil</structfield></entry>
1307 <entry><type>timestamptz</type></entry>
1308 <entry>Password expiry time (only used for password authentication);
1309 null if no expiration</entry>
1318 <sect1 id="catalog-pg-auth-members">
1319 <title><structname>pg_auth_members</structname></title>
1321 <indexterm zone="catalog-pg-auth-members">
1322 <primary>pg_auth_members</primary>
1326 The catalog <structname>pg_auth_members</structname> shows the membership
1327 relations between roles. Any non-circular set of relationships is allowed.
1331 Because user identities are cluster-wide,
1332 <structname>pg_auth_members</structname>
1333 is shared across all databases of a cluster: there is only one
1334 copy of <structname>pg_auth_members</structname> per cluster, not
1339 <title><structname>pg_auth_members</> Columns</title>
1346 <entry>References</entry>
1347 <entry>Description</entry>
1353 <entry><structfield>roleid</structfield></entry>
1354 <entry><type>oid</type></entry>
1355 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1356 <entry>ID of a role that has a member</entry>
1360 <entry><structfield>member</structfield></entry>
1361 <entry><type>oid</type></entry>
1362 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1363 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1367 <entry><structfield>grantor</structfield></entry>
1368 <entry><type>oid</type></entry>
1369 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1370 <entry>ID of the role that granted this membership</entry>
1374 <entry><structfield>admin_option</structfield></entry>
1375 <entry><type>bool</type></entry>
1377 <entry>True if <structfield>member</> can grant membership in
1378 <structfield>roleid</> to others</entry>
1387 <sect1 id="catalog-pg-cast">
1388 <title><structname>pg_cast</structname></title>
1390 <indexterm zone="catalog-pg-cast">
1391 <primary>pg_cast</primary>
1395 The catalog <structname>pg_cast</structname> stores data type conversion
1396 paths, both built-in paths and those defined with
1397 <xref linkend="sql-createcast">.
1401 It should be noted that <structname>pg_cast</structname> does not represent
1402 every type conversion that the system knows how to perform; only those that
1403 cannot be deduced from some generic rule. For example, casting between a
1404 domain and its base type is not explicitly represented in
1405 <structname>pg_cast</structname>. Another important exception is that
1406 <quote>automatic I/O conversion casts</>, those performed using a data
1407 type's own I/O functions to convert to or from <type>text</> or other
1408 string types, are not explicitly represented in
1409 <structname>pg_cast</structname>.
1413 <title><structname>pg_cast</> Columns</title>
1420 <entry>References</entry>
1421 <entry>Description</entry>
1427 <entry><structfield>castsource</structfield></entry>
1428 <entry><type>oid</type></entry>
1429 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1430 <entry>OID of the source data type</entry>
1434 <entry><structfield>casttarget</structfield></entry>
1435 <entry><type>oid</type></entry>
1436 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1437 <entry>OID of the target data type</entry>
1441 <entry><structfield>castfunc</structfield></entry>
1442 <entry><type>oid</type></entry>
1443 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1445 The OID of the function to use to perform this cast. Zero is
1446 stored if the cast method doesn't require a function.
1451 <entry><structfield>castcontext</structfield></entry>
1452 <entry><type>char</type></entry>
1455 Indicates what contexts the cast can be invoked in.
1456 <literal>e</> means only as an explicit cast (using
1457 <literal>CAST</> or <literal>::</> syntax).
1458 <literal>a</> means implicitly in assignment
1459 to a target column, as well as explicitly.
1460 <literal>i</> means implicitly in expressions, as well as the
1465 <entry><structfield>castmethod</structfield></entry>
1466 <entry><type>char</type></entry>
1469 Indicates how the cast is performed.
1470 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1471 <literal>i</> means that the input/output functions are used.
1472 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1480 The cast functions listed in <structname>pg_cast</structname> must
1481 always take the cast source type as their first argument type, and
1482 return the cast destination type as their result type. A cast
1483 function can have up to three arguments. The second argument,
1484 if present, must be type <type>integer</>; it receives the type
1485 modifier associated with the destination type, or -1
1486 if there is none. The third argument,
1487 if present, must be type <type>boolean</>; it receives <literal>true</>
1488 if the cast is an explicit cast, <literal>false</> otherwise.
1492 It is legitimate to create a <structname>pg_cast</structname> entry
1493 in which the source and target types are the same, if the associated
1494 function takes more than one argument. Such entries represent
1495 <quote>length coercion functions</> that coerce values of the type
1496 to be legal for a particular type modifier value.
1500 When a <structname>pg_cast</structname> entry has different source and
1501 target types and a function that takes more than one argument, it
1502 represents converting from one type to another and applying a length
1503 coercion in a single step. When no such entry is available, coercion
1504 to a type that uses a type modifier involves two steps, one to
1505 convert between data types and a second to apply the modifier.
1509 <sect1 id="catalog-pg-class">
1510 <title><structname>pg_class</structname></title>
1512 <indexterm zone="catalog-pg-class">
1513 <primary>pg_class</primary>
1517 The catalog <structname>pg_class</structname> catalogs tables and most
1518 everything else that has columns or is otherwise similar to a
1519 table. This includes indexes (but see also
1520 <structname>pg_index</structname>), sequences, views, composite types,
1521 and TOAST tables; see <structfield>relkind</>.
1522 Below, when we mean all of these
1523 kinds of objects we speak of <quote>relations</quote>. Not all
1524 columns are meaningful for all relation types.
1528 <title><structname>pg_class</> Columns</title>
1535 <entry>References</entry>
1536 <entry>Description</entry>
1542 <entry><structfield>relname</structfield></entry>
1543 <entry><type>name</type></entry>
1545 <entry>Name of the table, index, view, etc.</entry>
1549 <entry><structfield>relnamespace</structfield></entry>
1550 <entry><type>oid</type></entry>
1551 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1553 The OID of the namespace that contains this relation
1558 <entry><structfield>reltype</structfield></entry>
1559 <entry><type>oid</type></entry>
1560 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1562 The OID of the data type that corresponds to this table's row type,
1563 if any (zero for indexes, which have no <structname>pg_type</> entry)
1568 <entry><structfield>reloftype</structfield></entry>
1569 <entry><type>oid</type></entry>
1570 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1572 For typed tables, the OID of the underlying composite type,
1573 zero for all other relations
1578 <entry><structfield>relowner</structfield></entry>
1579 <entry><type>oid</type></entry>
1580 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1581 <entry>Owner of the relation</entry>
1585 <entry><structfield>relam</structfield></entry>
1586 <entry><type>oid</type></entry>
1587 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1588 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1592 <entry><structfield>relfilenode</structfield></entry>
1593 <entry><type>oid</type></entry>
1595 <entry>Name of the on-disk file of this relation; zero means this
1596 is a <quote>mapped</> relation whose disk file name is determined
1597 by low-level state</entry>
1601 <entry><structfield>reltablespace</structfield></entry>
1602 <entry><type>oid</type></entry>
1603 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1605 The tablespace in which this relation is stored. If zero,
1606 the database's default tablespace is implied. (Not meaningful
1607 if the relation has no on-disk file.)
1612 <entry><structfield>relpages</structfield></entry>
1613 <entry><type>int4</type></entry>
1616 Size of the on-disk representation of this table in pages (of size
1617 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1618 planner. It is updated by <command>VACUUM</command>,
1619 <command>ANALYZE</command>, and a few DDL commands such as
1620 <command>CREATE INDEX</command>.
1625 <entry><structfield>reltuples</structfield></entry>
1626 <entry><type>float4</type></entry>
1629 Number of rows in the table. This is only an estimate used by the
1630 planner. It is updated by <command>VACUUM</command>,
1631 <command>ANALYZE</command>, and a few DDL commands such as
1632 <command>CREATE INDEX</command>.
1637 <entry><structfield>reltoastrelid</structfield></entry>
1638 <entry><type>oid</type></entry>
1639 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1641 OID of the TOAST table associated with this table, 0 if none. The
1642 TOAST table stores large attributes <quote>out of line</quote> in a
1648 <entry><structfield>reltoastidxid</structfield></entry>
1649 <entry><type>oid</type></entry>
1650 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1652 For a TOAST table, the OID of its index. 0 if not a TOAST table.
1657 <entry><structfield>relhasindex</structfield></entry>
1658 <entry><type>bool</type></entry>
1661 True if this is a table and it has (or recently had) any indexes
1666 <entry><structfield>relisshared</structfield></entry>
1667 <entry><type>bool</type></entry>
1670 True if this table is shared across all databases in the cluster. Only
1671 certain system catalogs (such as <structname>pg_database</structname>)
1677 <entry><structfield>relpersistence</structfield></entry>
1678 <entry><type>char</type></entry>
1681 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1682 <literal>t</> = temporary table
1687 <entry><structfield>relkind</structfield></entry>
1688 <entry><type>char</type></entry>
1691 <literal>r</> = ordinary table, <literal>i</> = index,
1692 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1693 composite type, <literal>t</> = TOAST table,
1694 <literal>f</> = foreign table
1699 <entry><structfield>relnatts</structfield></entry>
1700 <entry><type>int2</type></entry>
1703 Number of user columns in the relation (system columns not
1704 counted). There must be this many corresponding entries in
1705 <structname>pg_attribute</structname>. See also
1706 <literal>pg_attribute.attnum</literal>.
1711 <entry><structfield>relchecks</structfield></entry>
1712 <entry><type>int2</type></entry>
1715 Number of <literal>CHECK</> constraints on the table; see
1716 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1721 <entry><structfield>relhasoids</structfield></entry>
1722 <entry><type>bool</type></entry>
1725 True if we generate an OID for each row of the relation
1730 <entry><structfield>relhaspkey</structfield></entry>
1731 <entry><type>bool</type></entry>
1734 True if the table has (or once had) a primary key
1739 <entry><structfield>relhasrules</structfield></entry>
1740 <entry><type>bool</type></entry>
1743 True if table has (or once had) rules; see
1744 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1749 <entry><structfield>relhastriggers</structfield></entry>
1750 <entry><type>bool</type></entry>
1753 True if table has (or once had) triggers; see
1754 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1759 <entry><structfield>relhassubclass</structfield></entry>
1760 <entry><type>bool</type></entry>
1762 <entry>True if table has (or once had) any inheritance children</entry>
1766 <entry><structfield>relfrozenxid</structfield></entry>
1767 <entry><type>xid</type></entry>
1770 All transaction IDs before this one have been replaced with a permanent
1771 (<quote>frozen</>) transaction ID in this table. This is used to track
1772 whether the table needs to be vacuumed in order to prevent transaction
1773 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1774 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1779 <entry><structfield>relacl</structfield></entry>
1780 <entry><type>aclitem[]</type></entry>
1783 Access privileges; see
1784 <xref linkend="sql-grant"> and
1785 <xref linkend="sql-revoke">
1791 <entry><structfield>reloptions</structfield></entry>
1792 <entry><type>text[]</type></entry>
1795 Access-method-specific options, as <quote>keyword=value</> strings
1803 Several of the Boolean flags in <structname>pg_class</> are maintained
1804 lazily: they are guaranteed to be true if that's the correct state, but
1805 may not be reset to false immediately when the condition is no longer
1806 true. For example, <structfield>relhasindex</> is set by
1807 <command>CREATE INDEX</command>, but it is never cleared by
1808 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1809 <structfield>relhasindex</> if it finds the table has no indexes. This
1810 arrangement avoids race conditions and improves concurrency.
1814 <sect1 id="catalog-pg-constraint">
1815 <title><structname>pg_constraint</structname></title>
1817 <indexterm zone="catalog-pg-constraint">
1818 <primary>pg_constraint</primary>
1822 The catalog <structname>pg_constraint</structname> stores check, primary
1823 key, unique, foreign key, and exclusion constraints on tables.
1824 (Column constraints are not treated specially. Every column constraint is
1825 equivalent to some table constraint.)
1826 Not-null constraints are represented in the <structname>pg_attribute</>
1831 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
1832 TRIGGER</>) also give rise to an entry in this table.
1836 Check constraints on domains are stored here, too.
1840 <title><structname>pg_constraint</> Columns</title>
1847 <entry>References</entry>
1848 <entry>Description</entry>
1854 <entry><structfield>conname</structfield></entry>
1855 <entry><type>name</type></entry>
1857 <entry>Constraint name (not necessarily unique!)</entry>
1861 <entry><structfield>connamespace</structfield></entry>
1862 <entry><type>oid</type></entry>
1863 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1865 The OID of the namespace that contains this constraint
1870 <entry><structfield>contype</structfield></entry>
1871 <entry><type>char</type></entry>
1874 <literal>c</> = check constraint,
1875 <literal>f</> = foreign key constraint,
1876 <literal>p</> = primary key constraint,
1877 <literal>u</> = unique constraint,
1878 <literal>t</> = constraint trigger,
1879 <literal>x</> = exclusion constraint
1884 <entry><structfield>condeferrable</structfield></entry>
1885 <entry><type>bool</type></entry>
1887 <entry>Is the constraint deferrable?</entry>
1891 <entry><structfield>condeferred</structfield></entry>
1892 <entry><type>bool</type></entry>
1894 <entry>Is the constraint deferred by default?</entry>
1898 <entry><structfield>convalidated</structfield></entry>
1899 <entry><type>bool</type></entry>
1901 <entry>Has the constraint been validated? Can only be false for foreign keys</entry>
1905 <entry><structfield>conrelid</structfield></entry>
1906 <entry><type>oid</type></entry>
1907 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1908 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1912 <entry><structfield>contypid</structfield></entry>
1913 <entry><type>oid</type></entry>
1914 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1915 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1919 <entry><structfield>conindid</structfield></entry>
1920 <entry><type>oid</type></entry>
1921 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1922 <entry>The index supporting this constraint, if it's a unique, primary
1923 key, foreign key, or exclusion constraint; else 0</entry>
1927 <entry><structfield>confrelid</structfield></entry>
1928 <entry><type>oid</type></entry>
1929 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1930 <entry>If a foreign key, the referenced table; else 0</entry>
1934 <entry><structfield>confupdtype</structfield></entry>
1935 <entry><type>char</type></entry>
1937 <entry>Foreign key update action code:
1938 <literal>a</> = no action,
1939 <literal>r</> = restrict,
1940 <literal>c</> = cascade,
1941 <literal>n</> = set null,
1942 <literal>d</> = set default
1947 <entry><structfield>confdeltype</structfield></entry>
1948 <entry><type>char</type></entry>
1950 <entry>Foreign key deletion action code:
1951 <literal>a</> = no action,
1952 <literal>r</> = restrict,
1953 <literal>c</> = cascade,
1954 <literal>n</> = set null,
1955 <literal>d</> = set default
1960 <entry><structfield>confmatchtype</structfield></entry>
1961 <entry><type>char</type></entry>
1963 <entry>Foreign key match type:
1964 <literal>f</> = full,
1965 <literal>p</> = partial,
1966 <literal>u</> = simple (unspecified)
1971 <entry><structfield>conislocal</structfield></entry>
1972 <entry><type>bool</type></entry>
1975 This constraint is defined locally for the relation. Note that a
1976 constraint can be locally defined and inherited simultaneously.
1981 <entry><structfield>coninhcount</structfield></entry>
1982 <entry><type>int4</type></entry>
1985 The number of direct inheritance ancestors this constraint has.
1987 a nonzero number of ancestors cannot be dropped nor renamed.
1992 <entry><structfield>conkey</structfield></entry>
1993 <entry><type>int2[]</type></entry>
1994 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1995 <entry>If a table constraint (including foreign keys, but not constraint
1996 triggers), list of the constrained columns</entry>
2000 <entry><structfield>confkey</structfield></entry>
2001 <entry><type>int2[]</type></entry>
2002 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2003 <entry>If a foreign key, list of the referenced columns</entry>
2007 <entry><structfield>conpfeqop</structfield></entry>
2008 <entry><type>oid[]</type></entry>
2009 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2010 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2014 <entry><structfield>conppeqop</structfield></entry>
2015 <entry><type>oid[]</type></entry>
2016 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2017 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2021 <entry><structfield>conffeqop</structfield></entry>
2022 <entry><type>oid[]</type></entry>
2023 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2024 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2028 <entry><structfield>conexclop</structfield></entry>
2029 <entry><type>oid[]</type></entry>
2030 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2031 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2035 <entry><structfield>conbin</structfield></entry>
2036 <entry><type>pg_node_tree</type></entry>
2038 <entry>If a check constraint, an internal representation of the expression</entry>
2042 <entry><structfield>consrc</structfield></entry>
2043 <entry><type>text</type></entry>
2045 <entry>If a check constraint, a human-readable representation of the expression</entry>
2052 In the case of an exclusion constraint, <structfield>conkey</structfield>
2053 is only useful for constraint elements that are simple column references.
2054 For other cases, a zero appears in <structfield>conkey</structfield>
2055 and the associated index must be consulted to discover the expression
2056 that is constrained. (<structfield>conkey</structfield> thus has the
2057 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2063 <structfield>consrc</structfield> is not updated when referenced objects
2064 change; for example, it won't track renaming of columns. Rather than
2065 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2066 to extract the definition of a check constraint.
2072 <literal>pg_class.relchecks</literal> needs to agree with the
2073 number of check-constraint entries found in this table for each
2080 <sect1 id="catalog-pg-collation">
2081 <title><structname>pg_collation</structname></title>
2083 <indexterm zone="catalog-pg-collation">
2084 <primary>pg_collation</primary>
2088 The catalog <structname>pg_collation</structname> describes the
2089 available collations, which are essentially mappings from an SQL
2090 name to operating system locale categories.
2091 See <xref linkend="locale"> for more information.
2095 <title><structname>pg_collation</> Columns</title>
2102 <entry>References</entry>
2103 <entry>Description</entry>
2109 <entry><structfield>collname</structfield></entry>
2110 <entry><type>name</type></entry>
2112 <entry>Collation name (unique per namespace and encoding)</entry>
2116 <entry><structfield>collnamespace</structfield></entry>
2117 <entry><type>oid</type></entry>
2118 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2120 The OID of the namespace that contains this collation
2125 <entry><structfield>collowner</structfield></entry>
2126 <entry><type>oid</type></entry>
2127 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2128 <entry>Owner of the collation</entry>
2132 <entry><structfield>collencoding</structfield></entry>
2133 <entry><type>int4</type></entry>
2136 Encoding to which the collation is applicable. SQL-level
2137 commands such as <command>ALTER COLLATION</command> only
2138 operate on the collation belonging to the current database
2139 encoding. But this field is necessary because when this
2140 catalog is initialized, the encoding of future databases is not
2141 yet known. For practical purposes, collations that do not
2142 match the current database encoding should be considered
2143 invalid or invisible. It could be useful, however, to create
2144 collations whose encoding does not match the database encoding
2145 in template databases. This would currently have to be done
2151 <entry><structfield>collcollate</structfield></entry>
2152 <entry><type>name</type></entry>
2154 <entry>LC_COLLATE for this collation object</entry>
2158 <entry><structfield>collctype</structfield></entry>
2159 <entry><type>name</type></entry>
2161 <entry>LC_CTYPE for this collation object</entry>
2169 <sect1 id="catalog-pg-conversion">
2170 <title><structname>pg_conversion</structname></title>
2172 <indexterm zone="catalog-pg-conversion">
2173 <primary>pg_conversion</primary>
2177 The catalog <structname>pg_conversion</structname> describes
2178 encoding conversion procedures. See <xref linkend="sql-createconversion">
2179 for more information.
2183 <title><structname>pg_conversion</> Columns</title>
2190 <entry>References</entry>
2191 <entry>Description</entry>
2197 <entry><structfield>conname</structfield></entry>
2198 <entry><type>name</type></entry>
2200 <entry>Conversion name (unique within a namespace)</entry>
2204 <entry><structfield>connamespace</structfield></entry>
2205 <entry><type>oid</type></entry>
2206 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2208 The OID of the namespace that contains this conversion
2213 <entry><structfield>conowner</structfield></entry>
2214 <entry><type>oid</type></entry>
2215 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2216 <entry>Owner of the conversion</entry>
2220 <entry><structfield>conforencoding</structfield></entry>
2221 <entry><type>int4</type></entry>
2223 <entry>Source encoding ID</entry>
2227 <entry><structfield>contoencoding</structfield></entry>
2228 <entry><type>int4</type></entry>
2230 <entry>Destination encoding ID</entry>
2234 <entry><structfield>conproc</structfield></entry>
2235 <entry><type>regproc</type></entry>
2236 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2237 <entry>Conversion procedure</entry>
2241 <entry><structfield>condefault</structfield></entry>
2242 <entry><type>bool</type></entry>
2244 <entry>True if this is the default conversion</entry>
2253 <sect1 id="catalog-pg-database">
2254 <title><structname>pg_database</structname></title>
2256 <indexterm zone="catalog-pg-database">
2257 <primary>pg_database</primary>
2261 The catalog <structname>pg_database</structname> stores information about
2262 the available databases. Databases are created with the <xref
2263 linkend="sql-createdatabase"> command.
2264 Consult <xref linkend="managing-databases"> for details about the meaning
2265 of some of the parameters.
2269 Unlike most system catalogs, <structname>pg_database</structname>
2270 is shared across all databases of a cluster: there is only one
2271 copy of <structname>pg_database</structname> per cluster, not
2276 <title><structname>pg_database</> Columns</title>
2283 <entry>References</entry>
2284 <entry>Description</entry>
2290 <entry><structfield>datname</structfield></entry>
2291 <entry><type>name</type></entry>
2293 <entry>Database name</entry>
2297 <entry><structfield>datdba</structfield></entry>
2298 <entry><type>oid</type></entry>
2299 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2300 <entry>Owner of the database, usually the user who created it</entry>
2304 <entry><structfield>encoding</structfield></entry>
2305 <entry><type>int4</type></entry>
2307 <entry>Character encoding for this database
2308 (<function>pg_encoding_to_char()</function> can translate
2309 this number to the encoding name)</entry>
2313 <entry><structfield>datcollate</structfield></entry>
2314 <entry><type>name</type></entry>
2316 <entry>LC_COLLATE for this database</entry>
2320 <entry><structfield>datctype</structfield></entry>
2321 <entry><type>name</type></entry>
2323 <entry>LC_CTYPE for this database</entry>
2327 <entry><structfield>datistemplate</structfield></entry>
2328 <entry><type>bool</type></entry>
2331 If true then this database can be used in the
2332 <literal>TEMPLATE</literal> clause of <command>CREATE
2333 DATABASE</command> to create a new database as a clone of
2339 <entry><structfield>datallowconn</structfield></entry>
2340 <entry><type>bool</type></entry>
2343 If false then no one can connect to this database. This is
2344 used to protect the <literal>template0</> database from being altered.
2349 <entry><structfield>datconnlimit</structfield></entry>
2350 <entry><type>int4</type></entry>
2353 Sets maximum number of concurrent connections that can be made
2354 to this database. -1 means no limit.
2359 <entry><structfield>datlastsysoid</structfield></entry>
2360 <entry><type>oid</type></entry>
2363 Last system OID in the database; useful
2364 particularly to <application>pg_dump</application>
2369 <entry><structfield>datfrozenxid</structfield></entry>
2370 <entry><type>xid</type></entry>
2373 All transaction IDs before this one have been replaced with a permanent
2374 (<quote>frozen</>) transaction ID in this database. This is used to
2375 track whether the database needs to be vacuumed in order to prevent
2376 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2377 It is the minimum of the per-table
2378 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2383 <entry><structfield>dattablespace</structfield></entry>
2384 <entry><type>oid</type></entry>
2385 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2387 The default tablespace for the database.
2388 Within this database, all tables for which
2389 <structname>pg_class</>.<structfield>reltablespace</> is zero
2390 will be stored in this tablespace; in particular, all the non-shared
2391 system catalogs will be there.
2396 <entry><structfield>datacl</structfield></entry>
2397 <entry><type>aclitem[]</type></entry>
2400 Access privileges; see
2401 <xref linkend="sql-grant"> and
2402 <xref linkend="sql-revoke">
2412 <sect1 id="catalog-pg-db-role-setting">
2413 <title><structname>pg_db_role_setting</structname></title>
2415 <indexterm zone="catalog-pg-db-role-setting">
2416 <primary>pg_db_role_setting</primary>
2420 The catalog <structname>pg_db_role_setting</structname> records the default
2421 values that have been set for run-time configuration variables,
2422 for each role and database combination.
2426 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2427 is shared across all databases of a cluster: there is only one
2428 copy of <structname>pg_db_role_setting</structname> per cluster, not
2433 <title><structname>pg_db_role_setting</> Columns</title>
2440 <entry>References</entry>
2441 <entry>Description</entry>
2447 <entry><structfield>setdatabase</structfield></entry>
2448 <entry><type>oid</type></entry>
2449 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2450 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2454 <entry><structfield>setrole</structfield></entry>
2455 <entry><type>oid</type></entry>
2456 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2457 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2461 <entry><structfield>setconfig</structfield></entry>
2462 <entry><type>text[]</type></entry>
2464 <entry>Defaults for run-time configuration variables</entry>
2472 <sect1 id="catalog-pg-default-acl">
2473 <title><structname>pg_default_acl</structname></title>
2475 <indexterm zone="catalog-pg-default-acl">
2476 <primary>pg_default_acl</primary>
2480 The catalog <structname>pg_default_acl</> stores initial
2481 privileges to be assigned to newly created objects.
2485 <title><structname>pg_default_acl</> Columns</title>
2492 <entry>References</entry>
2493 <entry>Description</entry>
2499 <entry><structfield>defaclrole</structfield></entry>
2500 <entry><type>oid</type></entry>
2501 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2502 <entry>The OID of the role associated with this entry</entry>
2506 <entry><structfield>defaclnamespace</structfield></entry>
2507 <entry><type>oid</type></entry>
2508 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2509 <entry>The OID of the namespace associated with this entry,
2510 or 0 if none</entry>
2514 <entry><structfield>defaclobjtype</structfield></entry>
2515 <entry><type>char</type></entry>
2518 Type of object this entry is for:
2519 <literal>r</> = relation (table, view),
2520 <literal>S</> = sequence,
2521 <literal>f</> = function
2526 <entry><structfield>defaclacl</structfield></entry>
2527 <entry><type>aclitem[]</type></entry>
2530 Access privileges that this type of object should have on creation
2538 A <structname>pg_default_acl</> entry shows the initial privileges to
2539 be assigned to an object belonging to the indicated user. There are
2540 currently two types of entry: <quote>global</> entries with
2541 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2542 that reference a particular schema. If a global entry is present then
2543 it <emphasis>overrides</> the normal hard-wired default privileges
2544 for the object type. A per-schema entry, if present, represents privileges
2545 to be <emphasis>added to</> the global or hard-wired default privileges.
2549 Note that when an ACL entry in another catalog is null, it is taken
2550 to represent the hard-wired default privileges for its object,
2551 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2552 at the moment. <structname>pg_default_acl</> is only consulted during
2559 <sect1 id="catalog-pg-depend">
2560 <title><structname>pg_depend</structname></title>
2562 <indexterm zone="catalog-pg-depend">
2563 <primary>pg_depend</primary>
2567 The catalog <structname>pg_depend</structname> records the dependency
2568 relationships between database objects. This information allows
2569 <command>DROP</> commands to find which other objects must be dropped
2570 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2575 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2576 which performs a similar function for dependencies involving objects
2577 that are shared across a database cluster.
2581 <title><structname>pg_depend</> Columns</title>
2588 <entry>References</entry>
2589 <entry>Description</entry>
2595 <entry><structfield>classid</structfield></entry>
2596 <entry><type>oid</type></entry>
2597 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2598 <entry>The OID of the system catalog the dependent object is in</entry>
2602 <entry><structfield>objid</structfield></entry>
2603 <entry><type>oid</type></entry>
2604 <entry>any OID column</entry>
2605 <entry>The OID of the specific dependent object</entry>
2609 <entry><structfield>objsubid</structfield></entry>
2610 <entry><type>int4</type></entry>
2613 For a table column, this is the column number (the
2614 <structfield>objid</> and <structfield>classid</> refer to the
2615 table itself). For all other object types, this column is
2621 <entry><structfield>refclassid</structfield></entry>
2622 <entry><type>oid</type></entry>
2623 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2624 <entry>The OID of the system catalog the referenced object is in</entry>
2628 <entry><structfield>refobjid</structfield></entry>
2629 <entry><type>oid</type></entry>
2630 <entry>any OID column</entry>
2631 <entry>The OID of the specific referenced object</entry>
2635 <entry><structfield>refobjsubid</structfield></entry>
2636 <entry><type>int4</type></entry>
2639 For a table column, this is the column number (the
2640 <structfield>refobjid</> and <structfield>refclassid</> refer
2641 to the table itself). For all other object types, this column
2647 <entry><structfield>deptype</structfield></entry>
2648 <entry><type>char</type></entry>
2651 A code defining the specific semantics of this dependency relationship; see text
2660 In all cases, a <structname>pg_depend</structname> entry indicates that the
2661 referenced object cannot be dropped without also dropping the dependent
2662 object. However, there are several subflavors identified by
2663 <structfield>deptype</>:
2667 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2670 A normal relationship between separately-created objects. The
2671 dependent object can be dropped without affecting the
2672 referenced object. The referenced object can only be dropped
2673 by specifying <literal>CASCADE</>, in which case the dependent
2674 object is dropped, too. Example: a table column has a normal
2675 dependency on its data type.
2681 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2684 The dependent object can be dropped separately from the
2685 referenced object, and should be automatically dropped
2686 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2687 mode) if the referenced object is dropped. Example: a named
2688 constraint on a table is made autodependent on the table, so
2689 that it will go away if the table is dropped.
2695 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2698 The dependent object was created as part of creation of the
2699 referenced object, and is really just a part of its internal
2700 implementation. A <command>DROP</> of the dependent object
2701 will be disallowed outright (we'll tell the user to issue a
2702 <command>DROP</> against the referenced object, instead). A
2703 <command>DROP</> of the referenced object will be propagated
2704 through to drop the dependent object whether
2705 <command>CASCADE</> is specified or not. Example: a trigger
2706 that's created to enforce a foreign-key constraint is made
2707 internally dependent on the constraint's
2708 <structname>pg_constraint</> entry.
2714 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2717 The dependent object is a member of the <firstterm>extension</> that is
2718 the referenced object (see
2719 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2720 The dependent object can be dropped only via
2721 <command>DROP EXTENSION</> on the referenced object. Functionally
2722 this dependency type acts the same as an internal dependency, but
2723 it's kept separate for clarity and to simplify <application>pg_dump</>.
2729 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2732 There is no dependent object; this type of entry is a signal
2733 that the system itself depends on the referenced object, and so
2734 that object must never be deleted. Entries of this type are
2735 created only by <command>initdb</command>. The columns for the
2736 dependent object contain zeroes.
2742 Other dependency flavors might be needed in future.
2748 <sect1 id="catalog-pg-description">
2749 <title><structname>pg_description</structname></title>
2751 <indexterm zone="catalog-pg-description">
2752 <primary>pg_description</primary>
2756 The catalog <structname>pg_description</> stores optional descriptions
2757 (comments) for each database object. Descriptions can be manipulated
2758 with the <xref linkend="sql-comment"> command and viewed with
2759 <application>psql</application>'s <literal>\d</literal> commands.
2760 Descriptions of many built-in system objects are provided in the initial
2761 contents of <structname>pg_description</structname>.
2765 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2766 which performs a similar function for descriptions involving objects that
2767 are shared across a database cluster.
2771 <title><structname>pg_description</> Columns</title>
2778 <entry>References</entry>
2779 <entry>Description</entry>
2785 <entry><structfield>objoid</structfield></entry>
2786 <entry><type>oid</type></entry>
2787 <entry>any OID column</entry>
2788 <entry>The OID of the object this description pertains to</entry>
2792 <entry><structfield>classoid</structfield></entry>
2793 <entry><type>oid</type></entry>
2794 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2795 <entry>The OID of the system catalog this object appears in</entry>
2799 <entry><structfield>objsubid</structfield></entry>
2800 <entry><type>int4</type></entry>
2803 For a comment on a table column, this is the column number (the
2804 <structfield>objoid</> and <structfield>classoid</> refer to
2805 the table itself). For all other object types, this column is
2811 <entry><structfield>description</structfield></entry>
2812 <entry><type>text</type></entry>
2814 <entry>Arbitrary text that serves as the description of this object</entry>
2823 <sect1 id="catalog-pg-enum">
2824 <title><structname>pg_enum</structname></title>
2826 <indexterm zone="catalog-pg-enum">
2827 <primary>pg_enum</primary>
2831 The <structname>pg_enum</structname> catalog contains entries
2832 showing the values and labels for each enum type. The
2833 internal representation of a given enum value is actually the OID
2834 of its associated row in <structname>pg_enum</structname>.
2838 <title><structname>pg_enum</> Columns</title>
2845 <entry>References</entry>
2846 <entry>Description</entry>
2852 <entry><structfield>enumtypid</structfield></entry>
2853 <entry><type>oid</type></entry>
2854 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2855 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2859 <entry><structfield>enumsortorder</structfield></entry>
2860 <entry><type>float4</type></entry>
2862 <entry>The sort position of this enum value within its enum type</entry>
2866 <entry><structfield>enumlabel</structfield></entry>
2867 <entry><type>name</type></entry>
2869 <entry>The textual label for this enum value</entry>
2876 The OIDs for <structname>pg_enum</structname> rows follow a special
2877 rule: even-numbered OIDs are guaranteed to be ordered in the same way
2878 as the sort ordering of their enum type. That is, if two even OIDs
2879 belong to the same enum type, the smaller OID must have the smaller
2880 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
2881 need bear no relationship to the sort order. This rule allows the
2882 enum comparison routines to avoid catalog lookups in many common cases.
2883 The routines that create and alter enum types attempt to assign even
2884 OIDs to enum values whenever possible.
2888 When an enum type is created, its members are assigned sort-order
2889 positions 1..<replaceable>n</>. But members added later might be given
2890 negative or fractional values of <structfield>enumsortorder</structfield>.
2891 The only requirement on these values is that they be correctly
2892 ordered and unique within each enum type.
2897 <sect1 id="catalog-pg-extension">
2898 <title><structname>pg_extension</structname></title>
2900 <indexterm zone="catalog-pg-extension">
2901 <primary>pg_extension</primary>
2905 The catalog <structname>pg_extension</structname> stores information
2906 about the installed extensions. See <xref linkend="extend-extensions">
2907 for details about extensions.
2911 <title><structname>pg_extension</> Columns</title>
2918 <entry>References</entry>
2919 <entry>Description</entry>
2925 <entry><structfield>extname</structfield></entry>
2926 <entry><type>name</type></entry>
2928 <entry>Name of the extension</entry>
2932 <entry><structfield>extowner</structfield></entry>
2933 <entry><type>oid</type></entry>
2934 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2935 <entry>Owner of the extension</entry>
2939 <entry><structfield>extnamespace</structfield></entry>
2940 <entry><type>oid</type></entry>
2941 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2942 <entry>Schema containing the extension's exported objects</entry>
2946 <entry><structfield>extrelocatable</structfield></entry>
2947 <entry><type>bool</type></entry>
2949 <entry>True if extension can be relocated to another schema</entry>
2953 <entry><structfield>extversion</structfield></entry>
2954 <entry><type>text</type></entry>
2956 <entry>Version name for the extension</entry>
2960 <entry><structfield>extconfig</structfield></entry>
2961 <entry><type>oid[]</type></entry>
2962 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2963 <entry>Array of <type>regclass</> OIDs for the extension's configuration
2964 table(s), or <literal>NULL</> if none</entry>
2968 <entry><structfield>extcondition</structfield></entry>
2969 <entry><type>text[]</type></entry>
2971 <entry>Array of <literal>WHERE</>-clause filter conditions for the
2972 extension's configuration table(s), or <literal>NULL</> if none</entry>
2980 Note that unlike most catalogs with a <quote>namespace</> column,
2981 <structfield>extnamespace</structfield> is not meant to imply
2982 that the extension belongs to that schema. Extension names are never
2983 schema-qualified. Rather, <structfield>extnamespace</structfield>
2984 indicates the schema that contains most or all of the extension's
2985 objects. If <structfield>extrelocatable</structfield> is true, then
2986 this schema must in fact contain all schema-qualifiable objects
2987 belonging to the extension.
2992 <sect1 id="catalog-pg-foreign-data-wrapper">
2993 <title><structname>pg_foreign_data_wrapper</structname></title>
2995 <indexterm zone="catalog-pg-foreign-data-wrapper">
2996 <primary>pg_foreign_data_wrapper</primary>
3000 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3001 foreign-data wrapper definitions. A foreign-data wrapper is the
3002 mechanism by which external data, residing on foreign servers, is
3007 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3014 <entry>References</entry>
3015 <entry>Description</entry>
3021 <entry><structfield>fdwname</structfield></entry>
3022 <entry><type>name</type></entry>
3024 <entry>Name of the foreign-data wrapper</entry>
3028 <entry><structfield>fdwowner</structfield></entry>
3029 <entry><type>oid</type></entry>
3030 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3031 <entry>Owner of the foreign-data wrapper</entry>
3035 <entry><structfield>fdwhandler</structfield></entry>
3036 <entry><type>oid</type></entry>
3037 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3039 References a handler function that is responsible for
3040 supplying execution routines for the foreign-data wrapper.
3041 Zero if no handler is provided
3046 <entry><structfield>fdwvalidator</structfield></entry>
3047 <entry><type>oid</type></entry>
3048 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3050 References a validator function that is responsible for
3051 checking the validity of the options given to the
3052 foreign-data wrapper, as well as options for foreign servers and user
3053 mappings using the foreign-data wrapper. Zero if no validator
3059 <entry><structfield>fdwacl</structfield></entry>
3060 <entry><type>aclitem[]</type></entry>
3063 Access privileges; see
3064 <xref linkend="sql-grant"> and
3065 <xref linkend="sql-revoke">
3071 <entry><structfield>fdwoptions</structfield></entry>
3072 <entry><type>text[]</type></entry>
3075 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3084 <sect1 id="catalog-pg-foreign-server">
3085 <title><structname>pg_foreign_server</structname></title>
3087 <indexterm zone="catalog-pg-foreign-server">
3088 <primary>pg_foreign_server</primary>
3092 The catalog <structname>pg_foreign_server</structname> stores
3093 foreign server definitions. A foreign server describes a source
3094 of external data, such as a remote server. Foreign
3095 servers are accessed via foreign-data wrappers.
3099 <title><structname>pg_foreign_server</> Columns</title>
3106 <entry>References</entry>
3107 <entry>Description</entry>
3113 <entry><structfield>srvname</structfield></entry>
3114 <entry><type>name</type></entry>
3116 <entry>Name of the foreign server</entry>
3120 <entry><structfield>srvowner</structfield></entry>
3121 <entry><type>oid</type></entry>
3122 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3123 <entry>Owner of the foreign server</entry>
3127 <entry><structfield>srvfdw</structfield></entry>
3128 <entry><type>oid</type></entry>
3129 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3130 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3134 <entry><structfield>srvtype</structfield></entry>
3135 <entry><type>text</type></entry>
3137 <entry>Type of the server (optional)</entry>
3141 <entry><structfield>srvversion</structfield></entry>
3142 <entry><type>text</type></entry>
3144 <entry>Version of the server (optional)</entry>
3148 <entry><structfield>srvacl</structfield></entry>
3149 <entry><type>aclitem[]</type></entry>
3152 Access privileges; see
3153 <xref linkend="sql-grant"> and
3154 <xref linkend="sql-revoke">
3160 <entry><structfield>srvoptions</structfield></entry>
3161 <entry><type>text[]</type></entry>
3164 Foreign server specific options, as <quote>keyword=value</> strings
3173 <sect1 id="catalog-pg-foreign-table">
3174 <title><structname>pg_foreign_table</structname></title>
3176 <indexterm zone="catalog-pg-foreign-table">
3177 <primary>pg_foreign_table</primary>
3181 The catalog <structname>pg_foreign_table</structname> contains
3182 auxiliary information about foreign tables. A foreign table is
3183 primarily represented by a <structname>pg_class</structname> entry,
3184 just like a regular table. Its <structname>pg_foreign_table</structname>
3185 entry contains the information that is pertinent only to foreign tables
3186 and not any other kind of relation.
3190 <title><structname>pg_foreign_table</> Columns</title>
3197 <entry>References</entry>
3198 <entry>Description</entry>
3204 <entry><structfield>ftrelid</structfield></entry>
3205 <entry><type>oid</type></entry>
3206 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3207 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3211 <entry><structfield>ftserver</structfield></entry>
3212 <entry><type>oid</type></entry>
3213 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3214 <entry>OID of the foreign server for this foreign table</entry>
3218 <entry><structfield>ftoptions</structfield></entry>
3219 <entry><type>text[]</type></entry>
3222 Foreign table options, as <quote>keyword=value</> strings
3231 <sect1 id="catalog-pg-index">
3232 <title><structname>pg_index</structname></title>
3234 <indexterm zone="catalog-pg-index">
3235 <primary>pg_index</primary>
3239 The catalog <structname>pg_index</structname> contains part of the information
3240 about indexes. The rest is mostly in
3241 <structname>pg_class</structname>.
3245 <title><structname>pg_index</> Columns</title>
3252 <entry>References</entry>
3253 <entry>Description</entry>
3259 <entry><structfield>indexrelid</structfield></entry>
3260 <entry><type>oid</type></entry>
3261 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3262 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3266 <entry><structfield>indrelid</structfield></entry>
3267 <entry><type>oid</type></entry>
3268 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3269 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3273 <entry><structfield>indnatts</structfield></entry>
3274 <entry><type>int2</type></entry>
3276 <entry>The number of columns in the index (duplicates
3277 <literal>pg_class.relnatts</literal>)</entry>
3281 <entry><structfield>indisunique</structfield></entry>
3282 <entry><type>bool</type></entry>
3284 <entry>If true, this is a unique index</entry>
3288 <entry><structfield>indisprimary</structfield></entry>
3289 <entry><type>bool</type></entry>
3291 <entry>If true, this index represents the primary key of the table
3292 (<structfield>indisunique</> should always be true when this is true)</entry>
3296 <entry><structfield>indisexclusion</structfield></entry>
3297 <entry><type>bool</type></entry>
3299 <entry>If true, this index supports an exclusion constraint</entry>
3303 <entry><structfield>indimmediate</structfield></entry>
3304 <entry><type>bool</type></entry>
3306 <entry>If true, the uniqueness check is enforced immediately on
3308 (irrelevant if <structfield>indisunique</> is not true)</entry>
3312 <entry><structfield>indisclustered</structfield></entry>
3313 <entry><type>bool</type></entry>
3315 <entry>If true, the table was last clustered on this index</entry>
3319 <entry><structfield>indisvalid</structfield></entry>
3320 <entry><type>bool</type></entry>
3323 If true, the index is currently valid for queries. False means the
3324 index is possibly incomplete: it must still be modified by
3325 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3326 be used for queries. If it is unique, the uniqueness property is not
3332 <entry><structfield>indcheckxmin</structfield></entry>
3333 <entry><type>bool</type></entry>
3336 If true, queries must not use the index until the <structfield>xmin</>
3337 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3338 event horizon, because the table may contain broken HOT chains with
3339 incompatible rows that they can see
3344 <entry><structfield>indisready</structfield></entry>
3345 <entry><type>bool</type></entry>
3348 If true, the index is currently ready for inserts. False means the
3349 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3355 <entry><structfield>indkey</structfield></entry>
3356 <entry><type>int2vector</type></entry>
3357 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3359 This is an array of <structfield>indnatts</structfield> values that
3360 indicate which table columns this index indexes. For example a value
3361 of <literal>1 3</literal> would mean that the first and the third table
3362 columns make up the index key. A zero in this array indicates that the
3363 corresponding index attribute is an expression over the table columns,
3364 rather than a simple column reference.
3369 <entry><structfield>indcollation</structfield></entry>
3370 <entry><type>oidvector</type></entry>
3371 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3373 For each column in the index key, this contains the OID of the
3374 collation to use for the index.
3379 <entry><structfield>indclass</structfield></entry>
3380 <entry><type>oidvector</type></entry>
3381 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3383 For each column in the index key, this contains the OID of
3384 the operator class to use. See
3385 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3390 <entry><structfield>indoption</structfield></entry>
3391 <entry><type>int2vector</type></entry>
3394 This is an array of <structfield>indnatts</structfield> values that
3395 store per-column flag bits. The meaning of the bits is defined by
3396 the index's access method.
3401 <entry><structfield>indexprs</structfield></entry>
3402 <entry><type>pg_node_tree</type></entry>
3405 Expression trees (in <function>nodeToString()</function>
3406 representation) for index attributes that are not simple column
3407 references. This is a list with one element for each zero
3408 entry in <structfield>indkey</>. Null if all index attributes
3409 are simple references.
3414 <entry><structfield>indpred</structfield></entry>
3415 <entry><type>pg_node_tree</type></entry>
3418 Expression tree (in <function>nodeToString()</function>
3419 representation) for partial index predicate. Null if not a
3430 <sect1 id="catalog-pg-inherits">
3431 <title><structname>pg_inherits</structname></title>
3433 <indexterm zone="catalog-pg-inherits">
3434 <primary>pg_inherits</primary>
3438 The catalog <structname>pg_inherits</> records information about
3439 table inheritance hierarchies. There is one entry for each direct
3440 child table in the database. (Indirect inheritance can be determined
3441 by following chains of entries.)
3445 <title><structname>pg_inherits</> Columns</title>
3452 <entry>References</entry>
3453 <entry>Description</entry>
3459 <entry><structfield>inhrelid</structfield></entry>
3460 <entry><type>oid</type></entry>
3461 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3463 The OID of the child table
3468 <entry><structfield>inhparent</structfield></entry>
3469 <entry><type>oid</type></entry>
3470 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3472 The OID of the parent table
3477 <entry><structfield>inhseqno</structfield></entry>
3478 <entry><type>int4</type></entry>
3481 If there is more than one direct parent for a child table (multiple
3482 inheritance), this number tells the order in which the
3483 inherited columns are to be arranged. The count starts at 1.
3493 <sect1 id="catalog-pg-language">
3494 <title><structname>pg_language</structname></title>
3496 <indexterm zone="catalog-pg-language">
3497 <primary>pg_language</primary>
3501 The catalog <structname>pg_language</structname> registers
3502 languages in which you can write functions or stored procedures.
3503 See <xref linkend="sql-createlanguage">
3504 and <xref linkend="xplang"> for more information about language handlers.
3508 <title><structname>pg_language</> Columns</title>
3515 <entry>References</entry>
3516 <entry>Description</entry>
3522 <entry><structfield>lanname</structfield></entry>
3523 <entry><type>name</type></entry>
3525 <entry>Name of the language</entry>
3529 <entry><structfield>lanowner</structfield></entry>
3530 <entry><type>oid</type></entry>
3531 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3532 <entry>Owner of the language</entry>
3536 <entry><structfield>lanispl</structfield></entry>
3537 <entry><type>bool</type></entry>
3540 This is false for internal languages (such as
3541 <acronym>SQL</acronym>) and true for user-defined languages.
3542 Currently, <application>pg_dump</application> still uses this
3543 to determine which languages need to be dumped, but this might be
3544 replaced by a different mechanism in the future.
3549 <entry><structfield>lanpltrusted</structfield></entry>
3550 <entry><type>bool</type></entry>
3553 True if this is a trusted language, which means that it is believed
3554 not to grant access to anything outside the normal SQL execution
3555 environment. Only superusers can create functions in untrusted
3561 <entry><structfield>lanplcallfoid</structfield></entry>
3562 <entry><type>oid</type></entry>
3563 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3565 For noninternal languages this references the language
3566 handler, which is a special function that is responsible for
3567 executing all functions that are written in the particular
3573 <entry><structfield>laninline</structfield></entry>
3574 <entry><type>oid</type></entry>
3575 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3577 This references a function that is responsible for executing
3578 <quote>inline</> anonymous code blocks
3579 (<xref linkend="sql-do"> blocks).
3580 Zero if inline blocks are not supported.
3585 <entry><structfield>lanvalidator</structfield></entry>
3586 <entry><type>oid</type></entry>
3587 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3589 This references a language validator function that is responsible
3590 for checking the syntax and validity of new functions when they
3591 are created. Zero if no validator is provided.
3596 <entry><structfield>lanacl</structfield></entry>
3597 <entry><type>aclitem[]</type></entry>
3600 Access privileges; see
3601 <xref linkend="sql-grant"> and
3602 <xref linkend="sql-revoke">
3613 <sect1 id="catalog-pg-largeobject">
3614 <title><structname>pg_largeobject</structname></title>
3616 <indexterm zone="catalog-pg-largeobject">
3617 <primary>pg_largeobject</primary>
3621 The catalog <structname>pg_largeobject</structname> holds the data making up
3622 <quote>large objects</quote>. A large object is identified by an OID
3623 assigned when it is created. Each large object is broken into
3624 segments or <quote>pages</> small enough to be conveniently stored as rows
3625 in <structname>pg_largeobject</structname>.
3626 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
3627 <literal>BLCKSZ/4</>, or typically 2 kB).
3631 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
3632 associated with large objects. As a result,
3633 <structname>pg_largeobject</structname> was publicly readable and could be
3634 used to obtain the OIDs (and contents) of all large objects in the system.
3635 This is no longer the case; use
3636 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
3637 to obtain a list of large object OIDs.
3641 <title><structname>pg_largeobject</> Columns</title>
3648 <entry>References</entry>
3649 <entry>Description</entry>
3655 <entry><structfield>loid</structfield></entry>
3656 <entry><type>oid</type></entry>
3657 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
3658 <entry>Identifier of the large object that includes this page</entry>
3662 <entry><structfield>pageno</structfield></entry>
3663 <entry><type>int4</type></entry>
3665 <entry>Page number of this page within its large object
3666 (counting from zero)</entry>
3670 <entry><structfield>data</structfield></entry>
3671 <entry><type>bytea</type></entry>
3674 Actual data stored in the large object.
3675 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
3683 Each row of <structname>pg_largeobject</structname> holds data
3684 for one page of a large object, beginning at
3685 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
3686 allows sparse storage: pages might be missing, and might be shorter than
3687 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
3688 Missing regions within a large object read as zeroes.
3693 <sect1 id="catalog-pg-largeobject-metadata">
3694 <title><structname>pg_largeobject_metadata</structname></title>
3696 <indexterm zone="catalog-pg-largeobject-metadata">
3697 <primary>pg_largeobject_metadata</primary>
3701 The catalog <structname>pg_largeobject_metadata</structname>
3702 holds metadata associated with large objects. The actual large object
3704 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
3708 <title><structname>pg_largeobject_metadata</> Columns</title>
3715 <entry>References</entry>
3716 <entry>Description</entry>
3722 <entry><structfield>lomowner</structfield></entry>
3723 <entry><type>oid</type></entry>
3724 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3725 <entry>Owner of the large object</entry>
3729 <entry><structfield>lomacl</structfield></entry>
3730 <entry><type>aclitem[]</type></entry>
3733 Access privileges; see
3734 <xref linkend="sql-grant"> and
3735 <xref linkend="sql-revoke">
3745 <sect1 id="catalog-pg-namespace">
3746 <title><structname>pg_namespace</structname></title>
3748 <indexterm zone="catalog-pg-namespace">
3749 <primary>pg_namespace</primary>
3753 The catalog <structname>pg_namespace</> stores namespaces.
3754 A namespace is the structure underlying SQL schemas: each namespace
3755 can have a separate collection of relations, types, etc. without name
3760 <title><structname>pg_namespace</> Columns</title>
3767 <entry>References</entry>
3768 <entry>Description</entry>
3774 <entry><structfield>nspname</structfield></entry>
3775 <entry><type>name</type></entry>
3777 <entry>Name of the namespace</entry>
3781 <entry><structfield>nspowner</structfield></entry>
3782 <entry><type>oid</type></entry>
3783 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3784 <entry>Owner of the namespace</entry>
3788 <entry><structfield>nspacl</structfield></entry>
3789 <entry><type>aclitem[]</type></entry>
3792 Access privileges; see
3793 <xref linkend="sql-grant"> and
3794 <xref linkend="sql-revoke">
3805 <sect1 id="catalog-pg-opclass">
3806 <title><structname>pg_opclass</structname></title>
3808 <indexterm zone="catalog-pg-opclass">
3809 <primary>pg_opclass</primary>
3813 The catalog <structname>pg_opclass</structname> defines
3814 index access method operator classes. Each operator class defines
3815 semantics for index columns of a particular data type and a particular
3816 index access method. An operator class essentially specifies that a
3817 particular operator family is applicable to a particular indexable column
3818 data type. The set of operators from the family that are actually usable
3819 with the indexed column are whichever ones accept the column's data type
3820 as their lefthand input.
3824 Operator classes are described at length in <xref linkend="xindex">.
3828 <title><structname>pg_opclass</> Columns</title>
3835 <entry>References</entry>
3836 <entry>Description</entry>
3842 <entry><structfield>opcmethod</structfield></entry>
3843 <entry><type>oid</type></entry>
3844 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3845 <entry>Index access method operator class is for</entry>
3849 <entry><structfield>opcname</structfield></entry>
3850 <entry><type>name</type></entry>
3852 <entry>Name of this operator class</entry>
3856 <entry><structfield>opcnamespace</structfield></entry>
3857 <entry><type>oid</type></entry>
3858 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3859 <entry>Namespace of this operator class</entry>
3863 <entry><structfield>opcowner</structfield></entry>
3864 <entry><type>oid</type></entry>
3865 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3866 <entry>Owner of the operator class</entry>
3870 <entry><structfield>opcfamily</structfield></entry>
3871 <entry><type>oid</type></entry>
3872 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3873 <entry>Operator family containing the operator class</entry>
3877 <entry><structfield>opcintype</structfield></entry>
3878 <entry><type>oid</type></entry>
3879 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3880 <entry>Data type that the operator class indexes</entry>
3884 <entry><structfield>opcdefault</structfield></entry>
3885 <entry><type>bool</type></entry>
3887 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3891 <entry><structfield>opckeytype</structfield></entry>
3892 <entry><type>oid</type></entry>
3893 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3894 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3902 An operator class's <structfield>opcmethod</> must match the
3903 <structname>opfmethod</> of its containing operator family.
3904 Also, there must be no more than one <structname>pg_opclass</structname>
3905 row having <structname>opcdefault</> true for any given combination of
3906 <structname>opcmethod</> and <structname>opcintype</>.
3912 <sect1 id="catalog-pg-operator">
3913 <title><structname>pg_operator</structname></title>
3915 <indexterm zone="catalog-pg-operator">
3916 <primary>pg_operator</primary>
3920 The catalog <structname>pg_operator</> stores information about operators.
3921 See <xref linkend="sql-createoperator">
3922 and <xref linkend="xoper"> for more information.
3926 <title><structname>pg_operator</> Columns</title>
3933 <entry>References</entry>
3934 <entry>Description</entry>
3940 <entry><structfield>oprname</structfield></entry>
3941 <entry><type>name</type></entry>
3943 <entry>Name of the operator</entry>
3947 <entry><structfield>oprnamespace</structfield></entry>
3948 <entry><type>oid</type></entry>
3949 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3951 The OID of the namespace that contains this operator
3956 <entry><structfield>oprowner</structfield></entry>
3957 <entry><type>oid</type></entry>
3958 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3959 <entry>Owner of the operator</entry>
3963 <entry><structfield>oprkind</structfield></entry>
3964 <entry><type>char</type></entry>
3967 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3968 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3973 <entry><structfield>oprcanmerge</structfield></entry>
3974 <entry><type>bool</type></entry>
3976 <entry>This operator supports merge joins</entry>
3980 <entry><structfield>oprcanhash</structfield></entry>
3981 <entry><type>bool</type></entry>
3983 <entry>This operator supports hash joins</entry>
3987 <entry><structfield>oprleft</structfield></entry>
3988 <entry><type>oid</type></entry>
3989 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3990 <entry>Type of the left operand</entry>
3994 <entry><structfield>oprright</structfield></entry>
3995 <entry><type>oid</type></entry>
3996 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3997 <entry>Type of the right operand</entry>
4001 <entry><structfield>oprresult</structfield></entry>
4002 <entry><type>oid</type></entry>
4003 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4004 <entry>Type of the result</entry>
4008 <entry><structfield>oprcom</structfield></entry>
4009 <entry><type>oid</type></entry>
4010 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4011 <entry>Commutator of this operator, if any</entry>
4015 <entry><structfield>oprnegate</structfield></entry>
4016 <entry><type>oid</type></entry>
4017 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4018 <entry>Negator of this operator, if any</entry>
4022 <entry><structfield>oprcode</structfield></entry>
4023 <entry><type>regproc</type></entry>
4024 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4025 <entry>Function that implements this operator</entry>
4029 <entry><structfield>oprrest</structfield></entry>
4030 <entry><type>regproc</type></entry>
4031 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4032 <entry>Restriction selectivity estimation function for this operator</entry>
4036 <entry><structfield>oprjoin</structfield></entry>
4037 <entry><type>regproc</type></entry>
4038 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4039 <entry>Join selectivity estimation function for this operator</entry>
4046 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4047 is zero for a prefix operator.
4053 <sect1 id="catalog-pg-opfamily">
4054 <title><structname>pg_opfamily</structname></title>
4056 <indexterm zone="catalog-pg-opfamily">
4057 <primary>pg_opfamily</primary>
4061 The catalog <structname>pg_opfamily</structname> defines operator families.
4062 Each operator family is a collection of operators and associated
4063 support routines that implement the semantics specified for a particular
4064 index access method. Furthermore, the operators in a family are all
4065 <quote>compatible</>, in a way that is specified by the access method.
4066 The operator family concept allows cross-data-type operators to be used
4067 with indexes and to be reasoned about using knowledge of access method
4072 Operator families are described at length in <xref linkend="xindex">.
4076 <title><structname>pg_opfamily</> Columns</title>
4083 <entry>References</entry>
4084 <entry>Description</entry>
4090 <entry><structfield>opfmethod</structfield></entry>
4091 <entry><type>oid</type></entry>
4092 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4093 <entry>Index access method operator family is for</entry>
4097 <entry><structfield>opfname</structfield></entry>
4098 <entry><type>name</type></entry>
4100 <entry>Name of this operator family</entry>
4104 <entry><structfield>opfnamespace</structfield></entry>
4105 <entry><type>oid</type></entry>
4106 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4107 <entry>Namespace of this operator family</entry>
4111 <entry><structfield>opfowner</structfield></entry>
4112 <entry><type>oid</type></entry>
4113 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4114 <entry>Owner of the operator family</entry>
4122 The majority of the information defining an operator family is not in its
4123 <structname>pg_opfamily</structname> row, but in the associated rows in
4124 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4125 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4127 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4133 <sect1 id="catalog-pg-pltemplate">
4134 <title><structname>pg_pltemplate</structname></title>
4136 <indexterm zone="catalog-pg-pltemplate">
4137 <primary>pg_pltemplate</primary>
4141 The catalog <structname>pg_pltemplate</structname> stores
4142 <quote>template</> information for procedural languages.
4143 A template for a language allows the language to be created in a
4144 particular database by a simple <command>CREATE LANGUAGE</> command,
4145 with no need to specify implementation details.
4149 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4150 is shared across all databases of a cluster: there is only one
4151 copy of <structname>pg_pltemplate</structname> per cluster, not
4152 one per database. This allows the information to be accessible in
4153 each database as it is needed.
4157 <title><structname>pg_pltemplate</> Columns</title>
4164 <entry>Description</entry>
4170 <entry><structfield>tmplname</structfield></entry>
4171 <entry><type>name</type></entry>
4172 <entry>Name of the language this template is for</entry>
4176 <entry><structfield>tmpltrusted</structfield></entry>
4177 <entry><type>boolean</type></entry>
4178 <entry>True if language is considered trusted</entry>
4182 <entry><structfield>tmpldbacreate</structfield></entry>
4183 <entry><type>boolean</type></entry>
4184 <entry>True if language may be created by a database owner</entry>
4188 <entry><structfield>tmplhandler</structfield></entry>
4189 <entry><type>text</type></entry>
4190 <entry>Name of call handler function</entry>
4194 <entry><structfield>tmplinline</structfield></entry>
4195 <entry><type>text</type></entry>
4196 <entry>Name of anonymous-block handler function, or null if none</entry>
4200 <entry><structfield>tmplvalidator</structfield></entry>
4201 <entry><type>text</type></entry>
4202 <entry>Name of validator function, or null if none</entry>
4206 <entry><structfield>tmpllibrary</structfield></entry>
4207 <entry><type>text</type></entry>
4208 <entry>Path of shared library that implements language</entry>
4212 <entry><structfield>tmplacl</structfield></entry>
4213 <entry><type>aclitem[]</type></entry>
4214 <entry>Access privileges for template (not yet used)</entry>
4222 There are not currently any commands that manipulate procedural language
4223 templates; to change the built-in information, a superuser must modify
4224 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4225 or <command>UPDATE</command> commands. It is likely that a future
4226 release of <productname>PostgreSQL</productname> will offer
4227 commands to change the entries in a cleaner fashion.
4231 When implemented, the <structfield>tmplacl</structfield> field will provide
4232 access control for the template itself (i.e., the right to create a
4233 language using it), not for the languages created from the template.
4239 <sect1 id="catalog-pg-proc">
4240 <title><structname>pg_proc</structname></title>
4242 <indexterm zone="catalog-pg-proc">
4243 <primary>pg_proc</primary>
4247 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4248 See <xref linkend="sql-createfunction">
4249 and <xref linkend="xfunc"> for more information.
4253 The table contains data for aggregate functions as well as plain functions.
4254 If <structfield>proisagg</structfield> is true, there should be a matching
4255 row in <structfield>pg_aggregate</structfield>.
4259 <title><structname>pg_proc</> Columns</title>
4266 <entry>References</entry>
4267 <entry>Description</entry>
4273 <entry><structfield>proname</structfield></entry>
4274 <entry><type>name</type></entry>
4276 <entry>Name of the function</entry>
4280 <entry><structfield>pronamespace</structfield></entry>
4281 <entry><type>oid</type></entry>
4282 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4284 The OID of the namespace that contains this function
4289 <entry><structfield>proowner</structfield></entry>
4290 <entry><type>oid</type></entry>
4291 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4292 <entry>Owner of the function</entry>
4296 <entry><structfield>prolang</structfield></entry>
4297 <entry><type>oid</type></entry>
4298 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4299 <entry>Implementation language or call interface of this function</entry>
4303 <entry><structfield>procost</structfield></entry>
4304 <entry><type>float4</type></entry>
4306 <entry>Estimated execution cost (in units of
4307 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4308 this is cost per row returned</entry>
4312 <entry><structfield>prorows</structfield></entry>
4313 <entry><type>float4</type></entry>
4315 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4319 <entry><structfield>provariadic</structfield></entry>
4320 <entry><type>oid</type></entry>
4321 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4322 <entry>Data type of the variadic array parameter's elements,
4323 or zero if the function does not have a variadic parameter</entry>
4327 <entry><structfield>proisagg</structfield></entry>
4328 <entry><type>bool</type></entry>
4330 <entry>Function is an aggregate function</entry>
4334 <entry><structfield>proiswindow</structfield></entry>
4335 <entry><type>bool</type></entry>
4337 <entry>Function is a window function</entry>
4341 <entry><structfield>prosecdef</structfield></entry>
4342 <entry><type>bool</type></entry>
4344 <entry>Function is a security definer (i.e., a <quote>setuid</>
4349 <entry><structfield>proisstrict</structfield></entry>
4350 <entry><type>bool</type></entry>
4353 Function returns null if any call argument is null. In that
4354 case the function won't actually be called at all. Functions
4355 that are not <quote>strict</quote> must be prepared to handle
4361 <entry><structfield>proretset</structfield></entry>
4362 <entry><type>bool</type></entry>
4364 <entry>Function returns a set (i.e., multiple values of the specified
4369 <entry><structfield>provolatile</structfield></entry>
4370 <entry><type>char</type></entry>
4373 <structfield>provolatile</structfield> tells whether the function's
4374 result depends only on its input arguments, or is affected by outside
4376 It is <literal>i</literal> for <quote>immutable</> functions,
4377 which always deliver the same result for the same inputs.
4378 It is <literal>s</literal> for <quote>stable</> functions,
4379 whose results (for fixed inputs) do not change within a scan.
4380 It is <literal>v</literal> for <quote>volatile</> functions,
4381 whose results might change at any time. (Use <literal>v</literal> also
4382 for functions with side-effects, so that calls to them cannot get
4388 <entry><structfield>pronargs</structfield></entry>
4389 <entry><type>int2</type></entry>
4391 <entry>Number of input arguments</entry>
4395 <entry><structfield>pronargdefaults</structfield></entry>
4396 <entry><type>int2</type></entry>
4398 <entry>Number of arguments that have defaults</entry>
4402 <entry><structfield>prorettype</structfield></entry>
4403 <entry><type>oid</type></entry>
4404 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4405 <entry>Data type of the return value</entry>
4409 <entry><structfield>proargtypes</structfield></entry>
4410 <entry><type>oidvector</type></entry>
4411 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4413 An array with the data types of the function arguments. This includes
4414 only input arguments (including <literal>INOUT</literal> and
4415 <literal>VARIADIC</> arguments), and thus represents
4416 the call signature of the function.
4421 <entry><structfield>proallargtypes</structfield></entry>
4422 <entry><type>oid[]</type></entry>
4423 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4425 An array with the data types of the function arguments. This includes
4426 all arguments (including <literal>OUT</literal> and
4427 <literal>INOUT</literal> arguments); however, if all the
4428 arguments are <literal>IN</literal> arguments, this field will be null.
4429 Note that subscripting is 1-based, whereas for historical reasons
4430 <structfield>proargtypes</> is subscripted from 0.
4435 <entry><structfield>proargmodes</structfield></entry>
4436 <entry><type>char[]</type></entry>
4439 An array with the modes of the function arguments, encoded as
4440 <literal>i</literal> for <literal>IN</> arguments,
4441 <literal>o</literal> for <literal>OUT</> arguments,
4442 <literal>b</literal> for <literal>INOUT</> arguments,
4443 <literal>v</literal> for <literal>VARIADIC</> arguments,
4444 <literal>t</literal> for <literal>TABLE</> arguments.
4445 If all the arguments are <literal>IN</literal> arguments,
4446 this field will be null.
4447 Note that subscripts correspond to positions of
4448 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4453 <entry><structfield>proargnames</structfield></entry>
4454 <entry><type>text[]</type></entry>
4457 An array with the names of the function arguments.
4458 Arguments without a name are set to empty strings in the array.
4459 If none of the arguments have a name, this field will be null.
4460 Note that subscripts correspond to positions of
4461 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4466 <entry><structfield>proargdefaults</structfield></entry>
4467 <entry><type>pg_node_tree</type></entry>
4470 Expression trees (in <function>nodeToString()</function> representation)
4471 for default values. This is a list with
4472 <structfield>pronargdefaults</> elements, corresponding to the last
4473 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
4474 <replaceable>N</> <structfield>proargtypes</> positions).
4475 If none of the arguments have defaults, this field will be null.
4480 <entry><structfield>prosrc</structfield></entry>
4481 <entry><type>text</type></entry>
4484 This tells the function handler how to invoke the function. It
4485 might be the actual source code of the function for interpreted
4486 languages, a link symbol, a file name, or just about anything
4487 else, depending on the implementation language/call convention.
4492 <entry><structfield>probin</structfield></entry>
4493 <entry><type>text</type></entry>
4496 Additional information about how to invoke the function.
4497 Again, the interpretation is language-specific.
4502 <entry><structfield>proconfig</structfield></entry>
4503 <entry><type>text[]</type></entry>
4505 <entry>Function's local settings for run-time configuration variables</entry>
4509 <entry><structfield>proacl</structfield></entry>
4510 <entry><type>aclitem[]</type></entry>
4513 Access privileges; see
4514 <xref linkend="sql-grant"> and
4515 <xref linkend="sql-revoke">
4524 For compiled functions, both built-in and dynamically loaded,
4525 <structfield>prosrc</structfield> contains the function's C-language
4526 name (link symbol). For all other currently-known language types,
4527 <structfield>prosrc</structfield> contains the function's source
4528 text. <structfield>probin</structfield> is unused except for
4529 dynamically-loaded C functions, for which it gives the name of the
4530 shared library file containing the function.
4535 <sect1 id="catalog-pg-rewrite">
4536 <title><structname>pg_rewrite</structname></title>
4538 <indexterm zone="catalog-pg-rewrite">
4539 <primary>pg_rewrite</primary>
4543 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
4547 <title><structname>pg_rewrite</> Columns</title>
4554 <entry>References</entry>
4555 <entry>Description</entry>
4561 <entry><structfield>rulename</structfield></entry>
4562 <entry><type>name</type></entry>
4564 <entry>Rule name</entry>
4568 <entry><structfield>ev_class</structfield></entry>
4569 <entry><type>oid</type></entry>
4570 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4571 <entry>The table this rule is for</entry>
4575 <entry><structfield>ev_attr</structfield></entry>
4576 <entry><type>int2</type></entry>
4578 <entry>The column this rule is for (currently, always zero to
4579 indicate the whole table)</entry>
4583 <entry><structfield>ev_type</structfield></entry>
4584 <entry><type>char</type></entry>
4587 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
4588 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
4594 <entry><structfield>ev_enabled</structfield></entry>
4595 <entry><type>char</type></entry>
4598 Controls in which <xref linkend="guc-session-replication-role"> modes
4600 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
4601 <literal>D</> = rule is disabled,
4602 <literal>R</> = rule fires in <quote>replica</> mode,
4603 <literal>A</> = rule fires always.
4608 <entry><structfield>is_instead</structfield></entry>
4609 <entry><type>bool</type></entry>
4611 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
4615 <entry><structfield>ev_qual</structfield></entry>
4616 <entry><type>pg_node_tree</type></entry>
4619 Expression tree (in the form of a
4620 <function>nodeToString()</function> representation) for the
4621 rule's qualifying condition
4626 <entry><structfield>ev_action</structfield></entry>
4627 <entry><type>pg_node_tree</type></entry>
4630 Query tree (in the form of a
4631 <function>nodeToString()</function> representation) for the
4641 <literal>pg_class.relhasrules</literal>
4642 must be true if a table has any rules in this catalog.
4649 <sect1 id="catalog-pg-seclabel">
4650 <title><structname>pg_seclabel</structname></title>
4652 <indexterm zone="catalog-pg-seclabel">
4653 <primary>pg_seclabel</primary>
4657 The catalog <structname>pg_seclabel</structname> stores security
4658 labels on database objects. See the
4659 <xref linkend="sql-security-label"> statement.
4663 <title><structname>pg_seclabel</structname> Columns</title>
4670 <entry>References</entry>
4671 <entry>Description</entry>
4677 <entry><structfield>objoid</structfield></entry>
4678 <entry><type>oid</type></entry>
4679 <entry>any OID column</entry>
4680 <entry>The OID of the object this security label pertains to</entry>
4684 <entry><structfield>classoid</structfield></entry>
4685 <entry><type>oid</type></entry>
4686 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4687 <entry>The OID of the system catalog this object appears in</entry>
4691 <entry><structfield>objsubid</structfield></entry>
4692 <entry><type>int4</type></entry>
4695 For a security label on a table column, this is the column number (the
4696 <structfield>objoid</> and <structfield>classoid</> refer to
4697 the table itself). For all other object types, this column is
4703 <entry><structfield>provider</structfield></entry>
4704 <entry><type>text</type></entry>
4706 <entry>The label provider associated with this label.</entry>
4710 <entry><structfield>label</structfield></entry>
4711 <entry><type>text</type></entry>
4713 <entry>The security label applied to this object.</entry>
4720 <sect1 id="catalog-pg-shdepend">
4721 <title><structname>pg_shdepend</structname></title>
4723 <indexterm zone="catalog-pg-shdepend">
4724 <primary>pg_shdepend</primary>
4728 The catalog <structname>pg_shdepend</structname> records the
4729 dependency relationships between database objects and shared objects,
4730 such as roles. This information allows
4731 <productname>PostgreSQL</productname> to ensure that those objects are
4732 unreferenced before attempting to delete them.
4736 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
4737 which performs a similar function for dependencies involving objects
4738 within a single database.
4742 Unlike most system catalogs, <structname>pg_shdepend</structname>
4743 is shared across all databases of a cluster: there is only one
4744 copy of <structname>pg_shdepend</structname> per cluster, not
4749 <title><structname>pg_shdepend</> Columns</title>
4756 <entry>References</entry>
4757 <entry>Description</entry>
4763 <entry><structfield>dbid</structfield></entry>
4764 <entry><type>oid</type></entry>
4765 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
4766 <entry>The OID of the database the dependent object is in,
4767 or zero for a shared object</entry>
4771 <entry><structfield>classid</structfield></entry>
4772 <entry><type>oid</type></entry>
4773 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4774 <entry>The OID of the system catalog the dependent object is in</entry>
4778 <entry><structfield>objid</structfield></entry>
4779 <entry><type>oid</type></entry>
4780 <entry>any OID column</entry>
4781 <entry>The OID of the specific dependent object</entry>
4785 <entry><structfield>objsubid</structfield></entry>
4786 <entry><type>int4</type></entry>
4789 For a table column, this is the column number (the
4790 <structfield>objid</> and <structfield>classid</> refer to the
4791 table itself). For all other object types, this column is zero.
4796 <entry><structfield>refclassid</structfield></entry>
4797 <entry><type>oid</type></entry>
4798 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4799 <entry>The OID of the system catalog the referenced object is in
4800 (must be a shared catalog)</entry>
4804 <entry><structfield>refobjid</structfield></entry>
4805 <entry><type>oid</type></entry>
4806 <entry>any OID column</entry>
4807 <entry>The OID of the specific referenced object</entry>
4811 <entry><structfield>deptype</structfield></entry>
4812 <entry><type>char</type></entry>
4815 A code defining the specific semantics of this dependency relationship; see text
4824 In all cases, a <structname>pg_shdepend</structname> entry indicates that
4825 the referenced object cannot be dropped without also dropping the dependent
4826 object. However, there are several subflavors identified by
4827 <structfield>deptype</>:
4831 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
4834 The referenced object (which must be a role) is the owner of the
4841 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
4844 The referenced object (which must be a role) is mentioned in the
4845 ACL (access control list, i.e., privileges list) of the
4846 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
4847 not made for the owner of the object, since the owner will have
4848 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
4854 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
4857 There is no dependent object; this type of entry is a signal
4858 that the system itself depends on the referenced object, and so
4859 that object must never be deleted. Entries of this type are
4860 created only by <command>initdb</command>. The columns for the
4861 dependent object contain zeroes.
4867 Other dependency flavors might be needed in future. Note in particular
4868 that the current definition only supports roles as referenced objects.
4873 <sect1 id="catalog-pg-shdescription">
4874 <title><structname>pg_shdescription</structname></title>
4876 <indexterm zone="catalog-pg-shdescription">
4877 <primary>pg_shdescription</primary>
4881 The catalog <structname>pg_shdescription</structname> stores optional
4882 descriptions (comments) for shared database objects. Descriptions can be
4883 manipulated with the <xref linkend="sql-comment"> command and viewed with
4884 <application>psql</application>'s <literal>\d</literal> commands.
4888 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4889 which performs a similar function for descriptions involving objects
4890 within a single database.
4894 Unlike most system catalogs, <structname>pg_shdescription</structname>
4895 is shared across all databases of a cluster: there is only one
4896 copy of <structname>pg_shdescription</structname> per cluster, not
4901 <title><structname>pg_shdescription</> Columns</title>
4908 <entry>References</entry>
4909 <entry>Description</entry>
4915 <entry><structfield>objoid</structfield></entry>
4916 <entry><type>oid</type></entry>
4917 <entry>any OID column</entry>
4918 <entry>The OID of the object this description pertains to</entry>
4922 <entry><structfield>classoid</structfield></entry>
4923 <entry><type>oid</type></entry>
4924 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4925 <entry>The OID of the system catalog this object appears in</entry>
4929 <entry><structfield>description</structfield></entry>
4930 <entry><type>text</type></entry>
4932 <entry>Arbitrary text that serves as the description of this object</entry>
4941 <sect1 id="catalog-pg-statistic">
4942 <title><structname>pg_statistic</structname></title>
4944 <indexterm zone="catalog-pg-statistic">
4945 <primary>pg_statistic</primary>
4949 The catalog <structname>pg_statistic</structname> stores
4950 statistical data about the contents of the database. Entries are
4951 created by <xref linkend="sql-analyze">
4952 and subsequently used by the query planner. Note that all the
4953 statistical data is inherently approximate, even assuming that it
4958 Normally there is one entry, with <structfield>stainherit</> =
4959 <literal>false</>, for each table column that has been analyzed.
4960 If the table has inheritance children, a second entry with
4961 <structfield>stainherit</> = <literal>true</> is also created. This row
4962 represents the column's statistics over the inheritance tree, i.e.,
4963 statistics for the data you'd see with
4964 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
4965 whereas the <structfield>stainherit</> = <literal>false</> row represents
4967 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
4971 <structname>pg_statistic</structname> also stores statistical data about
4972 the values of index expressions. These are described as if they were
4973 actual data columns; in particular, <structfield>starelid</structfield>
4974 references the index. No entry is made for an ordinary non-expression
4975 index column, however, since it would be redundant with the entry
4976 for the underlying table column. Currently, entries for index expressions
4977 always have <structfield>stainherit</> = <literal>false</>.
4981 Since different kinds of statistics might be appropriate for different
4982 kinds of data, <structname>pg_statistic</structname> is designed not
4983 to assume very much about what sort of statistics it stores. Only
4984 extremely general statistics (such as nullness) are given dedicated
4985 columns in <structname>pg_statistic</structname>. Everything else
4986 is stored in <quote>slots</quote>, which are groups of associated columns
4987 whose content is identified by a code number in one of the slot's columns.
4988 For more information see
4989 <filename>src/include/catalog/pg_statistic.h</filename>.
4993 <structname>pg_statistic</structname> should not be readable by the
4994 public, since even statistical information about a table's contents
4995 might be considered sensitive. (Example: minimum and maximum values
4996 of a salary column might be quite interesting.)
4997 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4998 is a publicly readable view on
4999 <structname>pg_statistic</structname> that only exposes information
5000 about those tables that are readable by the current user.
5004 <title><structname>pg_statistic</> Columns</title>
5011 <entry>References</entry>
5012 <entry>Description</entry>
5018 <entry><structfield>starelid</structfield></entry>
5019 <entry><type>oid</type></entry>
5020 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5021 <entry>The table or index that the described column belongs to</entry>
5025 <entry><structfield>staattnum</structfield></entry>
5026 <entry><type>int2</type></entry>
5027 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5028 <entry>The number of the described column</entry>
5032 <entry><structfield>stainherit</structfield></entry>
5033 <entry><type>bool</type></entry>
5035 <entry>If true, the stats include inheritance child columns, not just the
5036 values in the specified relation</entry>
5040 <entry><structfield>stanullfrac</structfield></entry>
5041 <entry><type>float4</type></entry>
5043 <entry>The fraction of the column's entries that are null</entry>
5047 <entry><structfield>stawidth</structfield></entry>
5048 <entry><type>int4</type></entry>
5050 <entry>The average stored width, in bytes, of nonnull entries</entry>
5054 <entry><structfield>stadistinct</structfield></entry>
5055 <entry><type>float4</type></entry>
5057 <entry>The number of distinct nonnull data values in the column.
5058 A value greater than zero is the actual number of distinct values.
5059 A value less than zero is the negative of a multiplier for the number
5060 of rows in the table; for example, a column in which values appear about
5061 twice on the average could be represented by
5062 <structfield>stadistinct</> = -0.5.
5063 A zero value means the number of distinct values is unknown.
5068 <entry><structfield>stakind<replaceable>N</></structfield></entry>
5069 <entry><type>int2</type></entry>
5072 A code number indicating the kind of statistics stored in the
5073 <replaceable>N</>th <quote>slot</quote> of the
5074 <structname>pg_statistic</structname> row.
5079 <entry><structfield>staop<replaceable>N</></structfield></entry>
5080 <entry><type>oid</type></entry>
5081 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
5083 An operator used to derive the statistics stored in the
5084 <replaceable>N</>th <quote>slot</quote>. For example, a
5085 histogram slot would show the <literal><</literal> operator
5086 that defines the sort order of the data.
5091 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
5092 <entry><type>float4[]</type></entry>
5095 Numerical statistics of the appropriate kind for the
5096 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5097 kind does not involve numerical values
5102 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
5103 <entry><type>anyarray</type></entry>
5106 Column data values of the appropriate kind for the
5107 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5108 kind does not store any data values. Each array's element
5109 values are actually of the specific column's data type, so there
5110 is no way to define these columns' type more specifically than
5121 <sect1 id="catalog-pg-tablespace">
5122 <title><structname>pg_tablespace</structname></title>
5124 <indexterm zone="catalog-pg-tablespace">
5125 <primary>pg_tablespace</primary>
5129 The catalog <structname>pg_tablespace</structname> stores information
5130 about the available tablespaces. Tables can be placed in particular
5131 tablespaces to aid administration of disk layout.
5135 Unlike most system catalogs, <structname>pg_tablespace</structname>
5136 is shared across all databases of a cluster: there is only one
5137 copy of <structname>pg_tablespace</structname> per cluster, not
5142 <title><structname>pg_tablespace</> Columns</title>
5149 <entry>References</entry>
5150 <entry>Description</entry>
5156 <entry><structfield>spcname</structfield></entry>
5157 <entry><type>name</type></entry>
5159 <entry>Tablespace name</entry>
5163 <entry><structfield>spcowner</structfield></entry>
5164 <entry><type>oid</type></entry>
5165 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5166 <entry>Owner of the tablespace, usually the user who created it</entry>
5170 <entry><structfield>spclocation</structfield></entry>
5171 <entry><type>text</type></entry>
5173 <entry>Location (directory path) of the tablespace</entry>
5177 <entry><structfield>spcacl</structfield></entry>
5178 <entry><type>aclitem[]</type></entry>
5181 Access privileges; see
5182 <xref linkend="sql-grant"> and
5183 <xref linkend="sql-revoke">
5189 <entry><structfield>spcoptions</structfield></entry>
5190 <entry><type>text[]</type></entry>
5193 Tablespace-level options, as <quote>keyword=value</> strings
5202 <sect1 id="catalog-pg-trigger">
5203 <title><structname>pg_trigger</structname></title>
5205 <indexterm zone="catalog-pg-trigger">
5206 <primary>pg_trigger</primary>
5210 The catalog <structname>pg_trigger</structname> stores triggers on tables
5212 See <xref linkend="sql-createtrigger">
5213 for more information.
5217 <title><structname>pg_trigger</> Columns</title>
5224 <entry>References</entry>
5225 <entry>Description</entry>
5231 <entry><structfield>tgrelid</structfield></entry>
5232 <entry><type>oid</type></entry>
5233 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5234 <entry>The table this trigger is on</entry>
5238 <entry><structfield>tgname</structfield></entry>
5239 <entry><type>name</type></entry>
5241 <entry>Trigger name (must be unique among triggers of same table)</entry>
5245 <entry><structfield>tgfoid</structfield></entry>
5246 <entry><type>oid</type></entry>
5247 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5248 <entry>The function to be called</entry>
5252 <entry><structfield>tgtype</structfield></entry>
5253 <entry><type>int2</type></entry>
5255 <entry>Bit mask identifying trigger firing conditions</entry>
5259 <entry><structfield>tgenabled</structfield></entry>
5260 <entry><type>char</type></entry>
5263 Controls in which <xref linkend="guc-session-replication-role"> modes
5265 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
5266 <literal>D</> = trigger is disabled,
5267 <literal>R</> = trigger fires in <quote>replica</> mode,
5268 <literal>A</> = trigger fires always.
5273 <entry><structfield>tgisinternal</structfield></entry>
5274 <entry><type>bool</type></entry>
5276 <entry>True if trigger is internally generated (usually, to enforce
5277 the constraint identified by <structfield>tgconstraint</>)</entry>
5281 <entry><structfield>tgconstrrelid</structfield></entry>
5282 <entry><type>oid</type></entry>
5283 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5284 <entry>The table referenced by a referential integrity constraint</entry>
5288 <entry><structfield>tgconstrindid</structfield></entry>
5289 <entry><type>oid</type></entry>
5290 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5291 <entry>The index supporting a unique, primary key, or referential integrity constraint</entry>
5295 <entry><structfield>tgconstraint</structfield></entry>
5296 <entry><type>oid</type></entry>
5297 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
5298 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
5302 <entry><structfield>tgdeferrable</structfield></entry>
5303 <entry><type>bool</type></entry>
5305 <entry>True if constraint trigger is deferrable</entry>
5309 <entry><structfield>tginitdeferred</structfield></entry>
5310 <entry><type>bool</type></entry>
5312 <entry>True if constraint trigger is initially deferred</entry>
5316 <entry><structfield>tgnargs</structfield></entry>
5317 <entry><type>int2</type></entry>
5319 <entry>Number of argument strings passed to trigger function</entry>
5323 <entry><structfield>tgattr</structfield></entry>
5324 <entry><type>int2vector</type></entry>
5325 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5326 <entry>Column numbers, if trigger is column-specific; otherwise an
5331 <entry><structfield>tgargs</structfield></entry>
5332 <entry><type>bytea</type></entry>
5334 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
5338 <entry><structfield>tgqual</structfield></entry>
5339 <entry><type>pg_node_tree</type></entry>
5341 <entry>Expression tree (in <function>nodeToString()</function>
5342 representation) for the trigger's <literal>WHEN</> condition, or null
5350 Currently, column-specific triggering is supported only for
5351 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
5352 only for that event type. <structfield>tgtype</structfield> might
5353 contain bits for other event types as well, but those are presumed
5354 to be table-wide regardless of what is in <structfield>tgattr</>.
5359 When <structfield>tgconstraint</> is nonzero,
5360 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
5361 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
5362 largely redundant with the referenced <structname>pg_constraint</> entry.
5363 However, it is possible for a non-deferrable trigger to be associated
5364 with a deferrable constraint: foreign key constraints can have some
5365 deferrable and some non-deferrable triggers.
5371 <literal>pg_class.relhastriggers</literal>
5372 must be true if a relation has any triggers in this catalog.
5379 <sect1 id="catalog-pg-ts-config">
5380 <title><structname>pg_ts_config</structname></title>
5382 <indexterm zone="catalog-pg-ts-config">
5383 <primary>pg_ts_config</primary>
5387 The <structname>pg_ts_config</structname> catalog contains entries
5388 representing text search configurations. A configuration specifies
5389 a particular text search parser and a list of dictionaries to use
5390 for each of the parser's output token types. The parser is shown
5391 in the <structname>pg_ts_config</structname> entry, but the
5392 token-to-dictionary mapping is defined by subsidiary entries in <link
5393 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
5397 <productname>PostgreSQL</productname>'s text search features are
5398 described at length in <xref linkend="textsearch">.
5402 <title><structname>pg_ts_config</> Columns</title>
5409 <entry>References</entry>
5410 <entry>Description</entry>
5416 <entry><structfield>cfgname</structfield></entry>
5417 <entry><type>name</type></entry>
5419 <entry>Text search configuration name</entry>
5423 <entry><structfield>cfgnamespace</structfield></entry>
5424 <entry><type>oid</type></entry>
5425 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5427 The OID of the namespace that contains this configuration
5432 <entry><structfield>cfgowner</structfield></entry>
5433 <entry><type>oid</type></entry>
5434 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5435 <entry>Owner of the configuration</entry>
5439 <entry><structfield>cfgparser</structfield></entry>
5440 <entry><type>oid</type></entry>
5441 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
5442 <entry>The OID of the text search parser for this configuration</entry>
5450 <sect1 id="catalog-pg-ts-config-map">
5451 <title><structname>pg_ts_config_map</structname></title>
5453 <indexterm zone="catalog-pg-ts-config-map">
5454 <primary>pg_ts_config_map</primary>
5458 The <structname>pg_ts_config_map</structname> catalog contains entries
5459 showing which text search dictionaries should be consulted, and in
5460 what order, for each output token type of each text search configuration's
5465 <productname>PostgreSQL</productname>'s text search features are
5466 described at length in <xref linkend="textsearch">.
5470 <title><structname>pg_ts_config_map</> Columns</title>
5477 <entry>References</entry>
5478 <entry>Description</entry>
5484 <entry><structfield>mapcfg</structfield></entry>
5485 <entry><type>oid</type></entry>
5486 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
5487 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
5491 <entry><structfield>maptokentype</structfield></entry>
5492 <entry><type>integer</type></entry>
5494 <entry>A token type emitted by the configuration's parser</entry>
5498 <entry><structfield>mapseqno</structfield></entry>
5499 <entry><type>integer</type></entry>
5501 <entry>Order in which to consult this entry (lower
5502 <structfield>mapseqno</>s first)</entry>
5506 <entry><structfield>mapdict</structfield></entry>
5507 <entry><type>oid</type></entry>
5508 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
5509 <entry>The OID of the text search dictionary to consult</entry>
5517 <sect1 id="catalog-pg-ts-dict">
5518 <title><structname>pg_ts_dict</structname></title>
5520 <indexterm zone="catalog-pg-ts-dict">
5521 <primary>pg_ts_dict</primary>
5525 The <structname>pg_ts_dict</structname> catalog contains entries
5526 defining text search dictionaries. A dictionary depends on a text
5527 search template, which specifies all the implementation functions
5528 needed; the dictionary itself provides values for the user-settable
5529 parameters supported by the template. This division of labor allows
5530 dictionaries to be created by unprivileged users. The parameters
5531 are specified by a text string <structfield>dictinitoption</>,
5532 whose format and meaning vary depending on the template.
5536 <productname>PostgreSQL</productname>'s text search features are
5537 described at length in <xref linkend="textsearch">.
5541 <title><structname>pg_ts_dict</> Columns</title>
5548 <entry>References</entry>
5549 <entry>Description</entry>
5555 <entry><structfield>dictname</structfield></entry>
5556 <entry><type>name</type></entry>
5558 <entry>Text search dictionary name</entry>
5562 <entry><structfield>dictnamespace</structfield></entry>
5563 <entry><type>oid</type></entry>
5564 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5566 The OID of the namespace that contains this dictionary
5571 <entry><structfield>dictowner</structfield></entry>
5572 <entry><type>oid</type></entry>
5573 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5574 <entry>Owner of the dictionary</entry>
5578 <entry><structfield>dicttemplate</structfield></entry>
5579 <entry><type>oid</type></entry>
5580 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
5581 <entry>The OID of the text search template for this dictionary</entry>
5585 <entry><structfield>dictinitoption</structfield></entry>
5586 <entry><type>text</type></entry>
5588 <entry>Initialization option string for the template</entry>
5596 <sect1 id="catalog-pg-ts-parser">
5597 <title><structname>pg_ts_parser</structname></title>
5599 <indexterm zone="catalog-pg-ts-parser">
5600 <primary>pg_ts_parser</primary>
5604 The <structname>pg_ts_parser</structname> catalog contains entries
5605 defining text search parsers. A parser is responsible for splitting
5606 input text into lexemes and assigning a token type to each lexeme.
5607 Since a parser must be implemented by C-language-level functions,
5608 creation of new parsers is restricted to database superusers.
5612 <productname>PostgreSQL</productname>'s text search features are
5613 described at length in <xref linkend="textsearch">.
5617 <title><structname>pg_ts_parser</> Columns</title>
5624 <entry>References</entry>
5625 <entry>Description</entry>
5631 <entry><structfield>prsname</structfield></entry>
5632 <entry><type>name</type></entry>
5634 <entry>Text search parser name</entry>
5638 <entry><structfield>prsnamespace</structfield></entry>
5639 <entry><type>oid</type></entry>
5640 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5642 The OID of the namespace that contains this parser
5647 <entry><structfield>prsstart</structfield></entry>
5648 <entry><type>regproc</type></entry>
5649 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5650 <entry>OID of the parser's startup function</entry>
5654 <entry><structfield>prstoken</structfield></entry>
5655 <entry><type>regproc</type></entry>
5656 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5657 <entry>OID of the parser's next-token function</entry>
5661 <entry><structfield>prsend</structfield></entry>
5662 <entry><type>regproc</type></entry>
5663 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5664 <entry>OID of the parser's shutdown function</entry>
5668 <entry><structfield>prsheadline</structfield></entry>
5669 <entry><type>regproc</type></entry>
5670 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5671 <entry>OID of the parser's headline function</entry>
5675 <entry><structfield>prslextype</structfield></entry>
5676 <entry><type>regproc</type></entry>
5677 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5678 <entry>OID of the parser's lextype function</entry>
5686 <sect1 id="catalog-pg-ts-template">
5687 <title><structname>pg_ts_template</structname></title>
5689 <indexterm zone="catalog-pg-ts-template">
5690 <primary>pg_ts_template</primary>
5694 The <structname>pg_ts_template</structname> catalog contains entries
5695 defining text search templates. A template is the implementation
5696 skeleton for a class of text search dictionaries.
5697 Since a template must be implemented by C-language-level functions,
5698 creation of new templates is restricted to database superusers.
5702 <productname>PostgreSQL</productname>'s text search features are
5703 described at length in <xref linkend="textsearch">.
5707 <title><structname>pg_ts_template</> Columns</title>
5714 <entry>References</entry>
5715 <entry>Description</entry>
5721 <entry><structfield>tmplname</structfield></entry>
5722 <entry><type>name</type></entry>
5724 <entry>Text search template name</entry>
5728 <entry><structfield>tmplnamespace</structfield></entry>
5729 <entry><type>oid</type></entry>
5730 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5732 The OID of the namespace that contains this template
5737 <entry><structfield>tmplinit</structfield></entry>
5738 <entry><type>regproc</type></entry>
5739 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5740 <entry>OID of the template's initialization function</entry>
5744 <entry><structfield>tmpllexize</structfield></entry>
5745 <entry><type>regproc</type></entry>
5746 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5747 <entry>OID of the template's lexize function</entry>
5755 <sect1 id="catalog-pg-type">
5756 <title><structname>pg_type</structname></title>
5758 <indexterm zone="catalog-pg-type">
5759 <primary>pg_type</primary>
5763 The catalog <structname>pg_type</structname> stores information about data
5764 types. Base types and enum types (scalar types) are created with
5765 <xref linkend="sql-createtype">, and
5767 <xref linkend="sql-createdomain">.
5768 A composite type is automatically created for each table in the database, to
5769 represent the row structure of the table. It is also possible to create
5770 composite types with <command>CREATE TYPE AS</command>.
5774 <title><structname>pg_type</> Columns</title>
5781 <entry>References</entry>
5782 <entry>Description</entry>
5788 <entry><structfield>typname</structfield></entry>
5789 <entry><type>name</type></entry>
5791 <entry>Data type name</entry>
5795 <entry><structfield>typnamespace</structfield></entry>
5796 <entry><type>oid</type></entry>
5797 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5799 The OID of the namespace that contains this type
5804 <entry><structfield>typowner</structfield></entry>
5805 <entry><type>oid</type></entry>
5806 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5807 <entry>Owner of the type</entry>
5811 <entry><structfield>typlen</structfield></entry>
5812 <entry><type>int2</type></entry>
5815 For a fixed-size type, <structfield>typlen</structfield> is the number
5816 of bytes in the internal representation of the type. But for a
5817 variable-length type, <structfield>typlen</structfield> is negative.
5818 -1 indicates a <quote>varlena</> type (one that has a length word),
5819 -2 indicates a null-terminated C string.
5824 <entry><structfield>typbyval</structfield></entry>
5825 <entry><type>bool</type></entry>
5828 <structfield>typbyval</structfield> determines whether internal
5829 routines pass a value of this type by value or by reference.
5830 <structfield>typbyval</structfield> had better be false if
5831 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
5832 where Datum is 8 bytes).
5833 Variable-length types are always passed by reference. Note that
5834 <structfield>typbyval</structfield> can be false even if the
5835 length would allow pass-by-value.
5840 <entry><structfield>typtype</structfield></entry>
5841 <entry><type>char</type></entry>
5844 <structfield>typtype</structfield> is
5845 <literal>b</literal> for a base type,
5846 <literal>c</literal> for a composite type (e.g., a table's row type),
5847 <literal>d</literal> for a domain,
5848 <literal>e</literal> for an enum type,
5849 or <literal>p</literal> for a pseudo-type.
5850 See also <structfield>typrelid</structfield> and
5851 <structfield>typbasetype</structfield>.
5856 <entry><structfield>typcategory</structfield></entry>
5857 <entry><type>char</type></entry>
5860 <structfield>typcategory</structfield> is an arbitrary classification
5861 of data types that is used by the parser to determine which implicit
5862 casts should be <quote>preferred</>.
5863 See <xref linkend="catalog-typcategory-table">.
5868 <entry><structfield>typispreferred</structfield></entry>
5869 <entry><type>bool</type></entry>
5872 True if the type is a preferred cast target within its
5873 <structfield>typcategory</structfield>
5878 <entry><structfield>typisdefined</structfield></entry>
5879 <entry><type>bool</type></entry>
5882 True if the type is defined, false if this is a placeholder
5883 entry for a not-yet-defined type. When
5884 <structfield>typisdefined</structfield> is false, nothing
5885 except the type name, namespace, and OID can be relied on.
5890 <entry><structfield>typdelim</structfield></entry>
5891 <entry><type>char</type></entry>
5894 Character that separates two values of this type when parsing
5895 array input. Note that the delimiter is associated with the array
5896 element data type, not the array data type.
5901 <entry><structfield>typrelid</structfield></entry>
5902 <entry><type>oid</type></entry>
5903 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5905 If this is a composite type (see
5906 <structfield>typtype</structfield>), then this column points to
5907 the <structname>pg_class</structname> entry that defines the
5908 corresponding table. (For a free-standing composite type, the
5909 <structname>pg_class</structname> entry doesn't really represent
5910 a table, but it is needed anyway for the type's
5911 <structname>pg_attribute</structname> entries to link to.)
5912 Zero for non-composite types.
5917 <entry><structfield>typelem</structfield></entry>
5918 <entry><type>oid</type></entry>
5919 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5921 If <structfield>typelem</structfield> is not 0 then it
5922 identifies another row in <structname>pg_type</structname>.
5923 The current type can then be subscripted like an array yielding
5924 values of type <structfield>typelem</structfield>. A
5925 <quote>true</quote> array type is variable length
5926 (<structfield>typlen</structfield> = -1),
5927 but some fixed-length (<structfield>typlen</structfield> > 0) types
5928 also have nonzero <structfield>typelem</structfield>, for example
5929 <type>name</type> and <type>point</type>.
5930 If a fixed-length type has a <structfield>typelem</structfield> then
5931 its internal representation must be some number of values of the
5932 <structfield>typelem</structfield> data type with no other data.
5933 Variable-length array types have a header defined by the array
5939 <entry><structfield>typarray</structfield></entry>
5940 <entry><type>oid</type></entry>
5941 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5943 If <structfield>typarray</structfield> is not 0 then it
5944 identifies another row in <structname>pg_type</structname>, which
5945 is the <quote>true</quote> array type having this type as element
5950 <entry><structfield>typinput</structfield></entry>
5951 <entry><type>regproc</type></entry>
5952 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5953 <entry>Input conversion function (text format)</entry>
5957 <entry><structfield>typoutput</structfield></entry>
5958 <entry><type>regproc</type></entry>
5959 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5960 <entry>Output conversion function (text format)</entry>
5964 <entry><structfield>typreceive</structfield></entry>
5965 <entry><type>regproc</type></entry>
5966 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5967 <entry>Input conversion function (binary format), or 0 if none</entry>
5971 <entry><structfield>typsend</structfield></entry>
5972 <entry><type>regproc</type></entry>
5973 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5974 <entry>Output conversion function (binary format), or 0 if none</entry>
5978 <entry><structfield>typmodin</structfield></entry>
5979 <entry><type>regproc</type></entry>
5980 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5981 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5985 <entry><structfield>typmodout</structfield></entry>
5986 <entry><type>regproc</type></entry>
5987 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5988 <entry>Type modifier output function, or 0 to use the standard format</entry>
5992 <entry><structfield>typanalyze</structfield></entry>
5993 <entry><type>regproc</type></entry>
5994 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5995 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
5999 <entry><structfield>typalign</structfield></entry>
6000 <entry><type>char</type></entry>
6004 <structfield>typalign</structfield> is the alignment required
6005 when storing a value of this type. It applies to storage on
6006 disk as well as most representations of the value inside
6007 <productname>PostgreSQL</>.
6008 When multiple values are stored consecutively, such
6009 as in the representation of a complete row on disk, padding is
6010 inserted before a datum of this type so that it begins on the
6011 specified boundary. The alignment reference is the beginning
6012 of the first datum in the sequence.
6016 Possible values are:
6019 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
6022 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
6025 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
6028 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
6033 For types used in system tables, it is critical that the size
6034 and alignment defined in <structname>pg_type</structname>
6035 agree with the way that the compiler will lay out the column in
6036 a structure representing a table row.
6042 <entry><structfield>typstorage</structfield></entry>
6043 <entry><type>char</type></entry>
6046 <structfield>typstorage</structfield> tells for varlena
6047 types (those with <structfield>typlen</structfield> = -1) if
6048 the type is prepared for toasting and what the default strategy
6049 for attributes of this type should be.
6053 <para><literal>p</>: Value must always be stored plain.</para>
6057 <literal>e</>: Value can be stored in a <quote>secondary</quote>
6058 relation (if relation has one, see
6059 <literal>pg_class.reltoastrelid</literal>).
6063 <para><literal>m</>: Value can be stored compressed inline.</para>
6066 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
6069 Note that <literal>m</> columns can also be moved out to secondary
6070 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
6076 <entry><structfield>typnotnull</structfield></entry>
6077 <entry><type>bool</type></entry>
6080 <structfield>typnotnull</structfield> represents a not-null
6081 constraint on a type. Used for domains only.
6086 <entry><structfield>typbasetype</structfield></entry>
6087 <entry><type>oid</type></entry>
6088 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6090 If this is a domain (see <structfield>typtype</structfield>), then
6091 <structfield>typbasetype</structfield> identifies the type that this
6092 one is based on. Zero if this type is not a domain.
6097 <entry><structfield>typtypmod</structfield></entry>
6098 <entry><type>int4</type></entry>
6101 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
6102 to be applied to their base type (-1 if base type does not use a
6103 <literal>typmod</>). -1 if this type is not a domain.
6108 <entry><structfield>typndims</structfield></entry>
6109 <entry><type>int4</type></entry>
6112 <structfield>typndims</structfield> is the number of array dimensions
6113 for a domain over an array (that is, <structfield>typbasetype</> is
6115 Zero for types other than domains over array types.
6120 <entry><structfield>typcollation</structfield></entry>
6121 <entry><type>oid</type></entry>
6122 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
6124 <structfield>typcollation</structfield> specifies the collation
6125 of the type. If a type does not support collations, this will
6126 be zero, collation analysis at parse time is skipped, and
6127 the use of <literal>COLLATE</literal> clauses with the type is
6128 invalid. A base type that supports collations will have
6129 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain can have
6130 another collation OID, if one was defined for the domain.
6135 <entry><structfield>typdefaultbin</structfield></entry>
6136 <entry><type>pg_node_tree</type></entry>
6139 If <structfield>typdefaultbin</> is not null, it is the
6140 <function>nodeToString()</function>
6141 representation of a default expression for the type. This is
6142 only used for domains.
6147 <entry><structfield>typdefault</structfield></entry>
6148 <entry><type>text</type></entry>
6151 <structfield>typdefault</> is null if the type has no associated
6152 default value. If <structfield>typdefaultbin</> is not null,
6153 <structfield>typdefault</> must contain a human-readable version of the
6154 default expression represented by <structfield>typdefaultbin</>. If
6155 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
6156 not, then <structfield>typdefault</> is the external representation of
6157 the type's default value, which can be fed to the type's input
6158 converter to produce a constant.
6166 <xref linkend="catalog-typcategory-table"> lists the system-defined values
6167 of <structfield>typcategory</>. Any future additions to this list will
6168 also be upper-case ASCII letters. All other ASCII characters are reserved
6169 for user-defined categories.
6172 <table id="catalog-typcategory-table">
6173 <title><structfield>typcategory</> Codes</title>
6179 <entry>Category</entry>
6185 <entry><literal>A</literal></entry>
6186 <entry>Array types</entry>
6189 <entry><literal>B</literal></entry>
6190 <entry>Boolean types</entry>
6193 <entry><literal>C</literal></entry>
6194 <entry>Composite types</entry>
6197 <entry><literal>D</literal></entry>
6198 <entry>Date/time types</entry>
6201 <entry><literal>E</literal></entry>
6202 <entry>Enum types</entry>
6205 <entry><literal>G</literal></entry>
6206 <entry>Geometric types</entry>
6209 <entry><literal>I</literal></entry>
6210 <entry>Network address types</entry>
6213 <entry><literal>N</literal></entry>
6214 <entry>Numeric types</entry>
6217 <entry><literal>P</literal></entry>
6218 <entry>Pseudo-types</entry>
6221 <entry><literal>S</literal></entry>
6222 <entry>String types</entry>
6225 <entry><literal>T</literal></entry>
6226 <entry>Timespan types</entry>
6229 <entry><literal>U</literal></entry>
6230 <entry>User-defined types</entry>
6233 <entry><literal>V</literal></entry>
6234 <entry>Bit-string types</entry>
6237 <entry><literal>X</literal></entry>
6238 <entry><type>unknown</> type</entry>
6247 <sect1 id="catalog-pg-user-mapping">
6248 <title><structname>pg_user_mapping</structname></title>
6250 <indexterm zone="catalog-pg-user-mapping">
6251 <primary>pg_user_mapping</primary>
6255 The catalog <structname>pg_user_mapping</structname> stores
6256 the mappings from local user to remote. Access to this catalog is
6257 restricted from normal users, use the view
6258 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
6263 <title><structname>pg_user_mapping</> Columns</title>
6270 <entry>References</entry>
6271 <entry>Description</entry>
6277 <entry><structfield>umuser</structfield></entry>
6278 <entry><type>oid</type></entry>
6279 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6280 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
6284 <entry><structfield>umserver</structfield></entry>
6285 <entry><type>oid</type></entry>
6286 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
6288 The OID of the foreign server that contains this mapping
6293 <entry><structfield>umoptions</structfield></entry>
6294 <entry><type>text[]</type></entry>
6297 User mapping specific options, as <quote>keyword=value</> strings
6306 <sect1 id="views-overview">
6307 <title>System Views</title>
6310 In addition to the system catalogs, <productname>PostgreSQL</productname>
6311 provides a number of built-in views. Some system views provide convenient
6312 access to some commonly used queries on the system catalogs. Other views
6313 provide access to internal server state.
6317 The information schema (<xref linkend="information-schema">) provides
6318 an alternative set of views which overlap the functionality of the system
6319 views. Since the information schema is SQL-standard whereas the views
6320 described here are <productname>PostgreSQL</productname>-specific,
6321 it's usually better to use the information schema if it provides all
6322 the information you need.
6326 <xref linkend="view-table"> lists the system views described here.
6327 More detailed documentation of each view follows below.
6328 There are some additional views that provide access to the results of
6329 the statistics collector; they are described in <xref
6330 linkend="monitoring-stats-views-table">.
6334 Except where noted, all the views described here are read-only.
6337 <table id="view-table">
6338 <title>System Views</title>
6343 <entry>View Name</entry>
6344 <entry>Purpose</entry>
6350 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
6351 <entry>available extensions</entry>
6355 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
6356 <entry>available versions of extensions</entry>
6360 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
6361 <entry>open cursors</entry>
6365 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
6366 <entry>groups of database users</entry>
6370 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
6371 <entry>indexes</entry>
6375 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
6376 <entry>currently held locks</entry>
6380 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
6381 <entry>prepared statements</entry>
6385 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
6386 <entry>prepared transactions</entry>
6390 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
6391 <entry>database roles</entry>
6395 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
6396 <entry>rules</entry>
6400 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
6401 <entry>security labels</entry>
6405 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
6406 <entry>parameter settings</entry>
6410 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
6411 <entry>database users</entry>
6415 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
6416 <entry>planner statistics</entry>
6420 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
6421 <entry>tables</entry>
6425 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
6426 <entry>time zone abbreviations</entry>
6430 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
6431 <entry>time zone names</entry>
6435 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
6436 <entry>database users</entry>
6440 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
6441 <entry>user mappings</entry>
6445 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
6446 <entry>views</entry>
6454 <sect1 id="view-pg-available-extensions">
6455 <title><structname>pg_available_extensions</structname></title>
6457 <indexterm zone="view-pg-available-extensions">
6458 <primary>pg_available_extensions</primary>
6462 The <structname>pg_available_extensions</structname> view lists the
6463 extensions that are available for installation. This view can only
6464 be read by superusers. See also the
6465 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
6466 catalog, which shows the extensions currently installed.
6470 <title><structname>pg_available_extensions</> Columns</title>
6477 <entry>Description</entry>
6483 <entry><structfield>name</structfield></entry>
6484 <entry><type>name</type></entry>
6485 <entry>Extension name</entry>
6489 <entry><structfield>default_version</structfield></entry>
6490 <entry><type>text</type></entry>
6491 <entry>Name of default version, or <literal>NULL</literal> if none is
6496 <entry><structfield>installed_version</structfield></entry>
6497 <entry><type>text</type></entry>
6498 <entry>Currently installed version of the extension,
6499 or <literal>NULL</literal> if not installed</entry>
6503 <entry><structfield>comment</structfield></entry>
6504 <entry><type>text</type></entry>
6505 <entry>Comment string from the extension's control file</entry>
6512 The <structname>pg_available_extensions</structname> view is read only.
6516 <sect1 id="view-pg-available-extension-versions">
6517 <title><structname>pg_available_extension_versions</structname></title>
6519 <indexterm zone="view-pg-available-extension-versions">
6520 <primary>pg_available_extension_versions</primary>
6524 The <structname>pg_available_extension_versions</structname> view lists the
6525 specific extension versions that are available for installation. This view
6526 can only be read by superusers. See also the <link
6527 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
6528 catalog, which shows the extensions currently installed.
6532 <title><structname>pg_available_extension_versions</> Columns</title>
6539 <entry>Description</entry>
6545 <entry><structfield>name</structfield></entry>
6546 <entry><type>name</type></entry>
6547 <entry>Extension name</entry>
6551 <entry><structfield>version</structfield></entry>
6552 <entry><type>text</type></entry>
6553 <entry>Version name</entry>
6557 <entry><structfield>installed</structfield></entry>
6558 <entry><type>bool</type></entry>
6559 <entry>True if this version of this extension is currently
6564 <entry><structfield>relocatable</structfield></entry>
6565 <entry><type>bool</type></entry>
6566 <entry>True if extension can be relocated to another schema</entry>
6570 <entry><structfield>schema</structfield></entry>
6571 <entry><type>name</type></entry>
6572 <entry>Name of the schema that the extension must be installed into,
6573 or <literal>NULL</literal> if partially or fully relocatable</entry>
6577 <entry><structfield>requires</structfield></entry>
6578 <entry><type>name[]</type></entry>
6579 <entry>Names of prerequisite extensions,
6580 or <literal>NULL</literal> if none</entry>
6584 <entry><structfield>comment</structfield></entry>
6585 <entry><type>text</type></entry>
6586 <entry>Comment string from the extension's control file</entry>
6593 The <structname>pg_available_extension_versions</structname> view is read
6598 <sect1 id="view-pg-cursors">
6599 <title><structname>pg_cursors</structname></title>
6601 <indexterm zone="view-pg-cursors">
6602 <primary>pg_cursors</primary>
6606 The <structname>pg_cursors</structname> view lists the cursors that
6607 are currently available. Cursors can be defined in several ways:
6611 via the <xref linkend="sql-declare">
6618 via the Bind message in the frontend/backend protocol, as
6619 described in <xref linkend="protocol-flow-ext-query">
6625 via the Server Programming Interface (SPI), as described in
6626 <xref linkend="spi-interface">
6631 The <structname>pg_cursors</structname> view displays cursors
6632 created by any of these means. Cursors only exist for the duration
6633 of the transaction that defines them, unless they have been
6634 declared <literal>WITH HOLD</literal>. Therefore non-holdable
6635 cursors are only present in the view until the end of their
6636 creating transaction.
6640 Cursors are used internally to implement some of the components
6641 of <productname>PostgreSQL</>, such as procedural languages.
6642 Therefore, the <structname>pg_cursors</> view might include cursors
6643 that have not been explicitly created by the user.
6649 <title><structname>pg_cursors</> Columns</title>
6656 <entry>Description</entry>
6662 <entry><structfield>name</structfield></entry>
6663 <entry><type>text</type></entry>
6664 <entry>The name of the cursor</entry>
6668 <entry><structfield>statement</structfield></entry>
6669 <entry><type>text</type></entry>
6670 <entry>The verbatim query string submitted to declare this cursor</entry>
6674 <entry><structfield>is_holdable</structfield></entry>
6675 <entry><type>boolean</type></entry>
6677 <literal>true</literal> if the cursor is holdable (that is, it
6678 can be accessed after the transaction that declared the cursor
6679 has committed); <literal>false</literal> otherwise
6684 <entry><structfield>is_binary</structfield></entry>
6685 <entry><type>boolean</type></entry>
6687 <literal>true</literal> if the cursor was declared
6688 <literal>BINARY</literal>; <literal>false</literal>
6694 <entry><structfield>is_scrollable</structfield></entry>
6695 <entry><type>boolean</type></entry>
6697 <literal>true</> if the cursor is scrollable (that is, it
6698 allows rows to be retrieved in a nonsequential manner);
6699 <literal>false</literal> otherwise
6704 <entry><structfield>creation_time</structfield></entry>
6705 <entry><type>timestamptz</type></entry>
6706 <entry>The time at which the cursor was declared</entry>
6713 The <structname>pg_cursors</structname> view is read only.
6718 <sect1 id="view-pg-group">
6719 <title><structname>pg_group</structname></title>
6721 <indexterm zone="view-pg-group">
6722 <primary>pg_group</primary>
6726 The view <structname>pg_group</structname> exists for backwards
6727 compatibility: it emulates a catalog that existed in
6728 <productname>PostgreSQL</productname> before version 8.1.
6729 It shows the names and members of all roles that are marked as not
6730 <structfield>rolcanlogin</>, which is an approximation to the set
6731 of roles that are being used as groups.
6735 <title><structname>pg_group</> Columns</title>
6742 <entry>References</entry>
6743 <entry>Description</entry>
6749 <entry><structfield>groname</structfield></entry>
6750 <entry><type>name</type></entry>
6751 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6752 <entry>Name of the group</entry>
6756 <entry><structfield>grosysid</structfield></entry>
6757 <entry><type>oid</type></entry>
6758 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6759 <entry>ID of this group</entry>
6763 <entry><structfield>grolist</structfield></entry>
6764 <entry><type>oid[]</type></entry>
6765 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6766 <entry>An array containing the IDs of the roles in this group</entry>
6774 <sect1 id="view-pg-indexes">
6775 <title><structname>pg_indexes</structname></title>
6777 <indexterm zone="view-pg-indexes">
6778 <primary>pg_indexes</primary>
6782 The view <structname>pg_indexes</structname> provides access to
6783 useful information about each index in the database.
6787 <title><structname>pg_indexes</> Columns</title>
6794 <entry>References</entry>
6795 <entry>Description</entry>
6800 <entry><structfield>schemaname</structfield></entry>
6801 <entry><type>name</type></entry>
6802 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6803 <entry>Name of schema containing table and index</entry>
6806 <entry><structfield>tablename</structfield></entry>
6807 <entry><type>name</type></entry>
6808 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6809 <entry>Name of table the index is for</entry>
6812 <entry><structfield>indexname</structfield></entry>
6813 <entry><type>name</type></entry>
6814 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6815 <entry>Name of index</entry>
6818 <entry><structfield>tablespace</structfield></entry>
6819 <entry><type>name</type></entry>
6820 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6821 <entry>Name of tablespace containing index (null if default for database)</entry>
6824 <entry><structfield>indexdef</structfield></entry>
6825 <entry><type>text</type></entry>
6827 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
6836 <sect1 id="view-pg-locks">
6837 <title><structname>pg_locks</structname></title>
6839 <indexterm zone="view-pg-locks">
6840 <primary>pg_locks</primary>
6844 The view <structname>pg_locks</structname> provides access to
6845 information about the locks held by open transactions within the
6846 database server. See <xref linkend="mvcc"> for more discussion
6851 <structname>pg_locks</structname> contains one row per active lockable
6852 object, requested lock mode, and relevant transaction. Thus, the same
6853 lockable object might
6854 appear many times, if multiple transactions are holding or waiting
6855 for locks on it. However, an object that currently has no locks on it
6856 will not appear at all.
6860 There are several distinct types of lockable objects:
6861 whole relations (e.g., tables), individual pages of relations,
6862 individual tuples of relations,
6863 transaction IDs (both virtual and permanent IDs),
6864 and general database objects (identified by class OID and object OID,
6865 in the same way as in <structname>pg_description</structname> or
6866 <structname>pg_depend</structname>). Also, the right to extend a
6867 relation is represented as a separate lockable object.
6871 <title><structname>pg_locks</> Columns</title>
6878 <entry>References</entry>
6879 <entry>Description</entry>
6884 <entry><structfield>locktype</structfield></entry>
6885 <entry><type>text</type></entry>
6888 Type of the lockable object:
6889 <literal>relation</>,
6893 <literal>transactionid</>,
6894 <literal>virtualxid</>,
6896 <literal>userlock</>, or
6897 <literal>advisory</>
6901 <entry><structfield>database</structfield></entry>
6902 <entry><type>oid</type></entry>
6903 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6905 OID of the database in which the object exists, or
6906 zero if the object is a shared object, or
6907 null if the object is a transaction ID
6911 <entry><structfield>relation</structfield></entry>
6912 <entry><type>oid</type></entry>
6913 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6915 OID of the relation, or null if the object is not
6916 a relation or part of a relation
6920 <entry><structfield>page</structfield></entry>
6921 <entry><type>integer</type></entry>
6924 Page number within the relation, or null if the object
6925 is not a tuple or relation page
6929 <entry><structfield>tuple</structfield></entry>
6930 <entry><type>smallint</type></entry>
6933 Tuple number within the page, or null if the object is not a tuple
6937 <entry><structfield>virtualxid</structfield></entry>
6938 <entry><type>text</type></entry>
6941 Virtual ID of a transaction, or null if the object is not a
6942 virtual transaction ID
6946 <entry><structfield>transactionid</structfield></entry>
6947 <entry><type>xid</type></entry>
6950 ID of a transaction, or null if the object is not a transaction ID
6954 <entry><structfield>classid</structfield></entry>
6955 <entry><type>oid</type></entry>
6956 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6958 OID of the system catalog containing the object, or null if the
6959 object is not a general database object
6963 <entry><structfield>objid</structfield></entry>
6964 <entry><type>oid</type></entry>
6965 <entry>any OID column</entry>
6967 OID of the object within its system catalog, or null if the
6968 object is not a general database object.
6969 For advisory locks it is used to distinguish the two key
6970 spaces (1 for an int8 key, 2 for two int4 keys).
6974 <entry><structfield>objsubid</structfield></entry>
6975 <entry><type>smallint</type></entry>
6978 For a table column, this is the column number (the
6979 <structfield>classid</> and <structfield>objid</> refer to the
6980 table itself). For all other object types, this column is
6981 zero. Null if the object is not a general database object
6985 <entry><structfield>virtualtransaction</structfield></entry>
6986 <entry><type>text</type></entry>
6989 Virtual ID of the transaction that is holding or awaiting this lock
6993 <entry><structfield>pid</structfield></entry>
6994 <entry><type>integer</type></entry>
6997 Process ID of the server process holding or awaiting this
6998 lock. Null if the lock is held by a prepared transaction.
7002 <entry><structfield>mode</structfield></entry>
7003 <entry><type>text</type></entry>
7005 <entry>Name of the lock mode held or desired by this process (see <xref
7006 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
7009 <entry><structfield>granted</structfield></entry>
7010 <entry><type>boolean</type></entry>
7012 <entry>True if lock is held, false if lock is awaited</entry>
7019 <structfield>granted</structfield> is true in a row representing a lock
7020 held by the indicated transaction. False indicates that this transaction is
7021 currently waiting to acquire this lock, which implies that some other
7022 transaction is holding a conflicting lock mode on the same lockable object.
7023 The waiting transaction will sleep until the other lock is released (or a
7024 deadlock situation is detected). A single transaction can be waiting to
7025 acquire at most one lock at a time.
7029 Every transaction holds an exclusive lock on its virtual transaction ID for
7030 its entire duration. If a permanent ID is assigned to the transaction
7031 (which normally happens only if the transaction changes the state of the
7032 database), it also holds an exclusive lock on its permanent transaction ID
7033 until it ends. When one transaction finds it necessary to wait specifically
7034 for another transaction, it does so by attempting to acquire share lock on
7035 the other transaction ID (either virtual or permanent ID depending on the
7036 situation). That will succeed only when the other transaction
7037 terminates and releases its locks.
7041 Although tuples are a lockable type of object,
7042 information about row-level locks is stored on disk, not in memory,
7043 and therefore row-level locks normally do not appear in this view.
7044 If a transaction is waiting for a
7045 row-level lock, it will usually appear in the view as waiting for the
7046 permanent transaction ID of the current holder of that row lock.
7050 Advisory locks can be acquired on keys consisting of either a single
7051 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
7052 high-order half in the <structfield>classid</> column, its low-order half
7053 in the <structfield>objid</> column, and <structfield>objsubid</> equal
7054 to 1. Integer keys are displayed with the first key in the
7055 <structfield>classid</> column, the second key in the <structfield>objid</>
7056 column, and <structfield>objsubid</> equal to 2. The actual meaning of
7057 the keys is up to the user. Advisory locks are local to each database,
7058 so the <structfield>database</> column is meaningful for an advisory lock.
7062 When the <structname>pg_locks</structname> view is accessed, the
7063 internal lock manager data structures are momentarily locked, and
7064 a copy is made for the view to display. This ensures that the
7065 view produces a consistent set of results, while not blocking
7066 normal lock manager operations longer than necessary. Nonetheless
7067 there could be some impact on database performance if this view is
7068 frequently accessed.
7072 <structname>pg_locks</structname> provides a global view of all locks
7073 in the database cluster, not only those relevant to the current database.
7074 Although its <structfield>relation</structfield> column can be joined
7075 against <structname>pg_class</>.<structfield>oid</> to identify locked
7076 relations, this will only work correctly for relations in the current
7077 database (those for which the <structfield>database</structfield> column
7078 is either the current database's OID or zero).
7082 The <structfield>pid</structfield> column can be joined to the
7083 <structfield>procpid</structfield> column of the
7084 <structname>pg_stat_activity</structname> view to get more
7085 information on the session holding or waiting to hold each lock.
7086 Also, if you are using prepared transactions, the
7087 <structfield>transaction</> column can be joined to the
7088 <structfield>transaction</structfield> column of the
7089 <structname>pg_prepared_xacts</structname> view to get more
7090 information on prepared transactions that hold locks.
7091 (A prepared transaction can never be waiting for a lock,
7092 but it continues to hold the locks it acquired while running.)
7097 <sect1 id="view-pg-prepared-statements">
7098 <title><structname>pg_prepared_statements</structname></title>
7100 <indexterm zone="view-pg-prepared-statements">
7101 <primary>pg_prepared_statements</primary>
7105 The <structname>pg_prepared_statements</structname> view displays
7106 all the prepared statements that are available in the current
7107 session. See <xref linkend="sql-prepare"> for more information about prepared
7112 <structname>pg_prepared_statements</structname> contains one row
7113 for each prepared statement. Rows are added to the view when a new
7114 prepared statement is created and removed when a prepared statement
7115 is released (for example, via the <xref linkend="sql-deallocate"> command).
7119 <title><structname>pg_prepared_statements</> Columns</title>
7126 <entry>Description</entry>
7131 <entry><structfield>name</structfield></entry>
7132 <entry><type>text</type></entry>
7134 The identifier of the prepared statement
7138 <entry><structfield>statement</structfield></entry>
7139 <entry><type>text</type></entry>
7141 The query string submitted by the client to create this
7142 prepared statement. For prepared statements created via SQL,
7143 this is the <command>PREPARE</command> statement submitted by
7144 the client. For prepared statements created via the
7145 frontend/backend protocol, this is the text of the prepared
7150 <entry><structfield>prepare_time</structfield></entry>
7151 <entry><type>timestamptz</type></entry>
7153 The time at which the prepared statement was created
7157 <entry><structfield>parameter_types</structfield></entry>
7158 <entry><type>regtype[]</type></entry>
7160 The expected parameter types for the prepared statement in the
7161 form of an array of <type>regtype</type>. The OID corresponding
7162 to an element of this array can be obtained by casting the
7163 <type>regtype</type> value to <type>oid</type>.
7167 <entry><structfield>from_sql</structfield></entry>
7168 <entry><type>boolean</type></entry>
7170 <literal>true</literal> if the prepared statement was created
7171 via the <command>PREPARE</command> SQL statement;
7172 <literal>false</literal> if the statement was prepared via the
7173 frontend/backend protocol
7181 The <structname>pg_prepared_statements</structname> view is read only.
7185 <sect1 id="view-pg-prepared-xacts">
7186 <title><structname>pg_prepared_xacts</structname></title>
7188 <indexterm zone="view-pg-prepared-xacts">
7189 <primary>pg_prepared_xacts</primary>
7193 The view <structname>pg_prepared_xacts</structname> displays
7194 information about transactions that are currently prepared for two-phase
7195 commit (see <xref linkend="sql-prepare-transaction"> for details).
7199 <structname>pg_prepared_xacts</structname> contains one row per prepared
7200 transaction. An entry is removed when the transaction is committed or
7205 <title><structname>pg_prepared_xacts</> Columns</title>
7212 <entry>References</entry>
7213 <entry>Description</entry>
7218 <entry><structfield>transaction</structfield></entry>
7219 <entry><type>xid</type></entry>
7222 Numeric transaction identifier of the prepared transaction
7226 <entry><structfield>gid</structfield></entry>
7227 <entry><type>text</type></entry>
7230 Global transaction identifier that was assigned to the transaction
7234 <entry><structfield>prepared</structfield></entry>
7235 <entry><type>timestamp with time zone</type></entry>
7238 Time at which the transaction was prepared for commit
7242 <entry><structfield>owner</structfield></entry>
7243 <entry><type>name</type></entry>
7244 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7246 Name of the user that executed the transaction
7250 <entry><structfield>database</structfield></entry>
7251 <entry><type>name</type></entry>
7252 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
7254 Name of the database in which the transaction was executed
7262 When the <structname>pg_prepared_xacts</structname> view is accessed, the
7263 internal transaction manager data structures are momentarily locked, and
7264 a copy is made for the view to display. This ensures that the
7265 view produces a consistent set of results, while not blocking
7266 normal operations longer than necessary. Nonetheless
7267 there could be some impact on database performance if this view is
7268 frequently accessed.
7273 <sect1 id="view-pg-roles">
7274 <title><structname>pg_roles</structname></title>
7276 <indexterm zone="view-pg-roles">
7277 <primary>pg_roles</primary>
7281 The view <structname>pg_roles</structname> provides access to
7282 information about database roles. This is simply a publicly
7284 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
7285 that blanks out the password field.
7289 This view explicitly exposes the OID column of the underlying table,
7290 since that is needed to do joins to other catalogs.
7294 <title><structname>pg_roles</> Columns</title>
7301 <entry>References</entry>
7302 <entry>Description</entry>
7308 <entry><structfield>rolname</structfield></entry>
7309 <entry><type>name</type></entry>
7311 <entry>Role name</entry>
7315 <entry><structfield>rolsuper</structfield></entry>
7316 <entry><type>bool</type></entry>
7318 <entry>Role has superuser privileges</entry>
7322 <entry><structfield>rolinherit</structfield></entry>
7323 <entry><type>bool</type></entry>
7325 <entry>Role automatically inherits privileges of roles it is a
7330 <entry><structfield>rolcreaterole</structfield></entry>
7331 <entry><type>bool</type></entry>
7333 <entry>Role can create more roles</entry>
7337 <entry><structfield>rolcreatedb</structfield></entry>
7338 <entry><type>bool</type></entry>
7340 <entry>Role can create databases</entry>
7344 <entry><structfield>rolcatupdate</structfield></entry>
7345 <entry><type>bool</type></entry>
7348 Role can update system catalogs directly. (Even a superuser cannot do
7349 this unless this column is true.)
7354 <entry><structfield>rolcanlogin</structfield></entry>
7355 <entry><type>bool</type></entry>
7358 Role can log in. That is, this role can be given as the initial
7359 session authorization identifier
7364 <entry><structfield>rolconnlimit</structfield></entry>
7365 <entry><type>int4</type></entry>
7368 For roles that can log in, this sets maximum number of concurrent
7369 connections this role can make. -1 means no limit.
7374 <entry><structfield>rolpassword</structfield></entry>
7375 <entry><type>text</type></entry>
7377 <entry>Not the password (always reads as <literal>********</>)</entry>
7381 <entry><structfield>rolvaliduntil</structfield></entry>
7382 <entry><type>timestamptz</type></entry>
7384 <entry>Password expiry time (only used for password authentication);
7385 null if no expiration</entry>
7389 <entry><structfield>oid</structfield></entry>
7390 <entry><type>oid</type></entry>
7391 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7392 <entry>ID of role</entry>
7400 <sect1 id="view-pg-rules">
7401 <title><structname>pg_rules</structname></title>
7403 <indexterm zone="view-pg-rules">
7404 <primary>pg_rules</primary>
7408 The view <structname>pg_rules</structname> provides access to
7409 useful information about query rewrite rules.
7413 <title><structname>pg_rules</> Columns</title>
7420 <entry>References</entry>
7421 <entry>Description</entry>
7426 <entry><structfield>schemaname</structfield></entry>
7427 <entry><type>name</type></entry>
7428 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7429 <entry>Name of schema containing table</entry>
7432 <entry><structfield>tablename</structfield></entry>
7433 <entry><type>name</type></entry>
7434 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7435 <entry>Name of table the rule is for</entry>
7438 <entry><structfield>rulename</structfield></entry>
7439 <entry><type>name</type></entry>
7440 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
7441 <entry>Name of rule</entry>
7444 <entry><structfield>definition</structfield></entry>
7445 <entry><type>text</type></entry>
7447 <entry>Rule definition (a reconstructed creation command)</entry>
7454 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
7455 of views; those can be seen in <structname>pg_views</>.
7460 <sect1 id="view-pg-seclabels">
7461 <title><structname>pg_seclabels</structname></title>
7463 <indexterm zone="view-pg-seclabels">
7464 <primary>pg_seclabels</primary>
7468 The view <structname>pg_seclabels</structname> provides information about
7469 security labels. It as an easier-to-query version of the
7470 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
7474 <title><structname>pg_seclabels</> Columns</title>
7481 <entry>References</entry>
7482 <entry>Description</entry>
7487 <entry><structfield>objoid</structfield></entry>
7488 <entry><type>oid</type></entry>
7489 <entry>any OID column</entry>
7490 <entry>The OID of the object this security label pertains to</entry>
7493 <entry><structfield>classoid</structfield></entry>
7494 <entry><type>oid</type></entry>
7495 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7496 <entry>The OID of the system catalog this object appears in</entry>
7499 <entry><structfield>objsubid</structfield></entry>
7500 <entry><type>int4</type></entry>
7503 For a security label on a table column, this is the column number (the
7504 <structfield>objoid</> and <structfield>classoid</> refer to
7505 the table itself). For all other object types, this column is
7510 <entry><structfield>objtype</structfield></entry>
7511 <entry><type>text</type></entry>
7514 The type of object to which this label applies, as text.
7518 <entry><structfield>objnamespace</structfield></entry>
7519 <entry><type>oid</type></entry>
7520 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7522 The OID of the namespace for this object, if applicable;
7527 <entry><structfield>objname</structfield></entry>
7528 <entry><type>text</type></entry>
7531 The name of the object to which this label applies, as text.
7535 <entry><structfield>provider</structfield></entry>
7536 <entry><type>text</type></entry>
7537 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
7538 <entry>The label provider associated with this label.</entry>
7541 <entry><structfield>label</structfield></entry>
7542 <entry><type>text</type></entry>
7543 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
7544 <entry>The security label applied to this object.</entry>
7551 <sect1 id="view-pg-settings">
7552 <title><structname>pg_settings</structname></title>
7554 <indexterm zone="view-pg-settings">
7555 <primary>pg_settings</primary>
7559 The view <structname>pg_settings</structname> provides access to
7560 run-time parameters of the server. It is essentially an alternative
7561 interface to the <xref linkend="sql-show">
7562 and <xref linkend="sql-set"> commands.
7563 It also provides access to some facts about each parameter that are
7564 not directly available from <command>SHOW</>, such as minimum and
7569 <title><structname>pg_settings</> Columns</title>
7576 <entry>Description</entry>
7581 <entry><structfield>name</structfield></entry>
7582 <entry><type>text</type></entry>
7583 <entry>Run-time configuration parameter name</entry>
7586 <entry><structfield>setting</structfield></entry>
7587 <entry><type>text</type></entry>
7588 <entry>Current value of the parameter</entry>
7591 <entry><structfield>unit</structfield></entry>
7592 <entry><type>text</type></entry>
7593 <entry>Implicit unit of the parameter</entry>
7596 <entry><structfield>category</structfield></entry>
7597 <entry><type>text</type></entry>
7598 <entry>Logical group of the parameter</entry>
7601 <entry><structfield>short_desc</structfield></entry>
7602 <entry><type>text</type></entry>
7603 <entry>A brief description of the parameter</entry>
7606 <entry><structfield>extra_desc</structfield></entry>
7607 <entry><type>text</type></entry>
7608 <entry>Additional, more detailed, description of the parameter</entry>
7611 <entry><structfield>context</structfield></entry>
7612 <entry><type>text</type></entry>
7613 <entry>Context required to set the parameter's value</entry>
7616 <entry><structfield>vartype</structfield></entry>
7617 <entry><type>text</type></entry>
7618 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
7619 <literal>integer</>, <literal>real</>, or <literal>string</>)
7623 <entry><structfield>source</structfield></entry>
7624 <entry><type>text</type></entry>
7625 <entry>Source of the current parameter value</entry>
7628 <entry><structfield>min_val</structfield></entry>
7629 <entry><type>text</type></entry>
7630 <entry>Minimum allowed value of the parameter (null for non-numeric
7634 <entry><structfield>max_val</structfield></entry>
7635 <entry><type>text</type></entry>
7636 <entry>Maximum allowed value of the parameter (null for non-numeric
7640 <entry><structfield>enumvals</structfield></entry>
7641 <entry><type>text[]</type></entry>
7642 <entry>Allowed values of an enum parameter (null for non-enum
7646 <entry><structfield>boot_val</structfield></entry>
7647 <entry><type>text</type></entry>
7648 <entry>Parameter value assumed at server startup if the parameter is
7649 not otherwise set</entry>
7652 <entry><structfield>reset_val</structfield></entry>
7653 <entry><type>text</type></entry>
7654 <entry>Value that <command>RESET</command> would reset the parameter to
7655 in the current session</entry>
7658 <entry><structfield>sourcefile</structfield></entry>
7659 <entry><type>text</type></entry>
7660 <entry>Configuration file the current value was set in (null for
7661 values set from sources other than configuration files, or when
7662 examined by a non-superuser);
7663 helpful when using <literal>include</> directives in configuration files</entry>
7666 <entry><structfield>sourceline</structfield></entry>
7667 <entry><type>integer</type></entry>
7668 <entry>Line number within the configuration file the current value was
7669 set at (null for values set from sources other than configuration files,
7670 or when examined by a non-superuser)
7678 The <structname>pg_settings</structname> view cannot be inserted into or
7679 deleted from, but it can be updated. An <command>UPDATE</command> applied
7680 to a row of <structname>pg_settings</structname> is equivalent to executing
7681 the <xref linkend="sql-set"> command on that named
7682 parameter. The change only affects the value used by the current
7683 session. If an <command>UPDATE</command> is issued within a transaction
7684 that is later aborted, the effects of the <command>UPDATE</command> command
7685 disappear when the transaction is rolled back. Once the surrounding
7686 transaction is committed, the effects will persist until the end of the
7687 session, unless overridden by another <command>UPDATE</command> or
7688 <command>SET</command>.
7693 <sect1 id="view-pg-shadow">
7694 <title><structname>pg_shadow</structname></title>
7696 <indexterm zone="view-pg-shadow">
7697 <primary>pg_shadow</primary>
7701 The view <structname>pg_shadow</structname> exists for backwards
7702 compatibility: it emulates a catalog that existed in
7703 <productname>PostgreSQL</productname> before version 8.1.
7704 It shows properties of all roles that are marked as
7705 <structfield>rolcanlogin</> in
7706 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
7710 The name stems from the fact that this table
7711 should not be readable by the public since it contains passwords.
7712 <link linkend="view-pg-user"><structname>pg_user</structname></link>
7713 is a publicly readable view on
7714 <structname>pg_shadow</structname> that blanks out the password field.
7718 <title><structname>pg_shadow</> Columns</title>
7725 <entry>References</entry>
7726 <entry>Description</entry>
7732 <entry><structfield>usename</structfield></entry>
7733 <entry><type>name</type></entry>
7734 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7735 <entry>User name</entry>
7739 <entry><structfield>usesysid</structfield></entry>
7740 <entry><type>oid</type></entry>
7741 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7742 <entry>ID of this user</entry>
7746 <entry><structfield>usecreatedb</structfield></entry>
7747 <entry><type>bool</type></entry>
7749 <entry>User can create databases</entry>
7753 <entry><structfield>usesuper</structfield></entry>
7754 <entry><type>bool</type></entry>
7756 <entry>User is a superuser</entry>
7760 <entry><structfield>usecatupd</structfield></entry>
7761 <entry><type>bool</type></entry>
7764 User can update system catalogs. (Even a superuser cannot do
7765 this unless this column is true.)
7770 <entry><structfield>passwd</structfield></entry>
7771 <entry><type>text</type></entry>
7773 <entry>Password (possibly encrypted); null if none. See
7774 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
7775 for details of how encrypted passwords are stored.</entry>
7779 <entry><structfield>valuntil</structfield></entry>
7780 <entry><type>abstime</type></entry>
7782 <entry>Password expiry time (only used for password authentication)</entry>
7786 <entry><structfield>useconfig</structfield></entry>
7787 <entry><type>text[]</type></entry>
7789 <entry>Session defaults for run-time configuration variables</entry>
7797 <sect1 id="view-pg-stats">
7798 <title><structname>pg_stats</structname></title>
7800 <indexterm zone="view-pg-stats">
7801 <primary>pg_stats</primary>
7805 The view <structname>pg_stats</structname> provides access to
7806 the information stored in the <link
7807 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
7808 catalog. This view allows access only to rows of
7809 <structname>pg_statistic</structname> that correspond to tables the
7810 user has permission to read, and therefore it is safe to allow public
7811 read access to this view.
7815 <structname>pg_stats</structname> is also designed to present the
7816 information in a more readable format than the underlying catalog
7817 — at the cost that its schema must be extended whenever new slot types
7818 are defined for <structname>pg_statistic</structname>.
7822 <title><structname>pg_stats</> Columns</title>
7829 <entry>References</entry>
7830 <entry>Description</entry>
7835 <entry><structfield>schemaname</structfield></entry>
7836 <entry><type>name</type></entry>
7837 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7838 <entry>Name of schema containing table</entry>
7842 <entry><structfield>tablename</structfield></entry>
7843 <entry><type>name</type></entry>
7844 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7845 <entry>Name of table</entry>
7849 <entry><structfield>attname</structfield></entry>
7850 <entry><type>name</type></entry>
7851 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
7852 <entry>Name of the column described by this row</entry>
7856 <entry><structfield>inherited</structfield></entry>
7857 <entry><type>bool</type></entry>
7859 <entry>If true, this row includes inheritance child columns, not just the
7860 values in the specified table</entry>
7864 <entry><structfield>null_frac</structfield></entry>
7865 <entry><type>real</type></entry>
7867 <entry>Fraction of column entries that are null</entry>
7871 <entry><structfield>avg_width</structfield></entry>
7872 <entry><type>integer</type></entry>
7874 <entry>Average width in bytes of column's entries</entry>
7878 <entry><structfield>n_distinct</structfield></entry>
7879 <entry><type>real</type></entry>
7882 If greater than zero, the estimated number of distinct values in the
7883 column. If less than zero, the negative of the number of distinct
7884 values divided by the number of rows. (The negated form is used when
7885 <command>ANALYZE</> believes that the number of distinct values is
7886 likely to increase as the table grows; the positive form is used when
7887 the column seems to have a fixed number of possible values.) For
7888 example, -1 indicates a unique column in which the number of distinct
7889 values is the same as the number of rows.
7894 <entry><structfield>most_common_vals</structfield></entry>
7895 <entry><type>anyarray</type></entry>
7898 A list of the most common values in the column. (Null if
7899 no values seem to be more common than any others.)
7900 For some data types such as <type>tsvector</>, this is a list of
7901 the most common element values rather than values of the type itself.
7906 <entry><structfield>most_common_freqs</structfield></entry>
7907 <entry><type>real[]</type></entry>
7910 A list of the frequencies of the most common values or elements,
7911 i.e., number of occurrences of each divided by total number of rows.
7912 (Null when <structfield>most_common_vals</structfield> is.)
7913 For some data types such as <type>tsvector</>, it can also store some
7914 additional information, making it longer than the
7915 <structfield>most_common_vals</> array.
7920 <entry><structfield>histogram_bounds</structfield></entry>
7921 <entry><type>anyarray</type></entry>
7924 A list of values that divide the column's values into groups of
7925 approximately equal population. The values in
7926 <structfield>most_common_vals</>, if present, are omitted from this
7927 histogram calculation. (This column is null if the column data type
7928 does not have a <literal><</> operator or if the
7929 <structfield>most_common_vals</> list accounts for the entire
7935 <entry><structfield>correlation</structfield></entry>
7936 <entry><type>real</type></entry>
7939 Statistical correlation between physical row ordering and
7940 logical ordering of the column values. This ranges from -1 to +1.
7941 When the value is near -1 or +1, an index scan on the column will
7942 be estimated to be cheaper than when it is near zero, due to reduction
7943 of random access to the disk. (This column is null if the column data
7944 type does not have a <literal><</> operator.)
7952 The maximum number of entries in the <structfield>most_common_vals</>
7953 and <structfield>histogram_bounds</> arrays can be set on a
7954 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
7955 command, or globally by setting the
7956 <xref linkend="guc-default-statistics-target"> run-time parameter.
7961 <sect1 id="view-pg-tables">
7962 <title><structname>pg_tables</structname></title>
7964 <indexterm zone="view-pg-tables">
7965 <primary>pg_tables</primary>
7969 The view <structname>pg_tables</structname> provides access to
7970 useful information about each table in the database.
7974 <title><structname>pg_tables</> Columns</title>
7981 <entry>References</entry>
7982 <entry>Description</entry>
7987 <entry><structfield>schemaname</structfield></entry>
7988 <entry><type>name</type></entry>
7989 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7990 <entry>Name of schema containing table</entry>
7993 <entry><structfield>tablename</structfield></entry>
7994 <entry><type>name</type></entry>
7995 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7996 <entry>Name of table</entry>
7999 <entry><structfield>tableowner</structfield></entry>
8000 <entry><type>name</type></entry>
8001 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8002 <entry>Name of table's owner</entry>
8005 <entry><structfield>tablespace</structfield></entry>
8006 <entry><type>name</type></entry>
8007 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8008 <entry>Name of tablespace containing table (null if default for database)</entry>
8011 <entry><structfield>hasindexes</structfield></entry>
8012 <entry><type>boolean</type></entry>
8013 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
8014 <entry>True if table has (or recently had) any indexes</entry>
8017 <entry><structfield>hasrules</structfield></entry>
8018 <entry><type>boolean</type></entry>
8019 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
8020 <entry>True if table has (or once had) rules</entry>
8023 <entry><structfield>hastriggers</structfield></entry>
8024 <entry><type>boolean</type></entry>
8025 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
8026 <entry>True if table has (or once had) triggers</entry>
8034 <sect1 id="view-pg-timezone-abbrevs">
8035 <title><structname>pg_timezone_abbrevs</structname></title>
8037 <indexterm zone="view-pg-timezone-abbrevs">
8038 <primary>pg_timezone_abbrevs</primary>
8042 The view <structname>pg_timezone_abbrevs</structname> provides a list
8043 of time zone abbreviations that are currently recognized by the datetime
8044 input routines. The contents of this view change when the
8045 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
8049 <title><structname>pg_timezone_abbrevs</> Columns</title>
8056 <entry>Description</entry>
8061 <entry><structfield>abbrev</structfield></entry>
8062 <entry><type>text</type></entry>
8063 <entry>Time zone abbreviation</entry>
8066 <entry><structfield>utc_offset</structfield></entry>
8067 <entry><type>interval</type></entry>
8068 <entry>Offset from UTC (positive means east of Greenwich)</entry>
8071 <entry><structfield>is_dst</structfield></entry>
8072 <entry><type>boolean</type></entry>
8073 <entry>True if this is a daylight-savings abbreviation</entry>
8081 <sect1 id="view-pg-timezone-names">
8082 <title><structname>pg_timezone_names</structname></title>
8084 <indexterm zone="view-pg-timezone-names">
8085 <primary>pg_timezone_names</primary>
8089 The view <structname>pg_timezone_names</structname> provides a list
8090 of time zone names that are recognized by <command>SET TIMEZONE</>,
8091 along with their associated abbreviations, UTC offsets,
8092 and daylight-savings status.
8093 Unlike the abbreviations shown in <link
8094 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
8095 date rules. Therefore, the associated information changes across local DST
8096 boundaries. The displayed information is computed based on the current
8097 value of <function>CURRENT_TIMESTAMP</>.
8101 <title><structname>pg_timezone_names</> Columns</title>
8108 <entry>Description</entry>
8113 <entry><structfield>name</structfield></entry>
8114 <entry><type>text</type></entry>
8115 <entry>Time zone name</entry>
8118 <entry><structfield>abbrev</structfield></entry>
8119 <entry><type>text</type></entry>
8120 <entry>Time zone abbreviation</entry>
8123 <entry><structfield>utc_offset</structfield></entry>
8124 <entry><type>interval</type></entry>
8125 <entry>Offset from UTC (positive means east of Greenwich)</entry>
8128 <entry><structfield>is_dst</structfield></entry>
8129 <entry><type>boolean</type></entry>
8130 <entry>True if currently observing daylight savings</entry>
8138 <sect1 id="view-pg-user">
8139 <title><structname>pg_user</structname></title>
8141 <indexterm zone="view-pg-user">
8142 <primary>pg_user</primary>
8146 The view <structname>pg_user</structname> provides access to
8147 information about database users. This is simply a publicly
8149 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
8150 that blanks out the password field.
8154 <title><structname>pg_user</> Columns</title>
8161 <entry>Description</entry>
8166 <entry><structfield>usename</structfield></entry>
8167 <entry><type>name</type></entry>
8168 <entry>User name</entry>
8172 <entry><structfield>usesysid</structfield></entry>
8173 <entry><type>int4</type></entry>
8174 <entry>User ID (arbitrary number used to reference this user)</entry>
8178 <entry><structfield>usecreatedb</structfield></entry>
8179 <entry><type>bool</type></entry>
8180 <entry>User can create databases</entry>
8184 <entry><structfield>usesuper</structfield></entry>
8185 <entry><type>bool</type></entry>
8186 <entry>User is a superuser</entry>
8190 <entry><structfield>usecatupd</structfield></entry>
8191 <entry><type>bool</type></entry>
8193 User can update system catalogs. (Even a superuser cannot do
8194 this unless this column is true.)
8199 <entry><structfield>passwd</structfield></entry>
8200 <entry><type>text</type></entry>
8201 <entry>Not the password (always reads as <literal>********</>)</entry>
8205 <entry><structfield>valuntil</structfield></entry>
8206 <entry><type>abstime</type></entry>
8207 <entry>Password expiry time (only used for password authentication)</entry>
8211 <entry><structfield>useconfig</structfield></entry>
8212 <entry><type>text[]</type></entry>
8213 <entry>Session defaults for run-time configuration variables</entry>
8221 <sect1 id="view-pg-user-mappings">
8222 <title><structname>pg_user_mappings</structname></title>
8224 <indexterm zone="view-pg-user-mappings">
8225 <primary>pg_user_mappings</primary>
8229 The view <structname>pg_user_mappings</structname> provides access
8230 to information about user mappings. This is essentially a publicly
8232 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
8233 that leaves out the options field if the user has no rights to use
8238 <title><structname>pg_user_mappings</> Columns</title>
8245 <entry>References</entry>
8246 <entry>Description</entry>
8252 <entry><structfield>umid</structfield></entry>
8253 <entry><type>oid</type></entry>
8254 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
8255 <entry>OID of the user mapping</entry>
8259 <entry><structfield>srvid</structfield></entry>
8260 <entry><type>oid</type></entry>
8261 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
8263 The OID of the foreign server that contains this mapping
8268 <entry><structfield>srvname</structfield></entry>
8269 <entry><type>text</type></entry>
8272 Name of the foreign server
8277 <entry><structfield>umuser</structfield></entry>
8278 <entry><type>oid</type></entry>
8279 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8280 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
8284 <entry><structfield>usename</structfield></entry>
8285 <entry><type>name</type></entry>
8287 <entry>Name of the local user to be mapped</entry>
8291 <entry><structfield>umoptions</structfield></entry>
8292 <entry><type>text[]</type></entry>
8295 User mapping specific options, as <quote>keyword=value</>
8296 strings, if the current user is the owner of the foreign
8306 <sect1 id="view-pg-views">
8307 <title><structname>pg_views</structname></title>
8309 <indexterm zone="view-pg-views">
8310 <primary>pg_views</primary>
8314 The view <structname>pg_views</structname> provides access to
8315 useful information about each view in the database.
8319 <title><structname>pg_views</> Columns</title>
8326 <entry>References</entry>
8327 <entry>Description</entry>
8332 <entry><structfield>schemaname</structfield></entry>
8333 <entry><type>name</type></entry>
8334 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8335 <entry>Name of schema containing view</entry>
8338 <entry><structfield>viewname</structfield></entry>
8339 <entry><type>name</type></entry>
8340 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8341 <entry>Name of view</entry>
8344 <entry><structfield>viewowner</structfield></entry>
8345 <entry><type>name</type></entry>
8346 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8347 <entry>Name of view's owner</entry>
8350 <entry><structfield>definition</structfield></entry>
8351 <entry><type>text</type></entry>
8353 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>