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-range"><structname>pg_range</structname></link></entry>
223 <entry>information about range types</entry>
227 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
228 <entry>query rewrite rules</entry>
232 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
233 <entry>security labels on database objects</entry>
237 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
238 <entry>dependencies on shared objects</entry>
242 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
243 <entry>comments on shared objects</entry>
247 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
248 <entry>security labels on shared database objects</entry>
252 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
253 <entry>planner statistics</entry>
257 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
258 <entry>tablespaces within this database cluster</entry>
262 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
263 <entry>triggers</entry>
267 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
268 <entry>text search configurations</entry>
272 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
273 <entry>text search configurations' token mappings</entry>
277 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
278 <entry>text search dictionaries</entry>
282 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
283 <entry>text search parsers</entry>
287 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
288 <entry>text search templates</entry>
292 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
293 <entry>data types</entry>
297 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
298 <entry>mappings of users to foreign servers</entry>
306 <sect1 id="catalog-pg-aggregate">
307 <title><structname>pg_aggregate</structname></title>
309 <indexterm zone="catalog-pg-aggregate">
310 <primary>pg_aggregate</primary>
314 The catalog <structname>pg_aggregate</structname> stores information about
315 aggregate functions. An aggregate function is a function that
316 operates on a set of values (typically one column from each row
317 that matches a query condition) and returns a single value computed
318 from all these values. Typical aggregate functions are
319 <function>sum</function>, <function>count</function>, and
320 <function>max</function>. Each entry in
321 <structname>pg_aggregate</structname> is an extension of an entry
322 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
323 entry carries the aggregate's name, input and output data types, and
324 other information that is similar to ordinary functions.
328 <title><structname>pg_aggregate</> Columns</title>
335 <entry>References</entry>
336 <entry>Description</entry>
341 <entry><structfield>aggfnoid</structfield></entry>
342 <entry><type>regproc</type></entry>
343 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
344 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
347 <entry><structfield>aggtransfn</structfield></entry>
348 <entry><type>regproc</type></entry>
349 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
350 <entry>Transition function</entry>
353 <entry><structfield>aggfinalfn</structfield></entry>
354 <entry><type>regproc</type></entry>
355 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
356 <entry>Final function (zero if none)</entry>
359 <entry><structfield>aggsortop</structfield></entry>
360 <entry><type>oid</type></entry>
361 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
362 <entry>Associated sort operator (zero if none)</entry>
365 <entry><structfield>aggtranstype</structfield></entry>
366 <entry><type>oid</type></entry>
367 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
368 <entry>Data type of the aggregate function's internal transition (state) data</entry>
371 <entry><structfield>agginitval</structfield></entry>
372 <entry><type>text</type></entry>
375 The initial value of the transition state. This is a text
376 field containing the initial value in its external string
377 representation. If this field is null, the transition state
378 value starts out null.
386 New aggregate functions are registered with the <xref
387 linkend="sql-createaggregate">
388 command. See <xref linkend="xaggr"> for more information about
389 writing aggregate functions and the meaning of the transition
396 <sect1 id="catalog-pg-am">
397 <title><structname>pg_am</structname></title>
399 <indexterm zone="catalog-pg-am">
400 <primary>pg_am</primary>
404 The catalog <structname>pg_am</structname> stores information about index
405 access methods. There is one row for each index access method supported by
406 the system. The contents of this catalog are discussed in detail in
407 <xref linkend="indexam">.
411 <title><structname>pg_am</> Columns</title>
418 <entry>References</entry>
419 <entry>Description</entry>
425 <entry><structfield>amname</structfield></entry>
426 <entry><type>name</type></entry>
428 <entry>Name of the access method</entry>
432 <entry><structfield>amstrategies</structfield></entry>
433 <entry><type>int2</type></entry>
435 <entry>Number of operator strategies for this access method,
436 or zero if access method does not have a fixed set of operator
441 <entry><structfield>amsupport</structfield></entry>
442 <entry><type>int2</type></entry>
444 <entry>Number of support routines for this access method</entry>
448 <entry><structfield>amcanorder</structfield></entry>
449 <entry><type>bool</type></entry>
451 <entry>Does the access method support ordered scans sorted by the
452 indexed column's value?</entry>
456 <entry><structfield>amcanorderbyop</structfield></entry>
457 <entry><type>bool</type></entry>
459 <entry>Does the access method support ordered scans sorted by the result
460 of an operator on the indexed column?</entry>
464 <entry><structfield>amcanbackward</structfield></entry>
465 <entry><type>bool</type></entry>
467 <entry>Does the access method support backward scanning?</entry>
471 <entry><structfield>amcanunique</structfield></entry>
472 <entry><type>bool</type></entry>
474 <entry>Does the access method support unique indexes?</entry>
478 <entry><structfield>amcanmulticol</structfield></entry>
479 <entry><type>bool</type></entry>
481 <entry>Does the access method support multicolumn indexes?</entry>
485 <entry><structfield>amcanreturn</structfield></entry>
486 <entry><type>bool</type></entry>
488 <entry>Can the access method return the contents of index entries?</entry>
492 <entry><structfield>amoptionalkey</structfield></entry>
493 <entry><type>bool</type></entry>
495 <entry>Does the access method support a scan without any constraint
496 for the first index column?</entry>
500 <entry><structfield>amsearcharray</structfield></entry>
501 <entry><type>bool</type></entry>
503 <entry>Does the access method support <literal>ScalarArrayOpExpr</> searches?</entry>
507 <entry><structfield>amsearchnulls</structfield></entry>
508 <entry><type>bool</type></entry>
510 <entry>Does the access method support <literal>IS NULL</>/<literal>NOT NULL</> searches?</entry>
514 <entry><structfield>amstorage</structfield></entry>
515 <entry><type>bool</type></entry>
517 <entry>Can index storage data type differ from column data type?</entry>
521 <entry><structfield>amclusterable</structfield></entry>
522 <entry><type>bool</type></entry>
524 <entry>Can an index of this type be clustered on?</entry>
528 <entry><structfield>ampredlocks</structfield></entry>
529 <entry><type>bool</type></entry>
531 <entry>Does an index of this type manage fine-grained predicate locks?</entry>
535 <entry><structfield>amkeytype</structfield></entry>
536 <entry><type>oid</type></entry>
537 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
538 <entry>Type of data stored in index, or zero if not a fixed type</entry>
542 <entry><structfield>aminsert</structfield></entry>
543 <entry><type>regproc</type></entry>
544 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
545 <entry><quote>Insert this tuple</quote> function</entry>
549 <entry><structfield>ambeginscan</structfield></entry>
550 <entry><type>regproc</type></entry>
551 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
552 <entry><quote>Prepare for index scan</quote> function</entry>
556 <entry><structfield>amgettuple</structfield></entry>
557 <entry><type>regproc</type></entry>
558 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
559 <entry><quote>Next valid tuple</quote> function, or zero if none</entry>
563 <entry><structfield>amgetbitmap</structfield></entry>
564 <entry><type>regproc</type></entry>
565 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
566 <entry><quote>Fetch all valid tuples</quote> function, or zero if none</entry>
570 <entry><structfield>amrescan</structfield></entry>
571 <entry><type>regproc</type></entry>
572 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
573 <entry><quote>(Re)start index scan</quote> function</entry>
577 <entry><structfield>amendscan</structfield></entry>
578 <entry><type>regproc</type></entry>
579 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
580 <entry><quote>Clean up after index scan</quote> function</entry>
584 <entry><structfield>ammarkpos</structfield></entry>
585 <entry><type>regproc</type></entry>
586 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
587 <entry><quote>Mark current scan position</quote> function</entry>
591 <entry><structfield>amrestrpos</structfield></entry>
592 <entry><type>regproc</type></entry>
593 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
594 <entry><quote>Restore marked scan position</quote> function</entry>
598 <entry><structfield>ambuild</structfield></entry>
599 <entry><type>regproc</type></entry>
600 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
601 <entry><quote>Build new index</quote> function</entry>
605 <entry><structfield>ambuildempty</structfield></entry>
606 <entry><type>regproc</type></entry>
607 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
608 <entry><quote>Build empty index</quote> function</entry>
612 <entry><structfield>ambulkdelete</structfield></entry>
613 <entry><type>regproc</type></entry>
614 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
615 <entry>Bulk-delete function</entry>
619 <entry><structfield>amvacuumcleanup</structfield></entry>
620 <entry><type>regproc</type></entry>
621 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
622 <entry>Post-<command>VACUUM</command> cleanup function</entry>
626 <entry><structfield>amcostestimate</structfield></entry>
627 <entry><type>regproc</type></entry>
628 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
629 <entry>Function to estimate cost of an index scan</entry>
633 <entry><structfield>amoptions</structfield></entry>
634 <entry><type>regproc</type></entry>
635 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
636 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
646 <sect1 id="catalog-pg-amop">
647 <title><structname>pg_amop</structname></title>
649 <indexterm zone="catalog-pg-amop">
650 <primary>pg_amop</primary>
654 The catalog <structname>pg_amop</structname> stores information about
655 operators associated with access method operator families. There is one
656 row for each operator that is a member of an operator family. A family
657 member can be either a <firstterm>search</> operator or an
658 <firstterm>ordering</> operator. An operator
659 can appear in more than one family, but cannot appear in more than one
660 search position nor more than one ordering position within a family.
661 (It is allowed, though unlikely, for an operator to be used for both
662 search and ordering purposes.)
666 <title><structname>pg_amop</> Columns</title>
673 <entry>References</entry>
674 <entry>Description</entry>
680 <entry><structfield>amopfamily</structfield></entry>
681 <entry><type>oid</type></entry>
682 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
683 <entry>The operator family this entry is for</entry>
687 <entry><structfield>amoplefttype</structfield></entry>
688 <entry><type>oid</type></entry>
689 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
690 <entry>Left-hand input data type of operator</entry>
694 <entry><structfield>amoprighttype</structfield></entry>
695 <entry><type>oid</type></entry>
696 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
697 <entry>Right-hand input data type of operator</entry>
701 <entry><structfield>amopstrategy</structfield></entry>
702 <entry><type>int2</type></entry>
704 <entry>Operator strategy number</entry>
708 <entry><structfield>amoppurpose</structfield></entry>
709 <entry><type>char</type></entry>
711 <entry>Operator purpose, either <literal>s</> for search or
712 <literal>o</> for ordering</entry>
716 <entry><structfield>amopopr</structfield></entry>
717 <entry><type>oid</type></entry>
718 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
719 <entry>OID of the operator</entry>
723 <entry><structfield>amopmethod</structfield></entry>
724 <entry><type>oid</type></entry>
725 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
726 <entry>Index access method operator family is for</entry>
730 <entry><structfield>amopsortfamily</structfield></entry>
731 <entry><type>oid</type></entry>
732 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
733 <entry>The btree operator family this entry sorts according to, if an
734 ordering operator; zero if a search operator</entry>
742 A <quote>search</> operator entry indicates that an index of this operator
743 family can be searched to find all rows satisfying
745 <replaceable>indexed_column</>
746 <replaceable>operator</>
747 <replaceable>constant</>.
748 Obviously, such an operator must return boolean, and its left-hand input
749 type must match the index's column data type.
753 An <quote>ordering</> operator entry indicates that an index of this
754 operator family can be scanned to return rows in the order represented by
756 <replaceable>indexed_column</>
757 <replaceable>operator</>
758 <replaceable>constant</>.
759 Such an operator could return any sortable data type, though again
760 its left-hand input type must match the index's column data type.
761 The exact semantics of the <literal>ORDER BY</> are specified by the
762 <structfield>amopsortfamily</structfield> column, which must reference
763 a btree operator family for the operator's result type.
768 At present, it's assumed that the sort order for an ordering operator
769 is the default for the referenced opfamily, i.e., <literal>ASC NULLS
770 LAST</>. This might someday be relaxed by adding additional columns
771 to specify sort options explicitly.
776 An entry's <structfield>amopmethod</> must match the
777 <structname>opfmethod</> of its containing operator family (including
778 <structfield>amopmethod</> here is an intentional denormalization of the
779 catalog structure for performance reasons). Also,
780 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
781 the <structfield>oprleft</> and <structfield>oprright</> fields of the
782 referenced <structname>pg_operator</> entry.
788 <sect1 id="catalog-pg-amproc">
789 <title><structname>pg_amproc</structname></title>
791 <indexterm zone="catalog-pg-amproc">
792 <primary>pg_amproc</primary>
796 The catalog <structname>pg_amproc</structname> stores information about
797 support procedures associated with access method operator families. There
798 is one row for each support procedure belonging to an operator family.
802 <title><structname>pg_amproc</structname> Columns</title>
809 <entry>References</entry>
810 <entry>Description</entry>
816 <entry><structfield>amprocfamily</structfield></entry>
817 <entry><type>oid</type></entry>
818 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
819 <entry>The operator family this entry is for</entry>
823 <entry><structfield>amproclefttype</structfield></entry>
824 <entry><type>oid</type></entry>
825 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
826 <entry>Left-hand input data type of associated operator</entry>
830 <entry><structfield>amprocrighttype</structfield></entry>
831 <entry><type>oid</type></entry>
832 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
833 <entry>Right-hand input data type of associated operator</entry>
837 <entry><structfield>amprocnum</structfield></entry>
838 <entry><type>int2</type></entry>
840 <entry>Support procedure number</entry>
844 <entry><structfield>amproc</structfield></entry>
845 <entry><type>regproc</type></entry>
846 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
847 <entry>OID of the procedure</entry>
855 The usual interpretation of the
856 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
857 is that they identify the left and right input types of the operator(s)
858 that a particular support procedure supports. For some access methods
859 these match the input data type(s) of the support procedure itself, for
860 others not. There is a notion of <quote>default</> support procedures for
861 an index, which are those with <structfield>amproclefttype</> and
862 <structfield>amprocrighttype</> both equal to the index opclass's
863 <structfield>opcintype</>.
869 <sect1 id="catalog-pg-attrdef">
870 <title><structname>pg_attrdef</structname></title>
872 <indexterm zone="catalog-pg-attrdef">
873 <primary>pg_attrdef</primary>
877 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
878 about columns is stored in <structname>pg_attribute</structname>
879 (see below). Only columns that explicitly specify a default value
880 (when the table is created or the column is added) will have an
885 <title><structname>pg_attrdef</> Columns</title>
892 <entry>References</entry>
893 <entry>Description</entry>
899 <entry><structfield>adrelid</structfield></entry>
900 <entry><type>oid</type></entry>
901 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
902 <entry>The table this column belongs to</entry>
906 <entry><structfield>adnum</structfield></entry>
907 <entry><type>int2</type></entry>
908 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
909 <entry>The number of the column</entry>
913 <entry><structfield>adbin</structfield></entry>
914 <entry><type>pg_node_tree</type></entry>
916 <entry>The internal representation of the column default value</entry>
920 <entry><structfield>adsrc</structfield></entry>
921 <entry><type>text</type></entry>
923 <entry>A human-readable representation of the default value</entry>
930 The <structfield>adsrc</structfield> field is historical, and is best
931 not used, because it does not track outside changes that might affect
932 the representation of the default value. Reverse-compiling the
933 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
934 example) is a better way to display the default value.
940 <sect1 id="catalog-pg-attribute">
941 <title><structname>pg_attribute</structname></title>
943 <indexterm zone="catalog-pg-attribute">
944 <primary>pg_attribute</primary>
948 The catalog <structname>pg_attribute</structname> stores information about
949 table columns. There will be exactly one
950 <structname>pg_attribute</structname> row for every column in every
951 table in the database. (There will also be attribute entries for
952 indexes, and indeed all objects that have <structname>pg_class</structname>
957 The term attribute is equivalent to column and is used for
962 <title><structname>pg_attribute</> Columns</title>
969 <entry>References</entry>
970 <entry>Description</entry>
976 <entry><structfield>attrelid</structfield></entry>
977 <entry><type>oid</type></entry>
978 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
979 <entry>The table this column belongs to</entry>
983 <entry><structfield>attname</structfield></entry>
984 <entry><type>name</type></entry>
986 <entry>The column name</entry>
990 <entry><structfield>atttypid</structfield></entry>
991 <entry><type>oid</type></entry>
992 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
993 <entry>The data type of this column</entry>
997 <entry><structfield>attstattarget</structfield></entry>
998 <entry><type>int4</type></entry>
1001 <structfield>attstattarget</structfield> controls the level of detail
1002 of statistics accumulated for this column by
1003 <xref linkend="sql-analyze">.
1004 A zero value indicates that no statistics should be collected.
1005 A negative value says to use the system default statistics target.
1006 The exact meaning of positive values is data type-dependent.
1007 For scalar data types, <structfield>attstattarget</structfield>
1008 is both the target number of <quote>most common values</quote>
1009 to collect, and the target number of histogram bins to create.
1014 <entry><structfield>attlen</structfield></entry>
1015 <entry><type>int2</type></entry>
1018 A copy of <literal>pg_type.typlen</literal> of this column's
1024 <entry><structfield>attnum</structfield></entry>
1025 <entry><type>int2</type></entry>
1028 The number of the column. Ordinary columns are numbered from 1
1029 up. System columns, such as <structfield>oid</structfield>,
1030 have (arbitrary) negative numbers.
1035 <entry><structfield>attndims</structfield></entry>
1036 <entry><type>int4</type></entry>
1039 Number of dimensions, if the column is an array type; otherwise 0.
1040 (Presently, the number of dimensions of an array is not enforced,
1041 so any nonzero value effectively means <quote>it's an array</>.)
1046 <entry><structfield>attcacheoff</structfield></entry>
1047 <entry><type>int4</type></entry>
1050 Always -1 in storage, but when loaded into a row descriptor
1051 in memory this might be updated to cache the offset of the attribute
1057 <entry><structfield>atttypmod</structfield></entry>
1058 <entry><type>int4</type></entry>
1061 <structfield>atttypmod</structfield> records type-specific data
1062 supplied at table creation time (for example, the maximum
1063 length of a <type>varchar</type> column). It is passed to
1064 type-specific input functions and length coercion functions.
1065 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1070 <entry><structfield>attbyval</structfield></entry>
1071 <entry><type>bool</type></entry>
1074 A copy of <literal>pg_type.typbyval</> of this column's type
1079 <entry><structfield>attstorage</structfield></entry>
1080 <entry><type>char</type></entry>
1083 Normally a copy of <literal>pg_type.typstorage</> of this
1084 column's type. For TOAST-able data types, this can be altered
1085 after column creation to control storage policy.
1090 <entry><structfield>attalign</structfield></entry>
1091 <entry><type>char</type></entry>
1094 A copy of <literal>pg_type.typalign</> of this column's type
1099 <entry><structfield>attnotnull</structfield></entry>
1100 <entry><type>bool</type></entry>
1103 This represents a not-null constraint. It is possible to
1104 change this column to enable or disable the constraint.
1109 <entry><structfield>atthasdef</structfield></entry>
1110 <entry><type>bool</type></entry>
1113 This column has a default value, in which case there will be a
1114 corresponding entry in the <structname>pg_attrdef</structname>
1115 catalog that actually defines the value.
1120 <entry><structfield>attisdropped</structfield></entry>
1121 <entry><type>bool</type></entry>
1124 This column has been dropped and is no longer valid. A dropped
1125 column is still physically present in the table, but is
1126 ignored by the parser and so cannot be accessed via SQL.
1131 <entry><structfield>attislocal</structfield></entry>
1132 <entry><type>bool</type></entry>
1135 This column is defined locally in the relation. Note that a column can
1136 be locally defined and inherited simultaneously.
1141 <entry><structfield>attinhcount</structfield></entry>
1142 <entry><type>int4</type></entry>
1145 The number of direct ancestors this column has. A column with a
1146 nonzero number of ancestors cannot be dropped nor renamed.
1151 <entry><structfield>attcollation</structfield></entry>
1152 <entry><type>oid</type></entry>
1153 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1155 The defined collation of the column, or zero if the column is
1156 not of a collatable data type.
1161 <entry><structfield>attacl</structfield></entry>
1162 <entry><type>aclitem[]</type></entry>
1165 Column-level access privileges, if any have been granted specifically
1171 <entry><structfield>attoptions</structfield></entry>
1172 <entry><type>text[]</type></entry>
1175 Attribute-level options, as <quote>keyword=value</> strings
1180 <entry><structfield>attfdwoptions</structfield></entry>
1181 <entry><type>text[]</type></entry>
1184 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1193 In a dropped column's <structname>pg_attribute</structname> entry,
1194 <structfield>atttypid</structfield> is reset to zero, but
1195 <structfield>attlen</structfield> and the other fields copied from
1196 <structname>pg_type</> are still valid. This arrangement is needed
1197 to cope with the situation where the dropped column's data type was
1198 later dropped, and so there is no <structname>pg_type</> row anymore.
1199 <structfield>attlen</structfield> and the other fields can be used
1200 to interpret the contents of a row of the table.
1205 <sect1 id="catalog-pg-authid">
1206 <title><structname>pg_authid</structname></title>
1208 <indexterm zone="catalog-pg-authid">
1209 <primary>pg_authid</primary>
1213 The catalog <structname>pg_authid</structname> contains information about
1214 database authorization identifiers (roles). A role subsumes the concepts
1215 of <quote>users</> and <quote>groups</>. A user is essentially just a
1216 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1217 without <structfield>rolcanlogin</>) can have other roles as members; see
1218 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1222 Since this catalog contains passwords, it must not be publicly readable.
1223 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1224 is a publicly readable view on
1225 <structname>pg_authid</structname> that blanks out the password field.
1229 <xref linkend="user-manag"> contains detailed information about user and
1230 privilege management.
1234 Because user identities are cluster-wide,
1235 <structname>pg_authid</structname>
1236 is shared across all databases of a cluster: there is only one
1237 copy of <structname>pg_authid</structname> per cluster, not
1242 <title><structname>pg_authid</> Columns</title>
1249 <entry>Description</entry>
1255 <entry><structfield>rolname</structfield></entry>
1256 <entry><type>name</type></entry>
1257 <entry>Role name</entry>
1261 <entry><structfield>rolsuper</structfield></entry>
1262 <entry><type>bool</type></entry>
1263 <entry>Role has superuser privileges</entry>
1267 <entry><structfield>rolinherit</structfield></entry>
1268 <entry><type>bool</type></entry>
1269 <entry>Role automatically inherits privileges of roles it is a
1274 <entry><structfield>rolcreaterole</structfield></entry>
1275 <entry><type>bool</type></entry>
1276 <entry>Role can create more roles</entry>
1280 <entry><structfield>rolcreatedb</structfield></entry>
1281 <entry><type>bool</type></entry>
1282 <entry>Role can create databases</entry>
1286 <entry><structfield>rolcatupdate</structfield></entry>
1287 <entry><type>bool</type></entry>
1289 Role can update system catalogs directly. (Even a superuser cannot do
1290 this unless this column is true)
1295 <entry><structfield>rolcanlogin</structfield></entry>
1296 <entry><type>bool</type></entry>
1298 Role can log in. That is, this role can be given as the initial
1299 session authorization identifier
1304 <entry><structfield>rolreplication</structfield></entry>
1305 <entry><type>bool</type></entry>
1307 Role is a replication role. That is, this role can initiate streaming
1308 replication (see <xref linkend="streaming-replication">) and set/unset
1309 the system backup mode using <function>pg_start_backup</> and
1310 <function>pg_stop_backup</>
1315 <entry><structfield>rolconnlimit</structfield></entry>
1316 <entry><type>int4</type></entry>
1318 For roles that can log in, this sets maximum number of concurrent
1319 connections this role can make. -1 means no limit.
1324 <entry><structfield>rolpassword</structfield></entry>
1325 <entry><type>text</type></entry>
1327 Password (possibly encrypted); null if none. If the password
1328 is encrypted, this column will begin with the string <literal>md5</>
1329 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1330 will be of the user's password concatenated to their user name.
1331 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1332 <productname>PostgreSQL</> will store the md5 hash of
1333 <literal>xyzzyjoe</>. A password that does not follow that
1334 format is assumed to be unencrypted.
1339 <entry><structfield>rolvaliduntil</structfield></entry>
1340 <entry><type>timestamptz</type></entry>
1341 <entry>Password expiry time (only used for password authentication);
1342 null if no expiration</entry>
1351 <sect1 id="catalog-pg-auth-members">
1352 <title><structname>pg_auth_members</structname></title>
1354 <indexterm zone="catalog-pg-auth-members">
1355 <primary>pg_auth_members</primary>
1359 The catalog <structname>pg_auth_members</structname> shows the membership
1360 relations between roles. Any non-circular set of relationships is allowed.
1364 Because user identities are cluster-wide,
1365 <structname>pg_auth_members</structname>
1366 is shared across all databases of a cluster: there is only one
1367 copy of <structname>pg_auth_members</structname> per cluster, not
1372 <title><structname>pg_auth_members</> Columns</title>
1379 <entry>References</entry>
1380 <entry>Description</entry>
1386 <entry><structfield>roleid</structfield></entry>
1387 <entry><type>oid</type></entry>
1388 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1389 <entry>ID of a role that has a member</entry>
1393 <entry><structfield>member</structfield></entry>
1394 <entry><type>oid</type></entry>
1395 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1396 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1400 <entry><structfield>grantor</structfield></entry>
1401 <entry><type>oid</type></entry>
1402 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1403 <entry>ID of the role that granted this membership</entry>
1407 <entry><structfield>admin_option</structfield></entry>
1408 <entry><type>bool</type></entry>
1410 <entry>True if <structfield>member</> can grant membership in
1411 <structfield>roleid</> to others</entry>
1420 <sect1 id="catalog-pg-cast">
1421 <title><structname>pg_cast</structname></title>
1423 <indexterm zone="catalog-pg-cast">
1424 <primary>pg_cast</primary>
1428 The catalog <structname>pg_cast</structname> stores data type conversion
1429 paths, both built-in paths and those defined with
1430 <xref linkend="sql-createcast">.
1434 It should be noted that <structname>pg_cast</structname> does not represent
1435 every type conversion that the system knows how to perform; only those that
1436 cannot be deduced from some generic rule. For example, casting between a
1437 domain and its base type is not explicitly represented in
1438 <structname>pg_cast</structname>. Another important exception is that
1439 <quote>automatic I/O conversion casts</>, those performed using a data
1440 type's own I/O functions to convert to or from <type>text</> or other
1441 string types, are not explicitly represented in
1442 <structname>pg_cast</structname>.
1446 <title><structname>pg_cast</> Columns</title>
1453 <entry>References</entry>
1454 <entry>Description</entry>
1460 <entry><structfield>castsource</structfield></entry>
1461 <entry><type>oid</type></entry>
1462 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1463 <entry>OID of the source data type</entry>
1467 <entry><structfield>casttarget</structfield></entry>
1468 <entry><type>oid</type></entry>
1469 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1470 <entry>OID of the target data type</entry>
1474 <entry><structfield>castfunc</structfield></entry>
1475 <entry><type>oid</type></entry>
1476 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1478 The OID of the function to use to perform this cast. Zero is
1479 stored if the cast method doesn't require a function.
1484 <entry><structfield>castcontext</structfield></entry>
1485 <entry><type>char</type></entry>
1488 Indicates what contexts the cast can be invoked in.
1489 <literal>e</> means only as an explicit cast (using
1490 <literal>CAST</> or <literal>::</> syntax).
1491 <literal>a</> means implicitly in assignment
1492 to a target column, as well as explicitly.
1493 <literal>i</> means implicitly in expressions, as well as the
1498 <entry><structfield>castmethod</structfield></entry>
1499 <entry><type>char</type></entry>
1502 Indicates how the cast is performed.
1503 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1504 <literal>i</> means that the input/output functions are used.
1505 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1513 The cast functions listed in <structname>pg_cast</structname> must
1514 always take the cast source type as their first argument type, and
1515 return the cast destination type as their result type. A cast
1516 function can have up to three arguments. The second argument,
1517 if present, must be type <type>integer</>; it receives the type
1518 modifier associated with the destination type, or -1
1519 if there is none. The third argument,
1520 if present, must be type <type>boolean</>; it receives <literal>true</>
1521 if the cast is an explicit cast, <literal>false</> otherwise.
1525 It is legitimate to create a <structname>pg_cast</structname> entry
1526 in which the source and target types are the same, if the associated
1527 function takes more than one argument. Such entries represent
1528 <quote>length coercion functions</> that coerce values of the type
1529 to be legal for a particular type modifier value.
1533 When a <structname>pg_cast</structname> entry has different source and
1534 target types and a function that takes more than one argument, it
1535 represents converting from one type to another and applying a length
1536 coercion in a single step. When no such entry is available, coercion
1537 to a type that uses a type modifier involves two steps, one to
1538 convert between data types and a second to apply the modifier.
1542 <sect1 id="catalog-pg-class">
1543 <title><structname>pg_class</structname></title>
1545 <indexterm zone="catalog-pg-class">
1546 <primary>pg_class</primary>
1550 The catalog <structname>pg_class</structname> catalogs tables and most
1551 everything else that has columns or is otherwise similar to a
1552 table. This includes indexes (but see also
1553 <structname>pg_index</structname>), sequences, views, composite types,
1554 and TOAST tables; see <structfield>relkind</>.
1555 Below, when we mean all of these
1556 kinds of objects we speak of <quote>relations</quote>. Not all
1557 columns are meaningful for all relation types.
1561 <title><structname>pg_class</> Columns</title>
1568 <entry>References</entry>
1569 <entry>Description</entry>
1575 <entry><structfield>relname</structfield></entry>
1576 <entry><type>name</type></entry>
1578 <entry>Name of the table, index, view, etc.</entry>
1582 <entry><structfield>relnamespace</structfield></entry>
1583 <entry><type>oid</type></entry>
1584 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1586 The OID of the namespace that contains this relation
1591 <entry><structfield>reltype</structfield></entry>
1592 <entry><type>oid</type></entry>
1593 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1595 The OID of the data type that corresponds to this table's row type,
1596 if any (zero for indexes, which have no <structname>pg_type</> entry)
1601 <entry><structfield>reloftype</structfield></entry>
1602 <entry><type>oid</type></entry>
1603 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1605 For typed tables, the OID of the underlying composite type,
1606 zero for all other relations
1611 <entry><structfield>relowner</structfield></entry>
1612 <entry><type>oid</type></entry>
1613 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1614 <entry>Owner of the relation</entry>
1618 <entry><structfield>relam</structfield></entry>
1619 <entry><type>oid</type></entry>
1620 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1621 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1625 <entry><structfield>relfilenode</structfield></entry>
1626 <entry><type>oid</type></entry>
1628 <entry>Name of the on-disk file of this relation; zero means this
1629 is a <quote>mapped</> relation whose disk file name is determined
1630 by low-level state</entry>
1634 <entry><structfield>reltablespace</structfield></entry>
1635 <entry><type>oid</type></entry>
1636 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1638 The tablespace in which this relation is stored. If zero,
1639 the database's default tablespace is implied. (Not meaningful
1640 if the relation has no on-disk file.)
1645 <entry><structfield>relpages</structfield></entry>
1646 <entry><type>int4</type></entry>
1649 Size of the on-disk representation of this table in pages (of size
1650 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1651 planner. It is updated by <command>VACUUM</command>,
1652 <command>ANALYZE</command>, and a few DDL commands such as
1653 <command>CREATE INDEX</command>.
1658 <entry><structfield>reltuples</structfield></entry>
1659 <entry><type>float4</type></entry>
1662 Number of rows in the table. This is only an estimate used by the
1663 planner. It is updated by <command>VACUUM</command>,
1664 <command>ANALYZE</command>, and a few DDL commands such as
1665 <command>CREATE INDEX</command>.
1670 <entry><structfield>relallvisible</structfield></entry>
1671 <entry><type>int4</type></entry>
1674 Number of pages that are marked all-visible in the table's
1675 visibility map. This is only an estimate used by the
1676 planner. It is updated by <command>VACUUM</command>,
1677 <command>ANALYZE</command>, and a few DDL commands such as
1678 <command>CREATE INDEX</command>.
1683 <entry><structfield>reltoastrelid</structfield></entry>
1684 <entry><type>oid</type></entry>
1685 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1687 OID of the TOAST table associated with this table, 0 if none. The
1688 TOAST table stores large attributes <quote>out of line</quote> in a
1694 <entry><structfield>reltoastidxid</structfield></entry>
1695 <entry><type>oid</type></entry>
1696 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1698 For a TOAST table, the OID of its index. 0 if not a TOAST table.
1703 <entry><structfield>relhasindex</structfield></entry>
1704 <entry><type>bool</type></entry>
1707 True if this is a table and it has (or recently had) any indexes
1712 <entry><structfield>relisshared</structfield></entry>
1713 <entry><type>bool</type></entry>
1716 True if this table is shared across all databases in the cluster. Only
1717 certain system catalogs (such as <structname>pg_database</structname>)
1723 <entry><structfield>relpersistence</structfield></entry>
1724 <entry><type>char</type></entry>
1727 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1728 <literal>t</> = temporary table
1733 <entry><structfield>relkind</structfield></entry>
1734 <entry><type>char</type></entry>
1737 <literal>r</> = ordinary table, <literal>i</> = index,
1738 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1739 composite type, <literal>t</> = TOAST table,
1740 <literal>f</> = foreign table
1745 <entry><structfield>relnatts</structfield></entry>
1746 <entry><type>int2</type></entry>
1749 Number of user columns in the relation (system columns not
1750 counted). There must be this many corresponding entries in
1751 <structname>pg_attribute</structname>. See also
1752 <literal>pg_attribute.attnum</literal>.
1757 <entry><structfield>relchecks</structfield></entry>
1758 <entry><type>int2</type></entry>
1761 Number of <literal>CHECK</> constraints on the table; see
1762 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1767 <entry><structfield>relhasoids</structfield></entry>
1768 <entry><type>bool</type></entry>
1771 True if we generate an OID for each row of the relation
1776 <entry><structfield>relhaspkey</structfield></entry>
1777 <entry><type>bool</type></entry>
1780 True if the table has (or once had) a primary key
1785 <entry><structfield>relhasrules</structfield></entry>
1786 <entry><type>bool</type></entry>
1789 True if table has (or once had) rules; see
1790 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1795 <entry><structfield>relhastriggers</structfield></entry>
1796 <entry><type>bool</type></entry>
1799 True if table has (or once had) triggers; see
1800 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1805 <entry><structfield>relhassubclass</structfield></entry>
1806 <entry><type>bool</type></entry>
1808 <entry>True if table has (or once had) any inheritance children</entry>
1812 <entry><structfield>relfrozenxid</structfield></entry>
1813 <entry><type>xid</type></entry>
1816 All transaction IDs before this one have been replaced with a permanent
1817 (<quote>frozen</>) transaction ID in this table. This is used to track
1818 whether the table needs to be vacuumed in order to prevent transaction
1819 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1820 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1825 <entry><structfield>relacl</structfield></entry>
1826 <entry><type>aclitem[]</type></entry>
1829 Access privileges; see
1830 <xref linkend="sql-grant"> and
1831 <xref linkend="sql-revoke">
1837 <entry><structfield>reloptions</structfield></entry>
1838 <entry><type>text[]</type></entry>
1841 Access-method-specific options, as <quote>keyword=value</> strings
1849 Several of the Boolean flags in <structname>pg_class</> are maintained
1850 lazily: they are guaranteed to be true if that's the correct state, but
1851 may not be reset to false immediately when the condition is no longer
1852 true. For example, <structfield>relhasindex</> is set by
1853 <command>CREATE INDEX</command>, but it is never cleared by
1854 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1855 <structfield>relhasindex</> if it finds the table has no indexes. This
1856 arrangement avoids race conditions and improves concurrency.
1860 <sect1 id="catalog-pg-constraint">
1861 <title><structname>pg_constraint</structname></title>
1863 <indexterm zone="catalog-pg-constraint">
1864 <primary>pg_constraint</primary>
1868 The catalog <structname>pg_constraint</structname> stores check, primary
1869 key, unique, foreign key, and exclusion constraints on tables.
1870 (Column constraints are not treated specially. Every column constraint is
1871 equivalent to some table constraint.)
1872 Not-null constraints are represented in the <structname>pg_attribute</>
1877 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
1878 TRIGGER</>) also give rise to an entry in this table.
1882 Check constraints on domains are stored here, too.
1886 <title><structname>pg_constraint</> Columns</title>
1893 <entry>References</entry>
1894 <entry>Description</entry>
1900 <entry><structfield>conname</structfield></entry>
1901 <entry><type>name</type></entry>
1903 <entry>Constraint name (not necessarily unique!)</entry>
1907 <entry><structfield>connamespace</structfield></entry>
1908 <entry><type>oid</type></entry>
1909 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1911 The OID of the namespace that contains this constraint
1916 <entry><structfield>contype</structfield></entry>
1917 <entry><type>char</type></entry>
1920 <literal>c</> = check constraint,
1921 <literal>f</> = foreign key constraint,
1922 <literal>p</> = primary key constraint,
1923 <literal>u</> = unique constraint,
1924 <literal>t</> = constraint trigger,
1925 <literal>x</> = exclusion constraint
1930 <entry><structfield>condeferrable</structfield></entry>
1931 <entry><type>bool</type></entry>
1933 <entry>Is the constraint deferrable?</entry>
1937 <entry><structfield>condeferred</structfield></entry>
1938 <entry><type>bool</type></entry>
1940 <entry>Is the constraint deferred by default?</entry>
1944 <entry><structfield>convalidated</structfield></entry>
1945 <entry><type>bool</type></entry>
1947 <entry>Has the constraint been validated?
1948 Currently, can only be false for foreign keys and CHECK constraints</entry>
1952 <entry><structfield>conrelid</structfield></entry>
1953 <entry><type>oid</type></entry>
1954 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1955 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1959 <entry><structfield>contypid</structfield></entry>
1960 <entry><type>oid</type></entry>
1961 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1962 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1966 <entry><structfield>conindid</structfield></entry>
1967 <entry><type>oid</type></entry>
1968 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1969 <entry>The index supporting this constraint, if it's a unique, primary
1970 key, foreign key, or exclusion constraint; else 0</entry>
1974 <entry><structfield>confrelid</structfield></entry>
1975 <entry><type>oid</type></entry>
1976 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1977 <entry>If a foreign key, the referenced table; else 0</entry>
1981 <entry><structfield>confupdtype</structfield></entry>
1982 <entry><type>char</type></entry>
1984 <entry>Foreign key update action code:
1985 <literal>a</> = no action,
1986 <literal>r</> = restrict,
1987 <literal>c</> = cascade,
1988 <literal>n</> = set null,
1989 <literal>d</> = set default
1994 <entry><structfield>confdeltype</structfield></entry>
1995 <entry><type>char</type></entry>
1997 <entry>Foreign key deletion action code:
1998 <literal>a</> = no action,
1999 <literal>r</> = restrict,
2000 <literal>c</> = cascade,
2001 <literal>n</> = set null,
2002 <literal>d</> = set default
2007 <entry><structfield>confmatchtype</structfield></entry>
2008 <entry><type>char</type></entry>
2010 <entry>Foreign key match type:
2011 <literal>f</> = full,
2012 <literal>p</> = partial,
2013 <literal>u</> = simple (unspecified)
2018 <entry><structfield>conislocal</structfield></entry>
2019 <entry><type>bool</type></entry>
2022 This constraint is defined locally for the relation. Note that a
2023 constraint can be locally defined and inherited simultaneously.
2028 <entry><structfield>coninhcount</structfield></entry>
2029 <entry><type>int4</type></entry>
2032 The number of direct inheritance ancestors this constraint has.
2034 a nonzero number of ancestors cannot be dropped nor renamed.
2039 <entry><structfield>conkey</structfield></entry>
2040 <entry><type>int2[]</type></entry>
2041 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2042 <entry>If a table constraint (including foreign keys, but not constraint
2043 triggers), list of the constrained columns</entry>
2047 <entry><structfield>confkey</structfield></entry>
2048 <entry><type>int2[]</type></entry>
2049 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2050 <entry>If a foreign key, list of the referenced columns</entry>
2054 <entry><structfield>conpfeqop</structfield></entry>
2055 <entry><type>oid[]</type></entry>
2056 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2057 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2061 <entry><structfield>conppeqop</structfield></entry>
2062 <entry><type>oid[]</type></entry>
2063 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2064 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2068 <entry><structfield>conffeqop</structfield></entry>
2069 <entry><type>oid[]</type></entry>
2070 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2071 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2075 <entry><structfield>conexclop</structfield></entry>
2076 <entry><type>oid[]</type></entry>
2077 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2078 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2082 <entry><structfield>conbin</structfield></entry>
2083 <entry><type>pg_node_tree</type></entry>
2085 <entry>If a check constraint, an internal representation of the expression</entry>
2089 <entry><structfield>consrc</structfield></entry>
2090 <entry><type>text</type></entry>
2092 <entry>If a check constraint, a human-readable representation of the expression</entry>
2099 In the case of an exclusion constraint, <structfield>conkey</structfield>
2100 is only useful for constraint elements that are simple column references.
2101 For other cases, a zero appears in <structfield>conkey</structfield>
2102 and the associated index must be consulted to discover the expression
2103 that is constrained. (<structfield>conkey</structfield> thus has the
2104 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2110 <structfield>consrc</structfield> is not updated when referenced objects
2111 change; for example, it won't track renaming of columns. Rather than
2112 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2113 to extract the definition of a check constraint.
2119 <literal>pg_class.relchecks</literal> needs to agree with the
2120 number of check-constraint entries found in this table for each
2127 <sect1 id="catalog-pg-collation">
2128 <title><structname>pg_collation</structname></title>
2130 <indexterm zone="catalog-pg-collation">
2131 <primary>pg_collation</primary>
2135 The catalog <structname>pg_collation</structname> describes the
2136 available collations, which are essentially mappings from an SQL
2137 name to operating system locale categories.
2138 See <xref linkend="collation"> for more information.
2142 <title><structname>pg_collation</> Columns</title>
2149 <entry>References</entry>
2150 <entry>Description</entry>
2156 <entry><structfield>collname</structfield></entry>
2157 <entry><type>name</type></entry>
2159 <entry>Collation name (unique per namespace and encoding)</entry>
2163 <entry><structfield>collnamespace</structfield></entry>
2164 <entry><type>oid</type></entry>
2165 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2167 The OID of the namespace that contains this collation
2172 <entry><structfield>collowner</structfield></entry>
2173 <entry><type>oid</type></entry>
2174 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2175 <entry>Owner of the collation</entry>
2179 <entry><structfield>collencoding</structfield></entry>
2180 <entry><type>int4</type></entry>
2182 <entry>Encoding in which the collation is applicable, or -1 if it
2183 works for any encoding</entry>
2187 <entry><structfield>collcollate</structfield></entry>
2188 <entry><type>name</type></entry>
2190 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2194 <entry><structfield>collctype</structfield></entry>
2195 <entry><type>name</type></entry>
2197 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2204 Note that the unique key on this catalog is (<structfield>collname</>,
2205 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2206 (<structfield>collname</>, <structfield>collnamespace</>).
2207 <productname>PostgreSQL</productname> generally ignores all
2208 collations that do not have <structfield>collencoding</> equal to
2209 either the current database's encoding or -1, and creation of new entries
2210 with the same name as an entry with <structfield>collencoding</> = -1
2211 is forbidden. Therefore it is sufficient to use a qualified SQL name
2212 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2213 even though this is not unique according to the catalog definition.
2214 The reason for defining the catalog this way is that
2215 <application>initdb</> fills it in at cluster initialization time with
2216 entries for all locales available on the system, so it must be able to
2217 hold entries for all encodings that might ever be used in the cluster.
2221 In the <literal>template0</> database, it could be useful to create
2222 collations whose encoding does not match the database encoding,
2223 since they could match the encodings of databases later cloned from
2224 <literal>template0</>. This would currently have to be done manually.
2228 <sect1 id="catalog-pg-conversion">
2229 <title><structname>pg_conversion</structname></title>
2231 <indexterm zone="catalog-pg-conversion">
2232 <primary>pg_conversion</primary>
2236 The catalog <structname>pg_conversion</structname> describes
2237 encoding conversion procedures. See <xref linkend="sql-createconversion">
2238 for more information.
2242 <title><structname>pg_conversion</> Columns</title>
2249 <entry>References</entry>
2250 <entry>Description</entry>
2256 <entry><structfield>conname</structfield></entry>
2257 <entry><type>name</type></entry>
2259 <entry>Conversion name (unique within a namespace)</entry>
2263 <entry><structfield>connamespace</structfield></entry>
2264 <entry><type>oid</type></entry>
2265 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2267 The OID of the namespace that contains this conversion
2272 <entry><structfield>conowner</structfield></entry>
2273 <entry><type>oid</type></entry>
2274 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2275 <entry>Owner of the conversion</entry>
2279 <entry><structfield>conforencoding</structfield></entry>
2280 <entry><type>int4</type></entry>
2282 <entry>Source encoding ID</entry>
2286 <entry><structfield>contoencoding</structfield></entry>
2287 <entry><type>int4</type></entry>
2289 <entry>Destination encoding ID</entry>
2293 <entry><structfield>conproc</structfield></entry>
2294 <entry><type>regproc</type></entry>
2295 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2296 <entry>Conversion procedure</entry>
2300 <entry><structfield>condefault</structfield></entry>
2301 <entry><type>bool</type></entry>
2303 <entry>True if this is the default conversion</entry>
2312 <sect1 id="catalog-pg-database">
2313 <title><structname>pg_database</structname></title>
2315 <indexterm zone="catalog-pg-database">
2316 <primary>pg_database</primary>
2320 The catalog <structname>pg_database</structname> stores information about
2321 the available databases. Databases are created with the <xref
2322 linkend="sql-createdatabase"> command.
2323 Consult <xref linkend="managing-databases"> for details about the meaning
2324 of some of the parameters.
2328 Unlike most system catalogs, <structname>pg_database</structname>
2329 is shared across all databases of a cluster: there is only one
2330 copy of <structname>pg_database</structname> per cluster, not
2335 <title><structname>pg_database</> Columns</title>
2342 <entry>References</entry>
2343 <entry>Description</entry>
2349 <entry><structfield>datname</structfield></entry>
2350 <entry><type>name</type></entry>
2352 <entry>Database name</entry>
2356 <entry><structfield>datdba</structfield></entry>
2357 <entry><type>oid</type></entry>
2358 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2359 <entry>Owner of the database, usually the user who created it</entry>
2363 <entry><structfield>encoding</structfield></entry>
2364 <entry><type>int4</type></entry>
2366 <entry>Character encoding for this database
2367 (<function>pg_encoding_to_char()</function> can translate
2368 this number to the encoding name)</entry>
2372 <entry><structfield>datcollate</structfield></entry>
2373 <entry><type>name</type></entry>
2375 <entry>LC_COLLATE for this database</entry>
2379 <entry><structfield>datctype</structfield></entry>
2380 <entry><type>name</type></entry>
2382 <entry>LC_CTYPE for this database</entry>
2386 <entry><structfield>datistemplate</structfield></entry>
2387 <entry><type>bool</type></entry>
2390 If true then this database can be used in the
2391 <literal>TEMPLATE</literal> clause of <command>CREATE
2392 DATABASE</command> to create a new database as a clone of
2398 <entry><structfield>datallowconn</structfield></entry>
2399 <entry><type>bool</type></entry>
2402 If false then no one can connect to this database. This is
2403 used to protect the <literal>template0</> database from being altered.
2408 <entry><structfield>datconnlimit</structfield></entry>
2409 <entry><type>int4</type></entry>
2412 Sets maximum number of concurrent connections that can be made
2413 to this database. -1 means no limit.
2418 <entry><structfield>datlastsysoid</structfield></entry>
2419 <entry><type>oid</type></entry>
2422 Last system OID in the database; useful
2423 particularly to <application>pg_dump</application>
2428 <entry><structfield>datfrozenxid</structfield></entry>
2429 <entry><type>xid</type></entry>
2432 All transaction IDs before this one have been replaced with a permanent
2433 (<quote>frozen</>) transaction ID in this database. This is used to
2434 track whether the database needs to be vacuumed in order to prevent
2435 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2436 It is the minimum of the per-table
2437 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2442 <entry><structfield>dattablespace</structfield></entry>
2443 <entry><type>oid</type></entry>
2444 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2446 The default tablespace for the database.
2447 Within this database, all tables for which
2448 <structname>pg_class</>.<structfield>reltablespace</> is zero
2449 will be stored in this tablespace; in particular, all the non-shared
2450 system catalogs will be there.
2455 <entry><structfield>datacl</structfield></entry>
2456 <entry><type>aclitem[]</type></entry>
2459 Access privileges; see
2460 <xref linkend="sql-grant"> and
2461 <xref linkend="sql-revoke">
2471 <sect1 id="catalog-pg-db-role-setting">
2472 <title><structname>pg_db_role_setting</structname></title>
2474 <indexterm zone="catalog-pg-db-role-setting">
2475 <primary>pg_db_role_setting</primary>
2479 The catalog <structname>pg_db_role_setting</structname> records the default
2480 values that have been set for run-time configuration variables,
2481 for each role and database combination.
2485 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2486 is shared across all databases of a cluster: there is only one
2487 copy of <structname>pg_db_role_setting</structname> per cluster, not
2492 <title><structname>pg_db_role_setting</> Columns</title>
2499 <entry>References</entry>
2500 <entry>Description</entry>
2506 <entry><structfield>setdatabase</structfield></entry>
2507 <entry><type>oid</type></entry>
2508 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2509 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2513 <entry><structfield>setrole</structfield></entry>
2514 <entry><type>oid</type></entry>
2515 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2516 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2520 <entry><structfield>setconfig</structfield></entry>
2521 <entry><type>text[]</type></entry>
2523 <entry>Defaults for run-time configuration variables</entry>
2531 <sect1 id="catalog-pg-default-acl">
2532 <title><structname>pg_default_acl</structname></title>
2534 <indexterm zone="catalog-pg-default-acl">
2535 <primary>pg_default_acl</primary>
2539 The catalog <structname>pg_default_acl</> stores initial
2540 privileges to be assigned to newly created objects.
2544 <title><structname>pg_default_acl</> Columns</title>
2551 <entry>References</entry>
2552 <entry>Description</entry>
2558 <entry><structfield>defaclrole</structfield></entry>
2559 <entry><type>oid</type></entry>
2560 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2561 <entry>The OID of the role associated with this entry</entry>
2565 <entry><structfield>defaclnamespace</structfield></entry>
2566 <entry><type>oid</type></entry>
2567 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2568 <entry>The OID of the namespace associated with this entry,
2569 or 0 if none</entry>
2573 <entry><structfield>defaclobjtype</structfield></entry>
2574 <entry><type>char</type></entry>
2577 Type of object this entry is for:
2578 <literal>r</> = relation (table, view),
2579 <literal>S</> = sequence,
2580 <literal>f</> = function
2585 <entry><structfield>defaclacl</structfield></entry>
2586 <entry><type>aclitem[]</type></entry>
2589 Access privileges that this type of object should have on creation
2597 A <structname>pg_default_acl</> entry shows the initial privileges to
2598 be assigned to an object belonging to the indicated user. There are
2599 currently two types of entry: <quote>global</> entries with
2600 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2601 that reference a particular schema. If a global entry is present then
2602 it <emphasis>overrides</> the normal hard-wired default privileges
2603 for the object type. A per-schema entry, if present, represents privileges
2604 to be <emphasis>added to</> the global or hard-wired default privileges.
2608 Note that when an ACL entry in another catalog is null, it is taken
2609 to represent the hard-wired default privileges for its object,
2610 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2611 at the moment. <structname>pg_default_acl</> is only consulted during
2618 <sect1 id="catalog-pg-depend">
2619 <title><structname>pg_depend</structname></title>
2621 <indexterm zone="catalog-pg-depend">
2622 <primary>pg_depend</primary>
2626 The catalog <structname>pg_depend</structname> records the dependency
2627 relationships between database objects. This information allows
2628 <command>DROP</> commands to find which other objects must be dropped
2629 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2634 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2635 which performs a similar function for dependencies involving objects
2636 that are shared across a database cluster.
2640 <title><structname>pg_depend</> Columns</title>
2647 <entry>References</entry>
2648 <entry>Description</entry>
2654 <entry><structfield>classid</structfield></entry>
2655 <entry><type>oid</type></entry>
2656 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2657 <entry>The OID of the system catalog the dependent object is in</entry>
2661 <entry><structfield>objid</structfield></entry>
2662 <entry><type>oid</type></entry>
2663 <entry>any OID column</entry>
2664 <entry>The OID of the specific dependent object</entry>
2668 <entry><structfield>objsubid</structfield></entry>
2669 <entry><type>int4</type></entry>
2672 For a table column, this is the column number (the
2673 <structfield>objid</> and <structfield>classid</> refer to the
2674 table itself). For all other object types, this column is
2680 <entry><structfield>refclassid</structfield></entry>
2681 <entry><type>oid</type></entry>
2682 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2683 <entry>The OID of the system catalog the referenced object is in</entry>
2687 <entry><structfield>refobjid</structfield></entry>
2688 <entry><type>oid</type></entry>
2689 <entry>any OID column</entry>
2690 <entry>The OID of the specific referenced object</entry>
2694 <entry><structfield>refobjsubid</structfield></entry>
2695 <entry><type>int4</type></entry>
2698 For a table column, this is the column number (the
2699 <structfield>refobjid</> and <structfield>refclassid</> refer
2700 to the table itself). For all other object types, this column
2706 <entry><structfield>deptype</structfield></entry>
2707 <entry><type>char</type></entry>
2710 A code defining the specific semantics of this dependency relationship; see text
2719 In all cases, a <structname>pg_depend</structname> entry indicates that the
2720 referenced object cannot be dropped without also dropping the dependent
2721 object. However, there are several subflavors identified by
2722 <structfield>deptype</>:
2726 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2729 A normal relationship between separately-created objects. The
2730 dependent object can be dropped without affecting the
2731 referenced object. The referenced object can only be dropped
2732 by specifying <literal>CASCADE</>, in which case the dependent
2733 object is dropped, too. Example: a table column has a normal
2734 dependency on its data type.
2740 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2743 The dependent object can be dropped separately from the
2744 referenced object, and should be automatically dropped
2745 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2746 mode) if the referenced object is dropped. Example: a named
2747 constraint on a table is made autodependent on the table, so
2748 that it will go away if the table is dropped.
2754 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2757 The dependent object was created as part of creation of the
2758 referenced object, and is really just a part of its internal
2759 implementation. A <command>DROP</> of the dependent object
2760 will be disallowed outright (we'll tell the user to issue a
2761 <command>DROP</> against the referenced object, instead). A
2762 <command>DROP</> of the referenced object will be propagated
2763 through to drop the dependent object whether
2764 <command>CASCADE</> is specified or not. Example: a trigger
2765 that's created to enforce a foreign-key constraint is made
2766 internally dependent on the constraint's
2767 <structname>pg_constraint</> entry.
2773 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2776 The dependent object is a member of the <firstterm>extension</> that is
2777 the referenced object (see
2778 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2779 The dependent object can be dropped only via
2780 <command>DROP EXTENSION</> on the referenced object. Functionally
2781 this dependency type acts the same as an internal dependency, but
2782 it's kept separate for clarity and to simplify <application>pg_dump</>.
2788 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2791 There is no dependent object; this type of entry is a signal
2792 that the system itself depends on the referenced object, and so
2793 that object must never be deleted. Entries of this type are
2794 created only by <command>initdb</command>. The columns for the
2795 dependent object contain zeroes.
2801 Other dependency flavors might be needed in future.
2807 <sect1 id="catalog-pg-description">
2808 <title><structname>pg_description</structname></title>
2810 <indexterm zone="catalog-pg-description">
2811 <primary>pg_description</primary>
2815 The catalog <structname>pg_description</> stores optional descriptions
2816 (comments) for each database object. Descriptions can be manipulated
2817 with the <xref linkend="sql-comment"> command and viewed with
2818 <application>psql</application>'s <literal>\d</literal> commands.
2819 Descriptions of many built-in system objects are provided in the initial
2820 contents of <structname>pg_description</structname>.
2824 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2825 which performs a similar function for descriptions involving objects that
2826 are shared across a database cluster.
2830 <title><structname>pg_description</> Columns</title>
2837 <entry>References</entry>
2838 <entry>Description</entry>
2844 <entry><structfield>objoid</structfield></entry>
2845 <entry><type>oid</type></entry>
2846 <entry>any OID column</entry>
2847 <entry>The OID of the object this description pertains to</entry>
2851 <entry><structfield>classoid</structfield></entry>
2852 <entry><type>oid</type></entry>
2853 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2854 <entry>The OID of the system catalog this object appears in</entry>
2858 <entry><structfield>objsubid</structfield></entry>
2859 <entry><type>int4</type></entry>
2862 For a comment on a table column, this is the column number (the
2863 <structfield>objoid</> and <structfield>classoid</> refer to
2864 the table itself). For all other object types, this column is
2870 <entry><structfield>description</structfield></entry>
2871 <entry><type>text</type></entry>
2873 <entry>Arbitrary text that serves as the description of this object</entry>
2882 <sect1 id="catalog-pg-enum">
2883 <title><structname>pg_enum</structname></title>
2885 <indexterm zone="catalog-pg-enum">
2886 <primary>pg_enum</primary>
2890 The <structname>pg_enum</structname> catalog contains entries
2891 showing the values and labels for each enum type. The
2892 internal representation of a given enum value is actually the OID
2893 of its associated row in <structname>pg_enum</structname>.
2897 <title><structname>pg_enum</> Columns</title>
2904 <entry>References</entry>
2905 <entry>Description</entry>
2911 <entry><structfield>enumtypid</structfield></entry>
2912 <entry><type>oid</type></entry>
2913 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2914 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2918 <entry><structfield>enumsortorder</structfield></entry>
2919 <entry><type>float4</type></entry>
2921 <entry>The sort position of this enum value within its enum type</entry>
2925 <entry><structfield>enumlabel</structfield></entry>
2926 <entry><type>name</type></entry>
2928 <entry>The textual label for this enum value</entry>
2935 The OIDs for <structname>pg_enum</structname> rows follow a special
2936 rule: even-numbered OIDs are guaranteed to be ordered in the same way
2937 as the sort ordering of their enum type. That is, if two even OIDs
2938 belong to the same enum type, the smaller OID must have the smaller
2939 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
2940 need bear no relationship to the sort order. This rule allows the
2941 enum comparison routines to avoid catalog lookups in many common cases.
2942 The routines that create and alter enum types attempt to assign even
2943 OIDs to enum values whenever possible.
2947 When an enum type is created, its members are assigned sort-order
2948 positions 1..<replaceable>n</>. But members added later might be given
2949 negative or fractional values of <structfield>enumsortorder</structfield>.
2950 The only requirement on these values is that they be correctly
2951 ordered and unique within each enum type.
2956 <sect1 id="catalog-pg-extension">
2957 <title><structname>pg_extension</structname></title>
2959 <indexterm zone="catalog-pg-extension">
2960 <primary>pg_extension</primary>
2964 The catalog <structname>pg_extension</structname> stores information
2965 about the installed extensions. See <xref linkend="extend-extensions">
2966 for details about extensions.
2970 <title><structname>pg_extension</> Columns</title>
2977 <entry>References</entry>
2978 <entry>Description</entry>
2984 <entry><structfield>extname</structfield></entry>
2985 <entry><type>name</type></entry>
2987 <entry>Name of the extension</entry>
2991 <entry><structfield>extowner</structfield></entry>
2992 <entry><type>oid</type></entry>
2993 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2994 <entry>Owner of the extension</entry>
2998 <entry><structfield>extnamespace</structfield></entry>
2999 <entry><type>oid</type></entry>
3000 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3001 <entry>Schema containing the extension's exported objects</entry>
3005 <entry><structfield>extrelocatable</structfield></entry>
3006 <entry><type>bool</type></entry>
3008 <entry>True if extension can be relocated to another schema</entry>
3012 <entry><structfield>extversion</structfield></entry>
3013 <entry><type>text</type></entry>
3015 <entry>Version name for the extension</entry>
3019 <entry><structfield>extconfig</structfield></entry>
3020 <entry><type>oid[]</type></entry>
3021 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3022 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3023 table(s), or <literal>NULL</> if none</entry>
3027 <entry><structfield>extcondition</structfield></entry>
3028 <entry><type>text[]</type></entry>
3030 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3031 extension's configuration table(s), or <literal>NULL</> if none</entry>
3039 Note that unlike most catalogs with a <quote>namespace</> column,
3040 <structfield>extnamespace</structfield> is not meant to imply
3041 that the extension belongs to that schema. Extension names are never
3042 schema-qualified. Rather, <structfield>extnamespace</structfield>
3043 indicates the schema that contains most or all of the extension's
3044 objects. If <structfield>extrelocatable</structfield> is true, then
3045 this schema must in fact contain all schema-qualifiable objects
3046 belonging to the extension.
3051 <sect1 id="catalog-pg-foreign-data-wrapper">
3052 <title><structname>pg_foreign_data_wrapper</structname></title>
3054 <indexterm zone="catalog-pg-foreign-data-wrapper">
3055 <primary>pg_foreign_data_wrapper</primary>
3059 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3060 foreign-data wrapper definitions. A foreign-data wrapper is the
3061 mechanism by which external data, residing on foreign servers, is
3066 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3073 <entry>References</entry>
3074 <entry>Description</entry>
3080 <entry><structfield>fdwname</structfield></entry>
3081 <entry><type>name</type></entry>
3083 <entry>Name of the foreign-data wrapper</entry>
3087 <entry><structfield>fdwowner</structfield></entry>
3088 <entry><type>oid</type></entry>
3089 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3090 <entry>Owner of the foreign-data wrapper</entry>
3094 <entry><structfield>fdwhandler</structfield></entry>
3095 <entry><type>oid</type></entry>
3096 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3098 References a handler function that is responsible for
3099 supplying execution routines for the foreign-data wrapper.
3100 Zero if no handler is provided
3105 <entry><structfield>fdwvalidator</structfield></entry>
3106 <entry><type>oid</type></entry>
3107 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3109 References a validator function that is responsible for
3110 checking the validity of the options given to the
3111 foreign-data wrapper, as well as options for foreign servers and user
3112 mappings using the foreign-data wrapper. Zero if no validator
3118 <entry><structfield>fdwacl</structfield></entry>
3119 <entry><type>aclitem[]</type></entry>
3122 Access privileges; see
3123 <xref linkend="sql-grant"> and
3124 <xref linkend="sql-revoke">
3130 <entry><structfield>fdwoptions</structfield></entry>
3131 <entry><type>text[]</type></entry>
3134 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3143 <sect1 id="catalog-pg-foreign-server">
3144 <title><structname>pg_foreign_server</structname></title>
3146 <indexterm zone="catalog-pg-foreign-server">
3147 <primary>pg_foreign_server</primary>
3151 The catalog <structname>pg_foreign_server</structname> stores
3152 foreign server definitions. A foreign server describes a source
3153 of external data, such as a remote server. Foreign
3154 servers are accessed via foreign-data wrappers.
3158 <title><structname>pg_foreign_server</> Columns</title>
3165 <entry>References</entry>
3166 <entry>Description</entry>
3172 <entry><structfield>srvname</structfield></entry>
3173 <entry><type>name</type></entry>
3175 <entry>Name of the foreign server</entry>
3179 <entry><structfield>srvowner</structfield></entry>
3180 <entry><type>oid</type></entry>
3181 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3182 <entry>Owner of the foreign server</entry>
3186 <entry><structfield>srvfdw</structfield></entry>
3187 <entry><type>oid</type></entry>
3188 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3189 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3193 <entry><structfield>srvtype</structfield></entry>
3194 <entry><type>text</type></entry>
3196 <entry>Type of the server (optional)</entry>
3200 <entry><structfield>srvversion</structfield></entry>
3201 <entry><type>text</type></entry>
3203 <entry>Version of the server (optional)</entry>
3207 <entry><structfield>srvacl</structfield></entry>
3208 <entry><type>aclitem[]</type></entry>
3211 Access privileges; see
3212 <xref linkend="sql-grant"> and
3213 <xref linkend="sql-revoke">
3219 <entry><structfield>srvoptions</structfield></entry>
3220 <entry><type>text[]</type></entry>
3223 Foreign server specific options, as <quote>keyword=value</> strings
3232 <sect1 id="catalog-pg-foreign-table">
3233 <title><structname>pg_foreign_table</structname></title>
3235 <indexterm zone="catalog-pg-foreign-table">
3236 <primary>pg_foreign_table</primary>
3240 The catalog <structname>pg_foreign_table</structname> contains
3241 auxiliary information about foreign tables. A foreign table is
3242 primarily represented by a <structname>pg_class</structname> entry,
3243 just like a regular table. Its <structname>pg_foreign_table</structname>
3244 entry contains the information that is pertinent only to foreign tables
3245 and not any other kind of relation.
3249 <title><structname>pg_foreign_table</> Columns</title>
3256 <entry>References</entry>
3257 <entry>Description</entry>
3263 <entry><structfield>ftrelid</structfield></entry>
3264 <entry><type>oid</type></entry>
3265 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3266 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3270 <entry><structfield>ftserver</structfield></entry>
3271 <entry><type>oid</type></entry>
3272 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3273 <entry>OID of the foreign server for this foreign table</entry>
3277 <entry><structfield>ftoptions</structfield></entry>
3278 <entry><type>text[]</type></entry>
3281 Foreign table options, as <quote>keyword=value</> strings
3290 <sect1 id="catalog-pg-index">
3291 <title><structname>pg_index</structname></title>
3293 <indexterm zone="catalog-pg-index">
3294 <primary>pg_index</primary>
3298 The catalog <structname>pg_index</structname> contains part of the information
3299 about indexes. The rest is mostly in
3300 <structname>pg_class</structname>.
3304 <title><structname>pg_index</> Columns</title>
3311 <entry>References</entry>
3312 <entry>Description</entry>
3318 <entry><structfield>indexrelid</structfield></entry>
3319 <entry><type>oid</type></entry>
3320 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3321 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3325 <entry><structfield>indrelid</structfield></entry>
3326 <entry><type>oid</type></entry>
3327 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3328 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3332 <entry><structfield>indnatts</structfield></entry>
3333 <entry><type>int2</type></entry>
3335 <entry>The number of columns in the index (duplicates
3336 <literal>pg_class.relnatts</literal>)</entry>
3340 <entry><structfield>indisunique</structfield></entry>
3341 <entry><type>bool</type></entry>
3343 <entry>If true, this is a unique index</entry>
3347 <entry><structfield>indisprimary</structfield></entry>
3348 <entry><type>bool</type></entry>
3350 <entry>If true, this index represents the primary key of the table
3351 (<structfield>indisunique</> should always be true when this is true)</entry>
3355 <entry><structfield>indisexclusion</structfield></entry>
3356 <entry><type>bool</type></entry>
3358 <entry>If true, this index supports an exclusion constraint</entry>
3362 <entry><structfield>indimmediate</structfield></entry>
3363 <entry><type>bool</type></entry>
3365 <entry>If true, the uniqueness check is enforced immediately on
3367 (irrelevant if <structfield>indisunique</> is not true)</entry>
3371 <entry><structfield>indisclustered</structfield></entry>
3372 <entry><type>bool</type></entry>
3374 <entry>If true, the table was last clustered on this index</entry>
3378 <entry><structfield>indisvalid</structfield></entry>
3379 <entry><type>bool</type></entry>
3382 If true, the index is currently valid for queries. False means the
3383 index is possibly incomplete: it must still be modified by
3384 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3385 be used for queries. If it is unique, the uniqueness property is not
3391 <entry><structfield>indcheckxmin</structfield></entry>
3392 <entry><type>bool</type></entry>
3395 If true, queries must not use the index until the <structfield>xmin</>
3396 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3397 event horizon, because the table may contain broken HOT chains with
3398 incompatible rows that they can see
3403 <entry><structfield>indisready</structfield></entry>
3404 <entry><type>bool</type></entry>
3407 If true, the index is currently ready for inserts. False means the
3408 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3414 <entry><structfield>indkey</structfield></entry>
3415 <entry><type>int2vector</type></entry>
3416 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3418 This is an array of <structfield>indnatts</structfield> values that
3419 indicate which table columns this index indexes. For example a value
3420 of <literal>1 3</literal> would mean that the first and the third table
3421 columns make up the index key. A zero in this array indicates that the
3422 corresponding index attribute is an expression over the table columns,
3423 rather than a simple column reference.
3428 <entry><structfield>indcollation</structfield></entry>
3429 <entry><type>oidvector</type></entry>
3430 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3432 For each column in the index key, this contains the OID of the
3433 collation to use for the index.
3438 <entry><structfield>indclass</structfield></entry>
3439 <entry><type>oidvector</type></entry>
3440 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3442 For each column in the index key, this contains the OID of
3443 the operator class to use. See
3444 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3449 <entry><structfield>indoption</structfield></entry>
3450 <entry><type>int2vector</type></entry>
3453 This is an array of <structfield>indnatts</structfield> values that
3454 store per-column flag bits. The meaning of the bits is defined by
3455 the index's access method.
3460 <entry><structfield>indexprs</structfield></entry>
3461 <entry><type>pg_node_tree</type></entry>
3464 Expression trees (in <function>nodeToString()</function>
3465 representation) for index attributes that are not simple column
3466 references. This is a list with one element for each zero
3467 entry in <structfield>indkey</>. Null if all index attributes
3468 are simple references.
3473 <entry><structfield>indpred</structfield></entry>
3474 <entry><type>pg_node_tree</type></entry>
3477 Expression tree (in <function>nodeToString()</function>
3478 representation) for partial index predicate. Null if not a
3489 <sect1 id="catalog-pg-inherits">
3490 <title><structname>pg_inherits</structname></title>
3492 <indexterm zone="catalog-pg-inherits">
3493 <primary>pg_inherits</primary>
3497 The catalog <structname>pg_inherits</> records information about
3498 table inheritance hierarchies. There is one entry for each direct
3499 child table in the database. (Indirect inheritance can be determined
3500 by following chains of entries.)
3504 <title><structname>pg_inherits</> Columns</title>
3511 <entry>References</entry>
3512 <entry>Description</entry>
3518 <entry><structfield>inhrelid</structfield></entry>
3519 <entry><type>oid</type></entry>
3520 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3522 The OID of the child table
3527 <entry><structfield>inhparent</structfield></entry>
3528 <entry><type>oid</type></entry>
3529 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3531 The OID of the parent table
3536 <entry><structfield>inhseqno</structfield></entry>
3537 <entry><type>int4</type></entry>
3540 If there is more than one direct parent for a child table (multiple
3541 inheritance), this number tells the order in which the
3542 inherited columns are to be arranged. The count starts at 1.
3552 <sect1 id="catalog-pg-language">
3553 <title><structname>pg_language</structname></title>
3555 <indexterm zone="catalog-pg-language">
3556 <primary>pg_language</primary>
3560 The catalog <structname>pg_language</structname> registers
3561 languages in which you can write functions or stored procedures.
3562 See <xref linkend="sql-createlanguage">
3563 and <xref linkend="xplang"> for more information about language handlers.
3567 <title><structname>pg_language</> Columns</title>
3574 <entry>References</entry>
3575 <entry>Description</entry>
3581 <entry><structfield>lanname</structfield></entry>
3582 <entry><type>name</type></entry>
3584 <entry>Name of the language</entry>
3588 <entry><structfield>lanowner</structfield></entry>
3589 <entry><type>oid</type></entry>
3590 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3591 <entry>Owner of the language</entry>
3595 <entry><structfield>lanispl</structfield></entry>
3596 <entry><type>bool</type></entry>
3599 This is false for internal languages (such as
3600 <acronym>SQL</acronym>) and true for user-defined languages.
3601 Currently, <application>pg_dump</application> still uses this
3602 to determine which languages need to be dumped, but this might be
3603 replaced by a different mechanism in the future.
3608 <entry><structfield>lanpltrusted</structfield></entry>
3609 <entry><type>bool</type></entry>
3612 True if this is a trusted language, which means that it is believed
3613 not to grant access to anything outside the normal SQL execution
3614 environment. Only superusers can create functions in untrusted
3620 <entry><structfield>lanplcallfoid</structfield></entry>
3621 <entry><type>oid</type></entry>
3622 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3624 For noninternal languages this references the language
3625 handler, which is a special function that is responsible for
3626 executing all functions that are written in the particular
3632 <entry><structfield>laninline</structfield></entry>
3633 <entry><type>oid</type></entry>
3634 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3636 This references a function that is responsible for executing
3637 <quote>inline</> anonymous code blocks
3638 (<xref linkend="sql-do"> blocks).
3639 Zero if inline blocks are not supported.
3644 <entry><structfield>lanvalidator</structfield></entry>
3645 <entry><type>oid</type></entry>
3646 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3648 This references a language validator function that is responsible
3649 for checking the syntax and validity of new functions when they
3650 are created. Zero if no validator is provided.
3655 <entry><structfield>lanacl</structfield></entry>
3656 <entry><type>aclitem[]</type></entry>
3659 Access privileges; see
3660 <xref linkend="sql-grant"> and
3661 <xref linkend="sql-revoke">
3672 <sect1 id="catalog-pg-largeobject">
3673 <title><structname>pg_largeobject</structname></title>
3675 <indexterm zone="catalog-pg-largeobject">
3676 <primary>pg_largeobject</primary>
3680 The catalog <structname>pg_largeobject</structname> holds the data making up
3681 <quote>large objects</quote>. A large object is identified by an OID
3682 assigned when it is created. Each large object is broken into
3683 segments or <quote>pages</> small enough to be conveniently stored as rows
3684 in <structname>pg_largeobject</structname>.
3685 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
3686 <literal>BLCKSZ/4</>, or typically 2 kB).
3690 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
3691 associated with large objects. As a result,
3692 <structname>pg_largeobject</structname> was publicly readable and could be
3693 used to obtain the OIDs (and contents) of all large objects in the system.
3694 This is no longer the case; use
3695 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
3696 to obtain a list of large object OIDs.
3700 <title><structname>pg_largeobject</> Columns</title>
3707 <entry>References</entry>
3708 <entry>Description</entry>
3714 <entry><structfield>loid</structfield></entry>
3715 <entry><type>oid</type></entry>
3716 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
3717 <entry>Identifier of the large object that includes this page</entry>
3721 <entry><structfield>pageno</structfield></entry>
3722 <entry><type>int4</type></entry>
3724 <entry>Page number of this page within its large object
3725 (counting from zero)</entry>
3729 <entry><structfield>data</structfield></entry>
3730 <entry><type>bytea</type></entry>
3733 Actual data stored in the large object.
3734 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
3742 Each row of <structname>pg_largeobject</structname> holds data
3743 for one page of a large object, beginning at
3744 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
3745 allows sparse storage: pages might be missing, and might be shorter than
3746 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
3747 Missing regions within a large object read as zeroes.
3752 <sect1 id="catalog-pg-largeobject-metadata">
3753 <title><structname>pg_largeobject_metadata</structname></title>
3755 <indexterm zone="catalog-pg-largeobject-metadata">
3756 <primary>pg_largeobject_metadata</primary>
3760 The catalog <structname>pg_largeobject_metadata</structname>
3761 holds metadata associated with large objects. The actual large object
3763 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
3767 <title><structname>pg_largeobject_metadata</> Columns</title>
3774 <entry>References</entry>
3775 <entry>Description</entry>
3781 <entry><structfield>lomowner</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 large object</entry>
3788 <entry><structfield>lomacl</structfield></entry>
3789 <entry><type>aclitem[]</type></entry>
3792 Access privileges; see
3793 <xref linkend="sql-grant"> and
3794 <xref linkend="sql-revoke">
3804 <sect1 id="catalog-pg-namespace">
3805 <title><structname>pg_namespace</structname></title>
3807 <indexterm zone="catalog-pg-namespace">
3808 <primary>pg_namespace</primary>
3812 The catalog <structname>pg_namespace</> stores namespaces.
3813 A namespace is the structure underlying SQL schemas: each namespace
3814 can have a separate collection of relations, types, etc. without name
3819 <title><structname>pg_namespace</> Columns</title>
3826 <entry>References</entry>
3827 <entry>Description</entry>
3833 <entry><structfield>nspname</structfield></entry>
3834 <entry><type>name</type></entry>
3836 <entry>Name of the namespace</entry>
3840 <entry><structfield>nspowner</structfield></entry>
3841 <entry><type>oid</type></entry>
3842 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3843 <entry>Owner of the namespace</entry>
3847 <entry><structfield>nspacl</structfield></entry>
3848 <entry><type>aclitem[]</type></entry>
3851 Access privileges; see
3852 <xref linkend="sql-grant"> and
3853 <xref linkend="sql-revoke">
3864 <sect1 id="catalog-pg-opclass">
3865 <title><structname>pg_opclass</structname></title>
3867 <indexterm zone="catalog-pg-opclass">
3868 <primary>pg_opclass</primary>
3872 The catalog <structname>pg_opclass</structname> defines
3873 index access method operator classes. Each operator class defines
3874 semantics for index columns of a particular data type and a particular
3875 index access method. An operator class essentially specifies that a
3876 particular operator family is applicable to a particular indexable column
3877 data type. The set of operators from the family that are actually usable
3878 with the indexed column are whichever ones accept the column's data type
3879 as their lefthand input.
3883 Operator classes are described at length in <xref linkend="xindex">.
3887 <title><structname>pg_opclass</> Columns</title>
3894 <entry>References</entry>
3895 <entry>Description</entry>
3901 <entry><structfield>opcmethod</structfield></entry>
3902 <entry><type>oid</type></entry>
3903 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3904 <entry>Index access method operator class is for</entry>
3908 <entry><structfield>opcname</structfield></entry>
3909 <entry><type>name</type></entry>
3911 <entry>Name of this operator class</entry>
3915 <entry><structfield>opcnamespace</structfield></entry>
3916 <entry><type>oid</type></entry>
3917 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3918 <entry>Namespace of this operator class</entry>
3922 <entry><structfield>opcowner</structfield></entry>
3923 <entry><type>oid</type></entry>
3924 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3925 <entry>Owner of the operator class</entry>
3929 <entry><structfield>opcfamily</structfield></entry>
3930 <entry><type>oid</type></entry>
3931 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3932 <entry>Operator family containing the operator class</entry>
3936 <entry><structfield>opcintype</structfield></entry>
3937 <entry><type>oid</type></entry>
3938 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3939 <entry>Data type that the operator class indexes</entry>
3943 <entry><structfield>opcdefault</structfield></entry>
3944 <entry><type>bool</type></entry>
3946 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3950 <entry><structfield>opckeytype</structfield></entry>
3951 <entry><type>oid</type></entry>
3952 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3953 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3961 An operator class's <structfield>opcmethod</> must match the
3962 <structname>opfmethod</> of its containing operator family.
3963 Also, there must be no more than one <structname>pg_opclass</structname>
3964 row having <structname>opcdefault</> true for any given combination of
3965 <structname>opcmethod</> and <structname>opcintype</>.
3971 <sect1 id="catalog-pg-operator">
3972 <title><structname>pg_operator</structname></title>
3974 <indexterm zone="catalog-pg-operator">
3975 <primary>pg_operator</primary>
3979 The catalog <structname>pg_operator</> stores information about operators.
3980 See <xref linkend="sql-createoperator">
3981 and <xref linkend="xoper"> for more information.
3985 <title><structname>pg_operator</> Columns</title>
3992 <entry>References</entry>
3993 <entry>Description</entry>
3999 <entry><structfield>oprname</structfield></entry>
4000 <entry><type>name</type></entry>
4002 <entry>Name of the operator</entry>
4006 <entry><structfield>oprnamespace</structfield></entry>
4007 <entry><type>oid</type></entry>
4008 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4010 The OID of the namespace that contains this operator
4015 <entry><structfield>oprowner</structfield></entry>
4016 <entry><type>oid</type></entry>
4017 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4018 <entry>Owner of the operator</entry>
4022 <entry><structfield>oprkind</structfield></entry>
4023 <entry><type>char</type></entry>
4026 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4027 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4032 <entry><structfield>oprcanmerge</structfield></entry>
4033 <entry><type>bool</type></entry>
4035 <entry>This operator supports merge joins</entry>
4039 <entry><structfield>oprcanhash</structfield></entry>
4040 <entry><type>bool</type></entry>
4042 <entry>This operator supports hash joins</entry>
4046 <entry><structfield>oprleft</structfield></entry>
4047 <entry><type>oid</type></entry>
4048 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4049 <entry>Type of the left operand</entry>
4053 <entry><structfield>oprright</structfield></entry>
4054 <entry><type>oid</type></entry>
4055 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4056 <entry>Type of the right operand</entry>
4060 <entry><structfield>oprresult</structfield></entry>
4061 <entry><type>oid</type></entry>
4062 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4063 <entry>Type of the result</entry>
4067 <entry><structfield>oprcom</structfield></entry>
4068 <entry><type>oid</type></entry>
4069 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4070 <entry>Commutator of this operator, if any</entry>
4074 <entry><structfield>oprnegate</structfield></entry>
4075 <entry><type>oid</type></entry>
4076 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4077 <entry>Negator of this operator, if any</entry>
4081 <entry><structfield>oprcode</structfield></entry>
4082 <entry><type>regproc</type></entry>
4083 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4084 <entry>Function that implements this operator</entry>
4088 <entry><structfield>oprrest</structfield></entry>
4089 <entry><type>regproc</type></entry>
4090 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4091 <entry>Restriction selectivity estimation function for this operator</entry>
4095 <entry><structfield>oprjoin</structfield></entry>
4096 <entry><type>regproc</type></entry>
4097 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4098 <entry>Join selectivity estimation function for this operator</entry>
4105 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4106 is zero for a prefix operator.
4112 <sect1 id="catalog-pg-opfamily">
4113 <title><structname>pg_opfamily</structname></title>
4115 <indexterm zone="catalog-pg-opfamily">
4116 <primary>pg_opfamily</primary>
4120 The catalog <structname>pg_opfamily</structname> defines operator families.
4121 Each operator family is a collection of operators and associated
4122 support routines that implement the semantics specified for a particular
4123 index access method. Furthermore, the operators in a family are all
4124 <quote>compatible</>, in a way that is specified by the access method.
4125 The operator family concept allows cross-data-type operators to be used
4126 with indexes and to be reasoned about using knowledge of access method
4131 Operator families are described at length in <xref linkend="xindex">.
4135 <title><structname>pg_opfamily</> Columns</title>
4142 <entry>References</entry>
4143 <entry>Description</entry>
4149 <entry><structfield>opfmethod</structfield></entry>
4150 <entry><type>oid</type></entry>
4151 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4152 <entry>Index access method operator family is for</entry>
4156 <entry><structfield>opfname</structfield></entry>
4157 <entry><type>name</type></entry>
4159 <entry>Name of this operator family</entry>
4163 <entry><structfield>opfnamespace</structfield></entry>
4164 <entry><type>oid</type></entry>
4165 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4166 <entry>Namespace of this operator family</entry>
4170 <entry><structfield>opfowner</structfield></entry>
4171 <entry><type>oid</type></entry>
4172 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4173 <entry>Owner of the operator family</entry>
4181 The majority of the information defining an operator family is not in its
4182 <structname>pg_opfamily</structname> row, but in the associated rows in
4183 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4184 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4186 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4192 <sect1 id="catalog-pg-pltemplate">
4193 <title><structname>pg_pltemplate</structname></title>
4195 <indexterm zone="catalog-pg-pltemplate">
4196 <primary>pg_pltemplate</primary>
4200 The catalog <structname>pg_pltemplate</structname> stores
4201 <quote>template</> information for procedural languages.
4202 A template for a language allows the language to be created in a
4203 particular database by a simple <command>CREATE LANGUAGE</> command,
4204 with no need to specify implementation details.
4208 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4209 is shared across all databases of a cluster: there is only one
4210 copy of <structname>pg_pltemplate</structname> per cluster, not
4211 one per database. This allows the information to be accessible in
4212 each database as it is needed.
4216 <title><structname>pg_pltemplate</> Columns</title>
4223 <entry>Description</entry>
4229 <entry><structfield>tmplname</structfield></entry>
4230 <entry><type>name</type></entry>
4231 <entry>Name of the language this template is for</entry>
4235 <entry><structfield>tmpltrusted</structfield></entry>
4236 <entry><type>boolean</type></entry>
4237 <entry>True if language is considered trusted</entry>
4241 <entry><structfield>tmpldbacreate</structfield></entry>
4242 <entry><type>boolean</type></entry>
4243 <entry>True if language may be created by a database owner</entry>
4247 <entry><structfield>tmplhandler</structfield></entry>
4248 <entry><type>text</type></entry>
4249 <entry>Name of call handler function</entry>
4253 <entry><structfield>tmplinline</structfield></entry>
4254 <entry><type>text</type></entry>
4255 <entry>Name of anonymous-block handler function, or null if none</entry>
4259 <entry><structfield>tmplvalidator</structfield></entry>
4260 <entry><type>text</type></entry>
4261 <entry>Name of validator function, or null if none</entry>
4265 <entry><structfield>tmpllibrary</structfield></entry>
4266 <entry><type>text</type></entry>
4267 <entry>Path of shared library that implements language</entry>
4271 <entry><structfield>tmplacl</structfield></entry>
4272 <entry><type>aclitem[]</type></entry>
4273 <entry>Access privileges for template (not actually used)</entry>
4281 There are not currently any commands that manipulate procedural language
4282 templates; to change the built-in information, a superuser must modify
4283 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4284 or <command>UPDATE</command> commands.
4289 It is likely that <structname>pg_pltemplate</> will be removed in some
4290 future release of <productname>PostgreSQL</productname>, in favor of
4291 keeping this knowledge about procedural languages in their respective
4292 extension installation scripts.
4299 <sect1 id="catalog-pg-proc">
4300 <title><structname>pg_proc</structname></title>
4302 <indexterm zone="catalog-pg-proc">
4303 <primary>pg_proc</primary>
4307 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4308 See <xref linkend="sql-createfunction">
4309 and <xref linkend="xfunc"> for more information.
4313 The table contains data for aggregate functions as well as plain functions.
4314 If <structfield>proisagg</structfield> is true, there should be a matching
4315 row in <structfield>pg_aggregate</structfield>.
4319 <title><structname>pg_proc</> Columns</title>
4326 <entry>References</entry>
4327 <entry>Description</entry>
4333 <entry><structfield>proname</structfield></entry>
4334 <entry><type>name</type></entry>
4336 <entry>Name of the function</entry>
4340 <entry><structfield>pronamespace</structfield></entry>
4341 <entry><type>oid</type></entry>
4342 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4344 The OID of the namespace that contains this function
4349 <entry><structfield>proowner</structfield></entry>
4350 <entry><type>oid</type></entry>
4351 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4352 <entry>Owner of the function</entry>
4356 <entry><structfield>prolang</structfield></entry>
4357 <entry><type>oid</type></entry>
4358 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4359 <entry>Implementation language or call interface of this function</entry>
4363 <entry><structfield>procost</structfield></entry>
4364 <entry><type>float4</type></entry>
4366 <entry>Estimated execution cost (in units of
4367 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4368 this is cost per row returned</entry>
4372 <entry><structfield>prorows</structfield></entry>
4373 <entry><type>float4</type></entry>
4375 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4379 <entry><structfield>provariadic</structfield></entry>
4380 <entry><type>oid</type></entry>
4381 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4382 <entry>Data type of the variadic array parameter's elements,
4383 or zero if the function does not have a variadic parameter</entry>
4387 <entry><structfield>protransform</structfield></entry>
4388 <entry><type>regproc</type></entry>
4389 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4390 <entry>Calls to function can be simplified by this other function</entry>
4394 <entry><structfield>proisagg</structfield></entry>
4395 <entry><type>bool</type></entry>
4397 <entry>Function is an aggregate function</entry>
4401 <entry><structfield>proiswindow</structfield></entry>
4402 <entry><type>bool</type></entry>
4404 <entry>Function is a window function</entry>
4408 <entry><structfield>prosecdef</structfield></entry>
4409 <entry><type>bool</type></entry>
4411 <entry>Function is a security definer (i.e., a <quote>setuid</>
4416 <entry><structfield>proisstrict</structfield></entry>
4417 <entry><type>bool</type></entry>
4420 Function returns null if any call argument is null. In that
4421 case the function won't actually be called at all. Functions
4422 that are not <quote>strict</quote> must be prepared to handle
4428 <entry><structfield>proretset</structfield></entry>
4429 <entry><type>bool</type></entry>
4431 <entry>Function returns a set (i.e., multiple values of the specified
4436 <entry><structfield>provolatile</structfield></entry>
4437 <entry><type>char</type></entry>
4440 <structfield>provolatile</structfield> tells whether the function's
4441 result depends only on its input arguments, or is affected by outside
4443 It is <literal>i</literal> for <quote>immutable</> functions,
4444 which always deliver the same result for the same inputs.
4445 It is <literal>s</literal> for <quote>stable</> functions,
4446 whose results (for fixed inputs) do not change within a scan.
4447 It is <literal>v</literal> for <quote>volatile</> functions,
4448 whose results might change at any time. (Use <literal>v</literal> also
4449 for functions with side-effects, so that calls to them cannot get
4455 <entry><structfield>pronargs</structfield></entry>
4456 <entry><type>int2</type></entry>
4458 <entry>Number of input arguments</entry>
4462 <entry><structfield>pronargdefaults</structfield></entry>
4463 <entry><type>int2</type></entry>
4465 <entry>Number of arguments that have defaults</entry>
4469 <entry><structfield>prorettype</structfield></entry>
4470 <entry><type>oid</type></entry>
4471 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4472 <entry>Data type of the return value</entry>
4476 <entry><structfield>proargtypes</structfield></entry>
4477 <entry><type>oidvector</type></entry>
4478 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4480 An array with the data types of the function arguments. This includes
4481 only input arguments (including <literal>INOUT</literal> and
4482 <literal>VARIADIC</> arguments), and thus represents
4483 the call signature of the function.
4488 <entry><structfield>proallargtypes</structfield></entry>
4489 <entry><type>oid[]</type></entry>
4490 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4492 An array with the data types of the function arguments. This includes
4493 all arguments (including <literal>OUT</literal> and
4494 <literal>INOUT</literal> arguments); however, if all the
4495 arguments are <literal>IN</literal> arguments, this field will be null.
4496 Note that subscripting is 1-based, whereas for historical reasons
4497 <structfield>proargtypes</> is subscripted from 0.
4502 <entry><structfield>proargmodes</structfield></entry>
4503 <entry><type>char[]</type></entry>
4506 An array with the modes of the function arguments, encoded as
4507 <literal>i</literal> for <literal>IN</> arguments,
4508 <literal>o</literal> for <literal>OUT</> arguments,
4509 <literal>b</literal> for <literal>INOUT</> arguments,
4510 <literal>v</literal> for <literal>VARIADIC</> arguments,
4511 <literal>t</literal> for <literal>TABLE</> arguments.
4512 If all the arguments are <literal>IN</literal> arguments,
4513 this field will be null.
4514 Note that subscripts correspond to positions of
4515 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4520 <entry><structfield>proargnames</structfield></entry>
4521 <entry><type>text[]</type></entry>
4524 An array with the names of the function arguments.
4525 Arguments without a name are set to empty strings in the array.
4526 If none of the arguments have a name, this field will be null.
4527 Note that subscripts correspond to positions of
4528 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4533 <entry><structfield>proargdefaults</structfield></entry>
4534 <entry><type>pg_node_tree</type></entry>
4537 Expression trees (in <function>nodeToString()</function> representation)
4538 for default values. This is a list with
4539 <structfield>pronargdefaults</> elements, corresponding to the last
4540 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
4541 <replaceable>N</> <structfield>proargtypes</> positions).
4542 If none of the arguments have defaults, this field will be null.
4547 <entry><structfield>prosrc</structfield></entry>
4548 <entry><type>text</type></entry>
4551 This tells the function handler how to invoke the function. It
4552 might be the actual source code of the function for interpreted
4553 languages, a link symbol, a file name, or just about anything
4554 else, depending on the implementation language/call convention.
4559 <entry><structfield>probin</structfield></entry>
4560 <entry><type>text</type></entry>
4563 Additional information about how to invoke the function.
4564 Again, the interpretation is language-specific.
4569 <entry><structfield>proconfig</structfield></entry>
4570 <entry><type>text[]</type></entry>
4572 <entry>Function's local settings for run-time configuration variables</entry>
4576 <entry><structfield>proacl</structfield></entry>
4577 <entry><type>aclitem[]</type></entry>
4580 Access privileges; see
4581 <xref linkend="sql-grant"> and
4582 <xref linkend="sql-revoke">
4591 For compiled functions, both built-in and dynamically loaded,
4592 <structfield>prosrc</structfield> contains the function's C-language
4593 name (link symbol). For all other currently-known language types,
4594 <structfield>prosrc</structfield> contains the function's source
4595 text. <structfield>probin</structfield> is unused except for
4596 dynamically-loaded C functions, for which it gives the name of the
4597 shared library file containing the function.
4602 <sect1 id="catalog-pg-range">
4603 <title><structname>pg_range</structname></title>
4605 <indexterm zone="catalog-pg-range">
4606 <primary>pg_range</primary>
4610 The catalog <structname>pg_range</structname> stores information about
4611 range types. This is in addition to the types' entries in
4612 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
4616 <title><structname>pg_range</> Columns</title>
4623 <entry>References</entry>
4624 <entry>Description</entry>
4630 <entry><structfield>rngtypid</structfield></entry>
4631 <entry><type>oid</type></entry>
4632 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4633 <entry>OID of the range type</entry>
4637 <entry><structfield>rngsubtype</structfield></entry>
4638 <entry><type>oid</type></entry>
4639 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4640 <entry>OID of the element type (subtype) of this range type</entry>
4644 <entry><structfield>rngcollation</structfield></entry>
4645 <entry><type>oid</type></entry>
4646 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
4647 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
4651 <entry><structfield>rngsubopc</structfield></entry>
4652 <entry><type>oid</type></entry>
4653 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4654 <entry>OID of the subtype's operator class used for range comparisons</entry>
4658 <entry><structfield>rngcanonical</structfield></entry>
4659 <entry><type>regproc</type></entry>
4660 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4661 <entry>OID of the function to convert a range value into canonical form,
4662 or 0 if none</entry>
4666 <entry><structfield>rngsubdiff</structfield></entry>
4667 <entry><type>regproc</type></entry>
4668 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4669 <entry>OID of the function to return the difference between two element
4670 values as <type>double precision</type>, or 0 if none</entry>
4677 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
4678 element type is collatable) determines the sort ordering used by the range
4679 type. <structfield>rngcanonical</> is used when the element type is
4680 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
4681 improve performance of GiST indexes on the range type.
4686 <sect1 id="catalog-pg-rewrite">
4687 <title><structname>pg_rewrite</structname></title>
4689 <indexterm zone="catalog-pg-rewrite">
4690 <primary>pg_rewrite</primary>
4694 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
4698 <title><structname>pg_rewrite</> Columns</title>
4705 <entry>References</entry>
4706 <entry>Description</entry>
4712 <entry><structfield>rulename</structfield></entry>
4713 <entry><type>name</type></entry>
4715 <entry>Rule name</entry>
4719 <entry><structfield>ev_class</structfield></entry>
4720 <entry><type>oid</type></entry>
4721 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4722 <entry>The table this rule is for</entry>
4726 <entry><structfield>ev_attr</structfield></entry>
4727 <entry><type>int2</type></entry>
4729 <entry>The column this rule is for (currently, always zero to
4730 indicate the whole table)</entry>
4734 <entry><structfield>ev_type</structfield></entry>
4735 <entry><type>char</type></entry>
4738 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
4739 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
4745 <entry><structfield>ev_enabled</structfield></entry>
4746 <entry><type>char</type></entry>
4749 Controls in which <xref linkend="guc-session-replication-role"> modes
4751 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
4752 <literal>D</> = rule is disabled,
4753 <literal>R</> = rule fires in <quote>replica</> mode,
4754 <literal>A</> = rule fires always.
4759 <entry><structfield>is_instead</structfield></entry>
4760 <entry><type>bool</type></entry>
4762 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
4766 <entry><structfield>ev_qual</structfield></entry>
4767 <entry><type>pg_node_tree</type></entry>
4770 Expression tree (in the form of a
4771 <function>nodeToString()</function> representation) for the
4772 rule's qualifying condition
4777 <entry><structfield>ev_action</structfield></entry>
4778 <entry><type>pg_node_tree</type></entry>
4781 Query tree (in the form of a
4782 <function>nodeToString()</function> representation) for the
4792 <literal>pg_class.relhasrules</literal>
4793 must be true if a table has any rules in this catalog.
4800 <sect1 id="catalog-pg-seclabel">
4801 <title><structname>pg_seclabel</structname></title>
4803 <indexterm zone="catalog-pg-seclabel">
4804 <primary>pg_seclabel</primary>
4808 The catalog <structname>pg_seclabel</structname> stores security
4809 labels on database objects. Security labels can be manipulated
4810 with the <xref linkend="sql-security-label"> command. For an easier
4811 way to view security labels, see <xref linkend="view-pg-seclabels">.
4815 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
4816 which performs a similar function for security labels of database objects
4817 that are shared across a database cluster.
4821 <title><structname>pg_seclabel</structname> Columns</title>
4828 <entry>References</entry>
4829 <entry>Description</entry>
4835 <entry><structfield>objoid</structfield></entry>
4836 <entry><type>oid</type></entry>
4837 <entry>any OID column</entry>
4838 <entry>The OID of the object this security label pertains to</entry>
4842 <entry><structfield>classoid</structfield></entry>
4843 <entry><type>oid</type></entry>
4844 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4845 <entry>The OID of the system catalog this object appears in</entry>
4849 <entry><structfield>objsubid</structfield></entry>
4850 <entry><type>int4</type></entry>
4853 For a security label on a table column, this is the column number (the
4854 <structfield>objoid</> and <structfield>classoid</> refer to
4855 the table itself). For all other object types, this column is
4861 <entry><structfield>provider</structfield></entry>
4862 <entry><type>text</type></entry>
4864 <entry>The label provider associated with this label.</entry>
4868 <entry><structfield>label</structfield></entry>
4869 <entry><type>text</type></entry>
4871 <entry>The security label applied to this object.</entry>
4878 <sect1 id="catalog-pg-shdepend">
4879 <title><structname>pg_shdepend</structname></title>
4881 <indexterm zone="catalog-pg-shdepend">
4882 <primary>pg_shdepend</primary>
4886 The catalog <structname>pg_shdepend</structname> records the
4887 dependency relationships between database objects and shared objects,
4888 such as roles. This information allows
4889 <productname>PostgreSQL</productname> to ensure that those objects are
4890 unreferenced before attempting to delete them.
4894 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
4895 which performs a similar function for dependencies involving objects
4896 within a single database.
4900 Unlike most system catalogs, <structname>pg_shdepend</structname>
4901 is shared across all databases of a cluster: there is only one
4902 copy of <structname>pg_shdepend</structname> per cluster, not
4907 <title><structname>pg_shdepend</> Columns</title>
4914 <entry>References</entry>
4915 <entry>Description</entry>
4921 <entry><structfield>dbid</structfield></entry>
4922 <entry><type>oid</type></entry>
4923 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
4924 <entry>The OID of the database the dependent object is in,
4925 or zero for a shared object</entry>
4929 <entry><structfield>classid</structfield></entry>
4930 <entry><type>oid</type></entry>
4931 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4932 <entry>The OID of the system catalog the dependent object is in</entry>
4936 <entry><structfield>objid</structfield></entry>
4937 <entry><type>oid</type></entry>
4938 <entry>any OID column</entry>
4939 <entry>The OID of the specific dependent object</entry>
4943 <entry><structfield>objsubid</structfield></entry>
4944 <entry><type>int4</type></entry>
4947 For a table column, this is the column number (the
4948 <structfield>objid</> and <structfield>classid</> refer to the
4949 table itself). For all other object types, this column is zero.
4954 <entry><structfield>refclassid</structfield></entry>
4955 <entry><type>oid</type></entry>
4956 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4957 <entry>The OID of the system catalog the referenced object is in
4958 (must be a shared catalog)</entry>
4962 <entry><structfield>refobjid</structfield></entry>
4963 <entry><type>oid</type></entry>
4964 <entry>any OID column</entry>
4965 <entry>The OID of the specific referenced object</entry>
4969 <entry><structfield>deptype</structfield></entry>
4970 <entry><type>char</type></entry>
4973 A code defining the specific semantics of this dependency relationship; see text
4982 In all cases, a <structname>pg_shdepend</structname> entry indicates that
4983 the referenced object cannot be dropped without also dropping the dependent
4984 object. However, there are several subflavors identified by
4985 <structfield>deptype</>:
4989 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
4992 The referenced object (which must be a role) is the owner of the
4999 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5002 The referenced object (which must be a role) is mentioned in the
5003 ACL (access control list, i.e., privileges list) of the
5004 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5005 not made for the owner of the object, since the owner will have
5006 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5012 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5015 There is no dependent object; this type of entry is a signal
5016 that the system itself depends on the referenced object, and so
5017 that object must never be deleted. Entries of this type are
5018 created only by <command>initdb</command>. The columns for the
5019 dependent object contain zeroes.
5025 Other dependency flavors might be needed in future. Note in particular
5026 that the current definition only supports roles as referenced objects.
5031 <sect1 id="catalog-pg-shdescription">
5032 <title><structname>pg_shdescription</structname></title>
5034 <indexterm zone="catalog-pg-shdescription">
5035 <primary>pg_shdescription</primary>
5039 The catalog <structname>pg_shdescription</structname> stores optional
5040 descriptions (comments) for shared database objects. Descriptions can be
5041 manipulated with the <xref linkend="sql-comment"> command and viewed with
5042 <application>psql</application>'s <literal>\d</literal> commands.
5046 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5047 which performs a similar function for descriptions involving objects
5048 within a single database.
5052 Unlike most system catalogs, <structname>pg_shdescription</structname>
5053 is shared across all databases of a cluster: there is only one
5054 copy of <structname>pg_shdescription</structname> per cluster, not
5059 <title><structname>pg_shdescription</> Columns</title>
5066 <entry>References</entry>
5067 <entry>Description</entry>
5073 <entry><structfield>objoid</structfield></entry>
5074 <entry><type>oid</type></entry>
5075 <entry>any OID column</entry>
5076 <entry>The OID of the object this description pertains to</entry>
5080 <entry><structfield>classoid</structfield></entry>
5081 <entry><type>oid</type></entry>
5082 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5083 <entry>The OID of the system catalog this object appears in</entry>
5087 <entry><structfield>description</structfield></entry>
5088 <entry><type>text</type></entry>
5090 <entry>Arbitrary text that serves as the description of this object</entry>
5098 <sect1 id="catalog-pg-shseclabel">
5099 <title><structname>pg_shseclabel</structname></title>
5101 <indexterm zone="catalog-pg-shseclabel">
5102 <primary>pg_shseclabel</primary>
5106 The catalog <structname>pg_shseclabel</structname> stores security
5107 lables on shared database objects. Security labels can be manipulated
5108 with the <xref linkend="sql-security-label"> command. For an easier
5109 way to view security labels, see <xref linkend="view-pg-seclabels">.
5113 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5114 which performs a similar function for security labels involving objects
5115 within a single database.
5119 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5120 is shared across all databases of a cluster: there is only one
5121 copy of <structname>pg_shseclabel</structname> per cluster, not
5126 <title><structname>pg_shseclabel</structname> Columns</title>
5132 <entry>References</entry>
5133 <entry>Description</entry>
5138 <entry><structfield>objoid</structfield></entry>
5139 <entry><type>oid</type></entry>
5140 <entry>any OID column</entry>
5141 <entry>The OID of the object this security label pertains to</entry>
5144 <entry><structfield>classoid</structfield></entry>
5145 <entry><type>oid</type></entry>
5146 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5147 <entry>The OID of the system catalog this object appears in</entry>
5150 <entry><structfield>provider</structfield></entry>
5151 <entry><type>name</type></entry>
5153 <entry>The label provider associated with this label.</entry>
5156 <entry><structfield>label</structfield></entry>
5157 <entry><type>text</type></entry>
5159 <entry>The security label applied to this object.</entry>
5166 <sect1 id="catalog-pg-statistic">
5167 <title><structname>pg_statistic</structname></title>
5169 <indexterm zone="catalog-pg-statistic">
5170 <primary>pg_statistic</primary>
5174 The catalog <structname>pg_statistic</structname> stores
5175 statistical data about the contents of the database. Entries are
5176 created by <xref linkend="sql-analyze">
5177 and subsequently used by the query planner. Note that all the
5178 statistical data is inherently approximate, even assuming that it
5183 Normally there is one entry, with <structfield>stainherit</> =
5184 <literal>false</>, for each table column that has been analyzed.
5185 If the table has inheritance children, a second entry with
5186 <structfield>stainherit</> = <literal>true</> is also created. This row
5187 represents the column's statistics over the inheritance tree, i.e.,
5188 statistics for the data you'd see with
5189 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5190 whereas the <structfield>stainherit</> = <literal>false</> row represents
5192 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5196 <structname>pg_statistic</structname> also stores statistical data about
5197 the values of index expressions. These are described as if they were
5198 actual data columns; in particular, <structfield>starelid</structfield>
5199 references the index. No entry is made for an ordinary non-expression
5200 index column, however, since it would be redundant with the entry
5201 for the underlying table column. Currently, entries for index expressions
5202 always have <structfield>stainherit</> = <literal>false</>.
5206 Since different kinds of statistics might be appropriate for different
5207 kinds of data, <structname>pg_statistic</structname> is designed not
5208 to assume very much about what sort of statistics it stores. Only
5209 extremely general statistics (such as nullness) are given dedicated
5210 columns in <structname>pg_statistic</structname>. Everything else
5211 is stored in <quote>slots</quote>, which are groups of associated columns
5212 whose content is identified by a code number in one of the slot's columns.
5213 For more information see
5214 <filename>src/include/catalog/pg_statistic.h</filename>.
5218 <structname>pg_statistic</structname> should not be readable by the
5219 public, since even statistical information about a table's contents
5220 might be considered sensitive. (Example: minimum and maximum values
5221 of a salary column might be quite interesting.)
5222 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
5223 is a publicly readable view on
5224 <structname>pg_statistic</structname> that only exposes information
5225 about those tables that are readable by the current user.
5229 <title><structname>pg_statistic</> Columns</title>
5236 <entry>References</entry>
5237 <entry>Description</entry>
5243 <entry><structfield>starelid</structfield></entry>
5244 <entry><type>oid</type></entry>
5245 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5246 <entry>The table or index that the described column belongs to</entry>
5250 <entry><structfield>staattnum</structfield></entry>
5251 <entry><type>int2</type></entry>
5252 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5253 <entry>The number of the described column</entry>
5257 <entry><structfield>stainherit</structfield></entry>
5258 <entry><type>bool</type></entry>
5260 <entry>If true, the stats include inheritance child columns, not just the
5261 values in the specified relation</entry>
5265 <entry><structfield>stanullfrac</structfield></entry>
5266 <entry><type>float4</type></entry>
5268 <entry>The fraction of the column's entries that are null</entry>
5272 <entry><structfield>stawidth</structfield></entry>
5273 <entry><type>int4</type></entry>
5275 <entry>The average stored width, in bytes, of nonnull entries</entry>
5279 <entry><structfield>stadistinct</structfield></entry>
5280 <entry><type>float4</type></entry>
5282 <entry>The number of distinct nonnull data values in the column.
5283 A value greater than zero is the actual number of distinct values.
5284 A value less than zero is the negative of a multiplier for the number
5285 of rows in the table; for example, a column in which values appear about
5286 twice on the average could be represented by
5287 <structfield>stadistinct</> = -0.5.
5288 A zero value means the number of distinct values is unknown.
5293 <entry><structfield>stakind<replaceable>N</></structfield></entry>
5294 <entry><type>int2</type></entry>
5297 A code number indicating the kind of statistics stored in the
5298 <replaceable>N</>th <quote>slot</quote> of the
5299 <structname>pg_statistic</structname> row.
5304 <entry><structfield>staop<replaceable>N</></structfield></entry>
5305 <entry><type>oid</type></entry>
5306 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
5308 An operator used to derive the statistics stored in the
5309 <replaceable>N</>th <quote>slot</quote>. For example, a
5310 histogram slot would show the <literal><</literal> operator
5311 that defines the sort order of the data.
5316 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
5317 <entry><type>float4[]</type></entry>
5320 Numerical statistics of the appropriate kind for the
5321 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5322 kind does not involve numerical values
5327 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
5328 <entry><type>anyarray</type></entry>
5331 Column data values of the appropriate kind for the
5332 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5333 kind does not store any data values. Each array's element
5334 values are actually of the specific column's data type, so there
5335 is no way to define these columns' type more specifically than
5346 <sect1 id="catalog-pg-tablespace">
5347 <title><structname>pg_tablespace</structname></title>
5349 <indexterm zone="catalog-pg-tablespace">
5350 <primary>pg_tablespace</primary>
5354 The catalog <structname>pg_tablespace</structname> stores information
5355 about the available tablespaces. Tables can be placed in particular
5356 tablespaces to aid administration of disk layout.
5360 Unlike most system catalogs, <structname>pg_tablespace</structname>
5361 is shared across all databases of a cluster: there is only one
5362 copy of <structname>pg_tablespace</structname> per cluster, not
5367 <title><structname>pg_tablespace</> Columns</title>
5374 <entry>References</entry>
5375 <entry>Description</entry>
5381 <entry><structfield>spcname</structfield></entry>
5382 <entry><type>name</type></entry>
5384 <entry>Tablespace name</entry>
5388 <entry><structfield>spcowner</structfield></entry>
5389 <entry><type>oid</type></entry>
5390 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5391 <entry>Owner of the tablespace, usually the user who created it</entry>
5395 <entry><structfield>spcacl</structfield></entry>
5396 <entry><type>aclitem[]</type></entry>
5399 Access privileges; see
5400 <xref linkend="sql-grant"> and
5401 <xref linkend="sql-revoke">
5407 <entry><structfield>spcoptions</structfield></entry>
5408 <entry><type>text[]</type></entry>
5411 Tablespace-level options, as <quote>keyword=value</> strings
5420 <sect1 id="catalog-pg-trigger">
5421 <title><structname>pg_trigger</structname></title>
5423 <indexterm zone="catalog-pg-trigger">
5424 <primary>pg_trigger</primary>
5428 The catalog <structname>pg_trigger</structname> stores triggers on tables
5430 See <xref linkend="sql-createtrigger">
5431 for more information.
5435 <title><structname>pg_trigger</> Columns</title>
5442 <entry>References</entry>
5443 <entry>Description</entry>
5449 <entry><structfield>tgrelid</structfield></entry>
5450 <entry><type>oid</type></entry>
5451 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5452 <entry>The table this trigger is on</entry>
5456 <entry><structfield>tgname</structfield></entry>
5457 <entry><type>name</type></entry>
5459 <entry>Trigger name (must be unique among triggers of same table)</entry>
5463 <entry><structfield>tgfoid</structfield></entry>
5464 <entry><type>oid</type></entry>
5465 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5466 <entry>The function to be called</entry>
5470 <entry><structfield>tgtype</structfield></entry>
5471 <entry><type>int2</type></entry>
5473 <entry>Bit mask identifying trigger firing conditions</entry>
5477 <entry><structfield>tgenabled</structfield></entry>
5478 <entry><type>char</type></entry>
5481 Controls in which <xref linkend="guc-session-replication-role"> modes
5483 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
5484 <literal>D</> = trigger is disabled,
5485 <literal>R</> = trigger fires in <quote>replica</> mode,
5486 <literal>A</> = trigger fires always.
5491 <entry><structfield>tgisinternal</structfield></entry>
5492 <entry><type>bool</type></entry>
5494 <entry>True if trigger is internally generated (usually, to enforce
5495 the constraint identified by <structfield>tgconstraint</>)</entry>
5499 <entry><structfield>tgconstrrelid</structfield></entry>
5500 <entry><type>oid</type></entry>
5501 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5502 <entry>The table referenced by a referential integrity constraint</entry>
5506 <entry><structfield>tgconstrindid</structfield></entry>
5507 <entry><type>oid</type></entry>
5508 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5509 <entry>The index supporting a unique, primary key, or referential integrity constraint</entry>
5513 <entry><structfield>tgconstraint</structfield></entry>
5514 <entry><type>oid</type></entry>
5515 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
5516 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
5520 <entry><structfield>tgdeferrable</structfield></entry>
5521 <entry><type>bool</type></entry>
5523 <entry>True if constraint trigger is deferrable</entry>
5527 <entry><structfield>tginitdeferred</structfield></entry>
5528 <entry><type>bool</type></entry>
5530 <entry>True if constraint trigger is initially deferred</entry>
5534 <entry><structfield>tgnargs</structfield></entry>
5535 <entry><type>int2</type></entry>
5537 <entry>Number of argument strings passed to trigger function</entry>
5541 <entry><structfield>tgattr</structfield></entry>
5542 <entry><type>int2vector</type></entry>
5543 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5544 <entry>Column numbers, if trigger is column-specific; otherwise an
5549 <entry><structfield>tgargs</structfield></entry>
5550 <entry><type>bytea</type></entry>
5552 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
5556 <entry><structfield>tgqual</structfield></entry>
5557 <entry><type>pg_node_tree</type></entry>
5559 <entry>Expression tree (in <function>nodeToString()</function>
5560 representation) for the trigger's <literal>WHEN</> condition, or null
5568 Currently, column-specific triggering is supported only for
5569 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
5570 only for that event type. <structfield>tgtype</structfield> might
5571 contain bits for other event types as well, but those are presumed
5572 to be table-wide regardless of what is in <structfield>tgattr</>.
5577 When <structfield>tgconstraint</> is nonzero,
5578 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
5579 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
5580 largely redundant with the referenced <structname>pg_constraint</> entry.
5581 However, it is possible for a non-deferrable trigger to be associated
5582 with a deferrable constraint: foreign key constraints can have some
5583 deferrable and some non-deferrable triggers.
5589 <literal>pg_class.relhastriggers</literal>
5590 must be true if a relation has any triggers in this catalog.
5597 <sect1 id="catalog-pg-ts-config">
5598 <title><structname>pg_ts_config</structname></title>
5600 <indexterm zone="catalog-pg-ts-config">
5601 <primary>pg_ts_config</primary>
5605 The <structname>pg_ts_config</structname> catalog contains entries
5606 representing text search configurations. A configuration specifies
5607 a particular text search parser and a list of dictionaries to use
5608 for each of the parser's output token types. The parser is shown
5609 in the <structname>pg_ts_config</structname> entry, but the
5610 token-to-dictionary mapping is defined by subsidiary entries in <link
5611 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
5615 <productname>PostgreSQL</productname>'s text search features are
5616 described at length in <xref linkend="textsearch">.
5620 <title><structname>pg_ts_config</> Columns</title>
5627 <entry>References</entry>
5628 <entry>Description</entry>
5634 <entry><structfield>cfgname</structfield></entry>
5635 <entry><type>name</type></entry>
5637 <entry>Text search configuration name</entry>
5641 <entry><structfield>cfgnamespace</structfield></entry>
5642 <entry><type>oid</type></entry>
5643 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5645 The OID of the namespace that contains this configuration
5650 <entry><structfield>cfgowner</structfield></entry>
5651 <entry><type>oid</type></entry>
5652 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5653 <entry>Owner of the configuration</entry>
5657 <entry><structfield>cfgparser</structfield></entry>
5658 <entry><type>oid</type></entry>
5659 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
5660 <entry>The OID of the text search parser for this configuration</entry>
5668 <sect1 id="catalog-pg-ts-config-map">
5669 <title><structname>pg_ts_config_map</structname></title>
5671 <indexterm zone="catalog-pg-ts-config-map">
5672 <primary>pg_ts_config_map</primary>
5676 The <structname>pg_ts_config_map</structname> catalog contains entries
5677 showing which text search dictionaries should be consulted, and in
5678 what order, for each output token type of each text search configuration's
5683 <productname>PostgreSQL</productname>'s text search features are
5684 described at length in <xref linkend="textsearch">.
5688 <title><structname>pg_ts_config_map</> Columns</title>
5695 <entry>References</entry>
5696 <entry>Description</entry>
5702 <entry><structfield>mapcfg</structfield></entry>
5703 <entry><type>oid</type></entry>
5704 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
5705 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
5709 <entry><structfield>maptokentype</structfield></entry>
5710 <entry><type>integer</type></entry>
5712 <entry>A token type emitted by the configuration's parser</entry>
5716 <entry><structfield>mapseqno</structfield></entry>
5717 <entry><type>integer</type></entry>
5719 <entry>Order in which to consult this entry (lower
5720 <structfield>mapseqno</>s first)</entry>
5724 <entry><structfield>mapdict</structfield></entry>
5725 <entry><type>oid</type></entry>
5726 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
5727 <entry>The OID of the text search dictionary to consult</entry>
5735 <sect1 id="catalog-pg-ts-dict">
5736 <title><structname>pg_ts_dict</structname></title>
5738 <indexterm zone="catalog-pg-ts-dict">
5739 <primary>pg_ts_dict</primary>
5743 The <structname>pg_ts_dict</structname> catalog contains entries
5744 defining text search dictionaries. A dictionary depends on a text
5745 search template, which specifies all the implementation functions
5746 needed; the dictionary itself provides values for the user-settable
5747 parameters supported by the template. This division of labor allows
5748 dictionaries to be created by unprivileged users. The parameters
5749 are specified by a text string <structfield>dictinitoption</>,
5750 whose format and meaning vary depending on the template.
5754 <productname>PostgreSQL</productname>'s text search features are
5755 described at length in <xref linkend="textsearch">.
5759 <title><structname>pg_ts_dict</> Columns</title>
5766 <entry>References</entry>
5767 <entry>Description</entry>
5773 <entry><structfield>dictname</structfield></entry>
5774 <entry><type>name</type></entry>
5776 <entry>Text search dictionary name</entry>
5780 <entry><structfield>dictnamespace</structfield></entry>
5781 <entry><type>oid</type></entry>
5782 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5784 The OID of the namespace that contains this dictionary
5789 <entry><structfield>dictowner</structfield></entry>
5790 <entry><type>oid</type></entry>
5791 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5792 <entry>Owner of the dictionary</entry>
5796 <entry><structfield>dicttemplate</structfield></entry>
5797 <entry><type>oid</type></entry>
5798 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
5799 <entry>The OID of the text search template for this dictionary</entry>
5803 <entry><structfield>dictinitoption</structfield></entry>
5804 <entry><type>text</type></entry>
5806 <entry>Initialization option string for the template</entry>
5814 <sect1 id="catalog-pg-ts-parser">
5815 <title><structname>pg_ts_parser</structname></title>
5817 <indexterm zone="catalog-pg-ts-parser">
5818 <primary>pg_ts_parser</primary>
5822 The <structname>pg_ts_parser</structname> catalog contains entries
5823 defining text search parsers. A parser is responsible for splitting
5824 input text into lexemes and assigning a token type to each lexeme.
5825 Since a parser must be implemented by C-language-level functions,
5826 creation of new parsers is restricted to database superusers.
5830 <productname>PostgreSQL</productname>'s text search features are
5831 described at length in <xref linkend="textsearch">.
5835 <title><structname>pg_ts_parser</> Columns</title>
5842 <entry>References</entry>
5843 <entry>Description</entry>
5849 <entry><structfield>prsname</structfield></entry>
5850 <entry><type>name</type></entry>
5852 <entry>Text search parser name</entry>
5856 <entry><structfield>prsnamespace</structfield></entry>
5857 <entry><type>oid</type></entry>
5858 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5860 The OID of the namespace that contains this parser
5865 <entry><structfield>prsstart</structfield></entry>
5866 <entry><type>regproc</type></entry>
5867 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5868 <entry>OID of the parser's startup function</entry>
5872 <entry><structfield>prstoken</structfield></entry>
5873 <entry><type>regproc</type></entry>
5874 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5875 <entry>OID of the parser's next-token function</entry>
5879 <entry><structfield>prsend</structfield></entry>
5880 <entry><type>regproc</type></entry>
5881 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5882 <entry>OID of the parser's shutdown function</entry>
5886 <entry><structfield>prsheadline</structfield></entry>
5887 <entry><type>regproc</type></entry>
5888 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5889 <entry>OID of the parser's headline function</entry>
5893 <entry><structfield>prslextype</structfield></entry>
5894 <entry><type>regproc</type></entry>
5895 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5896 <entry>OID of the parser's lextype function</entry>
5904 <sect1 id="catalog-pg-ts-template">
5905 <title><structname>pg_ts_template</structname></title>
5907 <indexterm zone="catalog-pg-ts-template">
5908 <primary>pg_ts_template</primary>
5912 The <structname>pg_ts_template</structname> catalog contains entries
5913 defining text search templates. A template is the implementation
5914 skeleton for a class of text search dictionaries.
5915 Since a template must be implemented by C-language-level functions,
5916 creation of new templates is restricted to database superusers.
5920 <productname>PostgreSQL</productname>'s text search features are
5921 described at length in <xref linkend="textsearch">.
5925 <title><structname>pg_ts_template</> Columns</title>
5932 <entry>References</entry>
5933 <entry>Description</entry>
5939 <entry><structfield>tmplname</structfield></entry>
5940 <entry><type>name</type></entry>
5942 <entry>Text search template name</entry>
5946 <entry><structfield>tmplnamespace</structfield></entry>
5947 <entry><type>oid</type></entry>
5948 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5950 The OID of the namespace that contains this template
5955 <entry><structfield>tmplinit</structfield></entry>
5956 <entry><type>regproc</type></entry>
5957 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5958 <entry>OID of the template's initialization function</entry>
5962 <entry><structfield>tmpllexize</structfield></entry>
5963 <entry><type>regproc</type></entry>
5964 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5965 <entry>OID of the template's lexize function</entry>
5973 <sect1 id="catalog-pg-type">
5974 <title><structname>pg_type</structname></title>
5976 <indexterm zone="catalog-pg-type">
5977 <primary>pg_type</primary>
5981 The catalog <structname>pg_type</structname> stores information about data
5982 types. Base types and enum types (scalar types) are created with
5983 <xref linkend="sql-createtype">, and
5985 <xref linkend="sql-createdomain">.
5986 A composite type is automatically created for each table in the database, to
5987 represent the row structure of the table. It is also possible to create
5988 composite types with <command>CREATE TYPE AS</command>.
5992 <title><structname>pg_type</> Columns</title>
5999 <entry>References</entry>
6000 <entry>Description</entry>
6006 <entry><structfield>typname</structfield></entry>
6007 <entry><type>name</type></entry>
6009 <entry>Data type name</entry>
6013 <entry><structfield>typnamespace</structfield></entry>
6014 <entry><type>oid</type></entry>
6015 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6017 The OID of the namespace that contains this type
6022 <entry><structfield>typowner</structfield></entry>
6023 <entry><type>oid</type></entry>
6024 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6025 <entry>Owner of the type</entry>
6029 <entry><structfield>typlen</structfield></entry>
6030 <entry><type>int2</type></entry>
6033 For a fixed-size type, <structfield>typlen</structfield> is the number
6034 of bytes in the internal representation of the type. But for a
6035 variable-length type, <structfield>typlen</structfield> is negative.
6036 -1 indicates a <quote>varlena</> type (one that has a length word),
6037 -2 indicates a null-terminated C string.
6042 <entry><structfield>typbyval</structfield></entry>
6043 <entry><type>bool</type></entry>
6046 <structfield>typbyval</structfield> determines whether internal
6047 routines pass a value of this type by value or by reference.
6048 <structfield>typbyval</structfield> had better be false if
6049 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6050 where Datum is 8 bytes).
6051 Variable-length types are always passed by reference. Note that
6052 <structfield>typbyval</structfield> can be false even if the
6053 length would allow pass-by-value.
6058 <entry><structfield>typtype</structfield></entry>
6059 <entry><type>char</type></entry>
6062 <structfield>typtype</structfield> is
6063 <literal>b</literal> for a base type,
6064 <literal>c</literal> for a composite type (e.g., a table's row type),
6065 <literal>d</literal> for a domain,
6066 <literal>e</literal> for an enum type,
6067 <literal>p</literal> for a pseudo-type, or
6068 <literal>r</literal> for a range type.
6069 See also <structfield>typrelid</structfield> and
6070 <structfield>typbasetype</structfield>.
6075 <entry><structfield>typcategory</structfield></entry>
6076 <entry><type>char</type></entry>
6079 <structfield>typcategory</structfield> is an arbitrary classification
6080 of data types that is used by the parser to determine which implicit
6081 casts should be <quote>preferred</>.
6082 See <xref linkend="catalog-typcategory-table">.
6087 <entry><structfield>typispreferred</structfield></entry>
6088 <entry><type>bool</type></entry>
6091 True if the type is a preferred cast target within its
6092 <structfield>typcategory</structfield>
6097 <entry><structfield>typisdefined</structfield></entry>
6098 <entry><type>bool</type></entry>
6101 True if the type is defined, false if this is a placeholder
6102 entry for a not-yet-defined type. When
6103 <structfield>typisdefined</structfield> is false, nothing
6104 except the type name, namespace, and OID can be relied on.
6109 <entry><structfield>typdelim</structfield></entry>
6110 <entry><type>char</type></entry>
6113 Character that separates two values of this type when parsing
6114 array input. Note that the delimiter is associated with the array
6115 element data type, not the array data type.
6120 <entry><structfield>typrelid</structfield></entry>
6121 <entry><type>oid</type></entry>
6122 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6124 If this is a composite type (see
6125 <structfield>typtype</structfield>), then this column points to
6126 the <structname>pg_class</structname> entry that defines the
6127 corresponding table. (For a free-standing composite type, the
6128 <structname>pg_class</structname> entry doesn't really represent
6129 a table, but it is needed anyway for the type's
6130 <structname>pg_attribute</structname> entries to link to.)
6131 Zero for non-composite types.
6136 <entry><structfield>typelem</structfield></entry>
6137 <entry><type>oid</type></entry>
6138 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6140 If <structfield>typelem</structfield> is not 0 then it
6141 identifies another row in <structname>pg_type</structname>.
6142 The current type can then be subscripted like an array yielding
6143 values of type <structfield>typelem</structfield>. A
6144 <quote>true</quote> array type is variable length
6145 (<structfield>typlen</structfield> = -1),
6146 but some fixed-length (<structfield>typlen</structfield> > 0) types
6147 also have nonzero <structfield>typelem</structfield>, for example
6148 <type>name</type> and <type>point</type>.
6149 If a fixed-length type has a <structfield>typelem</structfield> then
6150 its internal representation must be some number of values of the
6151 <structfield>typelem</structfield> data type with no other data.
6152 Variable-length array types have a header defined by the array
6158 <entry><structfield>typarray</structfield></entry>
6159 <entry><type>oid</type></entry>
6160 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6162 If <structfield>typarray</structfield> is not 0 then it
6163 identifies another row in <structname>pg_type</structname>, which
6164 is the <quote>true</quote> array type having this type as element
6169 <entry><structfield>typinput</structfield></entry>
6170 <entry><type>regproc</type></entry>
6171 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6172 <entry>Input conversion function (text format)</entry>
6176 <entry><structfield>typoutput</structfield></entry>
6177 <entry><type>regproc</type></entry>
6178 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6179 <entry>Output conversion function (text format)</entry>
6183 <entry><structfield>typreceive</structfield></entry>
6184 <entry><type>regproc</type></entry>
6185 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6186 <entry>Input conversion function (binary format), or 0 if none</entry>
6190 <entry><structfield>typsend</structfield></entry>
6191 <entry><type>regproc</type></entry>
6192 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6193 <entry>Output conversion function (binary format), or 0 if none</entry>
6197 <entry><structfield>typmodin</structfield></entry>
6198 <entry><type>regproc</type></entry>
6199 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6200 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
6204 <entry><structfield>typmodout</structfield></entry>
6205 <entry><type>regproc</type></entry>
6206 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6207 <entry>Type modifier output function, or 0 to use the standard format</entry>
6211 <entry><structfield>typanalyze</structfield></entry>
6212 <entry><type>regproc</type></entry>
6213 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6214 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
6218 <entry><structfield>typalign</structfield></entry>
6219 <entry><type>char</type></entry>
6223 <structfield>typalign</structfield> is the alignment required
6224 when storing a value of this type. It applies to storage on
6225 disk as well as most representations of the value inside
6226 <productname>PostgreSQL</>.
6227 When multiple values are stored consecutively, such
6228 as in the representation of a complete row on disk, padding is
6229 inserted before a datum of this type so that it begins on the
6230 specified boundary. The alignment reference is the beginning
6231 of the first datum in the sequence.
6235 Possible values are:
6238 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
6241 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
6244 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
6247 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
6252 For types used in system tables, it is critical that the size
6253 and alignment defined in <structname>pg_type</structname>
6254 agree with the way that the compiler will lay out the column in
6255 a structure representing a table row.
6261 <entry><structfield>typstorage</structfield></entry>
6262 <entry><type>char</type></entry>
6265 <structfield>typstorage</structfield> tells for varlena
6266 types (those with <structfield>typlen</structfield> = -1) if
6267 the type is prepared for toasting and what the default strategy
6268 for attributes of this type should be.
6272 <para><literal>p</>: Value must always be stored plain.</para>
6276 <literal>e</>: Value can be stored in a <quote>secondary</quote>
6277 relation (if relation has one, see
6278 <literal>pg_class.reltoastrelid</literal>).
6282 <para><literal>m</>: Value can be stored compressed inline.</para>
6285 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
6288 Note that <literal>m</> columns can also be moved out to secondary
6289 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
6295 <entry><structfield>typnotnull</structfield></entry>
6296 <entry><type>bool</type></entry>
6299 <structfield>typnotnull</structfield> represents a not-null
6300 constraint on a type. Used for domains only.
6305 <entry><structfield>typbasetype</structfield></entry>
6306 <entry><type>oid</type></entry>
6307 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6309 If this is a domain (see <structfield>typtype</structfield>), then
6310 <structfield>typbasetype</structfield> identifies the type that this
6311 one is based on. Zero if this type is not a domain.
6316 <entry><structfield>typtypmod</structfield></entry>
6317 <entry><type>int4</type></entry>
6320 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
6321 to be applied to their base type (-1 if base type does not use a
6322 <literal>typmod</>). -1 if this type is not a domain.
6327 <entry><structfield>typndims</structfield></entry>
6328 <entry><type>int4</type></entry>
6331 <structfield>typndims</structfield> is the number of array dimensions
6332 for a domain over an array (that is, <structfield>typbasetype</> is
6334 Zero for types other than domains over array types.
6339 <entry><structfield>typcollation</structfield></entry>
6340 <entry><type>oid</type></entry>
6341 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
6343 <structfield>typcollation</structfield> specifies the collation
6344 of the type. If the type does not support collations, this will
6345 be zero. A base type that supports collations will have
6346 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
6347 collatable type can have some other collation OID, if one was
6348 specified for the domain.
6353 <entry><structfield>typdefaultbin</structfield></entry>
6354 <entry><type>pg_node_tree</type></entry>
6357 If <structfield>typdefaultbin</> is not null, it is the
6358 <function>nodeToString()</function>
6359 representation of a default expression for the type. This is
6360 only used for domains.
6365 <entry><structfield>typdefault</structfield></entry>
6366 <entry><type>text</type></entry>
6369 <structfield>typdefault</> is null if the type has no associated
6370 default value. If <structfield>typdefaultbin</> is not null,
6371 <structfield>typdefault</> must contain a human-readable version of the
6372 default expression represented by <structfield>typdefaultbin</>. If
6373 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
6374 not, then <structfield>typdefault</> is the external representation of
6375 the type's default value, which can be fed to the type's input
6376 converter to produce a constant.
6384 <xref linkend="catalog-typcategory-table"> lists the system-defined values
6385 of <structfield>typcategory</>. Any future additions to this list will
6386 also be upper-case ASCII letters. All other ASCII characters are reserved
6387 for user-defined categories.
6390 <table id="catalog-typcategory-table">
6391 <title><structfield>typcategory</> Codes</title>
6397 <entry>Category</entry>
6403 <entry><literal>A</literal></entry>
6404 <entry>Array types</entry>
6407 <entry><literal>B</literal></entry>
6408 <entry>Boolean types</entry>
6411 <entry><literal>C</literal></entry>
6412 <entry>Composite types</entry>
6415 <entry><literal>D</literal></entry>
6416 <entry>Date/time types</entry>
6419 <entry><literal>E</literal></entry>
6420 <entry>Enum types</entry>
6423 <entry><literal>G</literal></entry>
6424 <entry>Geometric types</entry>
6427 <entry><literal>I</literal></entry>
6428 <entry>Network address types</entry>
6431 <entry><literal>N</literal></entry>
6432 <entry>Numeric types</entry>
6435 <entry><literal>P</literal></entry>
6436 <entry>Pseudo-types</entry>
6439 <entry><literal>R</literal></entry>
6440 <entry>Range types</entry>
6443 <entry><literal>S</literal></entry>
6444 <entry>String types</entry>
6447 <entry><literal>T</literal></entry>
6448 <entry>Timespan types</entry>
6451 <entry><literal>U</literal></entry>
6452 <entry>User-defined types</entry>
6455 <entry><literal>V</literal></entry>
6456 <entry>Bit-string types</entry>
6459 <entry><literal>X</literal></entry>
6460 <entry><type>unknown</> type</entry>
6469 <sect1 id="catalog-pg-user-mapping">
6470 <title><structname>pg_user_mapping</structname></title>
6472 <indexterm zone="catalog-pg-user-mapping">
6473 <primary>pg_user_mapping</primary>
6477 The catalog <structname>pg_user_mapping</structname> stores
6478 the mappings from local user to remote. Access to this catalog is
6479 restricted from normal users, use the view
6480 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
6485 <title><structname>pg_user_mapping</> Columns</title>
6492 <entry>References</entry>
6493 <entry>Description</entry>
6499 <entry><structfield>umuser</structfield></entry>
6500 <entry><type>oid</type></entry>
6501 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6502 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
6506 <entry><structfield>umserver</structfield></entry>
6507 <entry><type>oid</type></entry>
6508 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
6510 The OID of the foreign server that contains this mapping
6515 <entry><structfield>umoptions</structfield></entry>
6516 <entry><type>text[]</type></entry>
6519 User mapping specific options, as <quote>keyword=value</> strings
6528 <sect1 id="views-overview">
6529 <title>System Views</title>
6532 In addition to the system catalogs, <productname>PostgreSQL</productname>
6533 provides a number of built-in views. Some system views provide convenient
6534 access to some commonly used queries on the system catalogs. Other views
6535 provide access to internal server state.
6539 The information schema (<xref linkend="information-schema">) provides
6540 an alternative set of views which overlap the functionality of the system
6541 views. Since the information schema is SQL-standard whereas the views
6542 described here are <productname>PostgreSQL</productname>-specific,
6543 it's usually better to use the information schema if it provides all
6544 the information you need.
6548 <xref linkend="view-table"> lists the system views described here.
6549 More detailed documentation of each view follows below.
6550 There are some additional views that provide access to the results of
6551 the statistics collector; they are described in <xref
6552 linkend="monitoring-stats-views-table">.
6556 Except where noted, all the views described here are read-only.
6559 <table id="view-table">
6560 <title>System Views</title>
6565 <entry>View Name</entry>
6566 <entry>Purpose</entry>
6572 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
6573 <entry>available extensions</entry>
6577 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
6578 <entry>available versions of extensions</entry>
6582 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
6583 <entry>open cursors</entry>
6587 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
6588 <entry>groups of database users</entry>
6592 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
6593 <entry>indexes</entry>
6597 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
6598 <entry>currently held locks</entry>
6602 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
6603 <entry>prepared statements</entry>
6607 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
6608 <entry>prepared transactions</entry>
6612 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
6613 <entry>database roles</entry>
6617 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
6618 <entry>rules</entry>
6622 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
6623 <entry>security labels</entry>
6627 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
6628 <entry>parameter settings</entry>
6632 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
6633 <entry>database users</entry>
6637 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
6638 <entry>planner statistics</entry>
6642 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
6643 <entry>tables</entry>
6647 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
6648 <entry>time zone abbreviations</entry>
6652 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
6653 <entry>time zone names</entry>
6657 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
6658 <entry>database users</entry>
6662 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
6663 <entry>user mappings</entry>
6667 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
6668 <entry>views</entry>
6676 <sect1 id="view-pg-available-extensions">
6677 <title><structname>pg_available_extensions</structname></title>
6679 <indexterm zone="view-pg-available-extensions">
6680 <primary>pg_available_extensions</primary>
6684 The <structname>pg_available_extensions</structname> view lists the
6685 extensions that are available for installation.
6687 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
6688 catalog, which shows the extensions currently installed.
6692 <title><structname>pg_available_extensions</> Columns</title>
6699 <entry>Description</entry>
6705 <entry><structfield>name</structfield></entry>
6706 <entry><type>name</type></entry>
6707 <entry>Extension name</entry>
6711 <entry><structfield>default_version</structfield></entry>
6712 <entry><type>text</type></entry>
6713 <entry>Name of default version, or <literal>NULL</literal> if none is
6718 <entry><structfield>installed_version</structfield></entry>
6719 <entry><type>text</type></entry>
6720 <entry>Currently installed version of the extension,
6721 or <literal>NULL</literal> if not installed</entry>
6725 <entry><structfield>comment</structfield></entry>
6726 <entry><type>text</type></entry>
6727 <entry>Comment string from the extension's control file</entry>
6734 The <structname>pg_available_extensions</structname> view is read only.
6738 <sect1 id="view-pg-available-extension-versions">
6739 <title><structname>pg_available_extension_versions</structname></title>
6741 <indexterm zone="view-pg-available-extension-versions">
6742 <primary>pg_available_extension_versions</primary>
6746 The <structname>pg_available_extension_versions</structname> view lists the
6747 specific extension versions that are available for installation.
6749 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
6750 catalog, which shows the extensions currently installed.
6754 <title><structname>pg_available_extension_versions</> Columns</title>
6761 <entry>Description</entry>
6767 <entry><structfield>name</structfield></entry>
6768 <entry><type>name</type></entry>
6769 <entry>Extension name</entry>
6773 <entry><structfield>version</structfield></entry>
6774 <entry><type>text</type></entry>
6775 <entry>Version name</entry>
6779 <entry><structfield>installed</structfield></entry>
6780 <entry><type>bool</type></entry>
6781 <entry>True if this version of this extension is currently
6786 <entry><structfield>superuser</structfield></entry>
6787 <entry><type>bool</type></entry>
6788 <entry>True if only superusers are allowed to install this extension</entry>
6792 <entry><structfield>relocatable</structfield></entry>
6793 <entry><type>bool</type></entry>
6794 <entry>True if extension can be relocated to another schema</entry>
6798 <entry><structfield>schema</structfield></entry>
6799 <entry><type>name</type></entry>
6800 <entry>Name of the schema that the extension must be installed into,
6801 or <literal>NULL</literal> if partially or fully relocatable</entry>
6805 <entry><structfield>requires</structfield></entry>
6806 <entry><type>name[]</type></entry>
6807 <entry>Names of prerequisite extensions,
6808 or <literal>NULL</literal> if none</entry>
6812 <entry><structfield>comment</structfield></entry>
6813 <entry><type>text</type></entry>
6814 <entry>Comment string from the extension's control file</entry>
6821 The <structname>pg_available_extension_versions</structname> view is read
6826 <sect1 id="view-pg-cursors">
6827 <title><structname>pg_cursors</structname></title>
6829 <indexterm zone="view-pg-cursors">
6830 <primary>pg_cursors</primary>
6834 The <structname>pg_cursors</structname> view lists the cursors that
6835 are currently available. Cursors can be defined in several ways:
6839 via the <xref linkend="sql-declare">
6846 via the Bind message in the frontend/backend protocol, as
6847 described in <xref linkend="protocol-flow-ext-query">
6853 via the Server Programming Interface (SPI), as described in
6854 <xref linkend="spi-interface">
6859 The <structname>pg_cursors</structname> view displays cursors
6860 created by any of these means. Cursors only exist for the duration
6861 of the transaction that defines them, unless they have been
6862 declared <literal>WITH HOLD</literal>. Therefore non-holdable
6863 cursors are only present in the view until the end of their
6864 creating transaction.
6868 Cursors are used internally to implement some of the components
6869 of <productname>PostgreSQL</>, such as procedural languages.
6870 Therefore, the <structname>pg_cursors</> view might include cursors
6871 that have not been explicitly created by the user.
6877 <title><structname>pg_cursors</> Columns</title>
6884 <entry>Description</entry>
6890 <entry><structfield>name</structfield></entry>
6891 <entry><type>text</type></entry>
6892 <entry>The name of the cursor</entry>
6896 <entry><structfield>statement</structfield></entry>
6897 <entry><type>text</type></entry>
6898 <entry>The verbatim query string submitted to declare this cursor</entry>
6902 <entry><structfield>is_holdable</structfield></entry>
6903 <entry><type>boolean</type></entry>
6905 <literal>true</literal> if the cursor is holdable (that is, it
6906 can be accessed after the transaction that declared the cursor
6907 has committed); <literal>false</literal> otherwise
6912 <entry><structfield>is_binary</structfield></entry>
6913 <entry><type>boolean</type></entry>
6915 <literal>true</literal> if the cursor was declared
6916 <literal>BINARY</literal>; <literal>false</literal>
6922 <entry><structfield>is_scrollable</structfield></entry>
6923 <entry><type>boolean</type></entry>
6925 <literal>true</> if the cursor is scrollable (that is, it
6926 allows rows to be retrieved in a nonsequential manner);
6927 <literal>false</literal> otherwise
6932 <entry><structfield>creation_time</structfield></entry>
6933 <entry><type>timestamptz</type></entry>
6934 <entry>The time at which the cursor was declared</entry>
6941 The <structname>pg_cursors</structname> view is read only.
6946 <sect1 id="view-pg-group">
6947 <title><structname>pg_group</structname></title>
6949 <indexterm zone="view-pg-group">
6950 <primary>pg_group</primary>
6954 The view <structname>pg_group</structname> exists for backwards
6955 compatibility: it emulates a catalog that existed in
6956 <productname>PostgreSQL</productname> before version 8.1.
6957 It shows the names and members of all roles that are marked as not
6958 <structfield>rolcanlogin</>, which is an approximation to the set
6959 of roles that are being used as groups.
6963 <title><structname>pg_group</> Columns</title>
6970 <entry>References</entry>
6971 <entry>Description</entry>
6977 <entry><structfield>groname</structfield></entry>
6978 <entry><type>name</type></entry>
6979 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6980 <entry>Name of the group</entry>
6984 <entry><structfield>grosysid</structfield></entry>
6985 <entry><type>oid</type></entry>
6986 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6987 <entry>ID of this group</entry>
6991 <entry><structfield>grolist</structfield></entry>
6992 <entry><type>oid[]</type></entry>
6993 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6994 <entry>An array containing the IDs of the roles in this group</entry>
7002 <sect1 id="view-pg-indexes">
7003 <title><structname>pg_indexes</structname></title>
7005 <indexterm zone="view-pg-indexes">
7006 <primary>pg_indexes</primary>
7010 The view <structname>pg_indexes</structname> provides access to
7011 useful information about each index in the database.
7015 <title><structname>pg_indexes</> Columns</title>
7022 <entry>References</entry>
7023 <entry>Description</entry>
7028 <entry><structfield>schemaname</structfield></entry>
7029 <entry><type>name</type></entry>
7030 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7031 <entry>Name of schema containing table and index</entry>
7034 <entry><structfield>tablename</structfield></entry>
7035 <entry><type>name</type></entry>
7036 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7037 <entry>Name of table the index is for</entry>
7040 <entry><structfield>indexname</structfield></entry>
7041 <entry><type>name</type></entry>
7042 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7043 <entry>Name of index</entry>
7046 <entry><structfield>tablespace</structfield></entry>
7047 <entry><type>name</type></entry>
7048 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7049 <entry>Name of tablespace containing index (null if default for database)</entry>
7052 <entry><structfield>indexdef</structfield></entry>
7053 <entry><type>text</type></entry>
7055 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
7064 <sect1 id="view-pg-locks">
7065 <title><structname>pg_locks</structname></title>
7067 <indexterm zone="view-pg-locks">
7068 <primary>pg_locks</primary>
7072 The view <structname>pg_locks</structname> provides access to
7073 information about the locks held by open transactions within the
7074 database server. See <xref linkend="mvcc"> for more discussion
7079 <structname>pg_locks</structname> contains one row per active lockable
7080 object, requested lock mode, and relevant transaction. Thus, the same
7081 lockable object might
7082 appear many times, if multiple transactions are holding or waiting
7083 for locks on it. However, an object that currently has no locks on it
7084 will not appear at all.
7088 There are several distinct types of lockable objects:
7089 whole relations (e.g., tables), individual pages of relations,
7090 individual tuples of relations,
7091 transaction IDs (both virtual and permanent IDs),
7092 and general database objects (identified by class OID and object OID,
7093 in the same way as in <structname>pg_description</structname> or
7094 <structname>pg_depend</structname>). Also, the right to extend a
7095 relation is represented as a separate lockable object.
7096 Also, <quote>advisory</> locks can be taken on numbers that have
7097 user-defined meanings.
7101 <title><structname>pg_locks</> Columns</title>
7108 <entry>References</entry>
7109 <entry>Description</entry>
7114 <entry><structfield>locktype</structfield></entry>
7115 <entry><type>text</type></entry>
7118 Type of the lockable object:
7119 <literal>relation</>,
7123 <literal>transactionid</>,
7124 <literal>virtualxid</>,
7126 <literal>userlock</>, or
7127 <literal>advisory</>
7131 <entry><structfield>database</structfield></entry>
7132 <entry><type>oid</type></entry>
7133 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
7135 OID of the database in which the lock target exists, or
7136 zero if the target is a shared object, or
7137 null if the target is a transaction ID
7141 <entry><structfield>relation</structfield></entry>
7142 <entry><type>oid</type></entry>
7143 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7145 OID of the relation targeted by the lock, or null if the target is not
7146 a relation or part of a relation
7150 <entry><structfield>page</structfield></entry>
7151 <entry><type>integer</type></entry>
7154 Page number targeted by the lock within the relation,
7155 or null if the target is not a relation page or tuple
7159 <entry><structfield>tuple</structfield></entry>
7160 <entry><type>smallint</type></entry>
7163 Tuple number targeted by the lock within the page,
7164 or null if the target is not a tuple
7168 <entry><structfield>virtualxid</structfield></entry>
7169 <entry><type>text</type></entry>
7172 Virtual ID of the transaction targeted by the lock,
7173 or null if the target is not a virtual transaction ID
7177 <entry><structfield>transactionid</structfield></entry>
7178 <entry><type>xid</type></entry>
7181 ID of the transaction targeted by the lock,
7182 or null if the target is not a transaction ID
7186 <entry><structfield>classid</structfield></entry>
7187 <entry><type>oid</type></entry>
7188 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7190 OID of the system catalog containing the lock target, or null if the
7191 target is not a general database object
7195 <entry><structfield>objid</structfield></entry>
7196 <entry><type>oid</type></entry>
7197 <entry>any OID column</entry>
7199 OID of the lock target within its system catalog, or null if the
7200 target is not a general database object
7204 <entry><structfield>objsubid</structfield></entry>
7205 <entry><type>smallint</type></entry>
7208 Column number targeted by the lock (the
7209 <structfield>classid</> and <structfield>objid</> refer to the
7211 or zero if the target is some other general database object,
7212 or null if the target is not a general database object
7216 <entry><structfield>virtualtransaction</structfield></entry>
7217 <entry><type>text</type></entry>
7220 Virtual ID of the transaction that is holding or awaiting this lock
7224 <entry><structfield>pid</structfield></entry>
7225 <entry><type>integer</type></entry>
7228 Process ID of the server process holding or awaiting this
7229 lock, or null if the lock is held by a prepared transaction
7233 <entry><structfield>mode</structfield></entry>
7234 <entry><type>text</type></entry>
7236 <entry>Name of the lock mode held or desired by this process (see <xref
7237 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
7240 <entry><structfield>granted</structfield></entry>
7241 <entry><type>boolean</type></entry>
7243 <entry>True if lock is held, false if lock is awaited</entry>
7246 <entry><structfield>fastpath</structfield></entry>
7247 <entry><type>boolean</type></entry>
7249 <entry>True if lock was taken via fast path, false if taken via main
7257 <structfield>granted</structfield> is true in a row representing a lock
7258 held by the indicated transaction. False indicates that this transaction is
7259 currently waiting to acquire this lock, which implies that some other
7260 transaction is holding a conflicting lock mode on the same lockable object.
7261 The waiting transaction will sleep until the other lock is released (or a
7262 deadlock situation is detected). A single transaction can be waiting to
7263 acquire at most one lock at a time.
7267 Every transaction holds an exclusive lock on its virtual transaction ID for
7268 its entire duration. If a permanent ID is assigned to the transaction
7269 (which normally happens only if the transaction changes the state of the
7270 database), it also holds an exclusive lock on its permanent transaction ID
7271 until it ends. When one transaction finds it necessary to wait specifically
7272 for another transaction, it does so by attempting to acquire share lock on
7273 the other transaction ID (either virtual or permanent ID depending on the
7274 situation). That will succeed only when the other transaction
7275 terminates and releases its locks.
7279 Although tuples are a lockable type of object,
7280 information about row-level locks is stored on disk, not in memory,
7281 and therefore row-level locks normally do not appear in this view.
7282 If a transaction is waiting for a
7283 row-level lock, it will usually appear in the view as waiting for the
7284 permanent transaction ID of the current holder of that row lock.
7288 Advisory locks can be acquired on keys consisting of either a single
7289 <type>bigint</type> value or two integer values.
7290 A <type>bigint</type> key is displayed with its
7291 high-order half in the <structfield>classid</> column, its low-order half
7292 in the <structfield>objid</> column, and <structfield>objsubid</> equal
7293 to 1. Integer keys are displayed with the first key in the
7294 <structfield>classid</> column, the second key in the <structfield>objid</>
7295 column, and <structfield>objsubid</> equal to 2. The actual meaning of
7296 the keys is up to the user. Advisory locks are local to each database,
7297 so the <structfield>database</> column is meaningful for an advisory lock.
7301 <structname>pg_locks</structname> provides a global view of all locks
7302 in the database cluster, not only those relevant to the current database.
7303 Although its <structfield>relation</structfield> column can be joined
7304 against <structname>pg_class</>.<structfield>oid</> to identify locked
7305 relations, this will only work correctly for relations in the current
7306 database (those for which the <structfield>database</structfield> column
7307 is either the current database's OID or zero).
7311 The <structfield>pid</structfield> column can be joined to the
7312 <structfield>procpid</structfield> column of the
7313 <structname>pg_stat_activity</structname> view to get more
7314 information on the session holding or waiting to hold each lock.
7315 Also, if you are using prepared transactions, the
7316 <structfield>transaction</> column can be joined to the
7317 <structfield>transaction</structfield> column of the
7318 <structname>pg_prepared_xacts</structname> view to get more
7319 information on prepared transactions that hold locks.
7320 (A prepared transaction can never be waiting for a lock,
7321 but it continues to hold the locks it acquired while running.)
7325 The <structname>pg_locks</structname> view displays data from both the
7326 regular lock manager and the predicate lock manager, which are
7327 separate systems; in addition, the regular lock manager subdivides its
7328 locks into regular and <firstterm>fast-path</> locks.
7329 This data is not guaranteed to be entirely consistent.
7330 When the view is queried,
7331 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
7332 is gathered from each backend one at a time, without freezing the state of
7333 the entire lock manager, so it is possible for locks to be taken or
7334 released while information is gathered. Note, however, that these locks are
7335 known not to conflict with any other lock currently in place. After
7336 all backends have been queried for fast-path locks, the remainder of the
7337 regular lock manager is locked as a unit, and a consistent snapshot of all
7338 remaining locks is collected as an atomic action. After unlocking the
7339 regular lock manager, the predicate lock manager is similarly locked and all
7340 predicate locks are collected as an atomic action. Thus, with the exception
7341 of fast-path locks, each lock manager will deliver a consistent set of
7342 results, but as we do not lock both lock managers simultaneously, it is
7343 possible for locks to be taken or released after we interrogate the regular
7344 lock manager and before we interrogate the predicate lock manager.
7348 Locking the regular and/or predicate lock manager could have some
7349 impact on database performance if this view is very frequently accessed.
7350 The locks are held only for the minimum amount of time necessary to
7351 obtain data from the lock managers, but this does not completely eliminate
7352 the possibility of a performance impact.
7357 <sect1 id="view-pg-prepared-statements">
7358 <title><structname>pg_prepared_statements</structname></title>
7360 <indexterm zone="view-pg-prepared-statements">
7361 <primary>pg_prepared_statements</primary>
7365 The <structname>pg_prepared_statements</structname> view displays
7366 all the prepared statements that are available in the current
7367 session. See <xref linkend="sql-prepare"> for more information about prepared
7372 <structname>pg_prepared_statements</structname> contains one row
7373 for each prepared statement. Rows are added to the view when a new
7374 prepared statement is created and removed when a prepared statement
7375 is released (for example, via the <xref linkend="sql-deallocate"> command).
7379 <title><structname>pg_prepared_statements</> Columns</title>
7386 <entry>Description</entry>
7391 <entry><structfield>name</structfield></entry>
7392 <entry><type>text</type></entry>
7394 The identifier of the prepared statement
7398 <entry><structfield>statement</structfield></entry>
7399 <entry><type>text</type></entry>
7401 The query string submitted by the client to create this
7402 prepared statement. For prepared statements created via SQL,
7403 this is the <command>PREPARE</command> statement submitted by
7404 the client. For prepared statements created via the
7405 frontend/backend protocol, this is the text of the prepared
7410 <entry><structfield>prepare_time</structfield></entry>
7411 <entry><type>timestamptz</type></entry>
7413 The time at which the prepared statement was created
7417 <entry><structfield>parameter_types</structfield></entry>
7418 <entry><type>regtype[]</type></entry>
7420 The expected parameter types for the prepared statement in the
7421 form of an array of <type>regtype</type>. The OID corresponding
7422 to an element of this array can be obtained by casting the
7423 <type>regtype</type> value to <type>oid</type>.
7427 <entry><structfield>from_sql</structfield></entry>
7428 <entry><type>boolean</type></entry>
7430 <literal>true</literal> if the prepared statement was created
7431 via the <command>PREPARE</command> SQL statement;
7432 <literal>false</literal> if the statement was prepared via the
7433 frontend/backend protocol
7441 The <structname>pg_prepared_statements</structname> view is read only.
7445 <sect1 id="view-pg-prepared-xacts">
7446 <title><structname>pg_prepared_xacts</structname></title>
7448 <indexterm zone="view-pg-prepared-xacts">
7449 <primary>pg_prepared_xacts</primary>
7453 The view <structname>pg_prepared_xacts</structname> displays
7454 information about transactions that are currently prepared for two-phase
7455 commit (see <xref linkend="sql-prepare-transaction"> for details).
7459 <structname>pg_prepared_xacts</structname> contains one row per prepared
7460 transaction. An entry is removed when the transaction is committed or
7465 <title><structname>pg_prepared_xacts</> Columns</title>
7472 <entry>References</entry>
7473 <entry>Description</entry>
7478 <entry><structfield>transaction</structfield></entry>
7479 <entry><type>xid</type></entry>
7482 Numeric transaction identifier of the prepared transaction
7486 <entry><structfield>gid</structfield></entry>
7487 <entry><type>text</type></entry>
7490 Global transaction identifier that was assigned to the transaction
7494 <entry><structfield>prepared</structfield></entry>
7495 <entry><type>timestamp with time zone</type></entry>
7498 Time at which the transaction was prepared for commit
7502 <entry><structfield>owner</structfield></entry>
7503 <entry><type>name</type></entry>
7504 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7506 Name of the user that executed the transaction
7510 <entry><structfield>database</structfield></entry>
7511 <entry><type>name</type></entry>
7512 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
7514 Name of the database in which the transaction was executed
7522 When the <structname>pg_prepared_xacts</structname> view is accessed, the
7523 internal transaction manager data structures are momentarily locked, and
7524 a copy is made for the view to display. This ensures that the
7525 view produces a consistent set of results, while not blocking
7526 normal operations longer than necessary. Nonetheless
7527 there could be some impact on database performance if this view is
7528 frequently accessed.
7533 <sect1 id="view-pg-roles">
7534 <title><structname>pg_roles</structname></title>
7536 <indexterm zone="view-pg-roles">
7537 <primary>pg_roles</primary>
7541 The view <structname>pg_roles</structname> provides access to
7542 information about database roles. This is simply a publicly
7544 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
7545 that blanks out the password field.
7549 This view explicitly exposes the OID column of the underlying table,
7550 since that is needed to do joins to other catalogs.
7554 <title><structname>pg_roles</> Columns</title>
7561 <entry>References</entry>
7562 <entry>Description</entry>
7568 <entry><structfield>rolname</structfield></entry>
7569 <entry><type>name</type></entry>
7571 <entry>Role name</entry>
7575 <entry><structfield>rolsuper</structfield></entry>
7576 <entry><type>bool</type></entry>
7578 <entry>Role has superuser privileges</entry>
7582 <entry><structfield>rolinherit</structfield></entry>
7583 <entry><type>bool</type></entry>
7585 <entry>Role automatically inherits privileges of roles it is a
7590 <entry><structfield>rolcreaterole</structfield></entry>
7591 <entry><type>bool</type></entry>
7593 <entry>Role can create more roles</entry>
7597 <entry><structfield>rolcreatedb</structfield></entry>
7598 <entry><type>bool</type></entry>
7600 <entry>Role can create databases</entry>
7604 <entry><structfield>rolcatupdate</structfield></entry>
7605 <entry><type>bool</type></entry>
7608 Role can update system catalogs directly. (Even a superuser cannot do
7609 this unless this column is true)
7614 <entry><structfield>rolcanlogin</structfield></entry>
7615 <entry><type>bool</type></entry>
7618 Role can log in. That is, this role can be given as the initial
7619 session authorization identifier
7624 <entry><structfield>rolreplication</structfield></entry>
7625 <entry><type>bool</type></entry>
7628 Role is a replication role. That is, this role can initiate streaming
7629 replication (see <xref linkend="streaming-replication">) and set/unset
7630 the system backup mode using <function>pg_start_backup</> and
7631 <function>pg_stop_backup</>
7636 <entry><structfield>rolconnlimit</structfield></entry>
7637 <entry><type>int4</type></entry>
7640 For roles that can log in, this sets maximum number of concurrent
7641 connections this role can make. -1 means no limit.
7646 <entry><structfield>rolpassword</structfield></entry>
7647 <entry><type>text</type></entry>
7649 <entry>Not the password (always reads as <literal>********</>)</entry>
7653 <entry><structfield>rolvaliduntil</structfield></entry>
7654 <entry><type>timestamptz</type></entry>
7656 <entry>Password expiry time (only used for password authentication);
7657 null if no expiration</entry>
7661 <entry><structfield>rolconfig</structfield></entry>
7662 <entry><type>text[]</type></entry>
7664 <entry>Role-specific defaults for run-time configuration variables</entry>
7668 <entry><structfield>oid</structfield></entry>
7669 <entry><type>oid</type></entry>
7670 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7671 <entry>ID of role</entry>
7679 <sect1 id="view-pg-rules">
7680 <title><structname>pg_rules</structname></title>
7682 <indexterm zone="view-pg-rules">
7683 <primary>pg_rules</primary>
7687 The view <structname>pg_rules</structname> provides access to
7688 useful information about query rewrite rules.
7692 <title><structname>pg_rules</> Columns</title>
7699 <entry>References</entry>
7700 <entry>Description</entry>
7705 <entry><structfield>schemaname</structfield></entry>
7706 <entry><type>name</type></entry>
7707 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7708 <entry>Name of schema containing table</entry>
7711 <entry><structfield>tablename</structfield></entry>
7712 <entry><type>name</type></entry>
7713 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7714 <entry>Name of table the rule is for</entry>
7717 <entry><structfield>rulename</structfield></entry>
7718 <entry><type>name</type></entry>
7719 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
7720 <entry>Name of rule</entry>
7723 <entry><structfield>definition</structfield></entry>
7724 <entry><type>text</type></entry>
7726 <entry>Rule definition (a reconstructed creation command)</entry>
7733 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
7734 of views; those can be seen in <structname>pg_views</>.
7739 <sect1 id="view-pg-seclabels">
7740 <title><structname>pg_seclabels</structname></title>
7742 <indexterm zone="view-pg-seclabels">
7743 <primary>pg_seclabels</primary>
7747 The view <structname>pg_seclabels</structname> provides information about
7748 security labels. It as an easier-to-query version of the
7749 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
7753 <title><structname>pg_seclabels</> Columns</title>
7760 <entry>References</entry>
7761 <entry>Description</entry>
7766 <entry><structfield>objoid</structfield></entry>
7767 <entry><type>oid</type></entry>
7768 <entry>any OID column</entry>
7769 <entry>The OID of the object this security label pertains to</entry>
7772 <entry><structfield>classoid</structfield></entry>
7773 <entry><type>oid</type></entry>
7774 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7775 <entry>The OID of the system catalog this object appears in</entry>
7778 <entry><structfield>objsubid</structfield></entry>
7779 <entry><type>int4</type></entry>
7782 For a security label on a table column, this is the column number (the
7783 <structfield>objoid</> and <structfield>classoid</> refer to
7784 the table itself). For all other object types, this column is
7789 <entry><structfield>objtype</structfield></entry>
7790 <entry><type>text</type></entry>
7793 The type of object to which this label applies, as text.
7797 <entry><structfield>objnamespace</structfield></entry>
7798 <entry><type>oid</type></entry>
7799 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7801 The OID of the namespace for this object, if applicable;
7806 <entry><structfield>objname</structfield></entry>
7807 <entry><type>text</type></entry>
7810 The name of the object to which this label applies, as text.
7814 <entry><structfield>provider</structfield></entry>
7815 <entry><type>text</type></entry>
7816 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
7817 <entry>The label provider associated with this label.</entry>
7820 <entry><structfield>label</structfield></entry>
7821 <entry><type>text</type></entry>
7822 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
7823 <entry>The security label applied to this object.</entry>
7830 <sect1 id="view-pg-settings">
7831 <title><structname>pg_settings</structname></title>
7833 <indexterm zone="view-pg-settings">
7834 <primary>pg_settings</primary>
7838 The view <structname>pg_settings</structname> provides access to
7839 run-time parameters of the server. It is essentially an alternative
7840 interface to the <xref linkend="sql-show">
7841 and <xref linkend="sql-set"> commands.
7842 It also provides access to some facts about each parameter that are
7843 not directly available from <command>SHOW</>, such as minimum and
7848 <title><structname>pg_settings</> Columns</title>
7855 <entry>Description</entry>
7860 <entry><structfield>name</structfield></entry>
7861 <entry><type>text</type></entry>
7862 <entry>Run-time configuration parameter name</entry>
7865 <entry><structfield>setting</structfield></entry>
7866 <entry><type>text</type></entry>
7867 <entry>Current value of the parameter</entry>
7870 <entry><structfield>unit</structfield></entry>
7871 <entry><type>text</type></entry>
7872 <entry>Implicit unit of the parameter</entry>
7875 <entry><structfield>category</structfield></entry>
7876 <entry><type>text</type></entry>
7877 <entry>Logical group of the parameter</entry>
7880 <entry><structfield>short_desc</structfield></entry>
7881 <entry><type>text</type></entry>
7882 <entry>A brief description of the parameter</entry>
7885 <entry><structfield>extra_desc</structfield></entry>
7886 <entry><type>text</type></entry>
7887 <entry>Additional, more detailed, description of the parameter</entry>
7890 <entry><structfield>context</structfield></entry>
7891 <entry><type>text</type></entry>
7892 <entry>Context required to set the parameter's value (see below)</entry>
7895 <entry><structfield>vartype</structfield></entry>
7896 <entry><type>text</type></entry>
7897 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
7898 <literal>integer</>, <literal>real</>, or <literal>string</>)
7902 <entry><structfield>source</structfield></entry>
7903 <entry><type>text</type></entry>
7904 <entry>Source of the current parameter value</entry>
7907 <entry><structfield>min_val</structfield></entry>
7908 <entry><type>text</type></entry>
7909 <entry>Minimum allowed value of the parameter (null for non-numeric
7913 <entry><structfield>max_val</structfield></entry>
7914 <entry><type>text</type></entry>
7915 <entry>Maximum allowed value of the parameter (null for non-numeric
7919 <entry><structfield>enumvals</structfield></entry>
7920 <entry><type>text[]</type></entry>
7921 <entry>Allowed values of an enum parameter (null for non-enum
7925 <entry><structfield>boot_val</structfield></entry>
7926 <entry><type>text</type></entry>
7927 <entry>Parameter value assumed at server startup if the parameter is
7928 not otherwise set</entry>
7931 <entry><structfield>reset_val</structfield></entry>
7932 <entry><type>text</type></entry>
7933 <entry>Value that <command>RESET</command> would reset the parameter to
7934 in the current session</entry>
7937 <entry><structfield>sourcefile</structfield></entry>
7938 <entry><type>text</type></entry>
7939 <entry>Configuration file the current value was set in (null for
7940 values set from sources other than configuration files, or when
7941 examined by a non-superuser);
7942 helpful when using <literal>include</> directives in configuration files</entry>
7945 <entry><structfield>sourceline</structfield></entry>
7946 <entry><type>integer</type></entry>
7947 <entry>Line number within the configuration file the current value was
7948 set at (null for values set from sources other than configuration files,
7949 or when examined by a non-superuser)
7957 There are several possible values of <structfield>context</structfield>.
7958 In order of decreasing difficulty of changing the setting, they are:
7963 <term><literal>internal</literal></term>
7966 These settings cannot be changed directly; they reflect internally
7967 determined values. Some of them may be adjustable by rebuilding the
7968 server with different configuration options, or by changing options
7969 supplied to <command>initdb</command>.
7974 <term><literal>postmaster</literal></term>
7977 These settings can only be applied when the server starts, so any change
7978 requires restarting the server. Values for these settings are typically
7979 stored in the <filename>postgresql.conf</filename> file, or passed on
7980 the command line when starting the server. Of course, settings with any
7981 of the lower <structfield>context</structfield> types can also be
7982 set at server start time.
7987 <term><literal>sighup</literal></term>
7990 Changes to these settings can be made in
7991 <filename>postgresql.conf</filename> without restarting the server.
7992 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
7993 cause it to re-read <filename>postgresql.conf</filename> and apply
7994 the changes. The postmaster will also forward the
7995 <systemitem>SIGHUP</systemitem> signal to its child processes so that
7996 they all pick up the new value.
8001 <term><literal>backend</literal></term>
8004 Changes to these settings can be made in
8005 <filename>postgresql.conf</filename> without restarting the server;
8006 they can also be set for a particular session in the connection request
8007 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
8008 environment variable). However, these settings never change in a
8009 session after it is started. If you change them in
8010 <filename>postgresql.conf</filename>, send a
8011 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
8012 re-read <filename>postgresql.conf</filename>. The new values will only
8013 affect subsequently-launched sessions.
8018 <term><literal>superuser</literal></term>
8021 These settings can be set from <filename>postgresql.conf</filename>,
8022 or within a session via the <command>SET</> command; but only superusers
8023 can change them via <command>SET</>. Changes in
8024 <filename>postgresql.conf</filename> will affect existing sessions
8025 only if no session-local value has been established with <command>SET</>.
8030 <term><literal>user</literal></term>
8033 These settings can be set from <filename>postgresql.conf</filename>,
8034 or within a session via the <command>SET</> command. Any user is
8035 allowed to change his session-local value. Changes in
8036 <filename>postgresql.conf</filename> will affect existing sessions
8037 only if no session-local value has been established with <command>SET</>.
8044 See <xref linkend="config-setting"> for more information about the various
8045 ways to change these parameters.
8049 The <structname>pg_settings</structname> view cannot be inserted into or
8050 deleted from, but it can be updated. An <command>UPDATE</command> applied
8051 to a row of <structname>pg_settings</structname> is equivalent to executing
8052 the <xref linkend="sql-set"> command on that named
8053 parameter. The change only affects the value used by the current
8054 session. If an <command>UPDATE</command> is issued within a transaction
8055 that is later aborted, the effects of the <command>UPDATE</command> command
8056 disappear when the transaction is rolled back. Once the surrounding
8057 transaction is committed, the effects will persist until the end of the
8058 session, unless overridden by another <command>UPDATE</command> or
8059 <command>SET</command>.
8064 <sect1 id="view-pg-shadow">
8065 <title><structname>pg_shadow</structname></title>
8067 <indexterm zone="view-pg-shadow">
8068 <primary>pg_shadow</primary>
8072 The view <structname>pg_shadow</structname> exists for backwards
8073 compatibility: it emulates a catalog that existed in
8074 <productname>PostgreSQL</productname> before version 8.1.
8075 It shows properties of all roles that are marked as
8076 <structfield>rolcanlogin</> in
8077 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
8081 The name stems from the fact that this table
8082 should not be readable by the public since it contains passwords.
8083 <link linkend="view-pg-user"><structname>pg_user</structname></link>
8084 is a publicly readable view on
8085 <structname>pg_shadow</structname> that blanks out the password field.
8089 <title><structname>pg_shadow</> Columns</title>
8096 <entry>References</entry>
8097 <entry>Description</entry>
8103 <entry><structfield>usename</structfield></entry>
8104 <entry><type>name</type></entry>
8105 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8106 <entry>User name</entry>
8110 <entry><structfield>usesysid</structfield></entry>
8111 <entry><type>oid</type></entry>
8112 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8113 <entry>ID of this user</entry>
8117 <entry><structfield>usecreatedb</structfield></entry>
8118 <entry><type>bool</type></entry>
8120 <entry>User can create databases</entry>
8124 <entry><structfield>usesuper</structfield></entry>
8125 <entry><type>bool</type></entry>
8127 <entry>User is a superuser</entry>
8131 <entry><structfield>usecatupd</structfield></entry>
8132 <entry><type>bool</type></entry>
8135 User can update system catalogs. (Even a superuser cannot do
8136 this unless this column is true.)
8141 <entry><structfield>passwd</structfield></entry>
8142 <entry><type>text</type></entry>
8144 <entry>Password (possibly encrypted); null if none. See
8145 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8146 for details of how encrypted passwords are stored.</entry>
8150 <entry><structfield>valuntil</structfield></entry>
8151 <entry><type>abstime</type></entry>
8153 <entry>Password expiry time (only used for password authentication)</entry>
8157 <entry><structfield>useconfig</structfield></entry>
8158 <entry><type>text[]</type></entry>
8160 <entry>Session defaults for run-time configuration variables</entry>
8168 <sect1 id="view-pg-stats">
8169 <title><structname>pg_stats</structname></title>
8171 <indexterm zone="view-pg-stats">
8172 <primary>pg_stats</primary>
8176 The view <structname>pg_stats</structname> provides access to
8177 the information stored in the <link
8178 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
8179 catalog. This view allows access only to rows of
8180 <structname>pg_statistic</structname> that correspond to tables the
8181 user has permission to read, and therefore it is safe to allow public
8182 read access to this view.
8186 <structname>pg_stats</structname> is also designed to present the
8187 information in a more readable format than the underlying catalog
8188 — at the cost that its schema must be extended whenever new slot types
8189 are defined for <structname>pg_statistic</structname>.
8193 <title><structname>pg_stats</> Columns</title>
8200 <entry>References</entry>
8201 <entry>Description</entry>
8206 <entry><structfield>schemaname</structfield></entry>
8207 <entry><type>name</type></entry>
8208 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8209 <entry>Name of schema containing table</entry>
8213 <entry><structfield>tablename</structfield></entry>
8214 <entry><type>name</type></entry>
8215 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8216 <entry>Name of table</entry>
8220 <entry><structfield>attname</structfield></entry>
8221 <entry><type>name</type></entry>
8222 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
8223 <entry>Name of the column described by this row</entry>
8227 <entry><structfield>inherited</structfield></entry>
8228 <entry><type>bool</type></entry>
8230 <entry>If true, this row includes inheritance child columns, not just the
8231 values in the specified table</entry>
8235 <entry><structfield>null_frac</structfield></entry>
8236 <entry><type>real</type></entry>
8238 <entry>Fraction of column entries that are null</entry>
8242 <entry><structfield>avg_width</structfield></entry>
8243 <entry><type>integer</type></entry>
8245 <entry>Average width in bytes of column's entries</entry>
8249 <entry><structfield>n_distinct</structfield></entry>
8250 <entry><type>real</type></entry>
8253 If greater than zero, the estimated number of distinct values in the
8254 column. If less than zero, the negative of the number of distinct
8255 values divided by the number of rows. (The negated form is used when
8256 <command>ANALYZE</> believes that the number of distinct values is
8257 likely to increase as the table grows; the positive form is used when
8258 the column seems to have a fixed number of possible values.) For
8259 example, -1 indicates a unique column in which the number of distinct
8260 values is the same as the number of rows.
8265 <entry><structfield>most_common_vals</structfield></entry>
8266 <entry><type>anyarray</type></entry>
8269 A list of the most common values in the column. (Null if
8270 no values seem to be more common than any others.)
8271 For some data types such as <type>tsvector</>, this is a list of
8272 the most common element values rather than values of the type itself.
8277 <entry><structfield>most_common_freqs</structfield></entry>
8278 <entry><type>real[]</type></entry>
8281 A list of the frequencies of the most common values or elements,
8282 i.e., number of occurrences of each divided by total number of rows.
8283 (Null when <structfield>most_common_vals</structfield> is.)
8284 For some data types such as <type>tsvector</>, it can also store some
8285 additional information, making it longer than the
8286 <structfield>most_common_vals</> array.
8291 <entry><structfield>histogram_bounds</structfield></entry>
8292 <entry><type>anyarray</type></entry>
8295 A list of values that divide the column's values into groups of
8296 approximately equal population. The values in
8297 <structfield>most_common_vals</>, if present, are omitted from this
8298 histogram calculation. (This column is null if the column data type
8299 does not have a <literal><</> operator or if the
8300 <structfield>most_common_vals</> list accounts for the entire
8306 <entry><structfield>correlation</structfield></entry>
8307 <entry><type>real</type></entry>
8310 Statistical correlation between physical row ordering and
8311 logical ordering of the column values. This ranges from -1 to +1.
8312 When the value is near -1 or +1, an index scan on the column will
8313 be estimated to be cheaper than when it is near zero, due to reduction
8314 of random access to the disk. (This column is null if the column data
8315 type does not have a <literal><</> operator.)
8323 The maximum number of entries in the <structfield>most_common_vals</>
8324 and <structfield>histogram_bounds</> arrays can be set on a
8325 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
8326 command, or globally by setting the
8327 <xref linkend="guc-default-statistics-target"> run-time parameter.
8332 <sect1 id="view-pg-tables">
8333 <title><structname>pg_tables</structname></title>
8335 <indexterm zone="view-pg-tables">
8336 <primary>pg_tables</primary>
8340 The view <structname>pg_tables</structname> provides access to
8341 useful information about each table in the database.
8345 <title><structname>pg_tables</> Columns</title>
8352 <entry>References</entry>
8353 <entry>Description</entry>
8358 <entry><structfield>schemaname</structfield></entry>
8359 <entry><type>name</type></entry>
8360 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8361 <entry>Name of schema containing table</entry>
8364 <entry><structfield>tablename</structfield></entry>
8365 <entry><type>name</type></entry>
8366 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8367 <entry>Name of table</entry>
8370 <entry><structfield>tableowner</structfield></entry>
8371 <entry><type>name</type></entry>
8372 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8373 <entry>Name of table's owner</entry>
8376 <entry><structfield>tablespace</structfield></entry>
8377 <entry><type>name</type></entry>
8378 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8379 <entry>Name of tablespace containing table (null if default for database)</entry>
8382 <entry><structfield>hasindexes</structfield></entry>
8383 <entry><type>boolean</type></entry>
8384 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
8385 <entry>True if table has (or recently had) any indexes</entry>
8388 <entry><structfield>hasrules</structfield></entry>
8389 <entry><type>boolean</type></entry>
8390 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
8391 <entry>True if table has (or once had) rules</entry>
8394 <entry><structfield>hastriggers</structfield></entry>
8395 <entry><type>boolean</type></entry>
8396 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
8397 <entry>True if table has (or once had) triggers</entry>
8405 <sect1 id="view-pg-timezone-abbrevs">
8406 <title><structname>pg_timezone_abbrevs</structname></title>
8408 <indexterm zone="view-pg-timezone-abbrevs">
8409 <primary>pg_timezone_abbrevs</primary>
8413 The view <structname>pg_timezone_abbrevs</structname> provides a list
8414 of time zone abbreviations that are currently recognized by the datetime
8415 input routines. The contents of this view change when the
8416 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
8420 <title><structname>pg_timezone_abbrevs</> Columns</title>
8427 <entry>Description</entry>
8432 <entry><structfield>abbrev</structfield></entry>
8433 <entry><type>text</type></entry>
8434 <entry>Time zone abbreviation</entry>
8437 <entry><structfield>utc_offset</structfield></entry>
8438 <entry><type>interval</type></entry>
8439 <entry>Offset from UTC (positive means east of Greenwich)</entry>
8442 <entry><structfield>is_dst</structfield></entry>
8443 <entry><type>boolean</type></entry>
8444 <entry>True if this is a daylight-savings abbreviation</entry>
8452 <sect1 id="view-pg-timezone-names">
8453 <title><structname>pg_timezone_names</structname></title>
8455 <indexterm zone="view-pg-timezone-names">
8456 <primary>pg_timezone_names</primary>
8460 The view <structname>pg_timezone_names</structname> provides a list
8461 of time zone names that are recognized by <command>SET TIMEZONE</>,
8462 along with their associated abbreviations, UTC offsets,
8463 and daylight-savings status. (Technically,
8464 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
8465 than UTC because leap seconds are not handled.)
8466 Unlike the abbreviations shown in <link
8467 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
8468 date rules. Therefore, the associated information changes across local DST
8469 boundaries. The displayed information is computed based on the current
8470 value of <function>CURRENT_TIMESTAMP</>.
8474 <title><structname>pg_timezone_names</> Columns</title>
8481 <entry>Description</entry>
8486 <entry><structfield>name</structfield></entry>
8487 <entry><type>text</type></entry>
8488 <entry>Time zone name</entry>
8491 <entry><structfield>abbrev</structfield></entry>
8492 <entry><type>text</type></entry>
8493 <entry>Time zone abbreviation</entry>
8496 <entry><structfield>utc_offset</structfield></entry>
8497 <entry><type>interval</type></entry>
8498 <entry>Offset from UTC (positive means east of Greenwich)</entry>
8501 <entry><structfield>is_dst</structfield></entry>
8502 <entry><type>boolean</type></entry>
8503 <entry>True if currently observing daylight savings</entry>
8511 <sect1 id="view-pg-user">
8512 <title><structname>pg_user</structname></title>
8514 <indexterm zone="view-pg-user">
8515 <primary>pg_user</primary>
8519 The view <structname>pg_user</structname> provides access to
8520 information about database users. This is simply a publicly
8522 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
8523 that blanks out the password field.
8527 <title><structname>pg_user</> Columns</title>
8534 <entry>Description</entry>
8539 <entry><structfield>usename</structfield></entry>
8540 <entry><type>name</type></entry>
8541 <entry>User name</entry>
8545 <entry><structfield>usesysid</structfield></entry>
8546 <entry><type>int4</type></entry>
8547 <entry>User ID (arbitrary number used to reference this user)</entry>
8551 <entry><structfield>usecreatedb</structfield></entry>
8552 <entry><type>bool</type></entry>
8553 <entry>User can create databases</entry>
8557 <entry><structfield>usesuper</structfield></entry>
8558 <entry><type>bool</type></entry>
8559 <entry>User is a superuser</entry>
8563 <entry><structfield>usecatupd</structfield></entry>
8564 <entry><type>bool</type></entry>
8566 User can update system catalogs. (Even a superuser cannot do
8567 this unless this column is true.)
8572 <entry><structfield>passwd</structfield></entry>
8573 <entry><type>text</type></entry>
8574 <entry>Not the password (always reads as <literal>********</>)</entry>
8578 <entry><structfield>valuntil</structfield></entry>
8579 <entry><type>abstime</type></entry>
8580 <entry>Password expiry time (only used for password authentication)</entry>
8584 <entry><structfield>useconfig</structfield></entry>
8585 <entry><type>text[]</type></entry>
8586 <entry>Session defaults for run-time configuration variables</entry>
8594 <sect1 id="view-pg-user-mappings">
8595 <title><structname>pg_user_mappings</structname></title>
8597 <indexterm zone="view-pg-user-mappings">
8598 <primary>pg_user_mappings</primary>
8602 The view <structname>pg_user_mappings</structname> provides access
8603 to information about user mappings. This is essentially a publicly
8605 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
8606 that leaves out the options field if the user has no rights to use
8611 <title><structname>pg_user_mappings</> Columns</title>
8618 <entry>References</entry>
8619 <entry>Description</entry>
8625 <entry><structfield>umid</structfield></entry>
8626 <entry><type>oid</type></entry>
8627 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
8628 <entry>OID of the user mapping</entry>
8632 <entry><structfield>srvid</structfield></entry>
8633 <entry><type>oid</type></entry>
8634 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
8636 The OID of the foreign server that contains this mapping
8641 <entry><structfield>srvname</structfield></entry>
8642 <entry><type>text</type></entry>
8645 Name of the foreign server
8650 <entry><structfield>umuser</structfield></entry>
8651 <entry><type>oid</type></entry>
8652 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8653 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
8657 <entry><structfield>usename</structfield></entry>
8658 <entry><type>name</type></entry>
8660 <entry>Name of the local user to be mapped</entry>
8664 <entry><structfield>umoptions</structfield></entry>
8665 <entry><type>text[]</type></entry>
8668 User mapping specific options, as <quote>keyword=value</>
8669 strings, if the current user is the owner of the foreign
8679 <sect1 id="view-pg-views">
8680 <title><structname>pg_views</structname></title>
8682 <indexterm zone="view-pg-views">
8683 <primary>pg_views</primary>
8687 The view <structname>pg_views</structname> provides access to
8688 useful information about each view in the database.
8692 <title><structname>pg_views</> Columns</title>
8699 <entry>References</entry>
8700 <entry>Description</entry>
8705 <entry><structfield>schemaname</structfield></entry>
8706 <entry><type>name</type></entry>
8707 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8708 <entry>Name of schema containing view</entry>
8711 <entry><structfield>viewname</structfield></entry>
8712 <entry><type>name</type></entry>
8713 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8714 <entry>Name of view</entry>
8717 <entry><structfield>viewowner</structfield></entry>
8718 <entry><type>name</type></entry>
8719 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8720 <entry>Name of view's owner</entry>
8723 <entry><structfield>definition</structfield></entry>
8724 <entry><type>text</type></entry>
8726 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>