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 normally 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, but many of those have been made
22 available as SQL commands over time, and so the need for direct manipulation
23 of the system catalogs is ever decreasing.
26 <sect1 id="catalogs-overview">
27 <title>Overview</title>
30 <xref linkend="catalog-table"> lists the system catalogs.
31 More detailed documentation of each catalog follows below.
35 Most system catalogs are copied from the template database during
36 database creation and are thereafter database-specific. A few
37 catalogs are physically shared across all databases in a cluster;
38 these are noted in the descriptions of the individual catalogs.
41 <table id="catalog-table">
42 <title>System Catalogs</title>
47 <entry>Catalog Name</entry>
48 <entry>Purpose</entry>
54 <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
55 <entry>aggregate functions</entry>
59 <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
60 <entry>index access methods</entry>
64 <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
65 <entry>access method operators</entry>
69 <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
70 <entry>access method support procedures</entry>
74 <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
75 <entry>column default values</entry>
79 <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
80 <entry>table columns (<quote>attributes</quote>)</entry>
84 <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
85 <entry>authorization identifiers (roles)</entry>
89 <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
90 <entry>authorization identifier membership relationships</entry>
94 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
95 <entry>casts (data type conversions)</entry>
99 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
100 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
104 <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
105 <entry>collations (locale information)</entry>
109 <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
110 <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
114 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
115 <entry>encoding conversion information</entry>
119 <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
120 <entry>databases within this database cluster</entry>
124 <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
125 <entry>per-role and per-database settings</entry>
129 <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
130 <entry>default privileges for object types</entry>
134 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
135 <entry>dependencies between database objects</entry>
139 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
140 <entry>descriptions or comments on database objects</entry>
144 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
145 <entry>enum label and value definitions</entry>
149 <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
150 <entry>event triggers</entry>
154 <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
155 <entry>installed extensions</entry>
159 <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
160 <entry>foreign-data wrapper definitions</entry>
164 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
165 <entry>foreign server definitions</entry>
169 <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
170 <entry>additional foreign table information</entry>
174 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
175 <entry>additional index information</entry>
179 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
180 <entry>table inheritance hierarchy</entry>
184 <entry><link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link></entry>
185 <entry>object initial privileges</entry>
189 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
190 <entry>languages for writing functions</entry>
194 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
195 <entry>data pages for large objects</entry>
199 <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
200 <entry>metadata for large objects</entry>
204 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
205 <entry>schemas</entry>
209 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
210 <entry>access method operator classes</entry>
214 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
215 <entry>operators</entry>
219 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
220 <entry>access method operator families</entry>
224 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
225 <entry>template data for procedural languages</entry>
229 <entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
230 <entry>information about partition key of tables</entry>
234 <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
235 <entry>row-security policies</entry>
239 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
240 <entry>functions and procedures</entry>
244 <entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
245 <entry>publications for logical replication</entry>
249 <entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
250 <entry>relation to publication mapping</entry>
254 <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
255 <entry>information about range types</entry>
259 <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
260 <entry>registered replication origins</entry>
264 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
265 <entry>query rewrite rules</entry>
269 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
270 <entry>security labels on database objects</entry>
274 <entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
275 <entry>information about sequences</entry>
279 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
280 <entry>dependencies on shared objects</entry>
284 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
285 <entry>comments on shared objects</entry>
289 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
290 <entry>security labels on shared database objects</entry>
294 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
295 <entry>planner statistics</entry>
299 <entry><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link></entry>
300 <entry>extended planner statistics</entry>
304 <entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
305 <entry>logical replication subscriptions</entry>
309 <entry><link linkend="catalog-pg-subscription-rel"><structname>pg_subscription_rel</structname></link></entry>
310 <entry>relation state for subscriptions</entry>
314 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
315 <entry>tablespaces within this database cluster</entry>
319 <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
320 <entry>transforms (data type to procedural language conversions)</entry>
324 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
325 <entry>triggers</entry>
329 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
330 <entry>text search configurations</entry>
334 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
335 <entry>text search configurations' token mappings</entry>
339 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
340 <entry>text search dictionaries</entry>
344 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
345 <entry>text search parsers</entry>
349 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
350 <entry>text search templates</entry>
354 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
355 <entry>data types</entry>
359 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
360 <entry>mappings of users to foreign servers</entry>
368 <sect1 id="catalog-pg-aggregate">
369 <title><structname>pg_aggregate</structname></title>
371 <indexterm zone="catalog-pg-aggregate">
372 <primary>pg_aggregate</primary>
376 The catalog <structname>pg_aggregate</structname> stores information about
377 aggregate functions. An aggregate function is a function that
378 operates on a set of values (typically one column from each row
379 that matches a query condition) and returns a single value computed
380 from all these values. Typical aggregate functions are
381 <function>sum</function>, <function>count</function>, and
382 <function>max</function>. Each entry in
383 <structname>pg_aggregate</structname> is an extension of an entry
384 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
385 entry carries the aggregate's name, input and output data types, and
386 other information that is similar to ordinary functions.
390 <title><structname>pg_aggregate</> Columns</title>
397 <entry>References</entry>
398 <entry>Description</entry>
403 <entry><structfield>aggfnoid</structfield></entry>
404 <entry><type>regproc</type></entry>
405 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
406 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
409 <entry><structfield>aggkind</structfield></entry>
410 <entry><type>char</type></entry>
412 <entry>Aggregate kind:
413 <literal>n</literal> for <quote>normal</> aggregates,
414 <literal>o</literal> for <quote>ordered-set</> aggregates, or
415 <literal>h</literal> for <quote>hypothetical-set</> aggregates
419 <entry><structfield>aggnumdirectargs</structfield></entry>
420 <entry><type>int2</type></entry>
422 <entry>Number of direct (non-aggregated) arguments of an ordered-set or
423 hypothetical-set aggregate, counting a variadic array as one argument.
424 If equal to <structfield>pronargs</>, the aggregate must be variadic
425 and the variadic array describes the aggregated arguments as well as
426 the final direct arguments.
427 Always zero for normal aggregates.</entry>
430 <entry><structfield>aggtransfn</structfield></entry>
431 <entry><type>regproc</type></entry>
432 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
433 <entry>Transition function</entry>
436 <entry><structfield>aggfinalfn</structfield></entry>
437 <entry><type>regproc</type></entry>
438 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
439 <entry>Final function (zero if none)</entry>
442 <entry><structfield>aggcombinefn</structfield></entry>
443 <entry><type>regproc</type></entry>
444 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
445 <entry>Combine function (zero if none)</entry>
448 <entry><structfield>aggserialfn</structfield></entry>
449 <entry><type>regproc</type></entry>
450 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
451 <entry>Serialization function (zero if none)</entry>
454 <entry><structfield>aggdeserialfn</structfield></entry>
455 <entry><type>regproc</type></entry>
456 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
457 <entry>Deserialization function (zero if none)</entry>
460 <entry><structfield>aggmtransfn</structfield></entry>
461 <entry><type>regproc</type></entry>
462 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
463 <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
466 <entry><structfield>aggminvtransfn</structfield></entry>
467 <entry><type>regproc</type></entry>
468 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
469 <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
472 <entry><structfield>aggmfinalfn</structfield></entry>
473 <entry><type>regproc</type></entry>
474 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
475 <entry>Final function for moving-aggregate mode (zero if none)</entry>
478 <entry><structfield>aggfinalextra</structfield></entry>
479 <entry><type>bool</type></entry>
481 <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
484 <entry><structfield>aggmfinalextra</structfield></entry>
485 <entry><type>bool</type></entry>
487 <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
490 <entry><structfield>aggsortop</structfield></entry>
491 <entry><type>oid</type></entry>
492 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
493 <entry>Associated sort operator (zero if none)</entry>
496 <entry><structfield>aggtranstype</structfield></entry>
497 <entry><type>oid</type></entry>
498 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
499 <entry>Data type of the aggregate function's internal transition (state) data</entry>
502 <entry><structfield>aggtransspace</structfield></entry>
503 <entry><type>int4</type></entry>
505 <entry>Approximate average size (in bytes) of the transition state
506 data, or zero to use a default estimate</entry>
509 <entry><structfield>aggmtranstype</structfield></entry>
510 <entry><type>oid</type></entry>
511 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
512 <entry>Data type of the aggregate function's internal transition (state)
513 data for moving-aggregate mode (zero if none)</entry>
516 <entry><structfield>aggmtransspace</structfield></entry>
517 <entry><type>int4</type></entry>
519 <entry>Approximate average size (in bytes) of the transition state data
520 for moving-aggregate mode, or zero to use a default estimate</entry>
523 <entry><structfield>agginitval</structfield></entry>
524 <entry><type>text</type></entry>
527 The initial value of the transition state. This is a text
528 field containing the initial value in its external string
529 representation. If this field is null, the transition state
530 value starts out null.
534 <entry><structfield>aggminitval</structfield></entry>
535 <entry><type>text</type></entry>
538 The initial value of the transition state for moving-aggregate mode.
539 This is a text field containing the initial value in its external
540 string representation. If this field is null, the transition state
541 value starts out null.
549 New aggregate functions are registered with the <xref
550 linkend="sql-createaggregate">
551 command. See <xref linkend="xaggr"> for more information about
552 writing aggregate functions and the meaning of the transition
559 <sect1 id="catalog-pg-am">
560 <title><structname>pg_am</structname></title>
562 <indexterm zone="catalog-pg-am">
563 <primary>pg_am</primary>
567 The catalog <structname>pg_am</structname> stores information about
568 relation access methods. There is one row for each access method supported
570 Currently, only indexes have access methods. The requirements for index
571 access methods are discussed in detail in <xref linkend="indexam">.
575 <title><structname>pg_am</> Columns</title>
582 <entry>References</entry>
583 <entry>Description</entry>
589 <entry><structfield>oid</structfield></entry>
590 <entry><type>oid</type></entry>
592 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
596 <entry><structfield>amname</structfield></entry>
597 <entry><type>name</type></entry>
599 <entry>Name of the access method</entry>
603 <entry><structfield>amhandler</structfield></entry>
604 <entry><type>regproc</type></entry>
605 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
607 OID of a handler function that is responsible for supplying information
608 about the access method
613 <entry><structfield>amtype</structfield></entry>
614 <entry><type>char</type></entry>
617 Currently always <literal>i</literal> to indicate an index access
618 method; other values may be allowed in future
627 Before <productname>PostgreSQL</> 9.6, <structname>pg_am</structname>
628 contained many additional columns representing properties of index access
629 methods. That data is now only directly visible at the C code level.
630 However, <function>pg_index_column_has_property()</function> and related
631 functions have been added to allow SQL queries to inspect index access
632 method properties; see <xref linkend="functions-info-catalog-table">.
639 <sect1 id="catalog-pg-amop">
640 <title><structname>pg_amop</structname></title>
642 <indexterm zone="catalog-pg-amop">
643 <primary>pg_amop</primary>
647 The catalog <structname>pg_amop</structname> stores information about
648 operators associated with access method operator families. There is one
649 row for each operator that is a member of an operator family. A family
650 member can be either a <firstterm>search</> operator or an
651 <firstterm>ordering</> operator. An operator
652 can appear in more than one family, but cannot appear in more than one
653 search position nor more than one ordering position within a family.
654 (It is allowed, though unlikely, for an operator to be used for both
655 search and ordering purposes.)
659 <title><structname>pg_amop</> Columns</title>
666 <entry>References</entry>
667 <entry>Description</entry>
673 <entry><structfield>oid</structfield></entry>
674 <entry><type>oid</type></entry>
676 <entry>Row identifier (hidden attribute; must be explicitly selected)</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 B-tree 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 <type>boolean</type>, 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 B-tree 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 operator family, 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>oid</structfield></entry>
817 <entry><type>oid</type></entry>
819 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
823 <entry><structfield>amprocfamily</structfield></entry>
824 <entry><type>oid</type></entry>
825 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
826 <entry>The operator family this entry is for</entry>
830 <entry><structfield>amproclefttype</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>Left-hand input data type of associated operator</entry>
837 <entry><structfield>amprocrighttype</structfield></entry>
838 <entry><type>oid</type></entry>
839 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
840 <entry>Right-hand input data type of associated operator</entry>
844 <entry><structfield>amprocnum</structfield></entry>
845 <entry><type>int2</type></entry>
847 <entry>Support procedure number</entry>
851 <entry><structfield>amproc</structfield></entry>
852 <entry><type>regproc</type></entry>
853 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
854 <entry>OID of the procedure</entry>
862 The usual interpretation of the
863 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
864 is that they identify the left and right input types of the operator(s)
865 that a particular support procedure supports. For some access methods
866 these match the input data type(s) of the support procedure itself, for
867 others not. There is a notion of <quote>default</> support procedures for
868 an index, which are those with <structfield>amproclefttype</> and
869 <structfield>amprocrighttype</> both equal to the index operator class's
870 <structfield>opcintype</>.
876 <sect1 id="catalog-pg-attrdef">
877 <title><structname>pg_attrdef</structname></title>
879 <indexterm zone="catalog-pg-attrdef">
880 <primary>pg_attrdef</primary>
884 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
885 about columns is stored in <structname>pg_attribute</structname>
886 (see below). Only columns that explicitly specify a default value
887 (when the table is created or the column is added) will have an
892 <title><structname>pg_attrdef</> Columns</title>
899 <entry>References</entry>
900 <entry>Description</entry>
906 <entry><structfield>oid</structfield></entry>
907 <entry><type>oid</type></entry>
909 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
913 <entry><structfield>adrelid</structfield></entry>
914 <entry><type>oid</type></entry>
915 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
916 <entry>The table this column belongs to</entry>
920 <entry><structfield>adnum</structfield></entry>
921 <entry><type>int2</type></entry>
922 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
923 <entry>The number of the column</entry>
927 <entry><structfield>adbin</structfield></entry>
928 <entry><type>pg_node_tree</type></entry>
930 <entry>The internal representation of the column default value</entry>
934 <entry><structfield>adsrc</structfield></entry>
935 <entry><type>text</type></entry>
937 <entry>A human-readable representation of the default value</entry>
944 The <structfield>adsrc</structfield> field is historical, and is best
945 not used, because it does not track outside changes that might affect
946 the representation of the default value. Reverse-compiling the
947 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
948 example) is a better way to display the default value.
954 <sect1 id="catalog-pg-attribute">
955 <title><structname>pg_attribute</structname></title>
957 <indexterm zone="catalog-pg-attribute">
958 <primary>pg_attribute</primary>
962 The catalog <structname>pg_attribute</structname> stores information about
963 table columns. There will be exactly one
964 <structname>pg_attribute</structname> row for every column in every
965 table in the database. (There will also be attribute entries for
966 indexes, and indeed all objects that have <structname>pg_class</structname>
971 The term attribute is equivalent to column and is used for
976 <title><structname>pg_attribute</> Columns</title>
983 <entry>References</entry>
984 <entry>Description</entry>
990 <entry><structfield>attrelid</structfield></entry>
991 <entry><type>oid</type></entry>
992 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
993 <entry>The table this column belongs to</entry>
997 <entry><structfield>attname</structfield></entry>
998 <entry><type>name</type></entry>
1000 <entry>The column name</entry>
1004 <entry><structfield>atttypid</structfield></entry>
1005 <entry><type>oid</type></entry>
1006 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1007 <entry>The data type of this column</entry>
1011 <entry><structfield>attstattarget</structfield></entry>
1012 <entry><type>int4</type></entry>
1015 <structfield>attstattarget</structfield> controls the level of detail
1016 of statistics accumulated for this column by
1017 <xref linkend="sql-analyze">.
1018 A zero value indicates that no statistics should be collected.
1019 A negative value says to use the system default statistics target.
1020 The exact meaning of positive values is data type-dependent.
1021 For scalar data types, <structfield>attstattarget</structfield>
1022 is both the target number of <quote>most common values</quote>
1023 to collect, and the target number of histogram bins to create.
1028 <entry><structfield>attlen</structfield></entry>
1029 <entry><type>int2</type></entry>
1032 A copy of <literal>pg_type.typlen</literal> of this column's
1038 <entry><structfield>attnum</structfield></entry>
1039 <entry><type>int2</type></entry>
1042 The number of the column. Ordinary columns are numbered from 1
1043 up. System columns, such as <structfield>oid</structfield>,
1044 have (arbitrary) negative numbers.
1049 <entry><structfield>attndims</structfield></entry>
1050 <entry><type>int4</type></entry>
1053 Number of dimensions, if the column is an array type; otherwise 0.
1054 (Presently, the number of dimensions of an array is not enforced,
1055 so any nonzero value effectively means <quote>it's an array</>.)
1060 <entry><structfield>attcacheoff</structfield></entry>
1061 <entry><type>int4</type></entry>
1064 Always -1 in storage, but when loaded into a row descriptor
1065 in memory this might be updated to cache the offset of the attribute
1071 <entry><structfield>atttypmod</structfield></entry>
1072 <entry><type>int4</type></entry>
1075 <structfield>atttypmod</structfield> records type-specific data
1076 supplied at table creation time (for example, the maximum
1077 length of a <type>varchar</type> column). It is passed to
1078 type-specific input functions and length coercion functions.
1079 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1084 <entry><structfield>attbyval</structfield></entry>
1085 <entry><type>bool</type></entry>
1088 A copy of <literal>pg_type.typbyval</> of this column's type
1093 <entry><structfield>attstorage</structfield></entry>
1094 <entry><type>char</type></entry>
1097 Normally a copy of <literal>pg_type.typstorage</> of this
1098 column's type. For TOAST-able data types, this can be altered
1099 after column creation to control storage policy.
1104 <entry><structfield>attalign</structfield></entry>
1105 <entry><type>char</type></entry>
1108 A copy of <literal>pg_type.typalign</> of this column's type
1113 <entry><structfield>attnotnull</structfield></entry>
1114 <entry><type>bool</type></entry>
1117 This represents a not-null constraint.
1122 <entry><structfield>atthasdef</structfield></entry>
1123 <entry><type>bool</type></entry>
1126 This column has a default value, in which case there will be a
1127 corresponding entry in the <structname>pg_attrdef</structname>
1128 catalog that actually defines the value.
1133 <entry><structfield>attisdropped</structfield></entry>
1134 <entry><type>bool</type></entry>
1137 This column has been dropped and is no longer valid. A dropped
1138 column is still physically present in the table, but is
1139 ignored by the parser and so cannot be accessed via SQL.
1144 <entry><structfield>attislocal</structfield></entry>
1145 <entry><type>bool</type></entry>
1148 This column is defined locally in the relation. Note that a column can
1149 be locally defined and inherited simultaneously.
1154 <entry><structfield>attinhcount</structfield></entry>
1155 <entry><type>int4</type></entry>
1158 The number of direct ancestors this column has. A column with a
1159 nonzero number of ancestors cannot be dropped nor renamed.
1164 <entry><structfield>attcollation</structfield></entry>
1165 <entry><type>oid</type></entry>
1166 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1168 The defined collation of the column, or zero if the column is
1169 not of a collatable data type.
1174 <entry><structfield>attacl</structfield></entry>
1175 <entry><type>aclitem[]</type></entry>
1178 Column-level access privileges, if any have been granted specifically
1184 <entry><structfield>attoptions</structfield></entry>
1185 <entry><type>text[]</type></entry>
1188 Attribute-level options, as <quote>keyword=value</> strings
1193 <entry><structfield>attfdwoptions</structfield></entry>
1194 <entry><type>text[]</type></entry>
1197 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1206 In a dropped column's <structname>pg_attribute</structname> entry,
1207 <structfield>atttypid</structfield> is reset to zero, but
1208 <structfield>attlen</structfield> and the other fields copied from
1209 <structname>pg_type</> are still valid. This arrangement is needed
1210 to cope with the situation where the dropped column's data type was
1211 later dropped, and so there is no <structname>pg_type</> row anymore.
1212 <structfield>attlen</structfield> and the other fields can be used
1213 to interpret the contents of a row of the table.
1218 <sect1 id="catalog-pg-authid">
1219 <title><structname>pg_authid</structname></title>
1221 <indexterm zone="catalog-pg-authid">
1222 <primary>pg_authid</primary>
1226 The catalog <structname>pg_authid</structname> contains information about
1227 database authorization identifiers (roles). A role subsumes the concepts
1228 of <quote>users</> and <quote>groups</>. A user is essentially just a
1229 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1230 without <structfield>rolcanlogin</>) can have other roles as members; see
1231 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1235 Since this catalog contains passwords, it must not be publicly readable.
1236 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1237 is a publicly readable view on
1238 <structname>pg_authid</structname> that blanks out the password field.
1242 <xref linkend="user-manag"> contains detailed information about user and
1243 privilege management.
1247 Because user identities are cluster-wide,
1248 <structname>pg_authid</structname>
1249 is shared across all databases of a cluster: there is only one
1250 copy of <structname>pg_authid</structname> per cluster, not
1255 <title><structname>pg_authid</> Columns</title>
1262 <entry>Description</entry>
1269 <entry><structfield>oid</structfield></entry>
1270 <entry><type>oid</type></entry>
1271 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1275 <entry><structfield>rolname</structfield></entry>
1276 <entry><type>name</type></entry>
1277 <entry>Role name</entry>
1281 <entry><structfield>rolsuper</structfield></entry>
1282 <entry><type>bool</type></entry>
1283 <entry>Role has superuser privileges</entry>
1287 <entry><structfield>rolinherit</structfield></entry>
1288 <entry><type>bool</type></entry>
1289 <entry>Role automatically inherits privileges of roles it is a
1294 <entry><structfield>rolcreaterole</structfield></entry>
1295 <entry><type>bool</type></entry>
1296 <entry>Role can create more roles</entry>
1300 <entry><structfield>rolcreatedb</structfield></entry>
1301 <entry><type>bool</type></entry>
1302 <entry>Role can create databases</entry>
1306 <entry><structfield>rolcanlogin</structfield></entry>
1307 <entry><type>bool</type></entry>
1309 Role can log in. That is, this role can be given as the initial
1310 session authorization identifier
1315 <entry><structfield>rolreplication</structfield></entry>
1316 <entry><type>bool</type></entry>
1318 Role is a replication role. That is, this role can initiate streaming
1319 replication (see <xref linkend="streaming-replication">) and set/unset
1320 the system backup mode using <function>pg_start_backup</> and
1321 <function>pg_stop_backup</>
1326 <entry><structfield>rolbypassrls</structfield></entry>
1327 <entry><type>bool</type></entry>
1329 Role bypasses every row level security policy, see
1330 <xref linkend="ddl-rowsecurity"> for more information.
1335 <entry><structfield>rolconnlimit</structfield></entry>
1336 <entry><type>int4</type></entry>
1338 For roles that can log in, this sets maximum number of concurrent
1339 connections this role can make. -1 means no limit.
1344 <entry><structfield>rolpassword</structfield></entry>
1345 <entry><type>text</type></entry>
1347 Password (possibly encrypted); null if none. The format depends
1348 on the form of encryption used.
1353 <entry><structfield>rolvaliduntil</structfield></entry>
1354 <entry><type>timestamptz</type></entry>
1355 <entry>Password expiry time (only used for password authentication);
1356 null if no expiration</entry>
1363 For an MD5 encrypted password, <structfield>rolpassword</structfield>
1364 column will begin with the string <literal>md5</> followed by a
1365 32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
1366 password concatenated to their user name. For example, if user
1367 <literal>joe</> has password <literal>xyzzy</>, <productname>PostgreSQL</>
1368 will store the md5 hash of <literal>xyzzyjoe</>. If the password is
1369 encrypted with SCRAM-SHA-256, it consists of 5 fields separated by colons.
1370 The first field is the constant <literal>scram-sha-256</literal>, to
1371 identify the password as a SCRAM-SHA-256 verifier. The second field is a
1372 salt, Base64-encoded, and the third field is the number of iterations used
1373 to generate the password. The fourth field and fifth field are the stored
1374 key and server key, respectively, in hexadecimal format. A password that
1375 does not follow either of those formats is assumed to be unencrypted.
1380 <sect1 id="catalog-pg-auth-members">
1381 <title><structname>pg_auth_members</structname></title>
1383 <indexterm zone="catalog-pg-auth-members">
1384 <primary>pg_auth_members</primary>
1388 The catalog <structname>pg_auth_members</structname> shows the membership
1389 relations between roles. Any non-circular set of relationships is allowed.
1393 Because user identities are cluster-wide,
1394 <structname>pg_auth_members</structname>
1395 is shared across all databases of a cluster: there is only one
1396 copy of <structname>pg_auth_members</structname> per cluster, not
1401 <title><structname>pg_auth_members</> Columns</title>
1408 <entry>References</entry>
1409 <entry>Description</entry>
1415 <entry><structfield>roleid</structfield></entry>
1416 <entry><type>oid</type></entry>
1417 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1418 <entry>ID of a role that has a member</entry>
1422 <entry><structfield>member</structfield></entry>
1423 <entry><type>oid</type></entry>
1424 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1425 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1429 <entry><structfield>grantor</structfield></entry>
1430 <entry><type>oid</type></entry>
1431 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1432 <entry>ID of the role that granted this membership</entry>
1436 <entry><structfield>admin_option</structfield></entry>
1437 <entry><type>bool</type></entry>
1439 <entry>True if <structfield>member</> can grant membership in
1440 <structfield>roleid</> to others</entry>
1449 <sect1 id="catalog-pg-cast">
1450 <title><structname>pg_cast</structname></title>
1452 <indexterm zone="catalog-pg-cast">
1453 <primary>pg_cast</primary>
1457 The catalog <structname>pg_cast</structname> stores data type conversion
1458 paths, both built-in and user-defined.
1462 It should be noted that <structname>pg_cast</structname> does not represent
1463 every type conversion that the system knows how to perform; only those that
1464 cannot be deduced from some generic rule. For example, casting between a
1465 domain and its base type is not explicitly represented in
1466 <structname>pg_cast</structname>. Another important exception is that
1467 <quote>automatic I/O conversion casts</>, those performed using a data
1468 type's own I/O functions to convert to or from <type>text</> or other
1469 string types, are not explicitly represented in
1470 <structname>pg_cast</structname>.
1474 <title><structname>pg_cast</> Columns</title>
1481 <entry>References</entry>
1482 <entry>Description</entry>
1488 <entry><structfield>oid</structfield></entry>
1489 <entry><type>oid</type></entry>
1491 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1495 <entry><structfield>castsource</structfield></entry>
1496 <entry><type>oid</type></entry>
1497 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1498 <entry>OID of the source data type</entry>
1502 <entry><structfield>casttarget</structfield></entry>
1503 <entry><type>oid</type></entry>
1504 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1505 <entry>OID of the target data type</entry>
1509 <entry><structfield>castfunc</structfield></entry>
1510 <entry><type>oid</type></entry>
1511 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1513 The OID of the function to use to perform this cast. Zero is
1514 stored if the cast method doesn't require a function.
1519 <entry><structfield>castcontext</structfield></entry>
1520 <entry><type>char</type></entry>
1523 Indicates what contexts the cast can be invoked in.
1524 <literal>e</> means only as an explicit cast (using
1525 <literal>CAST</> or <literal>::</> syntax).
1526 <literal>a</> means implicitly in assignment
1527 to a target column, as well as explicitly.
1528 <literal>i</> means implicitly in expressions, as well as the
1533 <entry><structfield>castmethod</structfield></entry>
1534 <entry><type>char</type></entry>
1537 Indicates how the cast is performed.
1538 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1539 <literal>i</> means that the input/output functions are used.
1540 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1548 The cast functions listed in <structname>pg_cast</structname> must
1549 always take the cast source type as their first argument type, and
1550 return the cast destination type as their result type. A cast
1551 function can have up to three arguments. The second argument,
1552 if present, must be type <type>integer</>; it receives the type
1553 modifier associated with the destination type, or -1
1554 if there is none. The third argument,
1555 if present, must be type <type>boolean</>; it receives <literal>true</>
1556 if the cast is an explicit cast, <literal>false</> otherwise.
1560 It is legitimate to create a <structname>pg_cast</structname> entry
1561 in which the source and target types are the same, if the associated
1562 function takes more than one argument. Such entries represent
1563 <quote>length coercion functions</> that coerce values of the type
1564 to be legal for a particular type modifier value.
1568 When a <structname>pg_cast</structname> entry has different source and
1569 target types and a function that takes more than one argument, it
1570 represents converting from one type to another and applying a length
1571 coercion in a single step. When no such entry is available, coercion
1572 to a type that uses a type modifier involves two steps, one to
1573 convert between data types and a second to apply the modifier.
1577 <sect1 id="catalog-pg-class">
1578 <title><structname>pg_class</structname></title>
1580 <indexterm zone="catalog-pg-class">
1581 <primary>pg_class</primary>
1585 The catalog <structname>pg_class</structname> catalogs tables and most
1586 everything else that has columns or is otherwise similar to a
1587 table. This includes indexes (but see also
1588 <structname>pg_index</structname>), sequences (but see also
1589 <structname>pg_sequence</structname>), views, materialized
1590 views, composite types, and TOAST tables; see <structfield>relkind</>.
1591 Below, when we mean all of these
1592 kinds of objects we speak of <quote>relations</quote>. Not all
1593 columns are meaningful for all relation types.
1597 <title><structname>pg_class</> Columns</title>
1604 <entry>References</entry>
1605 <entry>Description</entry>
1611 <entry><structfield>oid</structfield></entry>
1612 <entry><type>oid</type></entry>
1614 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1618 <entry><structfield>relname</structfield></entry>
1619 <entry><type>name</type></entry>
1621 <entry>Name of the table, index, view, etc.</entry>
1625 <entry><structfield>relnamespace</structfield></entry>
1626 <entry><type>oid</type></entry>
1627 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1629 The OID of the namespace that contains this relation
1634 <entry><structfield>reltype</structfield></entry>
1635 <entry><type>oid</type></entry>
1636 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1638 The OID of the data type that corresponds to this table's row type,
1639 if any (zero for indexes, which have no <structname>pg_type</> entry)
1644 <entry><structfield>reloftype</structfield></entry>
1645 <entry><type>oid</type></entry>
1646 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1648 For typed tables, the OID of the underlying composite type,
1649 zero for all other relations
1654 <entry><structfield>relowner</structfield></entry>
1655 <entry><type>oid</type></entry>
1656 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1657 <entry>Owner of the relation</entry>
1661 <entry><structfield>relam</structfield></entry>
1662 <entry><type>oid</type></entry>
1663 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1664 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1668 <entry><structfield>relfilenode</structfield></entry>
1669 <entry><type>oid</type></entry>
1671 <entry>Name of the on-disk file of this relation; zero means this
1672 is a <quote>mapped</> relation whose disk file name is determined
1673 by low-level state</entry>
1677 <entry><structfield>reltablespace</structfield></entry>
1678 <entry><type>oid</type></entry>
1679 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1681 The tablespace in which this relation is stored. If zero,
1682 the database's default tablespace is implied. (Not meaningful
1683 if the relation has no on-disk file.)
1688 <entry><structfield>relpages</structfield></entry>
1689 <entry><type>int4</type></entry>
1692 Size of the on-disk representation of this table in pages (of size
1693 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1694 planner. It is updated by <command>VACUUM</command>,
1695 <command>ANALYZE</command>, and a few DDL commands such as
1696 <command>CREATE INDEX</command>.
1701 <entry><structfield>reltuples</structfield></entry>
1702 <entry><type>float4</type></entry>
1705 Number of rows in the table. This is only an estimate used by the
1706 planner. It is updated by <command>VACUUM</command>,
1707 <command>ANALYZE</command>, and a few DDL commands such as
1708 <command>CREATE INDEX</command>.
1713 <entry><structfield>relallvisible</structfield></entry>
1714 <entry><type>int4</type></entry>
1717 Number of pages that are marked all-visible in the table's
1718 visibility map. This is only an estimate used by the
1719 planner. It is updated by <command>VACUUM</command>,
1720 <command>ANALYZE</command>, and a few DDL commands such as
1721 <command>CREATE INDEX</command>.
1726 <entry><structfield>reltoastrelid</structfield></entry>
1727 <entry><type>oid</type></entry>
1728 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1730 OID of the TOAST table associated with this table, 0 if none. The
1731 TOAST table stores large attributes <quote>out of line</quote> in a
1737 <entry><structfield>relhasindex</structfield></entry>
1738 <entry><type>bool</type></entry>
1741 True if this is a table and it has (or recently had) any indexes
1746 <entry><structfield>relisshared</structfield></entry>
1747 <entry><type>bool</type></entry>
1750 True if this table is shared across all databases in the cluster. Only
1751 certain system catalogs (such as <structname>pg_database</structname>)
1757 <entry><structfield>relpersistence</structfield></entry>
1758 <entry><type>char</type></entry>
1761 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1762 <literal>t</> = temporary table
1767 <entry><structfield>relkind</structfield></entry>
1768 <entry><type>char</type></entry>
1771 <literal>r</> = ordinary table,
1772 <literal>i</> = index,
1773 <literal>S</> = sequence,
1774 <literal>t</> = TOAST table,
1775 <literal>v</> = view,
1776 <literal>m</> = materialized view,
1777 <literal>c</> = composite type,
1778 <literal>f</> = foreign table,
1779 <literal>p</> = partitioned table
1784 <entry><structfield>relnatts</structfield></entry>
1785 <entry><type>int2</type></entry>
1788 Number of user columns in the relation (system columns not
1789 counted). There must be this many corresponding entries in
1790 <structname>pg_attribute</structname>. See also
1791 <literal>pg_attribute.attnum</literal>.
1796 <entry><structfield>relchecks</structfield></entry>
1797 <entry><type>int2</type></entry>
1800 Number of <literal>CHECK</> constraints on the table; see
1801 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1806 <entry><structfield>relhasoids</structfield></entry>
1807 <entry><type>bool</type></entry>
1810 True if we generate an OID for each row of the relation
1815 <entry><structfield>relhaspkey</structfield></entry>
1816 <entry><type>bool</type></entry>
1819 True if the table has (or once had) a primary key
1824 <entry><structfield>relhasrules</structfield></entry>
1825 <entry><type>bool</type></entry>
1828 True if table has (or once had) rules; see
1829 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1834 <entry><structfield>relhastriggers</structfield></entry>
1835 <entry><type>bool</type></entry>
1838 True if table has (or once had) triggers; see
1839 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1844 <entry><structfield>relhassubclass</structfield></entry>
1845 <entry><type>bool</type></entry>
1847 <entry>True if table has (or once had) any inheritance children</entry>
1851 <entry><structfield>relrowsecurity</structfield></entry>
1852 <entry><type>bool</type></entry>
1855 True if table has row level security enabled; see
1856 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1861 <entry><structfield>relforcerowsecurity</structfield></entry>
1862 <entry><type>bool</type></entry>
1865 True if row level security (when enabled) will also apply to table owner; see
1866 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1871 <entry><structfield>relispopulated</structfield></entry>
1872 <entry><type>bool</type></entry>
1874 <entry>True if relation is populated (this is true for all
1875 relations other than some materialized views)</entry>
1879 <entry><structfield>relreplident</structfield></entry>
1880 <entry><type>char</type></entry>
1883 Columns used to form <quote>replica identity</> for rows:
1884 <literal>d</> = default (primary key, if any),
1885 <literal>n</> = nothing,
1886 <literal>f</> = all columns
1887 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1892 <entry><structfield>relispartition</structfield></entry>
1893 <entry><type>bool</type></entry>
1895 <entry>True if table is a partition</entry>
1899 <entry><structfield>relfrozenxid</structfield></entry>
1900 <entry><type>xid</type></entry>
1903 All transaction IDs before this one have been replaced with a permanent
1904 (<quote>frozen</>) transaction ID in this table. This is used to track
1905 whether the table needs to be vacuumed in order to prevent transaction
1906 ID wraparound or to allow <literal>pg_xact</> to be shrunk. Zero
1907 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1912 <entry><structfield>relminmxid</structfield></entry>
1913 <entry><type>xid</type></entry>
1916 All multixact IDs before this one have been replaced by a
1917 transaction ID in this table. This is used to track
1918 whether the table needs to be vacuumed in order to prevent multixact ID
1919 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
1920 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1925 <entry><structfield>relacl</structfield></entry>
1926 <entry><type>aclitem[]</type></entry>
1929 Access privileges; see
1930 <xref linkend="sql-grant"> and
1931 <xref linkend="sql-revoke">
1937 <entry><structfield>reloptions</structfield></entry>
1938 <entry><type>text[]</type></entry>
1941 Access-method-specific options, as <quote>keyword=value</> strings
1946 <entry><structfield>relpartbound</structfield></entry>
1947 <entry><type>pg_node_tree</type></entry>
1950 If table is a partition (see <structfield>relispartition</structfield>),
1951 internal representation of the partition bound
1959 Several of the Boolean flags in <structname>pg_class</> are maintained
1960 lazily: they are guaranteed to be true if that's the correct state, but
1961 may not be reset to false immediately when the condition is no longer
1962 true. For example, <structfield>relhasindex</> is set by
1963 <command>CREATE INDEX</command>, but it is never cleared by
1964 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1965 <structfield>relhasindex</> if it finds the table has no indexes. This
1966 arrangement avoids race conditions and improves concurrency.
1970 <sect1 id="catalog-pg-collation">
1971 <title><structname>pg_collation</structname></title>
1973 <indexterm zone="catalog-pg-collation">
1974 <primary>pg_collation</primary>
1978 The catalog <structname>pg_collation</structname> describes the
1979 available collations, which are essentially mappings from an SQL
1980 name to operating system locale categories.
1981 See <xref linkend="collation"> for more information.
1985 <title><structname>pg_collation</> Columns</title>
1992 <entry>References</entry>
1993 <entry>Description</entry>
1999 <entry><structfield>oid</structfield></entry>
2000 <entry><type>oid</type></entry>
2002 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2006 <entry><structfield>collname</structfield></entry>
2007 <entry><type>name</type></entry>
2009 <entry>Collation name (unique per namespace and encoding)</entry>
2013 <entry><structfield>collnamespace</structfield></entry>
2014 <entry><type>oid</type></entry>
2015 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2017 The OID of the namespace that contains this collation
2022 <entry><structfield>collowner</structfield></entry>
2023 <entry><type>oid</type></entry>
2024 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2025 <entry>Owner of the collation</entry>
2029 <entry><structfield>collprovider</structfield></entry>
2030 <entry><type>char</type></entry>
2032 <entry>Provider of the collation: <literal>d</literal> = database
2033 default, <literal>c</literal> = libc, <literal>i</literal> = icu</entry>
2037 <entry><structfield>collencoding</structfield></entry>
2038 <entry><type>int4</type></entry>
2040 <entry>Encoding in which the collation is applicable, or -1 if it
2041 works for any encoding</entry>
2045 <entry><structfield>collcollate</structfield></entry>
2046 <entry><type>name</type></entry>
2048 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2052 <entry><structfield>collctype</structfield></entry>
2053 <entry><type>name</type></entry>
2055 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2059 <entry><structfield>collversion</structfield></entry>
2060 <entry><type>text</type></entry>
2063 Provider-specific version of the collation. This is recorded when the
2064 collation is created and then checked when it is used, to detect
2065 changes in the collation definition that could lead to data corruption.
2073 Note that the unique key on this catalog is (<structfield>collname</>,
2074 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2075 (<structfield>collname</>, <structfield>collnamespace</>).
2076 <productname>PostgreSQL</productname> generally ignores all
2077 collations that do not have <structfield>collencoding</> equal to
2078 either the current database's encoding or -1, and creation of new entries
2079 with the same name as an entry with <structfield>collencoding</> = -1
2080 is forbidden. Therefore it is sufficient to use a qualified SQL name
2081 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2082 even though this is not unique according to the catalog definition.
2083 The reason for defining the catalog this way is that
2084 <application>initdb</> fills it in at cluster initialization time with
2085 entries for all locales available on the system, so it must be able to
2086 hold entries for all encodings that might ever be used in the cluster.
2090 In the <literal>template0</> database, it could be useful to create
2091 collations whose encoding does not match the database encoding,
2092 since they could match the encodings of databases later cloned from
2093 <literal>template0</>. This would currently have to be done manually.
2097 <sect1 id="catalog-pg-constraint">
2098 <title><structname>pg_constraint</structname></title>
2100 <indexterm zone="catalog-pg-constraint">
2101 <primary>pg_constraint</primary>
2105 The catalog <structname>pg_constraint</structname> stores check, primary
2106 key, unique, foreign key, and exclusion constraints on tables.
2107 (Column constraints are not treated specially. Every column constraint is
2108 equivalent to some table constraint.)
2109 Not-null constraints are represented in the <structname>pg_attribute</>
2114 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2115 TRIGGER</>) also give rise to an entry in this table.
2119 Check constraints on domains are stored here, too.
2123 <title><structname>pg_constraint</> Columns</title>
2130 <entry>References</entry>
2131 <entry>Description</entry>
2137 <entry><structfield>oid</structfield></entry>
2138 <entry><type>oid</type></entry>
2140 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2144 <entry><structfield>conname</structfield></entry>
2145 <entry><type>name</type></entry>
2147 <entry>Constraint name (not necessarily unique!)</entry>
2151 <entry><structfield>connamespace</structfield></entry>
2152 <entry><type>oid</type></entry>
2153 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2155 The OID of the namespace that contains this constraint
2160 <entry><structfield>contype</structfield></entry>
2161 <entry><type>char</type></entry>
2164 <literal>c</> = check constraint,
2165 <literal>f</> = foreign key constraint,
2166 <literal>p</> = primary key constraint,
2167 <literal>u</> = unique constraint,
2168 <literal>t</> = constraint trigger,
2169 <literal>x</> = exclusion constraint
2174 <entry><structfield>condeferrable</structfield></entry>
2175 <entry><type>bool</type></entry>
2177 <entry>Is the constraint deferrable?</entry>
2181 <entry><structfield>condeferred</structfield></entry>
2182 <entry><type>bool</type></entry>
2184 <entry>Is the constraint deferred by default?</entry>
2188 <entry><structfield>convalidated</structfield></entry>
2189 <entry><type>bool</type></entry>
2191 <entry>Has the constraint been validated?
2192 Currently, can only be false for foreign keys and CHECK constraints</entry>
2196 <entry><structfield>conrelid</structfield></entry>
2197 <entry><type>oid</type></entry>
2198 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2199 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2203 <entry><structfield>contypid</structfield></entry>
2204 <entry><type>oid</type></entry>
2205 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2206 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2210 <entry><structfield>conindid</structfield></entry>
2211 <entry><type>oid</type></entry>
2212 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2213 <entry>The index supporting this constraint, if it's a unique, primary
2214 key, foreign key, or exclusion constraint; else 0</entry>
2218 <entry><structfield>confrelid</structfield></entry>
2219 <entry><type>oid</type></entry>
2220 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2221 <entry>If a foreign key, the referenced table; else 0</entry>
2225 <entry><structfield>confupdtype</structfield></entry>
2226 <entry><type>char</type></entry>
2228 <entry>Foreign key update action code:
2229 <literal>a</> = no action,
2230 <literal>r</> = restrict,
2231 <literal>c</> = cascade,
2232 <literal>n</> = set null,
2233 <literal>d</> = set default
2238 <entry><structfield>confdeltype</structfield></entry>
2239 <entry><type>char</type></entry>
2241 <entry>Foreign key deletion action code:
2242 <literal>a</> = no action,
2243 <literal>r</> = restrict,
2244 <literal>c</> = cascade,
2245 <literal>n</> = set null,
2246 <literal>d</> = set default
2251 <entry><structfield>confmatchtype</structfield></entry>
2252 <entry><type>char</type></entry>
2254 <entry>Foreign key match type:
2255 <literal>f</> = full,
2256 <literal>p</> = partial,
2257 <literal>s</> = simple
2262 <entry><structfield>conislocal</structfield></entry>
2263 <entry><type>bool</type></entry>
2266 This constraint is defined locally for the relation. Note that a
2267 constraint can be locally defined and inherited simultaneously.
2272 <entry><structfield>coninhcount</structfield></entry>
2273 <entry><type>int4</type></entry>
2276 The number of direct inheritance ancestors this constraint has.
2278 a nonzero number of ancestors cannot be dropped nor renamed.
2283 <entry><structfield>connoinherit</structfield></entry>
2284 <entry><type>bool</type></entry>
2287 This constraint is defined locally for the relation. It is a
2288 non-inheritable constraint.
2293 <entry><structfield>conkey</structfield></entry>
2294 <entry><type>int2[]</type></entry>
2295 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2296 <entry>If a table constraint (including foreign keys, but not constraint
2297 triggers), list of the constrained columns</entry>
2301 <entry><structfield>confkey</structfield></entry>
2302 <entry><type>int2[]</type></entry>
2303 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2304 <entry>If a foreign key, list of the referenced columns</entry>
2308 <entry><structfield>conpfeqop</structfield></entry>
2309 <entry><type>oid[]</type></entry>
2310 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2311 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2315 <entry><structfield>conppeqop</structfield></entry>
2316 <entry><type>oid[]</type></entry>
2317 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2318 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2322 <entry><structfield>conffeqop</structfield></entry>
2323 <entry><type>oid[]</type></entry>
2324 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2325 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2329 <entry><structfield>conexclop</structfield></entry>
2330 <entry><type>oid[]</type></entry>
2331 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2332 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2336 <entry><structfield>conbin</structfield></entry>
2337 <entry><type>pg_node_tree</type></entry>
2339 <entry>If a check constraint, an internal representation of the expression</entry>
2343 <entry><structfield>consrc</structfield></entry>
2344 <entry><type>text</type></entry>
2346 <entry>If a check constraint, a human-readable representation of the expression</entry>
2353 In the case of an exclusion constraint, <structfield>conkey</structfield>
2354 is only useful for constraint elements that are simple column references.
2355 For other cases, a zero appears in <structfield>conkey</structfield>
2356 and the associated index must be consulted to discover the expression
2357 that is constrained. (<structfield>conkey</structfield> thus has the
2358 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2364 <structfield>consrc</structfield> is not updated when referenced objects
2365 change; for example, it won't track renaming of columns. Rather than
2366 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2367 to extract the definition of a check constraint.
2373 <literal>pg_class.relchecks</literal> needs to agree with the
2374 number of check-constraint entries found in this table for each
2381 <sect1 id="catalog-pg-conversion">
2382 <title><structname>pg_conversion</structname></title>
2384 <indexterm zone="catalog-pg-conversion">
2385 <primary>pg_conversion</primary>
2389 The catalog <structname>pg_conversion</structname> describes
2390 encoding conversion procedures. See <xref linkend="sql-createconversion">
2391 for more information.
2395 <title><structname>pg_conversion</> Columns</title>
2402 <entry>References</entry>
2403 <entry>Description</entry>
2409 <entry><structfield>oid</structfield></entry>
2410 <entry><type>oid</type></entry>
2412 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2416 <entry><structfield>conname</structfield></entry>
2417 <entry><type>name</type></entry>
2419 <entry>Conversion name (unique within a namespace)</entry>
2423 <entry><structfield>connamespace</structfield></entry>
2424 <entry><type>oid</type></entry>
2425 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2427 The OID of the namespace that contains this conversion
2432 <entry><structfield>conowner</structfield></entry>
2433 <entry><type>oid</type></entry>
2434 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2435 <entry>Owner of the conversion</entry>
2439 <entry><structfield>conforencoding</structfield></entry>
2440 <entry><type>int4</type></entry>
2442 <entry>Source encoding ID</entry>
2446 <entry><structfield>contoencoding</structfield></entry>
2447 <entry><type>int4</type></entry>
2449 <entry>Destination encoding ID</entry>
2453 <entry><structfield>conproc</structfield></entry>
2454 <entry><type>regproc</type></entry>
2455 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2456 <entry>Conversion procedure</entry>
2460 <entry><structfield>condefault</structfield></entry>
2461 <entry><type>bool</type></entry>
2463 <entry>True if this is the default conversion</entry>
2472 <sect1 id="catalog-pg-database">
2473 <title><structname>pg_database</structname></title>
2475 <indexterm zone="catalog-pg-database">
2476 <primary>pg_database</primary>
2480 The catalog <structname>pg_database</structname> stores information about
2481 the available databases. Databases are created with the <xref
2482 linkend="sql-createdatabase"> command.
2483 Consult <xref linkend="managing-databases"> for details about the meaning
2484 of some of the parameters.
2488 Unlike most system catalogs, <structname>pg_database</structname>
2489 is shared across all databases of a cluster: there is only one
2490 copy of <structname>pg_database</structname> per cluster, not
2495 <title><structname>pg_database</> Columns</title>
2502 <entry>References</entry>
2503 <entry>Description</entry>
2509 <entry><structfield>oid</structfield></entry>
2510 <entry><type>oid</type></entry>
2512 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2516 <entry><structfield>datname</structfield></entry>
2517 <entry><type>name</type></entry>
2519 <entry>Database name</entry>
2523 <entry><structfield>datdba</structfield></entry>
2524 <entry><type>oid</type></entry>
2525 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2526 <entry>Owner of the database, usually the user who created it</entry>
2530 <entry><structfield>encoding</structfield></entry>
2531 <entry><type>int4</type></entry>
2533 <entry>Character encoding for this database
2534 (<function>pg_encoding_to_char()</function> can translate
2535 this number to the encoding name)</entry>
2539 <entry><structfield>datcollate</structfield></entry>
2540 <entry><type>name</type></entry>
2542 <entry>LC_COLLATE for this database</entry>
2546 <entry><structfield>datctype</structfield></entry>
2547 <entry><type>name</type></entry>
2549 <entry>LC_CTYPE for this database</entry>
2553 <entry><structfield>datistemplate</structfield></entry>
2554 <entry><type>bool</type></entry>
2557 If true, then this database can be cloned by
2558 any user with <literal>CREATEDB</> privileges;
2559 if false, then only superusers or the owner of
2560 the database can clone it.
2565 <entry><structfield>datallowconn</structfield></entry>
2566 <entry><type>bool</type></entry>
2569 If false then no one can connect to this database. This is
2570 used to protect the <literal>template0</> database from being altered.
2575 <entry><structfield>datconnlimit</structfield></entry>
2576 <entry><type>int4</type></entry>
2579 Sets maximum number of concurrent connections that can be made
2580 to this database. -1 means no limit.
2585 <entry><structfield>datlastsysoid</structfield></entry>
2586 <entry><type>oid</type></entry>
2589 Last system OID in the database; useful
2590 particularly to <application>pg_dump</application>
2595 <entry><structfield>datfrozenxid</structfield></entry>
2596 <entry><type>xid</type></entry>
2599 All transaction IDs before this one have been replaced with a permanent
2600 (<quote>frozen</>) transaction ID in this database. This is used to
2601 track whether the database needs to be vacuumed in order to prevent
2602 transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
2603 It is the minimum of the per-table
2604 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2609 <entry><structfield>datminmxid</structfield></entry>
2610 <entry><type>xid</type></entry>
2613 All multixact IDs before this one have been replaced with a
2614 transaction ID in this database. This is used to
2615 track whether the database needs to be vacuumed in order to prevent
2616 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2617 It is the minimum of the per-table
2618 <structname>pg_class</>.<structfield>relminmxid</> values.
2623 <entry><structfield>dattablespace</structfield></entry>
2624 <entry><type>oid</type></entry>
2625 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2627 The default tablespace for the database.
2628 Within this database, all tables for which
2629 <structname>pg_class</>.<structfield>reltablespace</> is zero
2630 will be stored in this tablespace; in particular, all the non-shared
2631 system catalogs will be there.
2636 <entry><structfield>datacl</structfield></entry>
2637 <entry><type>aclitem[]</type></entry>
2640 Access privileges; see
2641 <xref linkend="sql-grant"> and
2642 <xref linkend="sql-revoke">
2652 <sect1 id="catalog-pg-db-role-setting">
2653 <title><structname>pg_db_role_setting</structname></title>
2655 <indexterm zone="catalog-pg-db-role-setting">
2656 <primary>pg_db_role_setting</primary>
2660 The catalog <structname>pg_db_role_setting</structname> records the default
2661 values that have been set for run-time configuration variables,
2662 for each role and database combination.
2666 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2667 is shared across all databases of a cluster: there is only one
2668 copy of <structname>pg_db_role_setting</structname> per cluster, not
2673 <title><structname>pg_db_role_setting</> Columns</title>
2680 <entry>References</entry>
2681 <entry>Description</entry>
2687 <entry><structfield>setdatabase</structfield></entry>
2688 <entry><type>oid</type></entry>
2689 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2690 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2694 <entry><structfield>setrole</structfield></entry>
2695 <entry><type>oid</type></entry>
2696 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2697 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2701 <entry><structfield>setconfig</structfield></entry>
2702 <entry><type>text[]</type></entry>
2704 <entry>Defaults for run-time configuration variables</entry>
2712 <sect1 id="catalog-pg-default-acl">
2713 <title><structname>pg_default_acl</structname></title>
2715 <indexterm zone="catalog-pg-default-acl">
2716 <primary>pg_default_acl</primary>
2720 The catalog <structname>pg_default_acl</> stores initial
2721 privileges to be assigned to newly created objects.
2725 <title><structname>pg_default_acl</> Columns</title>
2732 <entry>References</entry>
2733 <entry>Description</entry>
2739 <entry><structfield>oid</structfield></entry>
2740 <entry><type>oid</type></entry>
2742 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2746 <entry><structfield>defaclrole</structfield></entry>
2747 <entry><type>oid</type></entry>
2748 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2749 <entry>The OID of the role associated with this entry</entry>
2753 <entry><structfield>defaclnamespace</structfield></entry>
2754 <entry><type>oid</type></entry>
2755 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2756 <entry>The OID of the namespace associated with this entry,
2757 or 0 if none</entry>
2761 <entry><structfield>defaclobjtype</structfield></entry>
2762 <entry><type>char</type></entry>
2765 Type of object this entry is for:
2766 <literal>r</> = relation (table, view),
2767 <literal>S</> = sequence,
2768 <literal>f</> = function,
2769 <literal>T</> = type
2774 <entry><structfield>defaclacl</structfield></entry>
2775 <entry><type>aclitem[]</type></entry>
2778 Access privileges that this type of object should have on creation
2786 A <structname>pg_default_acl</> entry shows the initial privileges to
2787 be assigned to an object belonging to the indicated user. There are
2788 currently two types of entry: <quote>global</> entries with
2789 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2790 that reference a particular schema. If a global entry is present then
2791 it <emphasis>overrides</> the normal hard-wired default privileges
2792 for the object type. A per-schema entry, if present, represents privileges
2793 to be <emphasis>added to</> the global or hard-wired default privileges.
2797 Note that when an ACL entry in another catalog is null, it is taken
2798 to represent the hard-wired default privileges for its object,
2799 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2800 at the moment. <structname>pg_default_acl</> is only consulted during
2807 <sect1 id="catalog-pg-depend">
2808 <title><structname>pg_depend</structname></title>
2810 <indexterm zone="catalog-pg-depend">
2811 <primary>pg_depend</primary>
2815 The catalog <structname>pg_depend</structname> records the dependency
2816 relationships between database objects. This information allows
2817 <command>DROP</> commands to find which other objects must be dropped
2818 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2823 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2824 which performs a similar function for dependencies involving objects
2825 that are shared across a database cluster.
2829 <title><structname>pg_depend</> Columns</title>
2836 <entry>References</entry>
2837 <entry>Description</entry>
2843 <entry><structfield>classid</structfield></entry>
2844 <entry><type>oid</type></entry>
2845 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2846 <entry>The OID of the system catalog the dependent object is in</entry>
2850 <entry><structfield>objid</structfield></entry>
2851 <entry><type>oid</type></entry>
2852 <entry>any OID column</entry>
2853 <entry>The OID of the specific dependent object</entry>
2857 <entry><structfield>objsubid</structfield></entry>
2858 <entry><type>int4</type></entry>
2861 For a table column, this is the column number (the
2862 <structfield>objid</> and <structfield>classid</> refer to the
2863 table itself). For all other object types, this column is
2869 <entry><structfield>refclassid</structfield></entry>
2870 <entry><type>oid</type></entry>
2871 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2872 <entry>The OID of the system catalog the referenced object is in</entry>
2876 <entry><structfield>refobjid</structfield></entry>
2877 <entry><type>oid</type></entry>
2878 <entry>any OID column</entry>
2879 <entry>The OID of the specific referenced object</entry>
2883 <entry><structfield>refobjsubid</structfield></entry>
2884 <entry><type>int4</type></entry>
2887 For a table column, this is the column number (the
2888 <structfield>refobjid</> and <structfield>refclassid</> refer
2889 to the table itself). For all other object types, this column
2895 <entry><structfield>deptype</structfield></entry>
2896 <entry><type>char</type></entry>
2899 A code defining the specific semantics of this dependency relationship; see text
2908 In all cases, a <structname>pg_depend</structname> entry indicates that the
2909 referenced object cannot be dropped without also dropping the dependent
2910 object. However, there are several subflavors identified by
2911 <structfield>deptype</>:
2915 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2918 A normal relationship between separately-created objects. The
2919 dependent object can be dropped without affecting the
2920 referenced object. The referenced object can only be dropped
2921 by specifying <literal>CASCADE</>, in which case the dependent
2922 object is dropped, too. Example: a table column has a normal
2923 dependency on its data type.
2929 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2932 The dependent object can be dropped separately from the
2933 referenced object, and should be automatically dropped
2934 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2935 mode) if the referenced object is dropped. Example: a named
2936 constraint on a table is made autodependent on the table, so
2937 that it will go away if the table is dropped.
2943 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2946 The dependent object was created as part of creation of the
2947 referenced object, and is really just a part of its internal
2948 implementation. A <command>DROP</> of the dependent object
2949 will be disallowed outright (we'll tell the user to issue a
2950 <command>DROP</> against the referenced object, instead). A
2951 <command>DROP</> of the referenced object will be propagated
2952 through to drop the dependent object whether
2953 <command>CASCADE</> is specified or not. Example: a trigger
2954 that's created to enforce a foreign-key constraint is made
2955 internally dependent on the constraint's
2956 <structname>pg_constraint</> entry.
2962 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2965 The dependent object is a member of the <firstterm>extension</> that is
2966 the referenced object (see
2967 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2968 The dependent object can be dropped only via
2969 <command>DROP EXTENSION</> on the referenced object. Functionally
2970 this dependency type acts the same as an internal dependency, but
2971 it's kept separate for clarity and to simplify <application>pg_dump</>.
2977 <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2980 The dependent object is not a member of the extension that is the
2981 referenced object (and so should not be ignored by pg_dump), but
2982 cannot function without it and should be dropped when the
2983 extension itself is. The dependent object may be dropped on its
2990 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2993 There is no dependent object; this type of entry is a signal
2994 that the system itself depends on the referenced object, and so
2995 that object must never be deleted. Entries of this type are
2996 created only by <command>initdb</command>. The columns for the
2997 dependent object contain zeroes.
3003 Other dependency flavors might be needed in future.
3009 <sect1 id="catalog-pg-description">
3010 <title><structname>pg_description</structname></title>
3012 <indexterm zone="catalog-pg-description">
3013 <primary>pg_description</primary>
3017 The catalog <structname>pg_description</> stores optional descriptions
3018 (comments) for each database object. Descriptions can be manipulated
3019 with the <xref linkend="sql-comment"> command and viewed with
3020 <application>psql</application>'s <literal>\d</literal> commands.
3021 Descriptions of many built-in system objects are provided in the initial
3022 contents of <structname>pg_description</structname>.
3026 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3027 which performs a similar function for descriptions involving objects that
3028 are shared across a database cluster.
3032 <title><structname>pg_description</> Columns</title>
3039 <entry>References</entry>
3040 <entry>Description</entry>
3046 <entry><structfield>objoid</structfield></entry>
3047 <entry><type>oid</type></entry>
3048 <entry>any OID column</entry>
3049 <entry>The OID of the object this description pertains to</entry>
3053 <entry><structfield>classoid</structfield></entry>
3054 <entry><type>oid</type></entry>
3055 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3056 <entry>The OID of the system catalog this object appears in</entry>
3060 <entry><structfield>objsubid</structfield></entry>
3061 <entry><type>int4</type></entry>
3064 For a comment on a table column, this is the column number (the
3065 <structfield>objoid</> and <structfield>classoid</> refer to
3066 the table itself). For all other object types, this column is
3072 <entry><structfield>description</structfield></entry>
3073 <entry><type>text</type></entry>
3075 <entry>Arbitrary text that serves as the description of this object</entry>
3084 <sect1 id="catalog-pg-enum">
3085 <title><structname>pg_enum</structname></title>
3087 <indexterm zone="catalog-pg-enum">
3088 <primary>pg_enum</primary>
3092 The <structname>pg_enum</structname> catalog contains entries
3093 showing the values and labels for each enum type. The
3094 internal representation of a given enum value is actually the OID
3095 of its associated row in <structname>pg_enum</structname>.
3099 <title><structname>pg_enum</> Columns</title>
3106 <entry>References</entry>
3107 <entry>Description</entry>
3113 <entry><structfield>oid</structfield></entry>
3114 <entry><type>oid</type></entry>
3116 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3120 <entry><structfield>enumtypid</structfield></entry>
3121 <entry><type>oid</type></entry>
3122 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3123 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3127 <entry><structfield>enumsortorder</structfield></entry>
3128 <entry><type>float4</type></entry>
3130 <entry>The sort position of this enum value within its enum type</entry>
3134 <entry><structfield>enumlabel</structfield></entry>
3135 <entry><type>name</type></entry>
3137 <entry>The textual label for this enum value</entry>
3144 The OIDs for <structname>pg_enum</structname> rows follow a special
3145 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3146 as the sort ordering of their enum type. That is, if two even OIDs
3147 belong to the same enum type, the smaller OID must have the smaller
3148 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3149 need bear no relationship to the sort order. This rule allows the
3150 enum comparison routines to avoid catalog lookups in many common cases.
3151 The routines that create and alter enum types attempt to assign even
3152 OIDs to enum values whenever possible.
3156 When an enum type is created, its members are assigned sort-order
3157 positions 1..<replaceable>n</>. But members added later might be given
3158 negative or fractional values of <structfield>enumsortorder</structfield>.
3159 The only requirement on these values is that they be correctly
3160 ordered and unique within each enum type.
3165 <sect1 id="catalog-pg-event-trigger">
3166 <title><structname>pg_event_trigger</structname></title>
3168 <indexterm zone="catalog-pg-event-trigger">
3169 <primary>pg_event_trigger</primary>
3173 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3174 See <xref linkend="event-triggers"> for more information.
3178 <title><structname>pg_event_trigger</> Columns</title>
3185 <entry>References</entry>
3186 <entry>Description</entry>
3192 <entry><structfield>evtname</structfield></entry>
3193 <entry><type>name</type></entry>
3195 <entry>Trigger name (must be unique)</entry>
3199 <entry><structfield>evtevent</structfield></entry>
3200 <entry><type>name</type></entry>
3202 <entry>Identifies the event for which this trigger fires</entry>
3206 <entry><structfield>evtowner</structfield></entry>
3207 <entry><type>oid</type></entry>
3208 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3209 <entry>Owner of the event trigger</entry>
3213 <entry><structfield>evtfoid</structfield></entry>
3214 <entry><type>oid</type></entry>
3215 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3216 <entry>The function to be called</entry>
3220 <entry><structfield>evtenabled</structfield></entry>
3221 <entry><type>char</type></entry>
3224 Controls in which <xref linkend="guc-session-replication-role"> modes
3225 the event trigger fires.
3226 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3227 <literal>D</> = trigger is disabled,
3228 <literal>R</> = trigger fires in <quote>replica</> mode,
3229 <literal>A</> = trigger fires always.
3234 <entry><structfield>evttags</structfield></entry>
3235 <entry><type>text[]</type></entry>
3238 Command tags for which this trigger will fire. If NULL, the firing
3239 of this trigger is not restricted on the basis of the command tag.
3248 <sect1 id="catalog-pg-extension">
3249 <title><structname>pg_extension</structname></title>
3251 <indexterm zone="catalog-pg-extension">
3252 <primary>pg_extension</primary>
3256 The catalog <structname>pg_extension</structname> stores information
3257 about the installed extensions. See <xref linkend="extend-extensions">
3258 for details about extensions.
3262 <title><structname>pg_extension</> Columns</title>
3269 <entry>References</entry>
3270 <entry>Description</entry>
3276 <entry><structfield>oid</structfield></entry>
3277 <entry><type>oid</type></entry>
3279 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3283 <entry><structfield>extname</structfield></entry>
3284 <entry><type>name</type></entry>
3286 <entry>Name of the extension</entry>
3290 <entry><structfield>extowner</structfield></entry>
3291 <entry><type>oid</type></entry>
3292 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3293 <entry>Owner of the extension</entry>
3297 <entry><structfield>extnamespace</structfield></entry>
3298 <entry><type>oid</type></entry>
3299 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3300 <entry>Schema containing the extension's exported objects</entry>
3304 <entry><structfield>extrelocatable</structfield></entry>
3305 <entry><type>bool</type></entry>
3307 <entry>True if extension can be relocated to another schema</entry>
3311 <entry><structfield>extversion</structfield></entry>
3312 <entry><type>text</type></entry>
3314 <entry>Version name for the extension</entry>
3318 <entry><structfield>extconfig</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>Array of <type>regclass</> OIDs for the extension's configuration
3322 table(s), or <literal>NULL</> if none</entry>
3326 <entry><structfield>extcondition</structfield></entry>
3327 <entry><type>text[]</type></entry>
3329 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3330 extension's configuration table(s), or <literal>NULL</> if none</entry>
3338 Note that unlike most catalogs with a <quote>namespace</> column,
3339 <structfield>extnamespace</structfield> is not meant to imply
3340 that the extension belongs to that schema. Extension names are never
3341 schema-qualified. Rather, <structfield>extnamespace</structfield>
3342 indicates the schema that contains most or all of the extension's
3343 objects. If <structfield>extrelocatable</structfield> is true, then
3344 this schema must in fact contain all schema-qualifiable objects
3345 belonging to the extension.
3350 <sect1 id="catalog-pg-foreign-data-wrapper">
3351 <title><structname>pg_foreign_data_wrapper</structname></title>
3353 <indexterm zone="catalog-pg-foreign-data-wrapper">
3354 <primary>pg_foreign_data_wrapper</primary>
3358 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3359 foreign-data wrapper definitions. A foreign-data wrapper is the
3360 mechanism by which external data, residing on foreign servers, is
3365 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3372 <entry>References</entry>
3373 <entry>Description</entry>
3379 <entry><structfield>oid</structfield></entry>
3380 <entry><type>oid</type></entry>
3382 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3386 <entry><structfield>fdwname</structfield></entry>
3387 <entry><type>name</type></entry>
3389 <entry>Name of the foreign-data wrapper</entry>
3393 <entry><structfield>fdwowner</structfield></entry>
3394 <entry><type>oid</type></entry>
3395 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3396 <entry>Owner of the foreign-data wrapper</entry>
3400 <entry><structfield>fdwhandler</structfield></entry>
3401 <entry><type>oid</type></entry>
3402 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3404 References a handler function that is responsible for
3405 supplying execution routines for the foreign-data wrapper.
3406 Zero if no handler is provided
3411 <entry><structfield>fdwvalidator</structfield></entry>
3412 <entry><type>oid</type></entry>
3413 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3415 References a validator function that is responsible for
3416 checking the validity of the options given to the
3417 foreign-data wrapper, as well as options for foreign servers and user
3418 mappings using the foreign-data wrapper. Zero if no validator
3424 <entry><structfield>fdwacl</structfield></entry>
3425 <entry><type>aclitem[]</type></entry>
3428 Access privileges; see
3429 <xref linkend="sql-grant"> and
3430 <xref linkend="sql-revoke">
3436 <entry><structfield>fdwoptions</structfield></entry>
3437 <entry><type>text[]</type></entry>
3440 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3449 <sect1 id="catalog-pg-foreign-server">
3450 <title><structname>pg_foreign_server</structname></title>
3452 <indexterm zone="catalog-pg-foreign-server">
3453 <primary>pg_foreign_server</primary>
3457 The catalog <structname>pg_foreign_server</structname> stores
3458 foreign server definitions. A foreign server describes a source
3459 of external data, such as a remote server. Foreign
3460 servers are accessed via foreign-data wrappers.
3464 <title><structname>pg_foreign_server</> Columns</title>
3471 <entry>References</entry>
3472 <entry>Description</entry>
3478 <entry><structfield>oid</structfield></entry>
3479 <entry><type>oid</type></entry>
3481 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3485 <entry><structfield>srvname</structfield></entry>
3486 <entry><type>name</type></entry>
3488 <entry>Name of the foreign server</entry>
3492 <entry><structfield>srvowner</structfield></entry>
3493 <entry><type>oid</type></entry>
3494 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3495 <entry>Owner of the foreign server</entry>
3499 <entry><structfield>srvfdw</structfield></entry>
3500 <entry><type>oid</type></entry>
3501 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3502 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3506 <entry><structfield>srvtype</structfield></entry>
3507 <entry><type>text</type></entry>
3509 <entry>Type of the server (optional)</entry>
3513 <entry><structfield>srvversion</structfield></entry>
3514 <entry><type>text</type></entry>
3516 <entry>Version of the server (optional)</entry>
3520 <entry><structfield>srvacl</structfield></entry>
3521 <entry><type>aclitem[]</type></entry>
3524 Access privileges; see
3525 <xref linkend="sql-grant"> and
3526 <xref linkend="sql-revoke">
3532 <entry><structfield>srvoptions</structfield></entry>
3533 <entry><type>text[]</type></entry>
3536 Foreign server specific options, as <quote>keyword=value</> strings
3545 <sect1 id="catalog-pg-foreign-table">
3546 <title><structname>pg_foreign_table</structname></title>
3548 <indexterm zone="catalog-pg-foreign-table">
3549 <primary>pg_foreign_table</primary>
3553 The catalog <structname>pg_foreign_table</structname> contains
3554 auxiliary information about foreign tables. A foreign table is
3555 primarily represented by a <structname>pg_class</structname> entry,
3556 just like a regular table. Its <structname>pg_foreign_table</structname>
3557 entry contains the information that is pertinent only to foreign tables
3558 and not any other kind of relation.
3562 <title><structname>pg_foreign_table</> Columns</title>
3569 <entry>References</entry>
3570 <entry>Description</entry>
3576 <entry><structfield>ftrelid</structfield></entry>
3577 <entry><type>oid</type></entry>
3578 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3579 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3583 <entry><structfield>ftserver</structfield></entry>
3584 <entry><type>oid</type></entry>
3585 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3586 <entry>OID of the foreign server for this foreign table</entry>
3590 <entry><structfield>ftoptions</structfield></entry>
3591 <entry><type>text[]</type></entry>
3594 Foreign table options, as <quote>keyword=value</> strings
3603 <sect1 id="catalog-pg-index">
3604 <title><structname>pg_index</structname></title>
3606 <indexterm zone="catalog-pg-index">
3607 <primary>pg_index</primary>
3611 The catalog <structname>pg_index</structname> contains part of the information
3612 about indexes. The rest is mostly in
3613 <structname>pg_class</structname>.
3617 <title><structname>pg_index</> Columns</title>
3624 <entry>References</entry>
3625 <entry>Description</entry>
3631 <entry><structfield>indexrelid</structfield></entry>
3632 <entry><type>oid</type></entry>
3633 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3634 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3638 <entry><structfield>indrelid</structfield></entry>
3639 <entry><type>oid</type></entry>
3640 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3641 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3645 <entry><structfield>indnatts</structfield></entry>
3646 <entry><type>int2</type></entry>
3648 <entry>The number of columns in the index (duplicates
3649 <literal>pg_class.relnatts</literal>)</entry>
3653 <entry><structfield>indisunique</structfield></entry>
3654 <entry><type>bool</type></entry>
3656 <entry>If true, this is a unique index</entry>
3660 <entry><structfield>indisprimary</structfield></entry>
3661 <entry><type>bool</type></entry>
3663 <entry>If true, this index represents the primary key of the table
3664 (<structfield>indisunique</> should always be true when this is true)</entry>
3668 <entry><structfield>indisexclusion</structfield></entry>
3669 <entry><type>bool</type></entry>
3671 <entry>If true, this index supports an exclusion constraint</entry>
3675 <entry><structfield>indimmediate</structfield></entry>
3676 <entry><type>bool</type></entry>
3678 <entry>If true, the uniqueness check is enforced immediately on
3680 (irrelevant if <structfield>indisunique</> is not true)</entry>
3684 <entry><structfield>indisclustered</structfield></entry>
3685 <entry><type>bool</type></entry>
3687 <entry>If true, the table was last clustered on this index</entry>
3691 <entry><structfield>indisvalid</structfield></entry>
3692 <entry><type>bool</type></entry>
3695 If true, the index is currently valid for queries. False means the
3696 index is possibly incomplete: it must still be modified by
3697 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3698 be used for queries. If it is unique, the uniqueness property is not
3699 guaranteed true either.
3704 <entry><structfield>indcheckxmin</structfield></entry>
3705 <entry><type>bool</type></entry>
3708 If true, queries must not use the index until the <structfield>xmin</>
3709 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3710 event horizon, because the table may contain broken HOT chains with
3711 incompatible rows that they can see
3716 <entry><structfield>indisready</structfield></entry>
3717 <entry><type>bool</type></entry>
3720 If true, the index is currently ready for inserts. False means the
3721 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3727 <entry><structfield>indislive</structfield></entry>
3728 <entry><type>bool</type></entry>
3731 If false, the index is in process of being dropped, and should be
3732 ignored for all purposes (including HOT-safety decisions)
3737 <entry><structfield>indisreplident</structfield></entry>
3738 <entry><type>bool</type></entry>
3741 If true this index has been chosen as <quote>replica identity</>
3742 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3748 <entry><structfield>indkey</structfield></entry>
3749 <entry><type>int2vector</type></entry>
3750 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3752 This is an array of <structfield>indnatts</structfield> values that
3753 indicate which table columns this index indexes. For example a value
3754 of <literal>1 3</literal> would mean that the first and the third table
3755 columns make up the index key. A zero in this array indicates that the
3756 corresponding index attribute is an expression over the table columns,
3757 rather than a simple column reference.
3762 <entry><structfield>indcollation</structfield></entry>
3763 <entry><type>oidvector</type></entry>
3764 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3766 For each column in the index key, this contains the OID of the
3767 collation to use for the index.
3772 <entry><structfield>indclass</structfield></entry>
3773 <entry><type>oidvector</type></entry>
3774 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3776 For each column in the index key, this contains the OID of
3777 the operator class to use. See
3778 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3783 <entry><structfield>indoption</structfield></entry>
3784 <entry><type>int2vector</type></entry>
3787 This is an array of <structfield>indnatts</structfield> values that
3788 store per-column flag bits. The meaning of the bits is defined by
3789 the index's access method.
3794 <entry><structfield>indexprs</structfield></entry>
3795 <entry><type>pg_node_tree</type></entry>
3798 Expression trees (in <function>nodeToString()</function>
3799 representation) for index attributes that are not simple column
3800 references. This is a list with one element for each zero
3801 entry in <structfield>indkey</>. Null if all index attributes
3802 are simple references.
3807 <entry><structfield>indpred</structfield></entry>
3808 <entry><type>pg_node_tree</type></entry>
3811 Expression tree (in <function>nodeToString()</function>
3812 representation) for partial index predicate. Null if not a
3823 <sect1 id="catalog-pg-inherits">
3824 <title><structname>pg_inherits</structname></title>
3826 <indexterm zone="catalog-pg-inherits">
3827 <primary>pg_inherits</primary>
3831 The catalog <structname>pg_inherits</> records information about
3832 table inheritance hierarchies. There is one entry for each direct
3833 child table in the database. (Indirect inheritance can be determined
3834 by following chains of entries.)
3838 <title><structname>pg_inherits</> Columns</title>
3845 <entry>References</entry>
3846 <entry>Description</entry>
3852 <entry><structfield>inhrelid</structfield></entry>
3853 <entry><type>oid</type></entry>
3854 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3856 The OID of the child table
3861 <entry><structfield>inhparent</structfield></entry>
3862 <entry><type>oid</type></entry>
3863 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3865 The OID of the parent table
3870 <entry><structfield>inhseqno</structfield></entry>
3871 <entry><type>int4</type></entry>
3874 If there is more than one direct parent for a child table (multiple
3875 inheritance), this number tells the order in which the
3876 inherited columns are to be arranged. The count starts at 1.
3885 <sect1 id="catalog-pg-init-privs">
3886 <title><structname>pg_init_privs</structname></title>
3888 <indexterm zone="catalog-pg-init-privs">
3889 <primary>pg_init_privs</primary>
3893 The catalog <structname>pg_init_privs</> records information about
3894 the initial privileges of objects in the system. There is one entry
3895 for each object in the database which has a non-default (non-NULL)
3896 initial set of privileges.
3900 Objects can have initial privileges either by having those privileges set
3901 when the system is initialized (by <application>initdb</>) or when the
3902 object is created during a <command>CREATE EXTENSION</command> and the
3903 extension script sets initial privileges using the <command>GRANT</command>
3904 system. Note that the system will automatically handle recording of the
3905 privileges during the extension script and that extension authors need
3906 only use the <command>GRANT</command> and <command>REVOKE</command>
3907 statements in their script to have the privileges recorded. The
3908 <literal>privtype</literal> column indicates if the initial privilege was
3909 set by <application>initdb</> or during a
3910 <command>CREATE EXTENSION</command> command.
3914 Objects which have initial privileges set by <application>initdb</> will
3915 have entries where <literal>privtype</literal> is
3916 <literal>'i'</literal>, while objects which have initial privileges set
3917 by <command>CREATE EXTENSION</command> will have entries where
3918 <literal>privtype</literal> is <literal>'e'</literal>.
3922 <title><structname>pg_init_privs</> Columns</title>
3929 <entry>References</entry>
3930 <entry>Description</entry>
3936 <entry><structfield>objoid</structfield></entry>
3937 <entry><type>oid</type></entry>
3938 <entry>any OID column</entry>
3939 <entry>The OID of the specific object</entry>
3943 <entry><structfield>classoid</structfield></entry>
3944 <entry><type>oid</type></entry>
3945 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3946 <entry>The OID of the system catalog the object is in</entry>
3950 <entry><structfield>objsubid</structfield></entry>
3951 <entry><type>int4</type></entry>
3954 For a table column, this is the column number (the
3955 <structfield>objoid</> and <structfield>classoid</> refer to the
3956 table itself). For all other object types, this column is
3962 <entry><structfield>privtype</structfield></entry>
3963 <entry><type>char</type></entry>
3966 A code defining the type of initial privilege of this object; see text
3971 <entry><structfield>initprivs</structfield></entry>
3972 <entry><type>aclitem[]</type></entry>
3975 The initial access privileges; see
3976 <xref linkend="sql-grant"> and
3977 <xref linkend="sql-revoke">
3989 <sect1 id="catalog-pg-language">
3990 <title><structname>pg_language</structname></title>
3992 <indexterm zone="catalog-pg-language">
3993 <primary>pg_language</primary>
3997 The catalog <structname>pg_language</structname> registers
3998 languages in which you can write functions or stored procedures.
3999 See <xref linkend="sql-createlanguage">
4000 and <xref linkend="xplang"> for more information about language handlers.
4004 <title><structname>pg_language</> Columns</title>
4011 <entry>References</entry>
4012 <entry>Description</entry>
4018 <entry><structfield>oid</structfield></entry>
4019 <entry><type>oid</type></entry>
4021 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4025 <entry><structfield>lanname</structfield></entry>
4026 <entry><type>name</type></entry>
4028 <entry>Name of the language</entry>
4032 <entry><structfield>lanowner</structfield></entry>
4033 <entry><type>oid</type></entry>
4034 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4035 <entry>Owner of the language</entry>
4039 <entry><structfield>lanispl</structfield></entry>
4040 <entry><type>bool</type></entry>
4043 This is false for internal languages (such as
4044 <acronym>SQL</acronym>) and true for user-defined languages.
4045 Currently, <application>pg_dump</application> still uses this
4046 to determine which languages need to be dumped, but this might be
4047 replaced by a different mechanism in the future.
4052 <entry><structfield>lanpltrusted</structfield></entry>
4053 <entry><type>bool</type></entry>
4056 True if this is a trusted language, which means that it is believed
4057 not to grant access to anything outside the normal SQL execution
4058 environment. Only superusers can create functions in untrusted
4064 <entry><structfield>lanplcallfoid</structfield></entry>
4065 <entry><type>oid</type></entry>
4066 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4068 For noninternal languages this references the language
4069 handler, which is a special function that is responsible for
4070 executing all functions that are written in the particular
4076 <entry><structfield>laninline</structfield></entry>
4077 <entry><type>oid</type></entry>
4078 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4080 This references a function that is responsible for executing
4081 <quote>inline</> anonymous code blocks
4082 (<xref linkend="sql-do"> blocks).
4083 Zero if inline blocks are not supported.
4088 <entry><structfield>lanvalidator</structfield></entry>
4089 <entry><type>oid</type></entry>
4090 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4092 This references a language validator function that is responsible
4093 for checking the syntax and validity of new functions when they
4094 are created. Zero if no validator is provided.
4099 <entry><structfield>lanacl</structfield></entry>
4100 <entry><type>aclitem[]</type></entry>
4103 Access privileges; see
4104 <xref linkend="sql-grant"> and
4105 <xref linkend="sql-revoke">
4116 <sect1 id="catalog-pg-largeobject">
4117 <title><structname>pg_largeobject</structname></title>
4119 <indexterm zone="catalog-pg-largeobject">
4120 <primary>pg_largeobject</primary>
4124 The catalog <structname>pg_largeobject</structname> holds the data making up
4125 <quote>large objects</quote>. A large object is identified by an OID
4126 assigned when it is created. Each large object is broken into
4127 segments or <quote>pages</> small enough to be conveniently stored as rows
4128 in <structname>pg_largeobject</structname>.
4129 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4130 <literal>BLCKSZ/4</>, or typically 2 kB).
4134 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4135 associated with large objects. As a result,
4136 <structname>pg_largeobject</structname> was publicly readable and could be
4137 used to obtain the OIDs (and contents) of all large objects in the system.
4138 This is no longer the case; use
4139 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4140 to obtain a list of large object OIDs.
4144 <title><structname>pg_largeobject</> Columns</title>
4151 <entry>References</entry>
4152 <entry>Description</entry>
4158 <entry><structfield>loid</structfield></entry>
4159 <entry><type>oid</type></entry>
4160 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4161 <entry>Identifier of the large object that includes this page</entry>
4165 <entry><structfield>pageno</structfield></entry>
4166 <entry><type>int4</type></entry>
4168 <entry>Page number of this page within its large object
4169 (counting from zero)</entry>
4173 <entry><structfield>data</structfield></entry>
4174 <entry><type>bytea</type></entry>
4177 Actual data stored in the large object.
4178 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4186 Each row of <structname>pg_largeobject</structname> holds data
4187 for one page of a large object, beginning at
4188 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4189 allows sparse storage: pages might be missing, and might be shorter than
4190 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4191 Missing regions within a large object read as zeroes.
4196 <sect1 id="catalog-pg-largeobject-metadata">
4197 <title><structname>pg_largeobject_metadata</structname></title>
4199 <indexterm zone="catalog-pg-largeobject-metadata">
4200 <primary>pg_largeobject_metadata</primary>
4204 The catalog <structname>pg_largeobject_metadata</structname>
4205 holds metadata associated with large objects. The actual large object
4207 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4211 <title><structname>pg_largeobject_metadata</> Columns</title>
4218 <entry>References</entry>
4219 <entry>Description</entry>
4225 <entry><structfield>oid</structfield></entry>
4226 <entry><type>oid</type></entry>
4228 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4232 <entry><structfield>lomowner</structfield></entry>
4233 <entry><type>oid</type></entry>
4234 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4235 <entry>Owner of the large object</entry>
4239 <entry><structfield>lomacl</structfield></entry>
4240 <entry><type>aclitem[]</type></entry>
4243 Access privileges; see
4244 <xref linkend="sql-grant"> and
4245 <xref linkend="sql-revoke">
4255 <sect1 id="catalog-pg-statistic-ext">
4256 <title><structname>pg_statistic_ext</structname></title>
4258 <indexterm zone="catalog-pg-statistic-ext">
4259 <primary>pg_statistic_ext</primary>
4263 The catalog <structname>pg_statistic_ext</structname>
4264 holds extended planner statistics.
4268 <title><structname>pg_statistic_ext</> Columns</title>
4275 <entry>References</entry>
4276 <entry>Description</entry>
4283 <entry><structfield>starelid</structfield></entry>
4284 <entry><type>oid</type></entry>
4285 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4286 <entry>The table that the described columns belongs to</entry>
4290 <entry><structfield>staname</structfield></entry>
4291 <entry><type>name</type></entry>
4293 <entry>Name of the statistic.</entry>
4297 <entry><structfield>stanamespace</structfield></entry>
4298 <entry><type>oid</type></entry>
4299 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4301 The OID of the namespace that contains this statistic
4306 <entry><structfield>staowner</structfield></entry>
4307 <entry><type>oid</type></entry>
4308 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4309 <entry>Owner of the statistic</entry>
4313 <entry><structfield>staenabled</structfield></entry>
4314 <entry><type>char[]</type></entry>
4317 An array with the modes of the enabled statistic types, encoded as
4318 <literal>d</literal> for ndistinct coefficients.
4323 <entry><structfield>stakeys</structfield></entry>
4324 <entry><type>int2vector</type></entry>
4325 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4327 This is an array of values that indicate which table columns this
4328 statistic covers. For example a value of <literal>1 3</literal> would
4329 mean that the first and the third table columns make up the statistic key.
4334 <entry><structfield>standistinct</structfield></entry>
4335 <entry><type>pg_ndistinct</type></entry>
4338 N-distinct coefficients, serialized as <structname>pg_ndistinct</> type.
4347 <sect1 id="catalog-pg-namespace">
4348 <title><structname>pg_namespace</structname></title>
4350 <indexterm zone="catalog-pg-namespace">
4351 <primary>pg_namespace</primary>
4355 The catalog <structname>pg_namespace</> stores namespaces.
4356 A namespace is the structure underlying SQL schemas: each namespace
4357 can have a separate collection of relations, types, etc. without name
4362 <title><structname>pg_namespace</> Columns</title>
4369 <entry>References</entry>
4370 <entry>Description</entry>
4376 <entry><structfield>oid</structfield></entry>
4377 <entry><type>oid</type></entry>
4379 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4383 <entry><structfield>nspname</structfield></entry>
4384 <entry><type>name</type></entry>
4386 <entry>Name of the namespace</entry>
4390 <entry><structfield>nspowner</structfield></entry>
4391 <entry><type>oid</type></entry>
4392 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4393 <entry>Owner of the namespace</entry>
4397 <entry><structfield>nspacl</structfield></entry>
4398 <entry><type>aclitem[]</type></entry>
4401 Access privileges; see
4402 <xref linkend="sql-grant"> and
4403 <xref linkend="sql-revoke">
4414 <sect1 id="catalog-pg-opclass">
4415 <title><structname>pg_opclass</structname></title>
4417 <indexterm zone="catalog-pg-opclass">
4418 <primary>pg_opclass</primary>
4422 The catalog <structname>pg_opclass</structname> defines
4423 index access method operator classes. Each operator class defines
4424 semantics for index columns of a particular data type and a particular
4425 index access method. An operator class essentially specifies that a
4426 particular operator family is applicable to a particular indexable column
4427 data type. The set of operators from the family that are actually usable
4428 with the indexed column are whichever ones accept the column's data type
4429 as their left-hand input.
4433 Operator classes are described at length in <xref linkend="xindex">.
4437 <title><structname>pg_opclass</> Columns</title>
4444 <entry>References</entry>
4445 <entry>Description</entry>
4451 <entry><structfield>oid</structfield></entry>
4452 <entry><type>oid</type></entry>
4454 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4458 <entry><structfield>opcmethod</structfield></entry>
4459 <entry><type>oid</type></entry>
4460 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4461 <entry>Index access method operator class is for</entry>
4465 <entry><structfield>opcname</structfield></entry>
4466 <entry><type>name</type></entry>
4468 <entry>Name of this operator class</entry>
4472 <entry><structfield>opcnamespace</structfield></entry>
4473 <entry><type>oid</type></entry>
4474 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4475 <entry>Namespace of this operator class</entry>
4479 <entry><structfield>opcowner</structfield></entry>
4480 <entry><type>oid</type></entry>
4481 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4482 <entry>Owner of the operator class</entry>
4486 <entry><structfield>opcfamily</structfield></entry>
4487 <entry><type>oid</type></entry>
4488 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4489 <entry>Operator family containing the operator class</entry>
4493 <entry><structfield>opcintype</structfield></entry>
4494 <entry><type>oid</type></entry>
4495 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4496 <entry>Data type that the operator class indexes</entry>
4500 <entry><structfield>opcdefault</structfield></entry>
4501 <entry><type>bool</type></entry>
4503 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4507 <entry><structfield>opckeytype</structfield></entry>
4508 <entry><type>oid</type></entry>
4509 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4510 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4518 An operator class's <structfield>opcmethod</> must match the
4519 <structname>opfmethod</> of its containing operator family.
4520 Also, there must be no more than one <structname>pg_opclass</structname>
4521 row having <structname>opcdefault</> true for any given combination of
4522 <structname>opcmethod</> and <structname>opcintype</>.
4528 <sect1 id="catalog-pg-operator">
4529 <title><structname>pg_operator</structname></title>
4531 <indexterm zone="catalog-pg-operator">
4532 <primary>pg_operator</primary>
4536 The catalog <structname>pg_operator</> stores information about operators.
4537 See <xref linkend="sql-createoperator">
4538 and <xref linkend="xoper"> for more information.
4542 <title><structname>pg_operator</> Columns</title>
4549 <entry>References</entry>
4550 <entry>Description</entry>
4556 <entry><structfield>oid</structfield></entry>
4557 <entry><type>oid</type></entry>
4559 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4563 <entry><structfield>oprname</structfield></entry>
4564 <entry><type>name</type></entry>
4566 <entry>Name of the operator</entry>
4570 <entry><structfield>oprnamespace</structfield></entry>
4571 <entry><type>oid</type></entry>
4572 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4574 The OID of the namespace that contains this operator
4579 <entry><structfield>oprowner</structfield></entry>
4580 <entry><type>oid</type></entry>
4581 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4582 <entry>Owner of the operator</entry>
4586 <entry><structfield>oprkind</structfield></entry>
4587 <entry><type>char</type></entry>
4590 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4591 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4596 <entry><structfield>oprcanmerge</structfield></entry>
4597 <entry><type>bool</type></entry>
4599 <entry>This operator supports merge joins</entry>
4603 <entry><structfield>oprcanhash</structfield></entry>
4604 <entry><type>bool</type></entry>
4606 <entry>This operator supports hash joins</entry>
4610 <entry><structfield>oprleft</structfield></entry>
4611 <entry><type>oid</type></entry>
4612 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4613 <entry>Type of the left operand</entry>
4617 <entry><structfield>oprright</structfield></entry>
4618 <entry><type>oid</type></entry>
4619 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4620 <entry>Type of the right operand</entry>
4624 <entry><structfield>oprresult</structfield></entry>
4625 <entry><type>oid</type></entry>
4626 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4627 <entry>Type of the result</entry>
4631 <entry><structfield>oprcom</structfield></entry>
4632 <entry><type>oid</type></entry>
4633 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4634 <entry>Commutator of this operator, if any</entry>
4638 <entry><structfield>oprnegate</structfield></entry>
4639 <entry><type>oid</type></entry>
4640 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4641 <entry>Negator of this operator, if any</entry>
4645 <entry><structfield>oprcode</structfield></entry>
4646 <entry><type>regproc</type></entry>
4647 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4648 <entry>Function that implements this operator</entry>
4652 <entry><structfield>oprrest</structfield></entry>
4653 <entry><type>regproc</type></entry>
4654 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4655 <entry>Restriction selectivity estimation function for this operator</entry>
4659 <entry><structfield>oprjoin</structfield></entry>
4660 <entry><type>regproc</type></entry>
4661 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4662 <entry>Join selectivity estimation function for this operator</entry>
4669 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4670 is zero for a prefix operator.
4676 <sect1 id="catalog-pg-opfamily">
4677 <title><structname>pg_opfamily</structname></title>
4679 <indexterm zone="catalog-pg-opfamily">
4680 <primary>pg_opfamily</primary>
4684 The catalog <structname>pg_opfamily</structname> defines operator families.
4685 Each operator family is a collection of operators and associated
4686 support routines that implement the semantics specified for a particular
4687 index access method. Furthermore, the operators in a family are all
4688 <quote>compatible</>, in a way that is specified by the access method.
4689 The operator family concept allows cross-data-type operators to be used
4690 with indexes and to be reasoned about using knowledge of access method
4695 Operator families are described at length in <xref linkend="xindex">.
4699 <title><structname>pg_opfamily</> Columns</title>
4706 <entry>References</entry>
4707 <entry>Description</entry>
4713 <entry><structfield>oid</structfield></entry>
4714 <entry><type>oid</type></entry>
4716 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4720 <entry><structfield>opfmethod</structfield></entry>
4721 <entry><type>oid</type></entry>
4722 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4723 <entry>Index access method operator family is for</entry>
4727 <entry><structfield>opfname</structfield></entry>
4728 <entry><type>name</type></entry>
4730 <entry>Name of this operator family</entry>
4734 <entry><structfield>opfnamespace</structfield></entry>
4735 <entry><type>oid</type></entry>
4736 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4737 <entry>Namespace of this operator family</entry>
4741 <entry><structfield>opfowner</structfield></entry>
4742 <entry><type>oid</type></entry>
4743 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4744 <entry>Owner of the operator family</entry>
4752 The majority of the information defining an operator family is not in its
4753 <structname>pg_opfamily</structname> row, but in the associated rows in
4754 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4755 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4757 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4763 <sect1 id="catalog-pg-pltemplate">
4764 <title><structname>pg_pltemplate</structname></title>
4766 <indexterm zone="catalog-pg-pltemplate">
4767 <primary>pg_pltemplate</primary>
4771 The catalog <structname>pg_pltemplate</structname> stores
4772 <quote>template</> information for procedural languages.
4773 A template for a language allows the language to be created in a
4774 particular database by a simple <command>CREATE LANGUAGE</> command,
4775 with no need to specify implementation details.
4779 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4780 is shared across all databases of a cluster: there is only one
4781 copy of <structname>pg_pltemplate</structname> per cluster, not
4782 one per database. This allows the information to be accessible in
4783 each database as it is needed.
4787 <title><structname>pg_pltemplate</> Columns</title>
4794 <entry>Description</entry>
4800 <entry><structfield>tmplname</structfield></entry>
4801 <entry><type>name</type></entry>
4802 <entry>Name of the language this template is for</entry>
4806 <entry><structfield>tmpltrusted</structfield></entry>
4807 <entry><type>boolean</type></entry>
4808 <entry>True if language is considered trusted</entry>
4812 <entry><structfield>tmpldbacreate</structfield></entry>
4813 <entry><type>boolean</type></entry>
4814 <entry>True if language may be created by a database owner</entry>
4818 <entry><structfield>tmplhandler</structfield></entry>
4819 <entry><type>text</type></entry>
4820 <entry>Name of call handler function</entry>
4824 <entry><structfield>tmplinline</structfield></entry>
4825 <entry><type>text</type></entry>
4826 <entry>Name of anonymous-block handler function, or null if none</entry>
4830 <entry><structfield>tmplvalidator</structfield></entry>
4831 <entry><type>text</type></entry>
4832 <entry>Name of validator function, or null if none</entry>
4836 <entry><structfield>tmpllibrary</structfield></entry>
4837 <entry><type>text</type></entry>
4838 <entry>Path of shared library that implements language</entry>
4842 <entry><structfield>tmplacl</structfield></entry>
4843 <entry><type>aclitem[]</type></entry>
4844 <entry>Access privileges for template (not actually used)</entry>
4852 There are not currently any commands that manipulate procedural language
4853 templates; to change the built-in information, a superuser must modify
4854 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4855 or <command>UPDATE</command> commands.
4860 It is likely that <structname>pg_pltemplate</> will be removed in some
4861 future release of <productname>PostgreSQL</productname>, in favor of
4862 keeping this knowledge about procedural languages in their respective
4863 extension installation scripts.
4869 <sect1 id="catalog-pg-partitioned-table">
4870 <title><structname>pg_partitioned_table</structname></title>
4872 <indexterm zone="catalog-pg-partitioned-table">
4873 <primary>pg_partitioned_table</primary>
4877 The catalog <structname>pg_partitioned_table</structname> stores
4878 information about how tables are partitioned.
4882 <title><structname>pg_partitioned_table</> Columns</title>
4889 <entry>References</entry>
4890 <entry>Description</entry>
4897 <entry><structfield>partrelid</structfield></entry>
4898 <entry><type>oid</type></entry>
4899 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4900 <entry>The OID of the <structname>pg_class</> entry for this partitioned table</entry>
4904 <entry><structfield>partstrat</structfield></entry>
4905 <entry><type>char</type></entry>
4908 Partitioning strategy; <literal>l</> = list partitioned table,
4909 <literal>r</> = range partitioned table
4914 <entry><structfield>partnatts</structfield></entry>
4915 <entry><type>int2</type></entry>
4917 <entry>The number of columns in partition key</entry>
4921 <entry><structfield>partattrs</structfield></entry>
4922 <entry><type>int2vector</type></entry>
4923 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4925 This is an array of <structfield>partnatts</structfield> values that
4926 indicate which table columns are part of the partition key. For
4927 example, a value of <literal>1 3</literal> would mean that the first
4928 and the third table columns make up the partition key. A zero in this
4929 array indicates that the corresponding partition key column is an
4930 expression, rather than a simple column reference.
4935 <entry><structfield>partclass</structfield></entry>
4936 <entry><type>oidvector</type></entry>
4937 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4939 For each column in the partition key, this contains the OID of the
4940 operator class to use. See
4941 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4946 <entry><structfield>partcollation</structfield></entry>
4947 <entry><type>oidvector</type></entry>
4948 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4950 For each column in the partition key, this contains the OID of the
4951 the collation to use for partitioning.
4956 <entry><structfield>partexprs</structfield></entry>
4957 <entry><type>pg_node_tree</type></entry>
4960 Expression trees (in <function>nodeToString()</function>
4961 representation) for partition key columns that are not simple column
4962 references. This is a list with one element for each zero
4963 entry in <structfield>partattrs</>. Null if all partition key columns
4964 are simple references.
4973 <sect1 id="catalog-pg-policy">
4974 <title><structname>pg_policy</structname></title>
4976 <indexterm zone="catalog-pg-policy">
4977 <primary>pg_policy</primary>
4981 The catalog <structname>pg_policy</structname> stores row level
4982 security policies for tables. A policy includes the kind of
4983 command that it applies to (possibly all commands), the roles that it
4984 applies to, the expression to be added as a security-barrier
4985 qualification to queries that include the table, and the expression
4986 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4987 add new records to the table.
4992 <title><structname>pg_policy</structname> Columns</title>
4999 <entry>References</entry>
5000 <entry>Description</entry>
5006 <entry><structfield>polname</structfield></entry>
5007 <entry><type>name</type></entry>
5009 <entry>The name of the policy</entry>
5013 <entry><structfield>polrelid</structfield></entry>
5014 <entry><type>oid</type></entry>
5015 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5016 <entry>The table to which the policy applies</entry>
5020 <entry><structfield>polcmd</structfield></entry>
5021 <entry><type>char</type></entry>
5023 <entry>The command type to which the policy is applied:
5024 <literal>r</> for <command>SELECT</>,
5025 <literal>a</> for <command>INSERT</>,
5026 <literal>w</> for <command>UPDATE</>,
5027 <literal>d</> for <command>DELETE</>,
5028 or <literal>*</> for all</entry>
5032 <entry><structfield>polpermissive</structfield></entry>
5033 <entry><type>boolean</type></entry>
5035 <entry>Is the policy permissive or restrictive?</entry>
5039 <entry><structfield>polroles</structfield></entry>
5040 <entry><type>oid[]</type></entry>
5041 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5042 <entry>The roles to which the policy is applied</entry>
5046 <entry><structfield>polqual</structfield></entry>
5047 <entry><type>pg_node_tree</type></entry>
5049 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
5053 <entry><structfield>polwithcheck</structfield></entry>
5054 <entry><type>pg_node_tree</type></entry>
5056 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
5065 Policies stored in <structname>pg_policy</> are applied only when
5066 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
5073 <sect1 id="catalog-pg-proc">
5074 <title><structname>pg_proc</structname></title>
5076 <indexterm zone="catalog-pg-proc">
5077 <primary>pg_proc</primary>
5081 The catalog <structname>pg_proc</> stores information about functions (or procedures).
5082 See <xref linkend="sql-createfunction">
5083 and <xref linkend="xfunc"> for more information.
5087 The table contains data for aggregate functions as well as plain functions.
5088 If <structfield>proisagg</structfield> is true, there should be a matching
5089 row in <structfield>pg_aggregate</structfield>.
5093 <title><structname>pg_proc</> Columns</title>
5100 <entry>References</entry>
5101 <entry>Description</entry>
5107 <entry><structfield>oid</structfield></entry>
5108 <entry><type>oid</type></entry>
5110 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5114 <entry><structfield>proname</structfield></entry>
5115 <entry><type>name</type></entry>
5117 <entry>Name of the function</entry>
5121 <entry><structfield>pronamespace</structfield></entry>
5122 <entry><type>oid</type></entry>
5123 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5125 The OID of the namespace that contains this function
5130 <entry><structfield>proowner</structfield></entry>
5131 <entry><type>oid</type></entry>
5132 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5133 <entry>Owner of the function</entry>
5137 <entry><structfield>prolang</structfield></entry>
5138 <entry><type>oid</type></entry>
5139 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
5140 <entry>Implementation language or call interface of this function</entry>
5144 <entry><structfield>procost</structfield></entry>
5145 <entry><type>float4</type></entry>
5147 <entry>Estimated execution cost (in units of
5148 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
5149 this is cost per row returned</entry>
5153 <entry><structfield>prorows</structfield></entry>
5154 <entry><type>float4</type></entry>
5156 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
5160 <entry><structfield>provariadic</structfield></entry>
5161 <entry><type>oid</type></entry>
5162 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5163 <entry>Data type of the variadic array parameter's elements,
5164 or zero if the function does not have a variadic parameter</entry>
5168 <entry><structfield>protransform</structfield></entry>
5169 <entry><type>regproc</type></entry>
5170 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5171 <entry>Calls to this function can be simplified by this other function
5172 (see <xref linkend="xfunc-transform-functions">)</entry>
5176 <entry><structfield>proisagg</structfield></entry>
5177 <entry><type>bool</type></entry>
5179 <entry>Function is an aggregate function</entry>
5183 <entry><structfield>proiswindow</structfield></entry>
5184 <entry><type>bool</type></entry>
5186 <entry>Function is a window function</entry>
5190 <entry><structfield>prosecdef</structfield></entry>
5191 <entry><type>bool</type></entry>
5193 <entry>Function is a security definer (i.e., a <quote>setuid</>
5198 <entry><structfield>proleakproof</structfield></entry>
5199 <entry><type>bool</type></entry>
5202 The function has no side effects. No information about the
5203 arguments is conveyed except via the return value. Any function
5204 that might throw an error depending on the values of its arguments
5210 <entry><structfield>proisstrict</structfield></entry>
5211 <entry><type>bool</type></entry>
5214 Function returns null if any call argument is null. In that
5215 case the function won't actually be called at all. Functions
5216 that are not <quote>strict</quote> must be prepared to handle
5222 <entry><structfield>proretset</structfield></entry>
5223 <entry><type>bool</type></entry>
5225 <entry>Function returns a set (i.e., multiple values of the specified
5230 <entry><structfield>provolatile</structfield></entry>
5231 <entry><type>char</type></entry>
5234 <structfield>provolatile</structfield> tells whether the function's
5235 result depends only on its input arguments, or is affected by outside
5237 It is <literal>i</literal> for <quote>immutable</> functions,
5238 which always deliver the same result for the same inputs.
5239 It is <literal>s</literal> for <quote>stable</> functions,
5240 whose results (for fixed inputs) do not change within a scan.
5241 It is <literal>v</literal> for <quote>volatile</> functions,
5242 whose results might change at any time. (Use <literal>v</literal> also
5243 for functions with side-effects, so that calls to them cannot get
5249 <entry><structfield>proparallel</structfield></entry>
5250 <entry><type>char</type></entry>
5253 <structfield>proparallel</structfield> tells whether the function
5254 can be safely run in parallel mode.
5255 It is <literal>s</literal> for functions which are safe to run in
5256 parallel mode without restriction.
5257 It is <literal>r</literal> for functions which can be run in parallel
5258 mode, but their execution is restricted to the parallel group leader;
5259 parallel worker processes cannot invoke these functions.
5260 It is <literal>u</literal> for functions which are unsafe in parallel
5261 mode; the presence of such a function forces a serial execution plan.
5266 <entry><structfield>pronargs</structfield></entry>
5267 <entry><type>int2</type></entry>
5269 <entry>Number of input arguments</entry>
5273 <entry><structfield>pronargdefaults</structfield></entry>
5274 <entry><type>int2</type></entry>
5276 <entry>Number of arguments that have defaults</entry>
5280 <entry><structfield>prorettype</structfield></entry>
5281 <entry><type>oid</type></entry>
5282 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5283 <entry>Data type of the return value</entry>
5287 <entry><structfield>proargtypes</structfield></entry>
5288 <entry><type>oidvector</type></entry>
5289 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5291 An array with the data types of the function arguments. This includes
5292 only input arguments (including <literal>INOUT</literal> and
5293 <literal>VARIADIC</> arguments), and thus represents
5294 the call signature of the function.
5299 <entry><structfield>proallargtypes</structfield></entry>
5300 <entry><type>oid[]</type></entry>
5301 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5303 An array with the data types of the function arguments. This includes
5304 all arguments (including <literal>OUT</literal> and
5305 <literal>INOUT</literal> arguments); however, if all the
5306 arguments are <literal>IN</literal> arguments, this field will be null.
5307 Note that subscripting is 1-based, whereas for historical reasons
5308 <structfield>proargtypes</> is subscripted from 0.
5313 <entry><structfield>proargmodes</structfield></entry>
5314 <entry><type>char[]</type></entry>
5317 An array with the modes of the function arguments, encoded as
5318 <literal>i</literal> for <literal>IN</> arguments,
5319 <literal>o</literal> for <literal>OUT</> arguments,
5320 <literal>b</literal> for <literal>INOUT</> arguments,
5321 <literal>v</literal> for <literal>VARIADIC</> arguments,
5322 <literal>t</literal> for <literal>TABLE</> arguments.
5323 If all the arguments are <literal>IN</literal> arguments,
5324 this field will be null.
5325 Note that subscripts correspond to positions of
5326 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5331 <entry><structfield>proargnames</structfield></entry>
5332 <entry><type>text[]</type></entry>
5335 An array with the names of the function arguments.
5336 Arguments without a name are set to empty strings in the array.
5337 If none of the arguments have a name, this field will be null.
5338 Note that subscripts correspond to positions of
5339 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5344 <entry><structfield>proargdefaults</structfield></entry>
5345 <entry><type>pg_node_tree</type></entry>
5348 Expression trees (in <function>nodeToString()</function> representation)
5349 for default values. This is a list with
5350 <structfield>pronargdefaults</> elements, corresponding to the last
5351 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5352 <replaceable>N</> <structfield>proargtypes</> positions).
5353 If none of the arguments have defaults, this field will be null.
5358 <entry><structfield>protrftypes</structfield></entry>
5359 <entry><type>oid[]</type></entry>
5362 Data type OIDs for which to apply transforms.
5367 <entry><structfield>prosrc</structfield></entry>
5368 <entry><type>text</type></entry>
5371 This tells the function handler how to invoke the function. It
5372 might be the actual source code of the function for interpreted
5373 languages, a link symbol, a file name, or just about anything
5374 else, depending on the implementation language/call convention.
5379 <entry><structfield>probin</structfield></entry>
5380 <entry><type>text</type></entry>
5383 Additional information about how to invoke the function.
5384 Again, the interpretation is language-specific.
5389 <entry><structfield>proconfig</structfield></entry>
5390 <entry><type>text[]</type></entry>
5392 <entry>Function's local settings for run-time configuration variables</entry>
5396 <entry><structfield>proacl</structfield></entry>
5397 <entry><type>aclitem[]</type></entry>
5400 Access privileges; see
5401 <xref linkend="sql-grant"> and
5402 <xref linkend="sql-revoke">
5411 For compiled functions, both built-in and dynamically loaded,
5412 <structfield>prosrc</structfield> contains the function's C-language
5413 name (link symbol). For all other currently-known language types,
5414 <structfield>prosrc</structfield> contains the function's source
5415 text. <structfield>probin</structfield> is unused except for
5416 dynamically-loaded C functions, for which it gives the name of the
5417 shared library file containing the function.
5422 <sect1 id="catalog-pg-publication">
5423 <title><structname>pg_publication</structname></title>
5425 <indexterm zone="catalog-pg-publication">
5426 <primary>pg_publication</primary>
5430 The catalog <structname>pg_publication</structname> contains all
5431 publications created in the database. For more on publications see
5432 <xref linkend="logical-replication-publication">.
5436 <title><structname>pg_publication</structname> Columns</title>
5443 <entry>References</entry>
5444 <entry>Description</entry>
5450 <entry><structfield>oid</structfield></entry>
5451 <entry><type>oid</type></entry>
5453 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5457 <entry><structfield>pubname</structfield></entry>
5458 <entry><type>Name</type></entry>
5460 <entry>Name of the publication</entry>
5464 <entry><structfield>pubowner</structfield></entry>
5465 <entry><type>oid</type></entry>
5466 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5467 <entry>Owner of the publication</entry>
5471 <entry><structfield>puballtables</structfield></entry>
5472 <entry><type>bool</type></entry>
5474 <entry>If true, this publication automatically includes all tables
5475 in the database, including any that will be created in the future.
5480 <entry><structfield>pubinsert</structfield></entry>
5481 <entry><type>bool</type></entry>
5483 <entry>If true, <command>INSERT</command> operations are replicated for
5484 tables in the publication.</entry>
5488 <entry><structfield>pubupdate</structfield></entry>
5489 <entry><type>bool</type></entry>
5491 <entry>If true, <command>UPDATE</command> operations are replicated for
5492 tables in the publication.</entry>
5496 <entry><structfield>pubdelete</structfield></entry>
5497 <entry><type>bool</type></entry>
5499 <entry>If true, <command>DELETE</command> operations are replicated for
5500 tables in the publication.</entry>
5507 <sect1 id="catalog-pg-publication-rel">
5508 <title><structname>pg_publication_rel</structname></title>
5510 <indexterm zone="catalog-pg-publication-rel">
5511 <primary>pg_publication_rel</primary>
5515 The catalog <structname>pg_publication_rel</structname> contains the
5516 mapping between relations and publications in the database. This is a
5517 many-to-many mapping. See also <xref linkend="view-pg-publication-tables">
5518 for a more user-friendly view of this information.
5522 <title><structname>pg_publication_rel</structname> Columns</title>
5529 <entry>References</entry>
5530 <entry>Description</entry>
5536 <entry><structfield>prpubid</structfield></entry>
5537 <entry><type>oid</type></entry>
5538 <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
5539 <entry>Reference to publication</entry>
5543 <entry><structfield>prrelid</structfield></entry>
5544 <entry><type>oid</type></entry>
5545 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5546 <entry>Reference to relation</entry>
5553 <sect1 id="catalog-pg-range">
5554 <title><structname>pg_range</structname></title>
5556 <indexterm zone="catalog-pg-range">
5557 <primary>pg_range</primary>
5561 The catalog <structname>pg_range</structname> stores information about
5562 range types. This is in addition to the types' entries in
5563 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5567 <title><structname>pg_range</> Columns</title>
5574 <entry>References</entry>
5575 <entry>Description</entry>
5581 <entry><structfield>rngtypid</structfield></entry>
5582 <entry><type>oid</type></entry>
5583 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5584 <entry>OID of the range type</entry>
5588 <entry><structfield>rngsubtype</structfield></entry>
5589 <entry><type>oid</type></entry>
5590 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5591 <entry>OID of the element type (subtype) of this range type</entry>
5595 <entry><structfield>rngcollation</structfield></entry>
5596 <entry><type>oid</type></entry>
5597 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5598 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5602 <entry><structfield>rngsubopc</structfield></entry>
5603 <entry><type>oid</type></entry>
5604 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5605 <entry>OID of the subtype's operator class used for range comparisons</entry>
5609 <entry><structfield>rngcanonical</structfield></entry>
5610 <entry><type>regproc</type></entry>
5611 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5612 <entry>OID of the function to convert a range value into canonical form,
5613 or 0 if none</entry>
5617 <entry><structfield>rngsubdiff</structfield></entry>
5618 <entry><type>regproc</type></entry>
5619 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5620 <entry>OID of the function to return the difference between two element
5621 values as <type>double precision</type>, or 0 if none</entry>
5628 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5629 element type is collatable) determines the sort ordering used by the range
5630 type. <structfield>rngcanonical</> is used when the element type is
5631 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5632 improve performance of GiST indexes on the range type.
5637 <sect1 id="catalog-pg-replication-origin">
5638 <title><structname>pg_replication_origin</structname></title>
5640 <indexterm zone="catalog-pg-replication-origin">
5641 <primary>pg_replication_origin</primary>
5645 The <structname>pg_replication_origin</structname> catalog contains
5646 all replication origins created. For more on replication origins
5647 see <xref linkend="replication-origins">.
5652 <title><structname>pg_replication_origin</structname> Columns</title>
5659 <entry>References</entry>
5660 <entry>Description</entry>
5666 <entry><structfield>roident</structfield></entry>
5667 <entry><type>Oid</type></entry>
5669 <entry>A unique, cluster-wide identifier for the replication
5670 origin. Should never leave the system.</entry>
5674 <entry><structfield>roname</structfield></entry>
5675 <entry><type>text</type></entry>
5677 <entry>The external, user defined, name of a replication
5685 <sect1 id="catalog-pg-rewrite">
5686 <title><structname>pg_rewrite</structname></title>
5688 <indexterm zone="catalog-pg-rewrite">
5689 <primary>pg_rewrite</primary>
5693 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5697 <title><structname>pg_rewrite</> Columns</title>
5704 <entry>References</entry>
5705 <entry>Description</entry>
5711 <entry><structfield>oid</structfield></entry>
5712 <entry><type>oid</type></entry>
5714 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5718 <entry><structfield>rulename</structfield></entry>
5719 <entry><type>name</type></entry>
5721 <entry>Rule name</entry>
5725 <entry><structfield>ev_class</structfield></entry>
5726 <entry><type>oid</type></entry>
5727 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5728 <entry>The table this rule is for</entry>
5732 <entry><structfield>ev_type</structfield></entry>
5733 <entry><type>char</type></entry>
5736 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5737 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5743 <entry><structfield>ev_enabled</structfield></entry>
5744 <entry><type>char</type></entry>
5747 Controls in which <xref linkend="guc-session-replication-role"> modes
5749 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5750 <literal>D</> = rule is disabled,
5751 <literal>R</> = rule fires in <quote>replica</> mode,
5752 <literal>A</> = rule fires always.
5757 <entry><structfield>is_instead</structfield></entry>
5758 <entry><type>bool</type></entry>
5760 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5764 <entry><structfield>ev_qual</structfield></entry>
5765 <entry><type>pg_node_tree</type></entry>
5768 Expression tree (in the form of a
5769 <function>nodeToString()</function> representation) for the
5770 rule's qualifying condition
5775 <entry><structfield>ev_action</structfield></entry>
5776 <entry><type>pg_node_tree</type></entry>
5779 Query tree (in the form of a
5780 <function>nodeToString()</function> representation) for the
5790 <literal>pg_class.relhasrules</literal>
5791 must be true if a table has any rules in this catalog.
5797 <sect1 id="catalog-pg-seclabel">
5798 <title><structname>pg_seclabel</structname></title>
5800 <indexterm zone="catalog-pg-seclabel">
5801 <primary>pg_seclabel</primary>
5805 The catalog <structname>pg_seclabel</structname> stores security
5806 labels on database objects. Security labels can be manipulated
5807 with the <xref linkend="sql-security-label"> command. For an easier
5808 way to view security labels, see <xref linkend="view-pg-seclabels">.
5812 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5813 which performs a similar function for security labels of database objects
5814 that are shared across a database cluster.
5818 <title><structname>pg_seclabel</structname> Columns</title>
5825 <entry>References</entry>
5826 <entry>Description</entry>
5832 <entry><structfield>objoid</structfield></entry>
5833 <entry><type>oid</type></entry>
5834 <entry>any OID column</entry>
5835 <entry>The OID of the object this security label pertains to</entry>
5839 <entry><structfield>classoid</structfield></entry>
5840 <entry><type>oid</type></entry>
5841 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5842 <entry>The OID of the system catalog this object appears in</entry>
5846 <entry><structfield>objsubid</structfield></entry>
5847 <entry><type>int4</type></entry>
5850 For a security label on a table column, this is the column number (the
5851 <structfield>objoid</> and <structfield>classoid</> refer to
5852 the table itself). For all other object types, this column is
5858 <entry><structfield>provider</structfield></entry>
5859 <entry><type>text</type></entry>
5861 <entry>The label provider associated with this label.</entry>
5865 <entry><structfield>label</structfield></entry>
5866 <entry><type>text</type></entry>
5868 <entry>The security label applied to this object.</entry>
5875 <sect1 id="catalog-pg-sequence">
5876 <title><structname>pg_sequence</structname></title>
5878 <indexterm zone="catalog-pg-sequence">
5879 <primary>pg_sequence</primary>
5883 The catalog <structname>pg_sequence</structname> contains information about
5884 sequences. Some of the information about sequences, such as the name and
5885 the schema, is in <structname>pg_class</structname>.
5889 <title><structname>pg_sequence</> Columns</title>
5896 <entry>References</entry>
5897 <entry>Description</entry>
5903 <entry><structfield>seqrelid</structfield></entry>
5904 <entry><type>oid</type></entry>
5905 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5906 <entry>The OID of the <structname>pg_class</> entry for this sequence</entry>
5910 <entry><structfield>seqtypid</structfield></entry>
5911 <entry><type>oid</type></entry>
5912 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5913 <entry>Data type of the sequence</entry>
5917 <entry><structfield>seqstart</structfield></entry>
5918 <entry><type>int8</type></entry>
5920 <entry>Start value of the sequence</entry>
5924 <entry><structfield>seqincrement</structfield></entry>
5925 <entry><type>int8</type></entry>
5927 <entry>Increment value of the sequence</entry>
5931 <entry><structfield>seqmax</structfield></entry>
5932 <entry><type>int8</type></entry>
5934 <entry>Maximum value of the sequence</entry>
5938 <entry><structfield>seqmin</structfield></entry>
5939 <entry><type>int8</type></entry>
5941 <entry>Minimum value of the sequence</entry>
5945 <entry><structfield>seqcache</structfield></entry>
5946 <entry><type>int8</type></entry>
5948 <entry>Cache size of the sequence</entry>
5952 <entry><structfield>seqcycle</structfield></entry>
5953 <entry><type>bool</type></entry>
5955 <entry>Whether the sequence cycles</entry>
5962 <sect1 id="catalog-pg-shdepend">
5963 <title><structname>pg_shdepend</structname></title>
5965 <indexterm zone="catalog-pg-shdepend">
5966 <primary>pg_shdepend</primary>
5970 The catalog <structname>pg_shdepend</structname> records the
5971 dependency relationships between database objects and shared objects,
5972 such as roles. This information allows
5973 <productname>PostgreSQL</productname> to ensure that those objects are
5974 unreferenced before attempting to delete them.
5978 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5979 which performs a similar function for dependencies involving objects
5980 within a single database.
5984 Unlike most system catalogs, <structname>pg_shdepend</structname>
5985 is shared across all databases of a cluster: there is only one
5986 copy of <structname>pg_shdepend</structname> per cluster, not
5991 <title><structname>pg_shdepend</> Columns</title>
5998 <entry>References</entry>
5999 <entry>Description</entry>
6005 <entry><structfield>dbid</structfield></entry>
6006 <entry><type>oid</type></entry>
6007 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6008 <entry>The OID of the database the dependent object is in,
6009 or zero for a shared object</entry>
6013 <entry><structfield>classid</structfield></entry>
6014 <entry><type>oid</type></entry>
6015 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6016 <entry>The OID of the system catalog the dependent object is in</entry>
6020 <entry><structfield>objid</structfield></entry>
6021 <entry><type>oid</type></entry>
6022 <entry>any OID column</entry>
6023 <entry>The OID of the specific dependent object</entry>
6027 <entry><structfield>objsubid</structfield></entry>
6028 <entry><type>int4</type></entry>
6031 For a table column, this is the column number (the
6032 <structfield>objid</> and <structfield>classid</> refer to the
6033 table itself). For all other object types, this column is zero.
6038 <entry><structfield>refclassid</structfield></entry>
6039 <entry><type>oid</type></entry>
6040 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6041 <entry>The OID of the system catalog the referenced object is in
6042 (must be a shared catalog)</entry>
6046 <entry><structfield>refobjid</structfield></entry>
6047 <entry><type>oid</type></entry>
6048 <entry>any OID column</entry>
6049 <entry>The OID of the specific referenced object</entry>
6053 <entry><structfield>deptype</structfield></entry>
6054 <entry><type>char</type></entry>
6057 A code defining the specific semantics of this dependency relationship; see text
6066 In all cases, a <structname>pg_shdepend</structname> entry indicates that
6067 the referenced object cannot be dropped without also dropping the dependent
6068 object. However, there are several subflavors identified by
6069 <structfield>deptype</>:
6073 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
6076 The referenced object (which must be a role) is the owner of the
6083 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
6086 The referenced object (which must be a role) is mentioned in the
6087 ACL (access control list, i.e., privileges list) of the
6088 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
6089 not made for the owner of the object, since the owner will have
6090 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
6096 <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
6099 The referenced object (which must be a role) is mentioned as the
6100 target of a dependent policy object.
6106 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
6109 There is no dependent object; this type of entry is a signal
6110 that the system itself depends on the referenced object, and so
6111 that object must never be deleted. Entries of this type are
6112 created only by <command>initdb</command>. The columns for the
6113 dependent object contain zeroes.
6119 Other dependency flavors might be needed in future. Note in particular
6120 that the current definition only supports roles as referenced objects.
6125 <sect1 id="catalog-pg-shdescription">
6126 <title><structname>pg_shdescription</structname></title>
6128 <indexterm zone="catalog-pg-shdescription">
6129 <primary>pg_shdescription</primary>
6133 The catalog <structname>pg_shdescription</structname> stores optional
6134 descriptions (comments) for shared database objects. Descriptions can be
6135 manipulated with the <xref linkend="sql-comment"> command and viewed with
6136 <application>psql</application>'s <literal>\d</literal> commands.
6140 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6141 which performs a similar function for descriptions involving objects
6142 within a single database.
6146 Unlike most system catalogs, <structname>pg_shdescription</structname>
6147 is shared across all databases of a cluster: there is only one
6148 copy of <structname>pg_shdescription</structname> per cluster, not
6153 <title><structname>pg_shdescription</> Columns</title>
6160 <entry>References</entry>
6161 <entry>Description</entry>
6167 <entry><structfield>objoid</structfield></entry>
6168 <entry><type>oid</type></entry>
6169 <entry>any OID column</entry>
6170 <entry>The OID of the object this description pertains to</entry>
6174 <entry><structfield>classoid</structfield></entry>
6175 <entry><type>oid</type></entry>
6176 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6177 <entry>The OID of the system catalog this object appears in</entry>
6181 <entry><structfield>description</structfield></entry>
6182 <entry><type>text</type></entry>
6184 <entry>Arbitrary text that serves as the description of this object</entry>
6192 <sect1 id="catalog-pg-shseclabel">
6193 <title><structname>pg_shseclabel</structname></title>
6195 <indexterm zone="catalog-pg-shseclabel">
6196 <primary>pg_shseclabel</primary>
6200 The catalog <structname>pg_shseclabel</structname> stores security
6201 labels on shared database objects. Security labels can be manipulated
6202 with the <xref linkend="sql-security-label"> command. For an easier
6203 way to view security labels, see <xref linkend="view-pg-seclabels">.
6207 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6208 which performs a similar function for security labels involving objects
6209 within a single database.
6213 Unlike most system catalogs, <structname>pg_shseclabel</structname>
6214 is shared across all databases of a cluster: there is only one
6215 copy of <structname>pg_shseclabel</structname> per cluster, not
6220 <title><structname>pg_shseclabel</structname> Columns</title>
6226 <entry>References</entry>
6227 <entry>Description</entry>
6232 <entry><structfield>objoid</structfield></entry>
6233 <entry><type>oid</type></entry>
6234 <entry>any OID column</entry>
6235 <entry>The OID of the object this security label pertains to</entry>
6238 <entry><structfield>classoid</structfield></entry>
6239 <entry><type>oid</type></entry>
6240 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6241 <entry>The OID of the system catalog this object appears in</entry>
6244 <entry><structfield>provider</structfield></entry>
6245 <entry><type>text</type></entry>
6247 <entry>The label provider associated with this label.</entry>
6250 <entry><structfield>label</structfield></entry>
6251 <entry><type>text</type></entry>
6253 <entry>The security label applied to this object.</entry>
6260 <sect1 id="catalog-pg-statistic">
6261 <title><structname>pg_statistic</structname></title>
6263 <indexterm zone="catalog-pg-statistic">
6264 <primary>pg_statistic</primary>
6268 The catalog <structname>pg_statistic</structname> stores
6269 statistical data about the contents of the database. Entries are
6270 created by <xref linkend="sql-analyze">
6271 and subsequently used by the query planner. Note that all the
6272 statistical data is inherently approximate, even assuming that it
6277 Normally there is one entry, with <structfield>stainherit</> =
6278 <literal>false</>, for each table column that has been analyzed.
6279 If the table has inheritance children, a second entry with
6280 <structfield>stainherit</> = <literal>true</> is also created. This row
6281 represents the column's statistics over the inheritance tree, i.e.,
6282 statistics for the data you'd see with
6283 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
6284 whereas the <structfield>stainherit</> = <literal>false</> row represents
6286 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
6290 <structname>pg_statistic</structname> also stores statistical data about
6291 the values of index expressions. These are described as if they were
6292 actual data columns; in particular, <structfield>starelid</structfield>
6293 references the index. No entry is made for an ordinary non-expression
6294 index column, however, since it would be redundant with the entry
6295 for the underlying table column. Currently, entries for index expressions
6296 always have <structfield>stainherit</> = <literal>false</>.
6300 Since different kinds of statistics might be appropriate for different
6301 kinds of data, <structname>pg_statistic</structname> is designed not
6302 to assume very much about what sort of statistics it stores. Only
6303 extremely general statistics (such as nullness) are given dedicated
6304 columns in <structname>pg_statistic</structname>. Everything else
6305 is stored in <quote>slots</quote>, which are groups of associated columns
6306 whose content is identified by a code number in one of the slot's columns.
6307 For more information see
6308 <filename>src/include/catalog/pg_statistic.h</filename>.
6312 <structname>pg_statistic</structname> should not be readable by the
6313 public, since even statistical information about a table's contents
6314 might be considered sensitive. (Example: minimum and maximum values
6315 of a salary column might be quite interesting.)
6316 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6317 is a publicly readable view on
6318 <structname>pg_statistic</structname> that only exposes information
6319 about those tables that are readable by the current user.
6323 <title><structname>pg_statistic</> Columns</title>
6330 <entry>References</entry>
6331 <entry>Description</entry>
6337 <entry><structfield>starelid</structfield></entry>
6338 <entry><type>oid</type></entry>
6339 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6340 <entry>The table or index that the described column belongs to</entry>
6344 <entry><structfield>staattnum</structfield></entry>
6345 <entry><type>int2</type></entry>
6346 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6347 <entry>The number of the described column</entry>
6351 <entry><structfield>stainherit</structfield></entry>
6352 <entry><type>bool</type></entry>
6354 <entry>If true, the stats include inheritance child columns, not just the
6355 values in the specified relation</entry>
6359 <entry><structfield>stanullfrac</structfield></entry>
6360 <entry><type>float4</type></entry>
6362 <entry>The fraction of the column's entries that are null</entry>
6366 <entry><structfield>stawidth</structfield></entry>
6367 <entry><type>int4</type></entry>
6369 <entry>The average stored width, in bytes, of nonnull entries</entry>
6373 <entry><structfield>stadistinct</structfield></entry>
6374 <entry><type>float4</type></entry>
6376 <entry>The number of distinct nonnull data values in the column.
6377 A value greater than zero is the actual number of distinct values.
6378 A value less than zero is the negative of a multiplier for the number
6379 of rows in the table; for example, a column in which about 80% of the
6380 values are nonnull and each nonnull value appears about twice on
6381 average could be represented by <structfield>stadistinct</> = -0.4.
6382 A zero value means the number of distinct values is unknown.
6387 <entry><structfield>stakind<replaceable>N</></structfield></entry>
6388 <entry><type>int2</type></entry>
6391 A code number indicating the kind of statistics stored in the
6392 <replaceable>N</>th <quote>slot</quote> of the
6393 <structname>pg_statistic</structname> row.
6398 <entry><structfield>staop<replaceable>N</></structfield></entry>
6399 <entry><type>oid</type></entry>
6400 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6402 An operator used to derive the statistics stored in the
6403 <replaceable>N</>th <quote>slot</quote>. For example, a
6404 histogram slot would show the <literal><</literal> operator
6405 that defines the sort order of the data.
6410 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6411 <entry><type>float4[]</type></entry>
6414 Numerical statistics of the appropriate kind for the
6415 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6416 kind does not involve numerical values
6421 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6422 <entry><type>anyarray</type></entry>
6425 Column data values of the appropriate kind for the
6426 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6427 kind does not store any data values. Each array's element
6428 values are actually of the specific column's data type, or a related
6429 type such as an array's element type, so there is no way to define
6430 these columns' type more specifically than <type>anyarray</>.
6439 <sect1 id="catalog-pg-subscription">
6440 <title><structname>pg_subscription</structname></title>
6442 <indexterm zone="catalog-pg-subscription">
6443 <primary>pg_subscription</primary>
6447 The catalog <structname>pg_subscription</structname> contains all existing
6448 logical replication subscriptions. For more information about logical
6449 replication see <xref linkend="logical-replication">.
6453 Unlike most system catalogs, <structname>pg_subscription</structname> is
6454 shared across all databases of a cluster: There is only one copy
6455 of <structname>pg_subscription</structname> per cluster, not one per
6460 Access to the column <structfield>subconninfo</structfield> is revoked from
6461 normal users, because it could contain plain-text passwords.
6465 <title><structname>pg_subscription</structname> Columns</title>
6472 <entry>References</entry>
6473 <entry>Description</entry>
6479 <entry><structfield>oid</structfield></entry>
6480 <entry><type>oid</type></entry>
6482 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6486 <entry><structfield>subdbid</structfield></entry>
6487 <entry><type>oid</type></entry>
6488 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6489 <entry>OID of the database which the subscription resides in</entry>
6493 <entry><structfield>subname</structfield></entry>
6494 <entry><type>name</type></entry>
6496 <entry>Name of the subscription</entry>
6500 <entry><structfield>subowner</structfield></entry>
6501 <entry><type>oid</type></entry>
6502 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6503 <entry>Owner of the subscription</entry>
6507 <entry><structfield>subenabled</structfield></entry>
6508 <entry><type>bool</type></entry>
6510 <entry>If true, the subscription is enabled and should be replicating.</entry>
6514 <entry><structfield>subconninfo</structfield></entry>
6515 <entry><type>text</type></entry>
6517 <entry>Connection string to the upstream database</entry>
6521 <entry><structfield>subslotname</structfield></entry>
6522 <entry><type>name</type></entry>
6524 <entry>Name of the replication slot in the upstream database. Also used
6525 for local replication origin name.</entry>
6529 <entry><structfield>subpublications</structfield></entry>
6530 <entry><type>text[]</type></entry>
6532 <entry>Array of subscribed publication names. These reference the
6533 publications on the publisher server. For more on publications
6534 see <xref linkend="logical-replication-publication">.
6542 <sect1 id="catalog-pg-subscription-rel">
6543 <title><structname>pg_subscription_rel</structname></title>
6545 <indexterm zone="catalog-pg-subscription-rel">
6546 <primary>pg_subscription_rel</primary>
6550 The catalog <structname>pg_subscription_rel</structname> contains the
6551 state for each replicated relation in each subscription. This is a
6552 many-to-many mapping.
6556 This catalog only contains tables known to the subscription after running
6557 either <command>CREATE SUBSCRIPTION</command> or
6558 <command>ALTER SUBSCRIPTION ... REFRESH</command>.
6562 <title><structname>pg_subscription_rel</structname> Columns</title>
6569 <entry>References</entry>
6570 <entry>Description</entry>
6576 <entry><structfield>srsubid</structfield></entry>
6577 <entry><type>oid</type></entry>
6578 <entry><literal><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.oid</literal></entry>
6579 <entry>Reference to subscription</entry>
6583 <entry><structfield>srrelid</structfield></entry>
6584 <entry><type>oid</type></entry>
6585 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6586 <entry>Reference to relation</entry>
6590 <entry><structfield>srsubstate</structfield></entry>
6591 <entry><type>char</type></entry>
6595 <literal>i</> = initialize,
6596 <literal>d</> = data is being copied,
6597 <literal>s</> = synchronized,
6598 <literal>r</> = ready (normal replication)
6603 <entry><structfield>srsublsn</structfield></entry>
6604 <entry><type>pg_lsn</type></entry>
6607 End LSN for <literal>s</> and <literal>r</> states.
6615 <sect1 id="catalog-pg-tablespace">
6616 <title><structname>pg_tablespace</structname></title>
6618 <indexterm zone="catalog-pg-tablespace">
6619 <primary>pg_tablespace</primary>
6623 The catalog <structname>pg_tablespace</structname> stores information
6624 about the available tablespaces. Tables can be placed in particular
6625 tablespaces to aid administration of disk layout.
6629 Unlike most system catalogs, <structname>pg_tablespace</structname>
6630 is shared across all databases of a cluster: there is only one
6631 copy of <structname>pg_tablespace</structname> per cluster, not
6636 <title><structname>pg_tablespace</> Columns</title>
6643 <entry>References</entry>
6644 <entry>Description</entry>
6650 <entry><structfield>oid</structfield></entry>
6651 <entry><type>oid</type></entry>
6653 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6657 <entry><structfield>spcname</structfield></entry>
6658 <entry><type>name</type></entry>
6660 <entry>Tablespace name</entry>
6664 <entry><structfield>spcowner</structfield></entry>
6665 <entry><type>oid</type></entry>
6666 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6667 <entry>Owner of the tablespace, usually the user who created it</entry>
6671 <entry><structfield>spcacl</structfield></entry>
6672 <entry><type>aclitem[]</type></entry>
6675 Access privileges; see
6676 <xref linkend="sql-grant"> and
6677 <xref linkend="sql-revoke">
6683 <entry><structfield>spcoptions</structfield></entry>
6684 <entry><type>text[]</type></entry>
6687 Tablespace-level options, as <quote>keyword=value</> strings
6696 <sect1 id="catalog-pg-transform">
6697 <title><structname>pg_transform</structname></title>
6699 <indexterm zone="catalog-pg-transform">
6700 <primary>pg_transform</primary>
6704 The catalog <structname>pg_transform</structname> stores information about
6705 transforms, which are a mechanism to adapt data types to procedural
6706 languages. See <xref linkend="sql-createtransform"> for more information.
6710 <title><structname>pg_transform</> Columns</title>
6717 <entry>References</entry>
6718 <entry>Description</entry>
6724 <entry><structfield>trftype</structfield></entry>
6725 <entry><type>oid</type></entry>
6726 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6727 <entry>OID of the data type this transform is for</entry>
6731 <entry><structfield>trflang</structfield></entry>
6732 <entry><type>oid</type></entry>
6733 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6734 <entry>OID of the language this transform is for</entry>
6738 <entry><structfield>trffromsql</structfield></entry>
6739 <entry><type>regproc</type></entry>
6740 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6742 The OID of the function to use when converting the data type for input
6743 to the procedural language (e.g., function parameters). Zero is stored
6744 if this operation is not supported.
6749 <entry><structfield>trftosql</structfield></entry>
6750 <entry><type>regproc</type></entry>
6751 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6753 The OID of the function to use when converting output from the
6754 procedural language (e.g., return values) to the data type. Zero is
6755 stored if this operation is not supported.
6764 <sect1 id="catalog-pg-trigger">
6765 <title><structname>pg_trigger</structname></title>
6767 <indexterm zone="catalog-pg-trigger">
6768 <primary>pg_trigger</primary>
6772 The catalog <structname>pg_trigger</structname> stores triggers on tables
6774 See <xref linkend="sql-createtrigger">
6775 for more information.
6779 <title><structname>pg_trigger</> Columns</title>
6786 <entry>References</entry>
6787 <entry>Description</entry>
6793 <entry><structfield>oid</structfield></entry>
6794 <entry><type>oid</type></entry>
6796 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6800 <entry><structfield>tgrelid</structfield></entry>
6801 <entry><type>oid</type></entry>
6802 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6803 <entry>The table this trigger is on</entry>
6807 <entry><structfield>tgname</structfield></entry>
6808 <entry><type>name</type></entry>
6810 <entry>Trigger name (must be unique among triggers of same table)</entry>
6814 <entry><structfield>tgfoid</structfield></entry>
6815 <entry><type>oid</type></entry>
6816 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6817 <entry>The function to be called</entry>
6821 <entry><structfield>tgtype</structfield></entry>
6822 <entry><type>int2</type></entry>
6824 <entry>Bit mask identifying trigger firing conditions</entry>
6828 <entry><structfield>tgenabled</structfield></entry>
6829 <entry><type>char</type></entry>
6832 Controls in which <xref linkend="guc-session-replication-role"> modes
6834 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6835 <literal>D</> = trigger is disabled,
6836 <literal>R</> = trigger fires in <quote>replica</> mode,
6837 <literal>A</> = trigger fires always.
6842 <entry><structfield>tgisinternal</structfield></entry>
6843 <entry><type>bool</type></entry>
6845 <entry>True if trigger is internally generated (usually, to enforce
6846 the constraint identified by <structfield>tgconstraint</>)</entry>
6850 <entry><structfield>tgconstrrelid</structfield></entry>
6851 <entry><type>oid</type></entry>
6852 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6853 <entry>The table referenced by a referential integrity constraint</entry>
6857 <entry><structfield>tgconstrindid</structfield></entry>
6858 <entry><type>oid</type></entry>
6859 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6860 <entry>The index supporting a unique, primary key, referential integrity,
6861 or exclusion constraint</entry>
6865 <entry><structfield>tgconstraint</structfield></entry>
6866 <entry><type>oid</type></entry>
6867 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6868 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6872 <entry><structfield>tgdeferrable</structfield></entry>
6873 <entry><type>bool</type></entry>
6875 <entry>True if constraint trigger is deferrable</entry>
6879 <entry><structfield>tginitdeferred</structfield></entry>
6880 <entry><type>bool</type></entry>
6882 <entry>True if constraint trigger is initially deferred</entry>
6886 <entry><structfield>tgnargs</structfield></entry>
6887 <entry><type>int2</type></entry>
6889 <entry>Number of argument strings passed to trigger function</entry>
6893 <entry><structfield>tgattr</structfield></entry>
6894 <entry><type>int2vector</type></entry>
6895 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6896 <entry>Column numbers, if trigger is column-specific; otherwise an
6901 <entry><structfield>tgargs</structfield></entry>
6902 <entry><type>bytea</type></entry>
6904 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6908 <entry><structfield>tgqual</structfield></entry>
6909 <entry><type>pg_node_tree</type></entry>
6911 <entry>Expression tree (in <function>nodeToString()</function>
6912 representation) for the trigger's <literal>WHEN</> condition, or null
6917 <entry><structfield>tgoldtable</structfield></entry>
6918 <entry><type>name</type></entry>
6920 <entry><literal>REFERENCING</> clause name for <literal>OLD TABLE</>,
6921 or null if none</entry>
6925 <entry><structfield>tgnewtable</structfield></entry>
6926 <entry><type>name</type></entry>
6928 <entry><literal>REFERENCING</> clause name for <literal>NEW TABLE</>,
6929 or null if none</entry>
6936 Currently, column-specific triggering is supported only for
6937 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6938 only for that event type. <structfield>tgtype</structfield> might
6939 contain bits for other event types as well, but those are presumed
6940 to be table-wide regardless of what is in <structfield>tgattr</>.
6945 When <structfield>tgconstraint</> is nonzero,
6946 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6947 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6948 largely redundant with the referenced <structname>pg_constraint</> entry.
6949 However, it is possible for a non-deferrable trigger to be associated
6950 with a deferrable constraint: foreign key constraints can have some
6951 deferrable and some non-deferrable triggers.
6957 <literal>pg_class.relhastriggers</literal>
6958 must be true if a relation has any triggers in this catalog.
6965 <sect1 id="catalog-pg-ts-config">
6966 <title><structname>pg_ts_config</structname></title>
6968 <indexterm zone="catalog-pg-ts-config">
6969 <primary>pg_ts_config</primary>
6973 The <structname>pg_ts_config</structname> catalog contains entries
6974 representing text search configurations. A configuration specifies
6975 a particular text search parser and a list of dictionaries to use
6976 for each of the parser's output token types. The parser is shown
6977 in the <structname>pg_ts_config</structname> entry, but the
6978 token-to-dictionary mapping is defined by subsidiary entries in <link
6979 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6983 <productname>PostgreSQL</productname>'s text search features are
6984 described at length in <xref linkend="textsearch">.
6988 <title><structname>pg_ts_config</> Columns</title>
6995 <entry>References</entry>
6996 <entry>Description</entry>
7002 <entry><structfield>oid</structfield></entry>
7003 <entry><type>oid</type></entry>
7005 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7009 <entry><structfield>cfgname</structfield></entry>
7010 <entry><type>name</type></entry>
7012 <entry>Text search configuration name</entry>
7016 <entry><structfield>cfgnamespace</structfield></entry>
7017 <entry><type>oid</type></entry>
7018 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7020 The OID of the namespace that contains this configuration
7025 <entry><structfield>cfgowner</structfield></entry>
7026 <entry><type>oid</type></entry>
7027 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7028 <entry>Owner of the configuration</entry>
7032 <entry><structfield>cfgparser</structfield></entry>
7033 <entry><type>oid</type></entry>
7034 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
7035 <entry>The OID of the text search parser for this configuration</entry>
7043 <sect1 id="catalog-pg-ts-config-map">
7044 <title><structname>pg_ts_config_map</structname></title>
7046 <indexterm zone="catalog-pg-ts-config-map">
7047 <primary>pg_ts_config_map</primary>
7051 The <structname>pg_ts_config_map</structname> catalog contains entries
7052 showing which text search dictionaries should be consulted, and in
7053 what order, for each output token type of each text search configuration's
7058 <productname>PostgreSQL</productname>'s text search features are
7059 described at length in <xref linkend="textsearch">.
7063 <title><structname>pg_ts_config_map</> Columns</title>
7070 <entry>References</entry>
7071 <entry>Description</entry>
7077 <entry><structfield>mapcfg</structfield></entry>
7078 <entry><type>oid</type></entry>
7079 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
7080 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
7084 <entry><structfield>maptokentype</structfield></entry>
7085 <entry><type>integer</type></entry>
7087 <entry>A token type emitted by the configuration's parser</entry>
7091 <entry><structfield>mapseqno</structfield></entry>
7092 <entry><type>integer</type></entry>
7094 <entry>Order in which to consult this entry (lower
7095 <structfield>mapseqno</>s first)</entry>
7099 <entry><structfield>mapdict</structfield></entry>
7100 <entry><type>oid</type></entry>
7101 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
7102 <entry>The OID of the text search dictionary to consult</entry>
7110 <sect1 id="catalog-pg-ts-dict">
7111 <title><structname>pg_ts_dict</structname></title>
7113 <indexterm zone="catalog-pg-ts-dict">
7114 <primary>pg_ts_dict</primary>
7118 The <structname>pg_ts_dict</structname> catalog contains entries
7119 defining text search dictionaries. A dictionary depends on a text
7120 search template, which specifies all the implementation functions
7121 needed; the dictionary itself provides values for the user-settable
7122 parameters supported by the template. This division of labor allows
7123 dictionaries to be created by unprivileged users. The parameters
7124 are specified by a text string <structfield>dictinitoption</>,
7125 whose format and meaning vary depending on the template.
7129 <productname>PostgreSQL</productname>'s text search features are
7130 described at length in <xref linkend="textsearch">.
7134 <title><structname>pg_ts_dict</> Columns</title>
7141 <entry>References</entry>
7142 <entry>Description</entry>
7148 <entry><structfield>oid</structfield></entry>
7149 <entry><type>oid</type></entry>
7151 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7155 <entry><structfield>dictname</structfield></entry>
7156 <entry><type>name</type></entry>
7158 <entry>Text search dictionary name</entry>
7162 <entry><structfield>dictnamespace</structfield></entry>
7163 <entry><type>oid</type></entry>
7164 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7166 The OID of the namespace that contains this dictionary
7171 <entry><structfield>dictowner</structfield></entry>
7172 <entry><type>oid</type></entry>
7173 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7174 <entry>Owner of the dictionary</entry>
7178 <entry><structfield>dicttemplate</structfield></entry>
7179 <entry><type>oid</type></entry>
7180 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
7181 <entry>The OID of the text search template for this dictionary</entry>
7185 <entry><structfield>dictinitoption</structfield></entry>
7186 <entry><type>text</type></entry>
7188 <entry>Initialization option string for the template</entry>
7196 <sect1 id="catalog-pg-ts-parser">
7197 <title><structname>pg_ts_parser</structname></title>
7199 <indexterm zone="catalog-pg-ts-parser">
7200 <primary>pg_ts_parser</primary>
7204 The <structname>pg_ts_parser</structname> catalog contains entries
7205 defining text search parsers. A parser is responsible for splitting
7206 input text into lexemes and assigning a token type to each lexeme.
7207 Since a parser must be implemented by C-language-level functions,
7208 creation of new parsers is restricted to database superusers.
7212 <productname>PostgreSQL</productname>'s text search features are
7213 described at length in <xref linkend="textsearch">.
7217 <title><structname>pg_ts_parser</> Columns</title>
7224 <entry>References</entry>
7225 <entry>Description</entry>
7231 <entry><structfield>oid</structfield></entry>
7232 <entry><type>oid</type></entry>
7234 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7238 <entry><structfield>prsname</structfield></entry>
7239 <entry><type>name</type></entry>
7241 <entry>Text search parser name</entry>
7245 <entry><structfield>prsnamespace</structfield></entry>
7246 <entry><type>oid</type></entry>
7247 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7249 The OID of the namespace that contains this parser
7254 <entry><structfield>prsstart</structfield></entry>
7255 <entry><type>regproc</type></entry>
7256 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7257 <entry>OID of the parser's startup function</entry>
7261 <entry><structfield>prstoken</structfield></entry>
7262 <entry><type>regproc</type></entry>
7263 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7264 <entry>OID of the parser's next-token function</entry>
7268 <entry><structfield>prsend</structfield></entry>
7269 <entry><type>regproc</type></entry>
7270 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7271 <entry>OID of the parser's shutdown function</entry>
7275 <entry><structfield>prsheadline</structfield></entry>
7276 <entry><type>regproc</type></entry>
7277 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7278 <entry>OID of the parser's headline function</entry>
7282 <entry><structfield>prslextype</structfield></entry>
7283 <entry><type>regproc</type></entry>
7284 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7285 <entry>OID of the parser's lextype function</entry>
7293 <sect1 id="catalog-pg-ts-template">
7294 <title><structname>pg_ts_template</structname></title>
7296 <indexterm zone="catalog-pg-ts-template">
7297 <primary>pg_ts_template</primary>
7301 The <structname>pg_ts_template</structname> catalog contains entries
7302 defining text search templates. A template is the implementation
7303 skeleton for a class of text search dictionaries.
7304 Since a template must be implemented by C-language-level functions,
7305 creation of new templates is restricted to database superusers.
7309 <productname>PostgreSQL</productname>'s text search features are
7310 described at length in <xref linkend="textsearch">.
7314 <title><structname>pg_ts_template</> Columns</title>
7321 <entry>References</entry>
7322 <entry>Description</entry>
7328 <entry><structfield>oid</structfield></entry>
7329 <entry><type>oid</type></entry>
7331 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7335 <entry><structfield>tmplname</structfield></entry>
7336 <entry><type>name</type></entry>
7338 <entry>Text search template name</entry>
7342 <entry><structfield>tmplnamespace</structfield></entry>
7343 <entry><type>oid</type></entry>
7344 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7346 The OID of the namespace that contains this template
7351 <entry><structfield>tmplinit</structfield></entry>
7352 <entry><type>regproc</type></entry>
7353 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7354 <entry>OID of the template's initialization function</entry>
7358 <entry><structfield>tmpllexize</structfield></entry>
7359 <entry><type>regproc</type></entry>
7360 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7361 <entry>OID of the template's lexize function</entry>
7369 <sect1 id="catalog-pg-type">
7370 <title><structname>pg_type</structname></title>
7372 <indexterm zone="catalog-pg-type">
7373 <primary>pg_type</primary>
7377 The catalog <structname>pg_type</structname> stores information about data
7378 types. Base types and enum types (scalar types) are created with
7379 <xref linkend="sql-createtype">, and
7381 <xref linkend="sql-createdomain">.
7382 A composite type is automatically created for each table in the database, to
7383 represent the row structure of the table. It is also possible to create
7384 composite types with <command>CREATE TYPE AS</command>.
7388 <title><structname>pg_type</> Columns</title>
7395 <entry>References</entry>
7396 <entry>Description</entry>
7402 <entry><structfield>oid</structfield></entry>
7403 <entry><type>oid</type></entry>
7405 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7409 <entry><structfield>typname</structfield></entry>
7410 <entry><type>name</type></entry>
7412 <entry>Data type name</entry>
7416 <entry><structfield>typnamespace</structfield></entry>
7417 <entry><type>oid</type></entry>
7418 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7420 The OID of the namespace that contains this type
7425 <entry><structfield>typowner</structfield></entry>
7426 <entry><type>oid</type></entry>
7427 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7428 <entry>Owner of the type</entry>
7432 <entry><structfield>typlen</structfield></entry>
7433 <entry><type>int2</type></entry>
7436 For a fixed-size type, <structfield>typlen</structfield> is the number
7437 of bytes in the internal representation of the type. But for a
7438 variable-length type, <structfield>typlen</structfield> is negative.
7439 -1 indicates a <quote>varlena</> type (one that has a length word),
7440 -2 indicates a null-terminated C string.
7445 <entry><structfield>typbyval</structfield></entry>
7446 <entry><type>bool</type></entry>
7449 <structfield>typbyval</structfield> determines whether internal
7450 routines pass a value of this type by value or by reference.
7451 <structfield>typbyval</structfield> had better be false if
7452 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7453 where Datum is 8 bytes).
7454 Variable-length types are always passed by reference. Note that
7455 <structfield>typbyval</structfield> can be false even if the
7456 length would allow pass-by-value.
7461 <entry><structfield>typtype</structfield></entry>
7462 <entry><type>char</type></entry>
7465 <structfield>typtype</structfield> is
7466 <literal>b</literal> for a base type,
7467 <literal>c</literal> for a composite type (e.g., a table's row type),
7468 <literal>d</literal> for a domain,
7469 <literal>e</literal> for an enum type,
7470 <literal>p</literal> for a pseudo-type, or
7471 <literal>r</literal> for a range type.
7472 See also <structfield>typrelid</structfield> and
7473 <structfield>typbasetype</structfield>.
7478 <entry><structfield>typcategory</structfield></entry>
7479 <entry><type>char</type></entry>
7482 <structfield>typcategory</structfield> is an arbitrary classification
7483 of data types that is used by the parser to determine which implicit
7484 casts should be <quote>preferred</>.
7485 See <xref linkend="catalog-typcategory-table">.
7490 <entry><structfield>typispreferred</structfield></entry>
7491 <entry><type>bool</type></entry>
7494 True if the type is a preferred cast target within its
7495 <structfield>typcategory</structfield>
7500 <entry><structfield>typisdefined</structfield></entry>
7501 <entry><type>bool</type></entry>
7504 True if the type is defined, false if this is a placeholder
7505 entry for a not-yet-defined type. When
7506 <structfield>typisdefined</structfield> is false, nothing
7507 except the type name, namespace, and OID can be relied on.
7512 <entry><structfield>typdelim</structfield></entry>
7513 <entry><type>char</type></entry>
7516 Character that separates two values of this type when parsing
7517 array input. Note that the delimiter is associated with the array
7518 element data type, not the array data type.
7523 <entry><structfield>typrelid</structfield></entry>
7524 <entry><type>oid</type></entry>
7525 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7527 If this is a composite type (see
7528 <structfield>typtype</structfield>), then this column points to
7529 the <structname>pg_class</structname> entry that defines the
7530 corresponding table. (For a free-standing composite type, the
7531 <structname>pg_class</structname> entry doesn't really represent
7532 a table, but it is needed anyway for the type's
7533 <structname>pg_attribute</structname> entries to link to.)
7534 Zero for non-composite types.
7539 <entry><structfield>typelem</structfield></entry>
7540 <entry><type>oid</type></entry>
7541 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7543 If <structfield>typelem</structfield> is not 0 then it
7544 identifies another row in <structname>pg_type</structname>.
7545 The current type can then be subscripted like an array yielding
7546 values of type <structfield>typelem</structfield>. A
7547 <quote>true</quote> array type is variable length
7548 (<structfield>typlen</structfield> = -1),
7549 but some fixed-length (<structfield>typlen</structfield> > 0) types
7550 also have nonzero <structfield>typelem</structfield>, for example
7551 <type>name</type> and <type>point</type>.
7552 If a fixed-length type has a <structfield>typelem</structfield> then
7553 its internal representation must be some number of values of the
7554 <structfield>typelem</structfield> data type with no other data.
7555 Variable-length array types have a header defined by the array
7561 <entry><structfield>typarray</structfield></entry>
7562 <entry><type>oid</type></entry>
7563 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7565 If <structfield>typarray</structfield> is not 0 then it
7566 identifies another row in <structname>pg_type</structname>, which
7567 is the <quote>true</quote> array type having this type as element
7572 <entry><structfield>typinput</structfield></entry>
7573 <entry><type>regproc</type></entry>
7574 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7575 <entry>Input conversion function (text format)</entry>
7579 <entry><structfield>typoutput</structfield></entry>
7580 <entry><type>regproc</type></entry>
7581 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7582 <entry>Output conversion function (text format)</entry>
7586 <entry><structfield>typreceive</structfield></entry>
7587 <entry><type>regproc</type></entry>
7588 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7589 <entry>Input conversion function (binary format), or 0 if none</entry>
7593 <entry><structfield>typsend</structfield></entry>
7594 <entry><type>regproc</type></entry>
7595 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7596 <entry>Output conversion function (binary format), or 0 if none</entry>
7600 <entry><structfield>typmodin</structfield></entry>
7601 <entry><type>regproc</type></entry>
7602 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7603 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7607 <entry><structfield>typmodout</structfield></entry>
7608 <entry><type>regproc</type></entry>
7609 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7610 <entry>Type modifier output function, or 0 to use the standard format</entry>
7614 <entry><structfield>typanalyze</structfield></entry>
7615 <entry><type>regproc</type></entry>
7616 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7617 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7621 <entry><structfield>typalign</structfield></entry>
7622 <entry><type>char</type></entry>
7626 <structfield>typalign</structfield> is the alignment required
7627 when storing a value of this type. It applies to storage on
7628 disk as well as most representations of the value inside
7629 <productname>PostgreSQL</>.
7630 When multiple values are stored consecutively, such
7631 as in the representation of a complete row on disk, padding is
7632 inserted before a datum of this type so that it begins on the
7633 specified boundary. The alignment reference is the beginning
7634 of the first datum in the sequence.
7638 Possible values are:
7641 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7644 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7647 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7650 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7655 For types used in system tables, it is critical that the size
7656 and alignment defined in <structname>pg_type</structname>
7657 agree with the way that the compiler will lay out the column in
7658 a structure representing a table row.
7664 <entry><structfield>typstorage</structfield></entry>
7665 <entry><type>char</type></entry>
7668 <structfield>typstorage</structfield> tells for varlena
7669 types (those with <structfield>typlen</structfield> = -1) if
7670 the type is prepared for toasting and what the default strategy
7671 for attributes of this type should be.
7675 <para><literal>p</>: Value must always be stored plain.</para>
7679 <literal>e</>: Value can be stored in a <quote>secondary</quote>
7680 relation (if relation has one, see
7681 <literal>pg_class.reltoastrelid</literal>).
7685 <para><literal>m</>: Value can be stored compressed inline.</para>
7688 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7691 Note that <literal>m</> columns can also be moved out to secondary
7692 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7698 <entry><structfield>typnotnull</structfield></entry>
7699 <entry><type>bool</type></entry>
7702 <structfield>typnotnull</structfield> represents a not-null
7703 constraint on a type. Used for domains only.
7708 <entry><structfield>typbasetype</structfield></entry>
7709 <entry><type>oid</type></entry>
7710 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7712 If this is a domain (see <structfield>typtype</structfield>), then
7713 <structfield>typbasetype</structfield> identifies the type that this
7714 one is based on. Zero if this type is not a domain.
7719 <entry><structfield>typtypmod</structfield></entry>
7720 <entry><type>int4</type></entry>
7723 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7724 to be applied to their base type (-1 if base type does not use a
7725 <literal>typmod</>). -1 if this type is not a domain.
7730 <entry><structfield>typndims</structfield></entry>
7731 <entry><type>int4</type></entry>
7734 <structfield>typndims</structfield> is the number of array dimensions
7735 for a domain over an array (that is, <structfield>typbasetype</> is
7737 Zero for types other than domains over array types.
7742 <entry><structfield>typcollation</structfield></entry>
7743 <entry><type>oid</type></entry>
7744 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7746 <structfield>typcollation</structfield> specifies the collation
7747 of the type. If the type does not support collations, this will
7748 be zero. A base type that supports collations will have
7749 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7750 collatable type can have some other collation OID, if one was
7751 specified for the domain.
7756 <entry><structfield>typdefaultbin</structfield></entry>
7757 <entry><type>pg_node_tree</type></entry>
7760 If <structfield>typdefaultbin</> is not null, it is the
7761 <function>nodeToString()</function>
7762 representation of a default expression for the type. This is
7763 only used for domains.
7768 <entry><structfield>typdefault</structfield></entry>
7769 <entry><type>text</type></entry>
7772 <structfield>typdefault</> is null if the type has no associated
7773 default value. If <structfield>typdefaultbin</> is not null,
7774 <structfield>typdefault</> must contain a human-readable version of the
7775 default expression represented by <structfield>typdefaultbin</>. If
7776 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7777 not, then <structfield>typdefault</> is the external representation of
7778 the type's default value, which can be fed to the type's input
7779 converter to produce a constant.
7784 <entry><structfield>typacl</structfield></entry>
7785 <entry><type>aclitem[]</type></entry>
7788 Access privileges; see
7789 <xref linkend="sql-grant"> and
7790 <xref linkend="sql-revoke">
7799 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7800 of <structfield>typcategory</>. Any future additions to this list will
7801 also be upper-case ASCII letters. All other ASCII characters are reserved
7802 for user-defined categories.
7805 <table id="catalog-typcategory-table">
7806 <title><structfield>typcategory</> Codes</title>
7812 <entry>Category</entry>
7818 <entry><literal>A</literal></entry>
7819 <entry>Array types</entry>
7822 <entry><literal>B</literal></entry>
7823 <entry>Boolean types</entry>
7826 <entry><literal>C</literal></entry>
7827 <entry>Composite types</entry>
7830 <entry><literal>D</literal></entry>
7831 <entry>Date/time types</entry>
7834 <entry><literal>E</literal></entry>
7835 <entry>Enum types</entry>
7838 <entry><literal>G</literal></entry>
7839 <entry>Geometric types</entry>
7842 <entry><literal>I</literal></entry>
7843 <entry>Network address types</entry>
7846 <entry><literal>N</literal></entry>
7847 <entry>Numeric types</entry>
7850 <entry><literal>P</literal></entry>
7851 <entry>Pseudo-types</entry>
7854 <entry><literal>R</literal></entry>
7855 <entry>Range types</entry>
7858 <entry><literal>S</literal></entry>
7859 <entry>String types</entry>
7862 <entry><literal>T</literal></entry>
7863 <entry>Timespan types</entry>
7866 <entry><literal>U</literal></entry>
7867 <entry>User-defined types</entry>
7870 <entry><literal>V</literal></entry>
7871 <entry>Bit-string types</entry>
7874 <entry><literal>X</literal></entry>
7875 <entry><type>unknown</> type</entry>
7884 <sect1 id="catalog-pg-user-mapping">
7885 <title><structname>pg_user_mapping</structname></title>
7887 <indexterm zone="catalog-pg-user-mapping">
7888 <primary>pg_user_mapping</primary>
7892 The catalog <structname>pg_user_mapping</structname> stores
7893 the mappings from local user to remote. Access to this catalog is
7894 restricted from normal users, use the view
7895 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7900 <title><structname>pg_user_mapping</> Columns</title>
7907 <entry>References</entry>
7908 <entry>Description</entry>
7914 <entry><structfield>oid</structfield></entry>
7915 <entry><type>oid</type></entry>
7917 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7921 <entry><structfield>umuser</structfield></entry>
7922 <entry><type>oid</type></entry>
7923 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7924 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7928 <entry><structfield>umserver</structfield></entry>
7929 <entry><type>oid</type></entry>
7930 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7932 The OID of the foreign server that contains this mapping
7937 <entry><structfield>umoptions</structfield></entry>
7938 <entry><type>text[]</type></entry>
7941 User mapping specific options, as <quote>keyword=value</> strings
7950 <sect1 id="views-overview">
7951 <title>System Views</title>
7954 In addition to the system catalogs, <productname>PostgreSQL</productname>
7955 provides a number of built-in views. Some system views provide convenient
7956 access to some commonly used queries on the system catalogs. Other views
7957 provide access to internal server state.
7961 The information schema (<xref linkend="information-schema">) provides
7962 an alternative set of views which overlap the functionality of the system
7963 views. Since the information schema is SQL-standard whereas the views
7964 described here are <productname>PostgreSQL</productname>-specific,
7965 it's usually better to use the information schema if it provides all
7966 the information you need.
7970 <xref linkend="view-table"> lists the system views described here.
7971 More detailed documentation of each view follows below.
7972 There are some additional views that provide access to the results of
7973 the statistics collector; they are described in <xref
7974 linkend="monitoring-stats-views-table">.
7978 Except where noted, all the views described here are read-only.
7981 <table id="view-table">
7982 <title>System Views</title>
7987 <entry>View Name</entry>
7988 <entry>Purpose</entry>
7994 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7995 <entry>available extensions</entry>
7999 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
8000 <entry>available versions of extensions</entry>
8004 <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
8005 <entry>compile-time configuration parameters</entry>
8009 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
8010 <entry>open cursors</entry>
8014 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
8015 <entry>summary of configuration file contents</entry>
8019 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
8020 <entry>groups of database users</entry>
8024 <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
8025 <entry>summary of client authentication configuration file contents</entry>
8029 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
8030 <entry>indexes</entry>
8034 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
8035 <entry>locks currently held or awaited</entry>
8039 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
8040 <entry>materialized views</entry>
8044 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
8045 <entry>policies</entry>
8049 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
8050 <entry>prepared statements</entry>
8054 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
8055 <entry>prepared transactions</entry>
8059 <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
8060 <entry>publications and their associated tables</entry>
8064 <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
8065 <entry>information about replication origins, including replication progress</entry>
8069 <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
8070 <entry>replication slot information</entry>
8074 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
8075 <entry>database roles</entry>
8079 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
8080 <entry>rules</entry>
8084 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
8085 <entry>security labels</entry>
8089 <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
8090 <entry>sequences</entry>
8094 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
8095 <entry>parameter settings</entry>
8099 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
8100 <entry>database users</entry>
8104 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
8105 <entry>planner statistics</entry>
8109 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
8110 <entry>tables</entry>
8114 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
8115 <entry>time zone abbreviations</entry>
8119 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
8120 <entry>time zone names</entry>
8124 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
8125 <entry>database users</entry>
8129 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
8130 <entry>user mappings</entry>
8134 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
8135 <entry>views</entry>
8143 <sect1 id="view-pg-available-extensions">
8144 <title><structname>pg_available_extensions</structname></title>
8146 <indexterm zone="view-pg-available-extensions">
8147 <primary>pg_available_extensions</primary>
8151 The <structname>pg_available_extensions</structname> view lists the
8152 extensions that are available for installation.
8154 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8155 catalog, which shows the extensions currently installed.
8159 <title><structname>pg_available_extensions</> Columns</title>
8166 <entry>Description</entry>
8172 <entry><structfield>name</structfield></entry>
8173 <entry><type>name</type></entry>
8174 <entry>Extension name</entry>
8178 <entry><structfield>default_version</structfield></entry>
8179 <entry><type>text</type></entry>
8180 <entry>Name of default version, or <literal>NULL</literal> if none is
8185 <entry><structfield>installed_version</structfield></entry>
8186 <entry><type>text</type></entry>
8187 <entry>Currently installed version of the extension,
8188 or <literal>NULL</literal> if not installed</entry>
8192 <entry><structfield>comment</structfield></entry>
8193 <entry><type>text</type></entry>
8194 <entry>Comment string from the extension's control file</entry>
8201 The <structname>pg_available_extensions</structname> view is read only.
8205 <sect1 id="view-pg-available-extension-versions">
8206 <title><structname>pg_available_extension_versions</structname></title>
8208 <indexterm zone="view-pg-available-extension-versions">
8209 <primary>pg_available_extension_versions</primary>
8213 The <structname>pg_available_extension_versions</structname> view lists the
8214 specific extension versions that are available for installation.
8216 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8217 catalog, which shows the extensions currently installed.
8221 <title><structname>pg_available_extension_versions</> Columns</title>
8228 <entry>Description</entry>
8234 <entry><structfield>name</structfield></entry>
8235 <entry><type>name</type></entry>
8236 <entry>Extension name</entry>
8240 <entry><structfield>version</structfield></entry>
8241 <entry><type>text</type></entry>
8242 <entry>Version name</entry>
8246 <entry><structfield>installed</structfield></entry>
8247 <entry><type>bool</type></entry>
8248 <entry>True if this version of this extension is currently
8253 <entry><structfield>superuser</structfield></entry>
8254 <entry><type>bool</type></entry>
8255 <entry>True if only superusers are allowed to install this extension</entry>
8259 <entry><structfield>relocatable</structfield></entry>
8260 <entry><type>bool</type></entry>
8261 <entry>True if extension can be relocated to another schema</entry>
8265 <entry><structfield>schema</structfield></entry>
8266 <entry><type>name</type></entry>
8267 <entry>Name of the schema that the extension must be installed into,
8268 or <literal>NULL</literal> if partially or fully relocatable</entry>
8272 <entry><structfield>requires</structfield></entry>
8273 <entry><type>name[]</type></entry>
8274 <entry>Names of prerequisite extensions,
8275 or <literal>NULL</literal> if none</entry>
8279 <entry><structfield>comment</structfield></entry>
8280 <entry><type>text</type></entry>
8281 <entry>Comment string from the extension's control file</entry>
8288 The <structname>pg_available_extension_versions</structname> view is read
8293 <sect1 id="view-pg-config">
8294 <title><structname>pg_config</structname></title>
8296 <indexterm zone="view-pg-config">
8297 <primary>pg_config</primary>
8301 The view <structname>pg_config</structname> describes the
8302 compile-time configuration parameters of the currently installed
8303 version of <productname>PostgreSQL</>. It is intended, for example, to
8304 be used by software packages that want to interface to
8305 <productname>PostgreSQL</> to facilitate finding the required header
8306 files and libraries. It provides the same basic information as the
8307 <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
8312 By default, the <structname>pg_config</structname> view can be read
8317 <title><structname>pg_config</> Columns</title>
8323 <entry>Description</entry>
8329 <entry><structfield>name</structfield></entry>
8330 <entry><type>text</type></entry>
8331 <entry>The parameter name</entry>
8335 <entry><structfield>setting</structfield></entry>
8336 <entry><type>text</type></entry>
8337 <entry>The parameter value</entry>
8345 <sect1 id="view-pg-cursors">
8346 <title><structname>pg_cursors</structname></title>
8348 <indexterm zone="view-pg-cursors">
8349 <primary>pg_cursors</primary>
8353 The <structname>pg_cursors</structname> view lists the cursors that
8354 are currently available. Cursors can be defined in several ways:
8358 via the <xref linkend="sql-declare">
8365 via the Bind message in the frontend/backend protocol, as
8366 described in <xref linkend="protocol-flow-ext-query">
8372 via the Server Programming Interface (SPI), as described in
8373 <xref linkend="spi-interface">
8378 The <structname>pg_cursors</structname> view displays cursors
8379 created by any of these means. Cursors only exist for the duration
8380 of the transaction that defines them, unless they have been
8381 declared <literal>WITH HOLD</literal>. Therefore non-holdable
8382 cursors are only present in the view until the end of their
8383 creating transaction.
8387 Cursors are used internally to implement some of the components
8388 of <productname>PostgreSQL</>, such as procedural languages.
8389 Therefore, the <structname>pg_cursors</> view might include cursors
8390 that have not been explicitly created by the user.
8396 <title><structname>pg_cursors</> Columns</title>
8403 <entry>Description</entry>
8409 <entry><structfield>name</structfield></entry>
8410 <entry><type>text</type></entry>
8411 <entry>The name of the cursor</entry>
8415 <entry><structfield>statement</structfield></entry>
8416 <entry><type>text</type></entry>
8417 <entry>The verbatim query string submitted to declare this cursor</entry>
8421 <entry><structfield>is_holdable</structfield></entry>
8422 <entry><type>boolean</type></entry>
8424 <literal>true</literal> if the cursor is holdable (that is, it
8425 can be accessed after the transaction that declared the cursor
8426 has committed); <literal>false</literal> otherwise
8431 <entry><structfield>is_binary</structfield></entry>
8432 <entry><type>boolean</type></entry>
8434 <literal>true</literal> if the cursor was declared
8435 <literal>BINARY</literal>; <literal>false</literal>
8441 <entry><structfield>is_scrollable</structfield></entry>
8442 <entry><type>boolean</type></entry>
8444 <literal>true</> if the cursor is scrollable (that is, it
8445 allows rows to be retrieved in a nonsequential manner);
8446 <literal>false</literal> otherwise
8451 <entry><structfield>creation_time</structfield></entry>
8452 <entry><type>timestamptz</type></entry>
8453 <entry>The time at which the cursor was declared</entry>
8460 The <structname>pg_cursors</structname> view is read only.
8465 <sect1 id="view-pg-file-settings">
8466 <title><structname>pg_file_settings</structname></title>
8468 <indexterm zone="view-pg-file-settings">
8469 <primary>pg_file_settings</primary>
8473 The view <structname>pg_file_settings</structname> provides a summary of
8474 the contents of the server's configuration file(s). A row appears in
8475 this view for each <quote>name = value</> entry appearing in the files,
8476 with annotations indicating whether the value could be applied
8477 successfully. Additional row(s) may appear for problems not linked to
8478 a <quote>name = value</> entry, such as syntax errors in the files.
8482 This view is helpful for checking whether planned changes in the
8483 configuration files will work, or for diagnosing a previous failure.
8484 Note that this view reports on the <emphasis>current</> contents of the
8485 files, not on what was last applied by the server. (The
8486 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
8487 view is usually sufficient to determine that.)
8491 By default, the <structname>pg_file_settings</structname> view can be read
8496 <title><structname>pg_file_settings</> Columns</title>
8503 <entry>Description</entry>
8508 <entry><structfield>sourcefile</structfield></entry>
8509 <entry><structfield>text</structfield></entry>
8510 <entry>Full path name of the configuration file</entry>
8513 <entry><structfield>sourceline</structfield></entry>
8514 <entry><structfield>integer</structfield></entry>
8516 Line number within the configuration file where the entry appears
8520 <entry><structfield>seqno</structfield></entry>
8521 <entry><structfield>integer</structfield></entry>
8522 <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
8525 <entry><structfield>name</structfield></entry>
8526 <entry><structfield>text</structfield></entry>
8527 <entry>Configuration parameter name</entry>
8530 <entry><structfield>setting</structfield></entry>
8531 <entry><structfield>text</structfield></entry>
8532 <entry>Value to be assigned to the parameter</entry>
8535 <entry><structfield>applied</structfield></entry>
8536 <entry><structfield>boolean</structfield></entry>
8537 <entry>True if the value can be applied successfully</entry>
8540 <entry><structfield>error</structfield></entry>
8541 <entry><structfield>text</structfield></entry>
8542 <entry>If not null, an error message indicating why this entry could
8543 not be applied</entry>
8550 If the configuration file contains syntax errors or invalid parameter
8551 names, the server will not attempt to apply any settings from it, and
8552 therefore all the <structfield>applied</> fields will read as false.
8553 In such a case there will be one or more rows with
8554 non-null <structfield>error</structfield> fields indicating the
8555 problem(s). Otherwise, individual settings will be applied if possible.
8556 If an individual setting cannot be applied (e.g., invalid value, or the
8557 setting cannot be changed after server start) it will have an appropriate
8558 message in the <structfield>error</structfield> field. Another way that
8559 an entry might have <structfield>applied</> = false is that it is
8560 overridden by a later entry for the same parameter name; this case is not
8561 considered an error so nothing appears in
8562 the <structfield>error</structfield> field.
8566 See <xref linkend="config-setting"> for more information about the various
8567 ways to change run-time parameters.
8572 <sect1 id="view-pg-group">
8573 <title><structname>pg_group</structname></title>
8575 <indexterm zone="view-pg-group">
8576 <primary>pg_group</primary>
8580 The view <structname>pg_group</structname> exists for backwards
8581 compatibility: it emulates a catalog that existed in
8582 <productname>PostgreSQL</productname> before version 8.1.
8583 It shows the names and members of all roles that are marked as not
8584 <structfield>rolcanlogin</>, which is an approximation to the set
8585 of roles that are being used as groups.
8589 <title><structname>pg_group</> Columns</title>
8596 <entry>References</entry>
8597 <entry>Description</entry>
8603 <entry><structfield>groname</structfield></entry>
8604 <entry><type>name</type></entry>
8605 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8606 <entry>Name of the group</entry>
8610 <entry><structfield>grosysid</structfield></entry>
8611 <entry><type>oid</type></entry>
8612 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8613 <entry>ID of this group</entry>
8617 <entry><structfield>grolist</structfield></entry>
8618 <entry><type>oid[]</type></entry>
8619 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8620 <entry>An array containing the IDs of the roles in this group</entry>
8628 <sect1 id="view-pg-hba-file-rules">
8629 <title><structname>pg_hba_file_rules</structname></title>
8631 <indexterm zone="view-pg-hba-file-rules">
8632 <primary>pg_hba_file_rules</primary>
8636 The view <structname>pg_hba_file_rules</structname> provides a summary of
8637 the contents of the client authentication configuration
8638 file, <filename>pg_hba.conf</>. A row appears in this view for each
8639 non-empty, non-comment line in the file, with annotations indicating
8640 whether the rule could be applied successfully.
8644 This view can be helpful for checking whether planned changes in the
8645 authentication configuration file will work, or for diagnosing a previous
8646 failure. Note that this view reports on the <emphasis>current</> contents
8647 of the file, not on what was last loaded by the server.
8651 By default, the <structname>pg_hba_file_rules</structname> view can be read
8656 <title><structname>pg_hba_file_rules</> Columns</title>
8663 <entry>Description</entry>
8668 <entry><structfield>line_number</structfield></entry>
8669 <entry><structfield>integer</structfield></entry>
8671 Line number of this rule in <filename>pg_hba.conf</>
8675 <entry><structfield>type</structfield></entry>
8676 <entry><structfield>text</structfield></entry>
8677 <entry>Type of connection</entry>
8680 <entry><structfield>database</structfield></entry>
8681 <entry><structfield>text[]</structfield></entry>
8682 <entry>List of database name(s) to which this rule applies</entry>
8685 <entry><structfield>user_name</structfield></entry>
8686 <entry><structfield>text[]</structfield></entry>
8687 <entry>List of user and group name(s) to which this rule applies</entry>
8690 <entry><structfield>address</structfield></entry>
8691 <entry><structfield>text</structfield></entry>
8693 Host name or IP address, or one
8694 of <literal>all</literal>, <literal>samehost</literal>,
8695 or <literal>samenet</literal>, or null for local connections
8699 <entry><structfield>netmask</structfield></entry>
8700 <entry><structfield>text</structfield></entry>
8701 <entry>IP address mask, or null if not applicable</entry>
8704 <entry><structfield>auth_method</structfield></entry>
8705 <entry><type>text</type></entry>
8706 <entry>Authentication method</entry>
8709 <entry><structfield>options</structfield></entry>
8710 <entry><type>text[]</type></entry>
8711 <entry>Options specified for authentication method, if any</entry>
8714 <entry><structfield>error</structfield></entry>
8715 <entry><structfield>text</structfield></entry>
8717 If not null, an error message indicating why this
8718 line could not be processed
8726 Usually, a row reflecting an incorrect entry will have values for only
8727 the <structfield>line_number</> and <structfield>error</> fields.
8731 See <xref linkend="client-authentication"> for more information about
8732 client authentication configuration.
8736 <sect1 id="view-pg-indexes">
8737 <title><structname>pg_indexes</structname></title>
8739 <indexterm zone="view-pg-indexes">
8740 <primary>pg_indexes</primary>
8744 The view <structname>pg_indexes</structname> provides access to
8745 useful information about each index in the database.
8749 <title><structname>pg_indexes</> Columns</title>
8756 <entry>References</entry>
8757 <entry>Description</entry>
8762 <entry><structfield>schemaname</structfield></entry>
8763 <entry><type>name</type></entry>
8764 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8765 <entry>Name of schema containing table and index</entry>
8768 <entry><structfield>tablename</structfield></entry>
8769 <entry><type>name</type></entry>
8770 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8771 <entry>Name of table the index is for</entry>
8774 <entry><structfield>indexname</structfield></entry>
8775 <entry><type>name</type></entry>
8776 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8777 <entry>Name of index</entry>
8780 <entry><structfield>tablespace</structfield></entry>
8781 <entry><type>name</type></entry>
8782 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8783 <entry>Name of tablespace containing index (null if default for database)</entry>
8786 <entry><structfield>indexdef</structfield></entry>
8787 <entry><type>text</type></entry>
8789 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8798 <sect1 id="view-pg-locks">
8799 <title><structname>pg_locks</structname></title>
8801 <indexterm zone="view-pg-locks">
8802 <primary>pg_locks</primary>
8806 The view <structname>pg_locks</structname> provides access to
8807 information about the locks held by active processes within the
8808 database server. See <xref linkend="mvcc"> for more discussion
8813 <structname>pg_locks</structname> contains one row per active lockable
8814 object, requested lock mode, and relevant process. Thus, the same
8815 lockable object might
8816 appear many times, if multiple processes are holding or waiting
8817 for locks on it. However, an object that currently has no locks on it
8818 will not appear at all.
8822 There are several distinct types of lockable objects:
8823 whole relations (e.g., tables), individual pages of relations,
8824 individual tuples of relations,
8825 transaction IDs (both virtual and permanent IDs),
8826 and general database objects (identified by class OID and object OID,
8827 in the same way as in <structname>pg_description</structname> or
8828 <structname>pg_depend</structname>). Also, the right to extend a
8829 relation is represented as a separate lockable object.
8830 Also, <quote>advisory</> locks can be taken on numbers that have
8831 user-defined meanings.
8835 <title><structname>pg_locks</> Columns</title>
8842 <entry>References</entry>
8843 <entry>Description</entry>
8848 <entry><structfield>locktype</structfield></entry>
8849 <entry><type>text</type></entry>
8852 Type of the lockable object:
8853 <literal>relation</>,
8857 <literal>transactionid</>,
8858 <literal>virtualxid</>,
8860 <literal>userlock</>, or
8861 <literal>advisory</>
8865 <entry><structfield>database</structfield></entry>
8866 <entry><type>oid</type></entry>
8867 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8869 OID of the database in which the lock target exists, or
8870 zero if the target is a shared object, or
8871 null if the target is a transaction ID
8875 <entry><structfield>relation</structfield></entry>
8876 <entry><type>oid</type></entry>
8877 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8879 OID of the relation targeted by the lock, or null if the target is not
8880 a relation or part of a relation
8884 <entry><structfield>page</structfield></entry>
8885 <entry><type>integer</type></entry>
8888 Page number targeted by the lock within the relation,
8889 or null if the target is not a relation page or tuple
8893 <entry><structfield>tuple</structfield></entry>
8894 <entry><type>smallint</type></entry>
8897 Tuple number targeted by the lock within the page,
8898 or null if the target is not a tuple
8902 <entry><structfield>virtualxid</structfield></entry>
8903 <entry><type>text</type></entry>
8906 Virtual ID of the transaction targeted by the lock,
8907 or null if the target is not a virtual transaction ID
8911 <entry><structfield>transactionid</structfield></entry>
8912 <entry><type>xid</type></entry>
8915 ID of the transaction targeted by the lock,
8916 or null if the target is not a transaction ID
8920 <entry><structfield>classid</structfield></entry>
8921 <entry><type>oid</type></entry>
8922 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8924 OID of the system catalog containing the lock target, or null if the
8925 target is not a general database object
8929 <entry><structfield>objid</structfield></entry>
8930 <entry><type>oid</type></entry>
8931 <entry>any OID column</entry>
8933 OID of the lock target within its system catalog, or null if the
8934 target is not a general database object
8938 <entry><structfield>objsubid</structfield></entry>
8939 <entry><type>smallint</type></entry>
8942 Column number targeted by the lock (the
8943 <structfield>classid</> and <structfield>objid</> refer to the
8945 or zero if the target is some other general database object,
8946 or null if the target is not a general database object
8950 <entry><structfield>virtualtransaction</structfield></entry>
8951 <entry><type>text</type></entry>
8954 Virtual ID of the transaction that is holding or awaiting this lock
8958 <entry><structfield>pid</structfield></entry>
8959 <entry><type>integer</type></entry>
8962 Process ID of the server process holding or awaiting this
8963 lock, or null if the lock is held by a prepared transaction
8967 <entry><structfield>mode</structfield></entry>
8968 <entry><type>text</type></entry>
8970 <entry>Name of the lock mode held or desired by this process (see <xref
8971 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8974 <entry><structfield>granted</structfield></entry>
8975 <entry><type>boolean</type></entry>
8977 <entry>True if lock is held, false if lock is awaited</entry>
8980 <entry><structfield>fastpath</structfield></entry>
8981 <entry><type>boolean</type></entry>
8983 <entry>True if lock was taken via fast path, false if taken via main
8991 <structfield>granted</structfield> is true in a row representing a lock
8992 held by the indicated process. False indicates that this process is
8993 currently waiting to acquire this lock, which implies that at least one
8994 other process is holding or waiting for a conflicting lock mode on the same
8995 lockable object. The waiting process will sleep until the other lock is
8996 released (or a deadlock situation is detected). A single process can be
8997 waiting to acquire at most one lock at a time.
9001 Throughout running a transaction, a server process holds an exclusive lock
9002 on the transaction's virtual transaction ID. If a permanent ID is assigned
9003 to the transaction (which normally happens only if the transaction changes
9004 the state of the database), it also holds an exclusive lock on the
9005 transaction's permanent transaction ID until it ends. When a process finds
9006 it necessary to wait specifically for another transaction to end, it does
9007 so by attempting to acquire share lock on the other transaction's ID
9008 (either virtual or permanent ID depending on the situation). That will
9009 succeed only when the other transaction terminates and releases its locks.
9013 Although tuples are a lockable type of object,
9014 information about row-level locks is stored on disk, not in memory,
9015 and therefore row-level locks normally do not appear in this view.
9016 If a process is waiting for a
9017 row-level lock, it will usually appear in the view as waiting for the
9018 permanent transaction ID of the current holder of that row lock.
9022 Advisory locks can be acquired on keys consisting of either a single
9023 <type>bigint</type> value or two integer values.
9024 A <type>bigint</type> key is displayed with its
9025 high-order half in the <structfield>classid</> column, its low-order half
9026 in the <structfield>objid</> column, and <structfield>objsubid</> equal
9027 to 1. The original <type>bigint</type> value can be reassembled with the
9028 expression <literal>(classid::bigint << 32) |
9029 objid::bigint</literal>. Integer keys are displayed with the
9031 <structfield>classid</> column, the second key in the <structfield>objid</>
9032 column, and <structfield>objsubid</> equal to 2. The actual meaning of
9033 the keys is up to the user. Advisory locks are local to each database,
9034 so the <structfield>database</> column is meaningful for an advisory lock.
9038 <structname>pg_locks</structname> provides a global view of all locks
9039 in the database cluster, not only those relevant to the current database.
9040 Although its <structfield>relation</structfield> column can be joined
9041 against <structname>pg_class</>.<structfield>oid</> to identify locked
9042 relations, this will only work correctly for relations in the current
9043 database (those for which the <structfield>database</structfield> column
9044 is either the current database's OID or zero).
9048 The <structfield>pid</structfield> column can be joined to the
9049 <structfield>pid</structfield> column of the <link
9050 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
9052 information on the session holding or awaiting each lock,
9055 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
9056 ON pl.pid = psa.pid;
9058 Also, if you are using prepared transactions, the
9059 <structfield>virtualtransaction</> column can be joined to the
9060 <structfield>transaction</structfield> column of the <link
9061 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
9062 view to get more information on prepared transactions that hold locks.
9063 (A prepared transaction can never be waiting for a lock,
9064 but it continues to hold the locks it acquired while running.)
9067 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
9068 ON pl.virtualtransaction = '-1/' || ppx.transaction;
9073 While it is possible to obtain information about which processes block
9074 which other processes by joining <structname>pg_locks</structname> against
9075 itself, this is very difficult to get right in detail. Such a query would
9076 have to encode knowledge about which lock modes conflict with which
9077 others. Worse, the <structname>pg_locks</structname> view does not expose
9078 information about which processes are ahead of which others in lock wait
9079 queues, nor information about which processes are parallel workers running
9080 on behalf of which other client sessions. It is better to use
9081 the <function>pg_blocking_pids()</> function
9082 (see <xref linkend="functions-info-session-table">) to identify which
9083 process(es) a waiting process is blocked behind.
9087 The <structname>pg_locks</structname> view displays data from both the
9088 regular lock manager and the predicate lock manager, which are
9089 separate systems; in addition, the regular lock manager subdivides its
9090 locks into regular and <firstterm>fast-path</> locks.
9091 This data is not guaranteed to be entirely consistent.
9092 When the view is queried,
9093 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
9094 is gathered from each backend one at a time, without freezing the state of
9095 the entire lock manager, so it is possible for locks to be taken or
9096 released while information is gathered. Note, however, that these locks are
9097 known not to conflict with any other lock currently in place. After
9098 all backends have been queried for fast-path locks, the remainder of the
9099 regular lock manager is locked as a unit, and a consistent snapshot of all
9100 remaining locks is collected as an atomic action. After unlocking the
9101 regular lock manager, the predicate lock manager is similarly locked and all
9102 predicate locks are collected as an atomic action. Thus, with the exception
9103 of fast-path locks, each lock manager will deliver a consistent set of
9104 results, but as we do not lock both lock managers simultaneously, it is
9105 possible for locks to be taken or released after we interrogate the regular
9106 lock manager and before we interrogate the predicate lock manager.
9110 Locking the regular and/or predicate lock manager could have some
9111 impact on database performance if this view is very frequently accessed.
9112 The locks are held only for the minimum amount of time necessary to
9113 obtain data from the lock managers, but this does not completely eliminate
9114 the possibility of a performance impact.
9119 <sect1 id="view-pg-matviews">
9120 <title><structname>pg_matviews</structname></title>
9122 <indexterm zone="view-pg-matviews">
9123 <primary>pg_matviews</primary>
9126 <indexterm zone="view-pg-matviews">
9127 <primary>materialized views</primary>
9131 The view <structname>pg_matviews</structname> provides access to
9132 useful information about each materialized view in the database.
9136 <title><structname>pg_matviews</> Columns</title>
9143 <entry>References</entry>
9144 <entry>Description</entry>
9149 <entry><structfield>schemaname</structfield></entry>
9150 <entry><type>name</type></entry>
9151 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9152 <entry>Name of schema containing materialized view</entry>
9155 <entry><structfield>matviewname</structfield></entry>
9156 <entry><type>name</type></entry>
9157 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9158 <entry>Name of materialized view</entry>
9161 <entry><structfield>matviewowner</structfield></entry>
9162 <entry><type>name</type></entry>
9163 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9164 <entry>Name of materialized view's owner</entry>
9167 <entry><structfield>tablespace</structfield></entry>
9168 <entry><type>name</type></entry>
9169 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9170 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
9173 <entry><structfield>hasindexes</structfield></entry>
9174 <entry><type>boolean</type></entry>
9176 <entry>True if materialized view has (or recently had) any indexes</entry>
9179 <entry><structfield>ispopulated</structfield></entry>
9180 <entry><type>boolean</type></entry>
9182 <entry>True if materialized view is currently populated</entry>
9185 <entry><structfield>definition</structfield></entry>
9186 <entry><type>text</type></entry>
9188 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
9196 <sect1 id="view-pg-policies">
9197 <title><structname>pg_policies</structname></title>
9199 <indexterm zone="view-pg-policies">
9200 <primary>pg_policies</primary>
9204 The view <structname>pg_policies</structname> provides access to
9205 useful information about each row-level security policy in the database.
9209 <title><structname>pg_policies</> Columns</title>
9216 <entry>References</entry>
9217 <entry>Description</entry>
9222 <entry><structfield>schemaname</structfield></entry>
9223 <entry><type>name</type></entry>
9224 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9225 <entry>Name of schema containing table policy is on</entry>
9228 <entry><structfield>tablename</structfield></entry>
9229 <entry><type>name</type></entry>
9230 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9231 <entry>Name of table policy is on</entry>
9234 <entry><structfield>policyname</structfield></entry>
9235 <entry><type>name</type></entry>
9236 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
9237 <entry>Name of policy</entry>
9240 <entry><structfield>polpermissive</structfield></entry>
9241 <entry><type>text</type></entry>
9243 <entry>Is the policy permissive or restrictive?</entry>
9246 <entry><structfield>roles</structfield></entry>
9247 <entry><type>name[]</type></entry>
9249 <entry>The roles to which this policy applies</entry>
9252 <entry><structfield>cmd</structfield></entry>
9253 <entry><type>text</type></entry>
9255 <entry>The command type to which the policy is applied</entry>
9258 <entry><structfield>qual</structfield></entry>
9259 <entry><type>text</type></entry>
9261 <entry>The expression added to the security barrier qualifications for
9262 queries that this policy applies to</entry>
9265 <entry><structfield>with_check</structfield></entry>
9266 <entry><type>text</type></entry>
9268 <entry>The expression added to the WITH CHECK qualifications for
9269 queries that attempt to add rows to this table</entry>
9277 <sect1 id="view-pg-prepared-statements">
9278 <title><structname>pg_prepared_statements</structname></title>
9280 <indexterm zone="view-pg-prepared-statements">
9281 <primary>pg_prepared_statements</primary>
9285 The <structname>pg_prepared_statements</structname> view displays
9286 all the prepared statements that are available in the current
9287 session. See <xref linkend="sql-prepare"> for more information about prepared
9292 <structname>pg_prepared_statements</structname> contains one row
9293 for each prepared statement. Rows are added to the view when a new
9294 prepared statement is created and removed when a prepared statement
9295 is released (for example, via the <xref linkend="sql-deallocate"> command).
9299 <title><structname>pg_prepared_statements</> Columns</title>
9306 <entry>Description</entry>
9311 <entry><structfield>name</structfield></entry>
9312 <entry><type>text</type></entry>
9314 The identifier of the prepared statement
9318 <entry><structfield>statement</structfield></entry>
9319 <entry><type>text</type></entry>
9321 The query string submitted by the client to create this
9322 prepared statement. For prepared statements created via SQL,
9323 this is the <command>PREPARE</command> statement submitted by
9324 the client. For prepared statements created via the
9325 frontend/backend protocol, this is the text of the prepared
9330 <entry><structfield>prepare_time</structfield></entry>
9331 <entry><type>timestamptz</type></entry>
9333 The time at which the prepared statement was created
9337 <entry><structfield>parameter_types</structfield></entry>
9338 <entry><type>regtype[]</type></entry>
9340 The expected parameter types for the prepared statement in the
9341 form of an array of <type>regtype</type>. The OID corresponding
9342 to an element of this array can be obtained by casting the
9343 <type>regtype</type> value to <type>oid</type>.
9347 <entry><structfield>from_sql</structfield></entry>
9348 <entry><type>boolean</type></entry>
9350 <literal>true</literal> if the prepared statement was created
9351 via the <command>PREPARE</command> SQL command;
9352 <literal>false</literal> if the statement was prepared via the
9353 frontend/backend protocol
9361 The <structname>pg_prepared_statements</structname> view is read only.
9365 <sect1 id="view-pg-prepared-xacts">
9366 <title><structname>pg_prepared_xacts</structname></title>
9368 <indexterm zone="view-pg-prepared-xacts">
9369 <primary>pg_prepared_xacts</primary>
9373 The view <structname>pg_prepared_xacts</structname> displays
9374 information about transactions that are currently prepared for two-phase
9375 commit (see <xref linkend="sql-prepare-transaction"> for details).
9379 <structname>pg_prepared_xacts</structname> contains one row per prepared
9380 transaction. An entry is removed when the transaction is committed or
9385 <title><structname>pg_prepared_xacts</> Columns</title>
9392 <entry>References</entry>
9393 <entry>Description</entry>
9398 <entry><structfield>transaction</structfield></entry>
9399 <entry><type>xid</type></entry>
9402 Numeric transaction identifier of the prepared transaction
9406 <entry><structfield>gid</structfield></entry>
9407 <entry><type>text</type></entry>
9410 Global transaction identifier that was assigned to the transaction
9414 <entry><structfield>prepared</structfield></entry>
9415 <entry><type>timestamp with time zone</type></entry>
9418 Time at which the transaction was prepared for commit
9422 <entry><structfield>owner</structfield></entry>
9423 <entry><type>name</type></entry>
9424 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9426 Name of the user that executed the transaction
9430 <entry><structfield>database</structfield></entry>
9431 <entry><type>name</type></entry>
9432 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9434 Name of the database in which the transaction was executed
9442 When the <structname>pg_prepared_xacts</structname> view is accessed, the
9443 internal transaction manager data structures are momentarily locked, and
9444 a copy is made for the view to display. This ensures that the
9445 view produces a consistent set of results, while not blocking
9446 normal operations longer than necessary. Nonetheless
9447 there could be some impact on database performance if this view is
9448 frequently accessed.
9453 <sect1 id="view-pg-publication-tables">
9454 <title><structname>pg_publication_tables</structname></title>
9456 <indexterm zone="view-pg-publication-tables">
9457 <primary>pg_publication_tables</primary>
9461 The view <structname>pg_publication_tables</structname> provides
9462 information about the mapping between publications and the tables they
9463 contain. Unlike the underlying
9464 catalog <structname>pg_publication_rel</structname>, this view expands
9465 publications defined as <literal>FOR ALL TABLES</literal>, so for such
9466 publications there will be a row for each eligible table.
9470 <title><structname>pg_publication_tables</structname> Columns</title>
9477 <entry>References</entry>
9478 <entry>Description</entry>
9484 <entry><structfield>pubname</structfield></entry>
9485 <entry><type>name</type></entry>
9486 <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
9487 <entry>Name of publication</entry>
9491 <entry><structfield>schemaname</structfield></entry>
9492 <entry><type>name</type></entry>
9493 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9494 <entry>Name of schema containing table</entry>
9498 <entry><structfield>tablename</structfield></entry>
9499 <entry><type>name</type></entry>
9500 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9501 <entry>Name of table</entry>
9508 <sect1 id="view-pg-replication-origin-status">
9509 <title><structname>pg_replication_origin_status</structname></title>
9511 <indexterm zone="view-pg-replication-origin-status">
9512 <primary>pg_replication_origin_status</primary>
9516 The <structname>pg_replication_origin_status</structname> view
9517 contains information about how far replay for a certain origin has
9518 progressed. For more on replication origins
9519 see <xref linkend="replication-origins">.
9524 <title><structname>pg_replication_origin_status</structname> Columns</title>
9531 <entry>References</entry>
9532 <entry>Description</entry>
9538 <entry><structfield>local_id</structfield></entry>
9539 <entry><type>Oid</type></entry>
9540 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
9541 <entry>internal node identifier</entry>
9545 <entry><structfield>external_id</structfield></entry>
9546 <entry><type>text</type></entry>
9547 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
9548 <entry>external node identifier</entry>
9552 <entry><structfield>remote_lsn</structfield></entry>
9553 <entry><type>pg_lsn</type></entry>
9555 <entry>The origin node's LSN up to which data has been replicated.</entry>
9559 <entry><structfield>local_lsn</structfield></entry>
9560 <entry><type>pg_lsn</type></entry>
9563 This node's LSN at which <literal>remote_lsn</literal> has
9564 been replicated. Used to flush commit records before persisting
9565 data to disk when using asynchronous commits.
9573 <sect1 id="view-pg-replication-slots">
9574 <title><structname>pg_replication_slots</structname></title>
9576 <indexterm zone="view-pg-replication-slots">
9577 <primary>pg_replication_slots</primary>
9581 The <structname>pg_replication_slots</structname> view provides a listing
9582 of all replication slots that currently exist on the database cluster,
9583 along with their current state.
9587 For more on replication slots,
9588 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
9593 <title><structname>pg_replication_slots</structname> Columns</title>
9600 <entry>References</entry>
9601 <entry>Description</entry>
9607 <entry><structfield>slot_name</structfield></entry>
9608 <entry><type>name</type></entry>
9610 <entry>A unique, cluster-wide identifier for the replication slot</entry>
9614 <entry><structfield>plugin</structfield></entry>
9615 <entry><type>name</type></entry>
9617 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
9621 <entry><structfield>slot_type</structfield></entry>
9622 <entry><type>text</type></entry>
9624 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
9628 <entry><structfield>datoid</structfield></entry>
9629 <entry><type>oid</type></entry>
9630 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9631 <entry>The OID of the database this slot is associated with, or
9632 null. Only logical slots have an associated database.</entry>
9636 <entry><structfield>database</structfield></entry>
9637 <entry><type>text</type></entry>
9638 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9639 <entry>The name of the database this slot is associated with, or
9640 null. Only logical slots have an associated database.</entry>
9644 <entry><structfield>temporary</structfield></entry>
9645 <entry><type>boolean</type></entry>
9647 <entry>True if this is a temporary replication slot. Temporary slots are
9648 not saved to disk and are automatically dropped on error or when
9649 the session has finished.</entry>
9653 <entry><structfield>active</structfield></entry>
9654 <entry><type>boolean</type></entry>
9656 <entry>True if this slot is currently actively being used</entry>
9660 <entry><structfield>active_pid</structfield></entry>
9661 <entry><type>integer</type></entry>
9663 <entry>The process ID of the session using this slot if the slot
9664 is currently actively being used. <literal>NULL</literal> if
9670 <entry><structfield>xmin</structfield></entry>
9671 <entry><type>xid</type></entry>
9673 <entry>The oldest transaction that this slot needs the database to
9674 retain. <literal>VACUUM</literal> cannot remove tuples deleted
9675 by any later transaction.
9680 <entry><structfield>catalog_xmin</structfield></entry>
9681 <entry><type>xid</type></entry>
9683 <entry>The oldest transaction affecting the system catalogs that this
9684 slot needs the database to retain. <literal>VACUUM</literal> cannot
9685 remove catalog tuples deleted by any later transaction.
9690 <entry><structfield>restart_lsn</structfield></entry>
9691 <entry><type>pg_lsn</type></entry>
9693 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
9694 might be required by the consumer of this slot and thus won't be
9695 automatically removed during checkpoints.
9700 <entry><structfield>confirmed_flush_lsn</structfield></entry>
9701 <entry><type>pg_lsn</type></entry>
9703 <entry>The address (<literal>LSN</literal>) up to which the logical
9704 slot's consumer has confirmed receiving data. Data older than this is
9705 not available anymore. <literal>NULL</> for physical slots.
9714 <sect1 id="view-pg-roles">
9715 <title><structname>pg_roles</structname></title>
9717 <indexterm zone="view-pg-roles">
9718 <primary>pg_roles</primary>
9722 The view <structname>pg_roles</structname> provides access to
9723 information about database roles. This is simply a publicly
9725 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9726 that blanks out the password field.
9730 This view explicitly exposes the OID column of the underlying table,
9731 since that is needed to do joins to other catalogs.
9735 <title><structname>pg_roles</> Columns</title>
9742 <entry>References</entry>
9743 <entry>Description</entry>
9749 <entry><structfield>rolname</structfield></entry>
9750 <entry><type>name</type></entry>
9752 <entry>Role name</entry>
9756 <entry><structfield>rolsuper</structfield></entry>
9757 <entry><type>bool</type></entry>
9759 <entry>Role has superuser privileges</entry>
9763 <entry><structfield>rolinherit</structfield></entry>
9764 <entry><type>bool</type></entry>
9766 <entry>Role automatically inherits privileges of roles it is a
9771 <entry><structfield>rolcreaterole</structfield></entry>
9772 <entry><type>bool</type></entry>
9774 <entry>Role can create more roles</entry>
9778 <entry><structfield>rolcreatedb</structfield></entry>
9779 <entry><type>bool</type></entry>
9781 <entry>Role can create databases</entry>
9785 <entry><structfield>rolcanlogin</structfield></entry>
9786 <entry><type>bool</type></entry>
9789 Role can log in. That is, this role can be given as the initial
9790 session authorization identifier
9795 <entry><structfield>rolreplication</structfield></entry>
9796 <entry><type>bool</type></entry>
9799 Role is a replication role. That is, this role can initiate streaming
9800 replication (see <xref linkend="streaming-replication">) and set/unset
9801 the system backup mode using <function>pg_start_backup</> and
9802 <function>pg_stop_backup</>
9807 <entry><structfield>rolconnlimit</structfield></entry>
9808 <entry><type>int4</type></entry>
9811 For roles that can log in, this sets maximum number of concurrent
9812 connections this role can make. -1 means no limit.
9817 <entry><structfield>rolpassword</structfield></entry>
9818 <entry><type>text</type></entry>
9820 <entry>Not the password (always reads as <literal>********</>)</entry>
9824 <entry><structfield>rolvaliduntil</structfield></entry>
9825 <entry><type>timestamptz</type></entry>
9827 <entry>Password expiry time (only used for password authentication);
9828 null if no expiration</entry>
9832 <entry><structfield>rolbypassrls</structfield></entry>
9833 <entry><type>bool</type></entry>
9836 Role bypasses every row level security policy, see
9837 <xref linkend="ddl-rowsecurity"> for more information.
9842 <entry><structfield>rolconfig</structfield></entry>
9843 <entry><type>text[]</type></entry>
9845 <entry>Role-specific defaults for run-time configuration variables</entry>
9849 <entry><structfield>oid</structfield></entry>
9850 <entry><type>oid</type></entry>
9851 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9852 <entry>ID of role</entry>
9860 <sect1 id="view-pg-rules">
9861 <title><structname>pg_rules</structname></title>
9863 <indexterm zone="view-pg-rules">
9864 <primary>pg_rules</primary>
9868 The view <structname>pg_rules</structname> provides access to
9869 useful information about query rewrite rules.
9873 <title><structname>pg_rules</> Columns</title>
9880 <entry>References</entry>
9881 <entry>Description</entry>
9886 <entry><structfield>schemaname</structfield></entry>
9887 <entry><type>name</type></entry>
9888 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9889 <entry>Name of schema containing table</entry>
9892 <entry><structfield>tablename</structfield></entry>
9893 <entry><type>name</type></entry>
9894 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9895 <entry>Name of table the rule is for</entry>
9898 <entry><structfield>rulename</structfield></entry>
9899 <entry><type>name</type></entry>
9900 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
9901 <entry>Name of rule</entry>
9904 <entry><structfield>definition</structfield></entry>
9905 <entry><type>text</type></entry>
9907 <entry>Rule definition (a reconstructed creation command)</entry>
9914 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
9915 of views and materialized views; those can be seen in
9916 <structname>pg_views</> and <structname>pg_matviews</>.
9921 <sect1 id="view-pg-seclabels">
9922 <title><structname>pg_seclabels</structname></title>
9924 <indexterm zone="view-pg-seclabels">
9925 <primary>pg_seclabels</primary>
9929 The view <structname>pg_seclabels</structname> provides information about
9930 security labels. It as an easier-to-query version of the
9931 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9935 <title><structname>pg_seclabels</> Columns</title>
9942 <entry>References</entry>
9943 <entry>Description</entry>
9948 <entry><structfield>objoid</structfield></entry>
9949 <entry><type>oid</type></entry>
9950 <entry>any OID column</entry>
9951 <entry>The OID of the object this security label pertains to</entry>
9954 <entry><structfield>classoid</structfield></entry>
9955 <entry><type>oid</type></entry>
9956 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9957 <entry>The OID of the system catalog this object appears in</entry>
9960 <entry><structfield>objsubid</structfield></entry>
9961 <entry><type>int4</type></entry>
9964 For a security label on a table column, this is the column number (the
9965 <structfield>objoid</> and <structfield>classoid</> refer to
9966 the table itself). For all other object types, this column is
9971 <entry><structfield>objtype</structfield></entry>
9972 <entry><type>text</type></entry>
9975 The type of object to which this label applies, as text.
9979 <entry><structfield>objnamespace</structfield></entry>
9980 <entry><type>oid</type></entry>
9981 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9983 The OID of the namespace for this object, if applicable;
9988 <entry><structfield>objname</structfield></entry>
9989 <entry><type>text</type></entry>
9992 The name of the object to which this label applies, as text.
9996 <entry><structfield>provider</structfield></entry>
9997 <entry><type>text</type></entry>
9998 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9999 <entry>The label provider associated with this label.</entry>
10002 <entry><structfield>label</structfield></entry>
10003 <entry><type>text</type></entry>
10004 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
10005 <entry>The security label applied to this object.</entry>
10012 <sect1 id="view-pg-sequences">
10013 <title><structname>pg_sequences</structname></title>
10015 <indexterm zone="view-pg-sequences">
10016 <primary>pg_sequences</primary>
10020 The view <structname>pg_sequences</structname> provides access to
10021 useful information about each sequence in the database.
10025 <title><structname>pg_sequences</> Columns</title>
10030 <entry>Name</entry>
10031 <entry>Type</entry>
10032 <entry>References</entry>
10033 <entry>Description</entry>
10038 <entry><structfield>schemaname</structfield></entry>
10039 <entry><type>name</type></entry>
10040 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10041 <entry>Name of schema containing sequence</entry>
10044 <entry><structfield>sequencename</structfield></entry>
10045 <entry><type>name</type></entry>
10046 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10047 <entry>Name of sequence</entry>
10050 <entry><structfield>sequenceowner</structfield></entry>
10051 <entry><type>name</type></entry>
10052 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10053 <entry>Name of sequence's owner</entry>
10056 <entry><structfield>data_type</structfield></entry>
10057 <entry><type>regtype</type></entry>
10058 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_type</structname></link>.oid</literal></entry>
10059 <entry>Data type of the sequence</entry>
10062 <entry><structfield>start_value</structfield></entry>
10063 <entry><type>bigint</type></entry>
10065 <entry>Start value of the sequence</entry>
10068 <entry><structfield>min_value</structfield></entry>
10069 <entry><type>bigint</type></entry>
10071 <entry>Minimum value of the sequence</entry>
10074 <entry><structfield>max_value</structfield></entry>
10075 <entry><type>bigint</type></entry>
10077 <entry>Maximum value of the sequence</entry>
10080 <entry><structfield>increment_by</structfield></entry>
10081 <entry><type>bigint</type></entry>
10083 <entry>Increment value of the sequence</entry>
10086 <entry><structfield>cycle</structfield></entry>
10087 <entry><type>boolean</type></entry>
10089 <entry>Whether the sequence cycles</entry>
10092 <entry><structfield>cache_size</structfield></entry>
10093 <entry><type>bigint</type></entry>
10095 <entry>Cache size of the sequence</entry>
10098 <entry><structfield>last_value</structfield></entry>
10099 <entry><type>bigint</type></entry>
10101 <entry>The last sequence value written to disk. If caching is used,
10102 this value can be greater than the last value handed out from the
10103 sequence. Null if the sequence has not been read from yet. Also, if
10104 the current user does not have <literal>USAGE</literal>
10105 or <literal>SELECT</literal> privilege on the sequence, the value is
10113 <sect1 id="view-pg-settings">
10114 <title><structname>pg_settings</structname></title>
10116 <indexterm zone="view-pg-settings">
10117 <primary>pg_settings</primary>
10121 The view <structname>pg_settings</structname> provides access to
10122 run-time parameters of the server. It is essentially an alternative
10123 interface to the <xref linkend="sql-show">
10124 and <xref linkend="sql-set"> commands.
10125 It also provides access to some facts about each parameter that are
10126 not directly available from <command>SHOW</>, such as minimum and
10131 <title><structname>pg_settings</> Columns</title>
10136 <entry>Name</entry>
10137 <entry>Type</entry>
10138 <entry>Description</entry>
10143 <entry><structfield>name</structfield></entry>
10144 <entry><type>text</type></entry>
10145 <entry>Run-time configuration parameter name</entry>
10148 <entry><structfield>setting</structfield></entry>
10149 <entry><type>text</type></entry>
10150 <entry>Current value of the parameter</entry>
10153 <entry><structfield>unit</structfield></entry>
10154 <entry><type>text</type></entry>
10155 <entry>Implicit unit of the parameter</entry>
10158 <entry><structfield>category</structfield></entry>
10159 <entry><type>text</type></entry>
10160 <entry>Logical group of the parameter</entry>
10163 <entry><structfield>short_desc</structfield></entry>
10164 <entry><type>text</type></entry>
10165 <entry>A brief description of the parameter</entry>
10168 <entry><structfield>extra_desc</structfield></entry>
10169 <entry><type>text</type></entry>
10170 <entry>Additional, more detailed, description of the parameter</entry>
10173 <entry><structfield>context</structfield></entry>
10174 <entry><type>text</type></entry>
10175 <entry>Context required to set the parameter's value (see below)</entry>
10178 <entry><structfield>vartype</structfield></entry>
10179 <entry><type>text</type></entry>
10180 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
10181 <literal>integer</>, <literal>real</>, or <literal>string</>)
10185 <entry><structfield>source</structfield></entry>
10186 <entry><type>text</type></entry>
10187 <entry>Source of the current parameter value</entry>
10190 <entry><structfield>min_val</structfield></entry>
10191 <entry><type>text</type></entry>
10192 <entry>Minimum allowed value of the parameter (null for non-numeric
10196 <entry><structfield>max_val</structfield></entry>
10197 <entry><type>text</type></entry>
10198 <entry>Maximum allowed value of the parameter (null for non-numeric
10202 <entry><structfield>enumvals</structfield></entry>
10203 <entry><type>text[]</type></entry>
10204 <entry>Allowed values of an enum parameter (null for non-enum
10208 <entry><structfield>boot_val</structfield></entry>
10209 <entry><type>text</type></entry>
10210 <entry>Parameter value assumed at server startup if the parameter is
10211 not otherwise set</entry>
10214 <entry><structfield>reset_val</structfield></entry>
10215 <entry><type>text</type></entry>
10216 <entry>Value that <command>RESET</command> would reset the parameter to
10217 in the current session</entry>
10220 <entry><structfield>sourcefile</structfield></entry>
10221 <entry><type>text</type></entry>
10222 <entry>Configuration file the current value was set in (null for
10223 values set from sources other than configuration files, or when
10224 examined by a non-superuser);
10225 helpful when using <literal>include</> directives in configuration files</entry>
10228 <entry><structfield>sourceline</structfield></entry>
10229 <entry><type>integer</type></entry>
10230 <entry>Line number within the configuration file the current value was
10231 set at (null for values set from sources other than configuration files,
10232 or when examined by a non-superuser)
10236 <entry><structfield>pending_restart</structfield></entry>
10237 <entry><type>boolean</type></entry>
10238 <entry><literal>true</literal> if the value has been changed in the
10239 configuration file but needs a restart; or <literal>false</literal>
10248 There are several possible values of <structfield>context</structfield>.
10249 In order of decreasing difficulty of changing the setting, they are:
10254 <!-- PGC_INTERNAL -->
10255 <term><literal>internal</literal></term>
10258 These settings cannot be changed directly; they reflect internally
10259 determined values. Some of them may be adjustable by rebuilding the
10260 server with different configuration options, or by changing options
10261 supplied to <command>initdb</command>.
10266 <!-- PGC_POSTMASTER -->
10267 <term><literal>postmaster</literal></term>
10270 These settings can only be applied when the server starts, so any change
10271 requires restarting the server. Values for these settings are typically
10272 stored in the <filename>postgresql.conf</filename> file, or passed on
10273 the command line when starting the server. Of course, settings with any
10274 of the lower <structfield>context</structfield> types can also be
10275 set at server start time.
10280 <!-- PGC_SIGHUP -->
10281 <term><literal>sighup</literal></term>
10284 Changes to these settings can be made in
10285 <filename>postgresql.conf</filename> without restarting the server.
10286 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
10287 cause it to re-read <filename>postgresql.conf</filename> and apply
10288 the changes. The postmaster will also forward the
10289 <systemitem>SIGHUP</systemitem> signal to its child processes so that
10290 they all pick up the new value.
10295 <!-- PGC_SU_BACKEND -->
10296 <term><literal>superuser-backend</literal></term>
10299 Changes to these settings can be made in
10300 <filename>postgresql.conf</filename> without restarting the server.
10301 They can also be set for a particular session in the connection request
10302 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10303 environment variable), but only if the connecting user is a superuser.
10304 However, these settings never change in a session after it is started.
10305 If you change them in <filename>postgresql.conf</filename>, send a
10306 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10307 re-read <filename>postgresql.conf</filename>. The new values will only
10308 affect subsequently-launched sessions.
10313 <!-- PGC_BACKEND -->
10314 <term><literal>backend</literal></term>
10317 Changes to these settings can be made in
10318 <filename>postgresql.conf</filename> without restarting the server.
10319 They can also be set for a particular session in the connection request
10320 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10321 environment variable); any user can make such a change for their session.
10322 However, these settings never change in a session after it is started.
10323 If you change them in <filename>postgresql.conf</filename>, send a
10324 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10325 re-read <filename>postgresql.conf</filename>. The new values will only
10326 affect subsequently-launched sessions.
10332 <term><literal>superuser</literal></term>
10335 These settings can be set from <filename>postgresql.conf</filename>,
10336 or within a session via the <command>SET</> command; but only superusers
10337 can change them via <command>SET</>. Changes in
10338 <filename>postgresql.conf</filename> will affect existing sessions
10339 only if no session-local value has been established with <command>SET</>.
10344 <!-- PGC_USERSET -->
10345 <term><literal>user</literal></term>
10348 These settings can be set from <filename>postgresql.conf</filename>,
10349 or within a session via the <command>SET</> command. Any user is
10350 allowed to change their session-local value. Changes in
10351 <filename>postgresql.conf</filename> will affect existing sessions
10352 only if no session-local value has been established with <command>SET</>.
10359 See <xref linkend="config-setting"> for more information about the various
10360 ways to change these parameters.
10364 The <structname>pg_settings</structname> view cannot be inserted into or
10365 deleted from, but it can be updated. An <command>UPDATE</command> applied
10366 to a row of <structname>pg_settings</structname> is equivalent to executing
10367 the <xref linkend="sql-set"> command on that named
10368 parameter. The change only affects the value used by the current
10369 session. If an <command>UPDATE</command> is issued within a transaction
10370 that is later aborted, the effects of the <command>UPDATE</command> command
10371 disappear when the transaction is rolled back. Once the surrounding
10372 transaction is committed, the effects will persist until the end of the
10373 session, unless overridden by another <command>UPDATE</command> or
10374 <command>SET</command>.
10379 <sect1 id="view-pg-shadow">
10380 <title><structname>pg_shadow</structname></title>
10382 <indexterm zone="view-pg-shadow">
10383 <primary>pg_shadow</primary>
10387 The view <structname>pg_shadow</structname> exists for backwards
10388 compatibility: it emulates a catalog that existed in
10389 <productname>PostgreSQL</productname> before version 8.1.
10390 It shows properties of all roles that are marked as
10391 <structfield>rolcanlogin</> in
10392 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
10396 The name stems from the fact that this table
10397 should not be readable by the public since it contains passwords.
10398 <link linkend="view-pg-user"><structname>pg_user</structname></link>
10399 is a publicly readable view on
10400 <structname>pg_shadow</structname> that blanks out the password field.
10404 <title><structname>pg_shadow</> Columns</title>
10409 <entry>Name</entry>
10410 <entry>Type</entry>
10411 <entry>References</entry>
10412 <entry>Description</entry>
10418 <entry><structfield>usename</structfield></entry>
10419 <entry><type>name</type></entry>
10420 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10421 <entry>User name</entry>
10425 <entry><structfield>usesysid</structfield></entry>
10426 <entry><type>oid</type></entry>
10427 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10428 <entry>ID of this user</entry>
10432 <entry><structfield>usecreatedb</structfield></entry>
10433 <entry><type>bool</type></entry>
10435 <entry>User can create databases</entry>
10439 <entry><structfield>usesuper</structfield></entry>
10440 <entry><type>bool</type></entry>
10442 <entry>User is a superuser</entry>
10446 <entry><structfield>userepl</structfield></entry>
10447 <entry><type>bool</type></entry>
10450 User can initiate streaming replication and put the system in and
10451 out of backup mode.
10456 <entry><structfield>usebypassrls</structfield></entry>
10457 <entry><type>bool</type></entry>
10460 User bypasses every row level security policy, see
10461 <xref linkend="ddl-rowsecurity"> for more information.
10466 <entry><structfield>passwd</structfield></entry>
10467 <entry><type>text</type></entry>
10469 <entry>Password (possibly encrypted); null if none. See
10470 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
10471 for details of how encrypted passwords are stored.</entry>
10475 <entry><structfield>valuntil</structfield></entry>
10476 <entry><type>abstime</type></entry>
10478 <entry>Password expiry time (only used for password authentication)</entry>
10482 <entry><structfield>useconfig</structfield></entry>
10483 <entry><type>text[]</type></entry>
10485 <entry>Session defaults for run-time configuration variables</entry>
10493 <sect1 id="view-pg-stats">
10494 <title><structname>pg_stats</structname></title>
10496 <indexterm zone="view-pg-stats">
10497 <primary>pg_stats</primary>
10501 The view <structname>pg_stats</structname> provides access to
10502 the information stored in the <link
10503 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
10504 catalog. This view allows access only to rows of
10505 <structname>pg_statistic</structname> that correspond to tables the
10506 user has permission to read, and therefore it is safe to allow public
10507 read access to this view.
10511 <structname>pg_stats</structname> is also designed to present the
10512 information in a more readable format than the underlying catalog
10513 — at the cost that its schema must be extended whenever new slot types
10514 are defined for <structname>pg_statistic</structname>.
10518 <title><structname>pg_stats</> Columns</title>
10523 <entry>Name</entry>
10524 <entry>Type</entry>
10525 <entry>References</entry>
10526 <entry>Description</entry>
10531 <entry><structfield>schemaname</structfield></entry>
10532 <entry><type>name</type></entry>
10533 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10534 <entry>Name of schema containing table</entry>
10538 <entry><structfield>tablename</structfield></entry>
10539 <entry><type>name</type></entry>
10540 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10541 <entry>Name of table</entry>
10545 <entry><structfield>attname</structfield></entry>
10546 <entry><type>name</type></entry>
10547 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
10548 <entry>Name of the column described by this row</entry>
10552 <entry><structfield>inherited</structfield></entry>
10553 <entry><type>bool</type></entry>
10555 <entry>If true, this row includes inheritance child columns, not just the
10556 values in the specified table</entry>
10560 <entry><structfield>null_frac</structfield></entry>
10561 <entry><type>real</type></entry>
10563 <entry>Fraction of column entries that are null</entry>
10567 <entry><structfield>avg_width</structfield></entry>
10568 <entry><type>integer</type></entry>
10570 <entry>Average width in bytes of column's entries</entry>
10574 <entry><structfield>n_distinct</structfield></entry>
10575 <entry><type>real</type></entry>
10578 If greater than zero, the estimated number of distinct values in the
10579 column. If less than zero, the negative of the number of distinct
10580 values divided by the number of rows. (The negated form is used when
10581 <command>ANALYZE</> believes that the number of distinct values is
10582 likely to increase as the table grows; the positive form is used when
10583 the column seems to have a fixed number of possible values.) For
10584 example, -1 indicates a unique column in which the number of distinct
10585 values is the same as the number of rows.
10590 <entry><structfield>most_common_vals</structfield></entry>
10591 <entry><type>anyarray</type></entry>
10594 A list of the most common values in the column. (Null if
10595 no values seem to be more common than any others.)
10600 <entry><structfield>most_common_freqs</structfield></entry>
10601 <entry><type>real[]</type></entry>
10604 A list of the frequencies of the most common values,
10605 i.e., number of occurrences of each divided by total number of rows.
10606 (Null when <structfield>most_common_vals</structfield> is.)
10611 <entry><structfield>histogram_bounds</structfield></entry>
10612 <entry><type>anyarray</type></entry>
10615 A list of values that divide the column's values into groups of
10616 approximately equal population. The values in
10617 <structfield>most_common_vals</>, if present, are omitted from this
10618 histogram calculation. (This column is null if the column data type
10619 does not have a <literal><</> operator or if the
10620 <structfield>most_common_vals</> list accounts for the entire
10626 <entry><structfield>correlation</structfield></entry>
10627 <entry><type>real</type></entry>
10630 Statistical correlation between physical row ordering and
10631 logical ordering of the column values. This ranges from -1 to +1.
10632 When the value is near -1 or +1, an index scan on the column will
10633 be estimated to be cheaper than when it is near zero, due to reduction
10634 of random access to the disk. (This column is null if the column data
10635 type does not have a <literal><</> operator.)
10640 <entry><structfield>most_common_elems</structfield></entry>
10641 <entry><type>anyarray</type></entry>
10644 A list of non-null element values most often appearing within values of
10645 the column. (Null for scalar types.)
10650 <entry><structfield>most_common_elem_freqs</structfield></entry>
10651 <entry><type>real[]</type></entry>
10654 A list of the frequencies of the most common element values, i.e., the
10655 fraction of rows containing at least one instance of the given value.
10656 Two or three additional values follow the per-element frequencies;
10657 these are the minimum and maximum of the preceding per-element
10658 frequencies, and optionally the frequency of null elements.
10659 (Null when <structfield>most_common_elems</structfield> is.)
10664 <entry><structfield>elem_count_histogram</structfield></entry>
10665 <entry><type>real[]</type></entry>
10668 A histogram of the counts of distinct non-null element values within the
10669 values of the column, followed by the average number of distinct
10670 non-null elements. (Null for scalar types.)
10678 The maximum number of entries in the array fields can be controlled on a
10679 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
10680 command, or globally by setting the
10681 <xref linkend="guc-default-statistics-target"> run-time parameter.
10686 <sect1 id="view-pg-tables">
10687 <title><structname>pg_tables</structname></title>
10689 <indexterm zone="view-pg-tables">
10690 <primary>pg_tables</primary>
10694 The view <structname>pg_tables</structname> provides access to
10695 useful information about each table in the database.
10699 <title><structname>pg_tables</> Columns</title>
10704 <entry>Name</entry>
10705 <entry>Type</entry>
10706 <entry>References</entry>
10707 <entry>Description</entry>
10712 <entry><structfield>schemaname</structfield></entry>
10713 <entry><type>name</type></entry>
10714 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10715 <entry>Name of schema containing table</entry>
10718 <entry><structfield>tablename</structfield></entry>
10719 <entry><type>name</type></entry>
10720 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10721 <entry>Name of table</entry>
10724 <entry><structfield>tableowner</structfield></entry>
10725 <entry><type>name</type></entry>
10726 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10727 <entry>Name of table's owner</entry>
10730 <entry><structfield>tablespace</structfield></entry>
10731 <entry><type>name</type></entry>
10732 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
10733 <entry>Name of tablespace containing table (null if default for database)</entry>
10736 <entry><structfield>hasindexes</structfield></entry>
10737 <entry><type>boolean</type></entry>
10738 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
10739 <entry>True if table has (or recently had) any indexes</entry>
10742 <entry><structfield>hasrules</structfield></entry>
10743 <entry><type>boolean</type></entry>
10744 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
10745 <entry>True if table has (or once had) rules</entry>
10748 <entry><structfield>hastriggers</structfield></entry>
10749 <entry><type>boolean</type></entry>
10750 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
10751 <entry>True if table has (or once had) triggers</entry>
10754 <entry><structfield>rowsecurity</structfield></entry>
10755 <entry><type>boolean</type></entry>
10756 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
10757 <entry>True if row security is enabled on the table</entry>
10765 <sect1 id="view-pg-timezone-abbrevs">
10766 <title><structname>pg_timezone_abbrevs</structname></title>
10768 <indexterm zone="view-pg-timezone-abbrevs">
10769 <primary>pg_timezone_abbrevs</primary>
10773 The view <structname>pg_timezone_abbrevs</structname> provides a list
10774 of time zone abbreviations that are currently recognized by the datetime
10775 input routines. The contents of this view change when the
10776 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
10780 <title><structname>pg_timezone_abbrevs</> Columns</title>
10785 <entry>Name</entry>
10786 <entry>Type</entry>
10787 <entry>Description</entry>
10792 <entry><structfield>abbrev</structfield></entry>
10793 <entry><type>text</type></entry>
10794 <entry>Time zone abbreviation</entry>
10797 <entry><structfield>utc_offset</structfield></entry>
10798 <entry><type>interval</type></entry>
10799 <entry>Offset from UTC (positive means east of Greenwich)</entry>
10802 <entry><structfield>is_dst</structfield></entry>
10803 <entry><type>boolean</type></entry>
10804 <entry>True if this is a daylight-savings abbreviation</entry>
10811 While most timezone abbreviations represent fixed offsets from UTC,
10812 there are some that have historically varied in value
10813 (see <xref linkend="datetime-config-files"> for more information).
10814 In such cases this view presents their current meaning.
10819 <sect1 id="view-pg-timezone-names">
10820 <title><structname>pg_timezone_names</structname></title>
10822 <indexterm zone="view-pg-timezone-names">
10823 <primary>pg_timezone_names</primary>
10827 The view <structname>pg_timezone_names</structname> provides a list
10828 of time zone names that are recognized by <command>SET TIMEZONE</>,
10829 along with their associated abbreviations, UTC offsets,
10830 and daylight-savings status. (Technically,
10831 <productname>PostgreSQL</productname> does not use UTC because leap
10832 seconds are not handled.)
10833 Unlike the abbreviations shown in <link
10834 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
10835 date rules. Therefore, the associated information changes across local DST
10836 boundaries. The displayed information is computed based on the current
10837 value of <function>CURRENT_TIMESTAMP</>.
10841 <title><structname>pg_timezone_names</> Columns</title>
10846 <entry>Name</entry>
10847 <entry>Type</entry>
10848 <entry>Description</entry>
10853 <entry><structfield>name</structfield></entry>
10854 <entry><type>text</type></entry>
10855 <entry>Time zone name</entry>
10858 <entry><structfield>abbrev</structfield></entry>
10859 <entry><type>text</type></entry>
10860 <entry>Time zone abbreviation</entry>
10863 <entry><structfield>utc_offset</structfield></entry>
10864 <entry><type>interval</type></entry>
10865 <entry>Offset from UTC (positive means east of Greenwich)</entry>
10868 <entry><structfield>is_dst</structfield></entry>
10869 <entry><type>boolean</type></entry>
10870 <entry>True if currently observing daylight savings</entry>
10878 <sect1 id="view-pg-user">
10879 <title><structname>pg_user</structname></title>
10881 <indexterm zone="view-pg-user">
10882 <primary>pg_user</primary>
10886 The view <structname>pg_user</structname> provides access to
10887 information about database users. This is simply a publicly
10889 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
10890 that blanks out the password field.
10894 <title><structname>pg_user</> Columns</title>
10899 <entry>Name</entry>
10900 <entry>Type</entry>
10901 <entry>Description</entry>
10906 <entry><structfield>usename</structfield></entry>
10907 <entry><type>name</type></entry>
10908 <entry>User name</entry>
10912 <entry><structfield>usesysid</structfield></entry>
10913 <entry><type>oid</type></entry>
10914 <entry>ID of this user</entry>
10918 <entry><structfield>usecreatedb</structfield></entry>
10919 <entry><type>bool</type></entry>
10920 <entry>User can create databases</entry>
10924 <entry><structfield>usesuper</structfield></entry>
10925 <entry><type>bool</type></entry>
10926 <entry>User is a superuser</entry>
10930 <entry><structfield>userepl</structfield></entry>
10931 <entry><type>bool</type></entry>
10933 User can initiate streaming replication and put the system in and
10934 out of backup mode.
10939 <entry><structfield>usebypassrls</structfield></entry>
10940 <entry><type>bool</type></entry>
10942 User bypasses every row level security policy, see
10943 <xref linkend="ddl-rowsecurity"> for more information.
10948 <entry><structfield>passwd</structfield></entry>
10949 <entry><type>text</type></entry>
10950 <entry>Not the password (always reads as <literal>********</>)</entry>
10954 <entry><structfield>valuntil</structfield></entry>
10955 <entry><type>abstime</type></entry>
10956 <entry>Password expiry time (only used for password authentication)</entry>
10960 <entry><structfield>useconfig</structfield></entry>
10961 <entry><type>text[]</type></entry>
10962 <entry>Session defaults for run-time configuration variables</entry>
10970 <sect1 id="view-pg-user-mappings">
10971 <title><structname>pg_user_mappings</structname></title>
10973 <indexterm zone="view-pg-user-mappings">
10974 <primary>pg_user_mappings</primary>
10978 The view <structname>pg_user_mappings</structname> provides access
10979 to information about user mappings. This is essentially a publicly
10981 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
10982 that leaves out the options field if the user has no rights to use
10987 <title><structname>pg_user_mappings</> Columns</title>
10992 <entry>Name</entry>
10993 <entry>Type</entry>
10994 <entry>References</entry>
10995 <entry>Description</entry>
11001 <entry><structfield>umid</structfield></entry>
11002 <entry><type>oid</type></entry>
11003 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
11004 <entry>OID of the user mapping</entry>
11008 <entry><structfield>srvid</structfield></entry>
11009 <entry><type>oid</type></entry>
11010 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
11012 The OID of the foreign server that contains this mapping
11017 <entry><structfield>srvname</structfield></entry>
11018 <entry><type>name</type></entry>
11019 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
11021 Name of the foreign server
11026 <entry><structfield>umuser</structfield></entry>
11027 <entry><type>oid</type></entry>
11028 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
11029 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
11033 <entry><structfield>usename</structfield></entry>
11034 <entry><type>name</type></entry>
11036 <entry>Name of the local user to be mapped</entry>
11040 <entry><structfield>umoptions</structfield></entry>
11041 <entry><type>text[]</type></entry>
11044 User mapping specific options, as <quote>keyword=value</>
11045 strings, if the current user is the owner of the foreign
11055 <sect1 id="view-pg-views">
11056 <title><structname>pg_views</structname></title>
11058 <indexterm zone="view-pg-views">
11059 <primary>pg_views</primary>
11063 The view <structname>pg_views</structname> provides access to
11064 useful information about each view in the database.
11068 <title><structname>pg_views</> Columns</title>
11073 <entry>Name</entry>
11074 <entry>Type</entry>
11075 <entry>References</entry>
11076 <entry>Description</entry>
11081 <entry><structfield>schemaname</structfield></entry>
11082 <entry><type>name</type></entry>
11083 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
11084 <entry>Name of schema containing view</entry>
11087 <entry><structfield>viewname</structfield></entry>
11088 <entry><type>name</type></entry>
11089 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
11090 <entry>Name of view</entry>
11093 <entry><structfield>viewowner</structfield></entry>
11094 <entry><type>name</type></entry>
11095 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
11096 <entry>Name of view's owner</entry>
11099 <entry><structfield>definition</structfield></entry>
11100 <entry><type>text</type></entry>
11102 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>