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>attidentity</structfield></entry>
1134 <entry><type>char</type></entry>
1137 If a zero byte (<literal>''</literal>), then not an identity column.
1138 Otherwise, <literal>a</literal> = generated
1139 always, <literal>d</literal> = generated by default.
1144 <entry><structfield>attisdropped</structfield></entry>
1145 <entry><type>bool</type></entry>
1148 This column has been dropped and is no longer valid. A dropped
1149 column is still physically present in the table, but is
1150 ignored by the parser and so cannot be accessed via SQL.
1155 <entry><structfield>attislocal</structfield></entry>
1156 <entry><type>bool</type></entry>
1159 This column is defined locally in the relation. Note that a column can
1160 be locally defined and inherited simultaneously.
1165 <entry><structfield>attinhcount</structfield></entry>
1166 <entry><type>int4</type></entry>
1169 The number of direct ancestors this column has. A column with a
1170 nonzero number of ancestors cannot be dropped nor renamed.
1175 <entry><structfield>attcollation</structfield></entry>
1176 <entry><type>oid</type></entry>
1177 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1179 The defined collation of the column, or zero if the column is
1180 not of a collatable data type.
1185 <entry><structfield>attacl</structfield></entry>
1186 <entry><type>aclitem[]</type></entry>
1189 Column-level access privileges, if any have been granted specifically
1195 <entry><structfield>attoptions</structfield></entry>
1196 <entry><type>text[]</type></entry>
1199 Attribute-level options, as <quote>keyword=value</> strings
1204 <entry><structfield>attfdwoptions</structfield></entry>
1205 <entry><type>text[]</type></entry>
1208 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1217 In a dropped column's <structname>pg_attribute</structname> entry,
1218 <structfield>atttypid</structfield> is reset to zero, but
1219 <structfield>attlen</structfield> and the other fields copied from
1220 <structname>pg_type</> are still valid. This arrangement is needed
1221 to cope with the situation where the dropped column's data type was
1222 later dropped, and so there is no <structname>pg_type</> row anymore.
1223 <structfield>attlen</structfield> and the other fields can be used
1224 to interpret the contents of a row of the table.
1229 <sect1 id="catalog-pg-authid">
1230 <title><structname>pg_authid</structname></title>
1232 <indexterm zone="catalog-pg-authid">
1233 <primary>pg_authid</primary>
1237 The catalog <structname>pg_authid</structname> contains information about
1238 database authorization identifiers (roles). A role subsumes the concepts
1239 of <quote>users</> and <quote>groups</>. A user is essentially just a
1240 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1241 without <structfield>rolcanlogin</>) can have other roles as members; see
1242 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1246 Since this catalog contains passwords, it must not be publicly readable.
1247 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1248 is a publicly readable view on
1249 <structname>pg_authid</structname> that blanks out the password field.
1253 <xref linkend="user-manag"> contains detailed information about user and
1254 privilege management.
1258 Because user identities are cluster-wide,
1259 <structname>pg_authid</structname>
1260 is shared across all databases of a cluster: there is only one
1261 copy of <structname>pg_authid</structname> per cluster, not
1266 <title><structname>pg_authid</> Columns</title>
1273 <entry>Description</entry>
1280 <entry><structfield>oid</structfield></entry>
1281 <entry><type>oid</type></entry>
1282 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1286 <entry><structfield>rolname</structfield></entry>
1287 <entry><type>name</type></entry>
1288 <entry>Role name</entry>
1292 <entry><structfield>rolsuper</structfield></entry>
1293 <entry><type>bool</type></entry>
1294 <entry>Role has superuser privileges</entry>
1298 <entry><structfield>rolinherit</structfield></entry>
1299 <entry><type>bool</type></entry>
1300 <entry>Role automatically inherits privileges of roles it is a
1305 <entry><structfield>rolcreaterole</structfield></entry>
1306 <entry><type>bool</type></entry>
1307 <entry>Role can create more roles</entry>
1311 <entry><structfield>rolcreatedb</structfield></entry>
1312 <entry><type>bool</type></entry>
1313 <entry>Role can create databases</entry>
1317 <entry><structfield>rolcanlogin</structfield></entry>
1318 <entry><type>bool</type></entry>
1320 Role can log in. That is, this role can be given as the initial
1321 session authorization identifier
1326 <entry><structfield>rolreplication</structfield></entry>
1327 <entry><type>bool</type></entry>
1329 Role is a replication role. That is, this role can initiate streaming
1330 replication (see <xref linkend="streaming-replication">) and set/unset
1331 the system backup mode using <function>pg_start_backup</> and
1332 <function>pg_stop_backup</>
1337 <entry><structfield>rolbypassrls</structfield></entry>
1338 <entry><type>bool</type></entry>
1340 Role bypasses every row level security policy, see
1341 <xref linkend="ddl-rowsecurity"> for more information.
1346 <entry><structfield>rolconnlimit</structfield></entry>
1347 <entry><type>int4</type></entry>
1349 For roles that can log in, this sets maximum number of concurrent
1350 connections this role can make. -1 means no limit.
1355 <entry><structfield>rolpassword</structfield></entry>
1356 <entry><type>text</type></entry>
1358 Password (possibly encrypted); null if none. The format depends
1359 on the form of encryption used.
1364 <entry><structfield>rolvaliduntil</structfield></entry>
1365 <entry><type>timestamptz</type></entry>
1366 <entry>Password expiry time (only used for password authentication);
1367 null if no expiration</entry>
1374 For an MD5 encrypted password, <structfield>rolpassword</structfield>
1375 column will begin with the string <literal>md5</> followed by a
1376 32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
1377 password concatenated to their user name. For example, if user
1378 <literal>joe</> has password <literal>xyzzy</>, <productname>PostgreSQL</>
1379 will store the md5 hash of <literal>xyzzyjoe</>. If the password is
1380 encrypted with SCRAM-SHA-256, it consists of 5 fields separated by colons.
1381 The first field is the constant <literal>scram-sha-256</literal>, to
1382 identify the password as a SCRAM-SHA-256 verifier. The second field is a
1383 salt, Base64-encoded, and the third field is the number of iterations used
1384 to generate the password. The fourth field and fifth field are the stored
1385 key and server key, respectively, in hexadecimal format. A password that
1386 does not follow either of those formats is assumed to be unencrypted.
1391 <sect1 id="catalog-pg-auth-members">
1392 <title><structname>pg_auth_members</structname></title>
1394 <indexterm zone="catalog-pg-auth-members">
1395 <primary>pg_auth_members</primary>
1399 The catalog <structname>pg_auth_members</structname> shows the membership
1400 relations between roles. Any non-circular set of relationships is allowed.
1404 Because user identities are cluster-wide,
1405 <structname>pg_auth_members</structname>
1406 is shared across all databases of a cluster: there is only one
1407 copy of <structname>pg_auth_members</structname> per cluster, not
1412 <title><structname>pg_auth_members</> Columns</title>
1419 <entry>References</entry>
1420 <entry>Description</entry>
1426 <entry><structfield>roleid</structfield></entry>
1427 <entry><type>oid</type></entry>
1428 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1429 <entry>ID of a role that has a member</entry>
1433 <entry><structfield>member</structfield></entry>
1434 <entry><type>oid</type></entry>
1435 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1436 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1440 <entry><structfield>grantor</structfield></entry>
1441 <entry><type>oid</type></entry>
1442 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1443 <entry>ID of the role that granted this membership</entry>
1447 <entry><structfield>admin_option</structfield></entry>
1448 <entry><type>bool</type></entry>
1450 <entry>True if <structfield>member</> can grant membership in
1451 <structfield>roleid</> to others</entry>
1460 <sect1 id="catalog-pg-cast">
1461 <title><structname>pg_cast</structname></title>
1463 <indexterm zone="catalog-pg-cast">
1464 <primary>pg_cast</primary>
1468 The catalog <structname>pg_cast</structname> stores data type conversion
1469 paths, both built-in and user-defined.
1473 It should be noted that <structname>pg_cast</structname> does not represent
1474 every type conversion that the system knows how to perform; only those that
1475 cannot be deduced from some generic rule. For example, casting between a
1476 domain and its base type is not explicitly represented in
1477 <structname>pg_cast</structname>. Another important exception is that
1478 <quote>automatic I/O conversion casts</>, those performed using a data
1479 type's own I/O functions to convert to or from <type>text</> or other
1480 string types, are not explicitly represented in
1481 <structname>pg_cast</structname>.
1485 <title><structname>pg_cast</> Columns</title>
1492 <entry>References</entry>
1493 <entry>Description</entry>
1499 <entry><structfield>oid</structfield></entry>
1500 <entry><type>oid</type></entry>
1502 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1506 <entry><structfield>castsource</structfield></entry>
1507 <entry><type>oid</type></entry>
1508 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1509 <entry>OID of the source data type</entry>
1513 <entry><structfield>casttarget</structfield></entry>
1514 <entry><type>oid</type></entry>
1515 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1516 <entry>OID of the target data type</entry>
1520 <entry><structfield>castfunc</structfield></entry>
1521 <entry><type>oid</type></entry>
1522 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1524 The OID of the function to use to perform this cast. Zero is
1525 stored if the cast method doesn't require a function.
1530 <entry><structfield>castcontext</structfield></entry>
1531 <entry><type>char</type></entry>
1534 Indicates what contexts the cast can be invoked in.
1535 <literal>e</> means only as an explicit cast (using
1536 <literal>CAST</> or <literal>::</> syntax).
1537 <literal>a</> means implicitly in assignment
1538 to a target column, as well as explicitly.
1539 <literal>i</> means implicitly in expressions, as well as the
1544 <entry><structfield>castmethod</structfield></entry>
1545 <entry><type>char</type></entry>
1548 Indicates how the cast is performed.
1549 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1550 <literal>i</> means that the input/output functions are used.
1551 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1559 The cast functions listed in <structname>pg_cast</structname> must
1560 always take the cast source type as their first argument type, and
1561 return the cast destination type as their result type. A cast
1562 function can have up to three arguments. The second argument,
1563 if present, must be type <type>integer</>; it receives the type
1564 modifier associated with the destination type, or -1
1565 if there is none. The third argument,
1566 if present, must be type <type>boolean</>; it receives <literal>true</>
1567 if the cast is an explicit cast, <literal>false</> otherwise.
1571 It is legitimate to create a <structname>pg_cast</structname> entry
1572 in which the source and target types are the same, if the associated
1573 function takes more than one argument. Such entries represent
1574 <quote>length coercion functions</> that coerce values of the type
1575 to be legal for a particular type modifier value.
1579 When a <structname>pg_cast</structname> entry has different source and
1580 target types and a function that takes more than one argument, it
1581 represents converting from one type to another and applying a length
1582 coercion in a single step. When no such entry is available, coercion
1583 to a type that uses a type modifier involves two steps, one to
1584 convert between data types and a second to apply the modifier.
1588 <sect1 id="catalog-pg-class">
1589 <title><structname>pg_class</structname></title>
1591 <indexterm zone="catalog-pg-class">
1592 <primary>pg_class</primary>
1596 The catalog <structname>pg_class</structname> catalogs tables and most
1597 everything else that has columns or is otherwise similar to a
1598 table. This includes indexes (but see also
1599 <structname>pg_index</structname>), sequences (but see also
1600 <structname>pg_sequence</structname>), views, materialized
1601 views, composite types, and TOAST tables; see <structfield>relkind</>.
1602 Below, when we mean all of these
1603 kinds of objects we speak of <quote>relations</quote>. Not all
1604 columns are meaningful for all relation types.
1608 <title><structname>pg_class</> Columns</title>
1615 <entry>References</entry>
1616 <entry>Description</entry>
1622 <entry><structfield>oid</structfield></entry>
1623 <entry><type>oid</type></entry>
1625 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1629 <entry><structfield>relname</structfield></entry>
1630 <entry><type>name</type></entry>
1632 <entry>Name of the table, index, view, etc.</entry>
1636 <entry><structfield>relnamespace</structfield></entry>
1637 <entry><type>oid</type></entry>
1638 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1640 The OID of the namespace that contains this relation
1645 <entry><structfield>reltype</structfield></entry>
1646 <entry><type>oid</type></entry>
1647 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1649 The OID of the data type that corresponds to this table's row type,
1650 if any (zero for indexes, which have no <structname>pg_type</> entry)
1655 <entry><structfield>reloftype</structfield></entry>
1656 <entry><type>oid</type></entry>
1657 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1659 For typed tables, the OID of the underlying composite type,
1660 zero for all other relations
1665 <entry><structfield>relowner</structfield></entry>
1666 <entry><type>oid</type></entry>
1667 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1668 <entry>Owner of the relation</entry>
1672 <entry><structfield>relam</structfield></entry>
1673 <entry><type>oid</type></entry>
1674 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1675 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1679 <entry><structfield>relfilenode</structfield></entry>
1680 <entry><type>oid</type></entry>
1682 <entry>Name of the on-disk file of this relation; zero means this
1683 is a <quote>mapped</> relation whose disk file name is determined
1684 by low-level state</entry>
1688 <entry><structfield>reltablespace</structfield></entry>
1689 <entry><type>oid</type></entry>
1690 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1692 The tablespace in which this relation is stored. If zero,
1693 the database's default tablespace is implied. (Not meaningful
1694 if the relation has no on-disk file.)
1699 <entry><structfield>relpages</structfield></entry>
1700 <entry><type>int4</type></entry>
1703 Size of the on-disk representation of this table in pages (of size
1704 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1705 planner. It is updated by <command>VACUUM</command>,
1706 <command>ANALYZE</command>, and a few DDL commands such as
1707 <command>CREATE INDEX</command>.
1712 <entry><structfield>reltuples</structfield></entry>
1713 <entry><type>float4</type></entry>
1716 Number of rows in the table. This is only an estimate used by the
1717 planner. It is updated by <command>VACUUM</command>,
1718 <command>ANALYZE</command>, and a few DDL commands such as
1719 <command>CREATE INDEX</command>.
1724 <entry><structfield>relallvisible</structfield></entry>
1725 <entry><type>int4</type></entry>
1728 Number of pages that are marked all-visible in the table's
1729 visibility map. This is only an estimate used by the
1730 planner. It is updated by <command>VACUUM</command>,
1731 <command>ANALYZE</command>, and a few DDL commands such as
1732 <command>CREATE INDEX</command>.
1737 <entry><structfield>reltoastrelid</structfield></entry>
1738 <entry><type>oid</type></entry>
1739 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1741 OID of the TOAST table associated with this table, 0 if none. The
1742 TOAST table stores large attributes <quote>out of line</quote> in a
1748 <entry><structfield>relhasindex</structfield></entry>
1749 <entry><type>bool</type></entry>
1752 True if this is a table and it has (or recently had) any indexes
1757 <entry><structfield>relisshared</structfield></entry>
1758 <entry><type>bool</type></entry>
1761 True if this table is shared across all databases in the cluster. Only
1762 certain system catalogs (such as <structname>pg_database</structname>)
1768 <entry><structfield>relpersistence</structfield></entry>
1769 <entry><type>char</type></entry>
1772 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1773 <literal>t</> = temporary table
1778 <entry><structfield>relkind</structfield></entry>
1779 <entry><type>char</type></entry>
1782 <literal>r</> = ordinary table,
1783 <literal>i</> = index,
1784 <literal>S</> = sequence,
1785 <literal>t</> = TOAST table,
1786 <literal>v</> = view,
1787 <literal>m</> = materialized view,
1788 <literal>c</> = composite type,
1789 <literal>f</> = foreign table,
1790 <literal>p</> = partitioned table
1795 <entry><structfield>relnatts</structfield></entry>
1796 <entry><type>int2</type></entry>
1799 Number of user columns in the relation (system columns not
1800 counted). There must be this many corresponding entries in
1801 <structname>pg_attribute</structname>. See also
1802 <literal>pg_attribute.attnum</literal>.
1807 <entry><structfield>relchecks</structfield></entry>
1808 <entry><type>int2</type></entry>
1811 Number of <literal>CHECK</> constraints on the table; see
1812 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1817 <entry><structfield>relhasoids</structfield></entry>
1818 <entry><type>bool</type></entry>
1821 True if we generate an OID for each row of the relation
1826 <entry><structfield>relhaspkey</structfield></entry>
1827 <entry><type>bool</type></entry>
1830 True if the table has (or once had) a primary key
1835 <entry><structfield>relhasrules</structfield></entry>
1836 <entry><type>bool</type></entry>
1839 True if table has (or once had) rules; see
1840 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1845 <entry><structfield>relhastriggers</structfield></entry>
1846 <entry><type>bool</type></entry>
1849 True if table has (or once had) triggers; see
1850 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1855 <entry><structfield>relhassubclass</structfield></entry>
1856 <entry><type>bool</type></entry>
1858 <entry>True if table has (or once had) any inheritance children</entry>
1862 <entry><structfield>relrowsecurity</structfield></entry>
1863 <entry><type>bool</type></entry>
1866 True if table has row level security enabled; see
1867 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1872 <entry><structfield>relforcerowsecurity</structfield></entry>
1873 <entry><type>bool</type></entry>
1876 True if row level security (when enabled) will also apply to table owner; see
1877 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1882 <entry><structfield>relispopulated</structfield></entry>
1883 <entry><type>bool</type></entry>
1885 <entry>True if relation is populated (this is true for all
1886 relations other than some materialized views)</entry>
1890 <entry><structfield>relreplident</structfield></entry>
1891 <entry><type>char</type></entry>
1894 Columns used to form <quote>replica identity</> for rows:
1895 <literal>d</> = default (primary key, if any),
1896 <literal>n</> = nothing,
1897 <literal>f</> = all columns
1898 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1903 <entry><structfield>relispartition</structfield></entry>
1904 <entry><type>bool</type></entry>
1906 <entry>True if table is a partition</entry>
1910 <entry><structfield>relfrozenxid</structfield></entry>
1911 <entry><type>xid</type></entry>
1914 All transaction IDs before this one have been replaced with a permanent
1915 (<quote>frozen</>) transaction ID in this table. This is used to track
1916 whether the table needs to be vacuumed in order to prevent transaction
1917 ID wraparound or to allow <literal>pg_xact</> to be shrunk. Zero
1918 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1923 <entry><structfield>relminmxid</structfield></entry>
1924 <entry><type>xid</type></entry>
1927 All multixact IDs before this one have been replaced by a
1928 transaction ID in this table. This is used to track
1929 whether the table needs to be vacuumed in order to prevent multixact ID
1930 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
1931 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1936 <entry><structfield>relacl</structfield></entry>
1937 <entry><type>aclitem[]</type></entry>
1940 Access privileges; see
1941 <xref linkend="sql-grant"> and
1942 <xref linkend="sql-revoke">
1948 <entry><structfield>reloptions</structfield></entry>
1949 <entry><type>text[]</type></entry>
1952 Access-method-specific options, as <quote>keyword=value</> strings
1957 <entry><structfield>relpartbound</structfield></entry>
1958 <entry><type>pg_node_tree</type></entry>
1961 If table is a partition (see <structfield>relispartition</structfield>),
1962 internal representation of the partition bound
1970 Several of the Boolean flags in <structname>pg_class</> are maintained
1971 lazily: they are guaranteed to be true if that's the correct state, but
1972 may not be reset to false immediately when the condition is no longer
1973 true. For example, <structfield>relhasindex</> is set by
1974 <command>CREATE INDEX</command>, but it is never cleared by
1975 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1976 <structfield>relhasindex</> if it finds the table has no indexes. This
1977 arrangement avoids race conditions and improves concurrency.
1981 <sect1 id="catalog-pg-collation">
1982 <title><structname>pg_collation</structname></title>
1984 <indexterm zone="catalog-pg-collation">
1985 <primary>pg_collation</primary>
1989 The catalog <structname>pg_collation</structname> describes the
1990 available collations, which are essentially mappings from an SQL
1991 name to operating system locale categories.
1992 See <xref linkend="collation"> for more information.
1996 <title><structname>pg_collation</> Columns</title>
2003 <entry>References</entry>
2004 <entry>Description</entry>
2010 <entry><structfield>oid</structfield></entry>
2011 <entry><type>oid</type></entry>
2013 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2017 <entry><structfield>collname</structfield></entry>
2018 <entry><type>name</type></entry>
2020 <entry>Collation name (unique per namespace and encoding)</entry>
2024 <entry><structfield>collnamespace</structfield></entry>
2025 <entry><type>oid</type></entry>
2026 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2028 The OID of the namespace that contains this collation
2033 <entry><structfield>collowner</structfield></entry>
2034 <entry><type>oid</type></entry>
2035 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2036 <entry>Owner of the collation</entry>
2040 <entry><structfield>collprovider</structfield></entry>
2041 <entry><type>char</type></entry>
2043 <entry>Provider of the collation: <literal>d</literal> = database
2044 default, <literal>c</literal> = libc, <literal>i</literal> = icu</entry>
2048 <entry><structfield>collencoding</structfield></entry>
2049 <entry><type>int4</type></entry>
2051 <entry>Encoding in which the collation is applicable, or -1 if it
2052 works for any encoding</entry>
2056 <entry><structfield>collcollate</structfield></entry>
2057 <entry><type>name</type></entry>
2059 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2063 <entry><structfield>collctype</structfield></entry>
2064 <entry><type>name</type></entry>
2066 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2070 <entry><structfield>collversion</structfield></entry>
2071 <entry><type>text</type></entry>
2074 Provider-specific version of the collation. This is recorded when the
2075 collation is created and then checked when it is used, to detect
2076 changes in the collation definition that could lead to data corruption.
2084 Note that the unique key on this catalog is (<structfield>collname</>,
2085 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2086 (<structfield>collname</>, <structfield>collnamespace</>).
2087 <productname>PostgreSQL</productname> generally ignores all
2088 collations that do not have <structfield>collencoding</> equal to
2089 either the current database's encoding or -1, and creation of new entries
2090 with the same name as an entry with <structfield>collencoding</> = -1
2091 is forbidden. Therefore it is sufficient to use a qualified SQL name
2092 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2093 even though this is not unique according to the catalog definition.
2094 The reason for defining the catalog this way is that
2095 <application>initdb</> fills it in at cluster initialization time with
2096 entries for all locales available on the system, so it must be able to
2097 hold entries for all encodings that might ever be used in the cluster.
2101 In the <literal>template0</> database, it could be useful to create
2102 collations whose encoding does not match the database encoding,
2103 since they could match the encodings of databases later cloned from
2104 <literal>template0</>. This would currently have to be done manually.
2108 <sect1 id="catalog-pg-constraint">
2109 <title><structname>pg_constraint</structname></title>
2111 <indexterm zone="catalog-pg-constraint">
2112 <primary>pg_constraint</primary>
2116 The catalog <structname>pg_constraint</structname> stores check, primary
2117 key, unique, foreign key, and exclusion constraints on tables.
2118 (Column constraints are not treated specially. Every column constraint is
2119 equivalent to some table constraint.)
2120 Not-null constraints are represented in the <structname>pg_attribute</>
2125 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2126 TRIGGER</>) also give rise to an entry in this table.
2130 Check constraints on domains are stored here, too.
2134 <title><structname>pg_constraint</> Columns</title>
2141 <entry>References</entry>
2142 <entry>Description</entry>
2148 <entry><structfield>oid</structfield></entry>
2149 <entry><type>oid</type></entry>
2151 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2155 <entry><structfield>conname</structfield></entry>
2156 <entry><type>name</type></entry>
2158 <entry>Constraint name (not necessarily unique!)</entry>
2162 <entry><structfield>connamespace</structfield></entry>
2163 <entry><type>oid</type></entry>
2164 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2166 The OID of the namespace that contains this constraint
2171 <entry><structfield>contype</structfield></entry>
2172 <entry><type>char</type></entry>
2175 <literal>c</> = check constraint,
2176 <literal>f</> = foreign key constraint,
2177 <literal>p</> = primary key constraint,
2178 <literal>u</> = unique constraint,
2179 <literal>t</> = constraint trigger,
2180 <literal>x</> = exclusion constraint
2185 <entry><structfield>condeferrable</structfield></entry>
2186 <entry><type>bool</type></entry>
2188 <entry>Is the constraint deferrable?</entry>
2192 <entry><structfield>condeferred</structfield></entry>
2193 <entry><type>bool</type></entry>
2195 <entry>Is the constraint deferred by default?</entry>
2199 <entry><structfield>convalidated</structfield></entry>
2200 <entry><type>bool</type></entry>
2202 <entry>Has the constraint been validated?
2203 Currently, can only be false for foreign keys and CHECK constraints</entry>
2207 <entry><structfield>conrelid</structfield></entry>
2208 <entry><type>oid</type></entry>
2209 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2210 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2214 <entry><structfield>contypid</structfield></entry>
2215 <entry><type>oid</type></entry>
2216 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2217 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2221 <entry><structfield>conindid</structfield></entry>
2222 <entry><type>oid</type></entry>
2223 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2224 <entry>The index supporting this constraint, if it's a unique, primary
2225 key, foreign key, or exclusion constraint; else 0</entry>
2229 <entry><structfield>confrelid</structfield></entry>
2230 <entry><type>oid</type></entry>
2231 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2232 <entry>If a foreign key, the referenced table; else 0</entry>
2236 <entry><structfield>confupdtype</structfield></entry>
2237 <entry><type>char</type></entry>
2239 <entry>Foreign key update action code:
2240 <literal>a</> = no action,
2241 <literal>r</> = restrict,
2242 <literal>c</> = cascade,
2243 <literal>n</> = set null,
2244 <literal>d</> = set default
2249 <entry><structfield>confdeltype</structfield></entry>
2250 <entry><type>char</type></entry>
2252 <entry>Foreign key deletion action code:
2253 <literal>a</> = no action,
2254 <literal>r</> = restrict,
2255 <literal>c</> = cascade,
2256 <literal>n</> = set null,
2257 <literal>d</> = set default
2262 <entry><structfield>confmatchtype</structfield></entry>
2263 <entry><type>char</type></entry>
2265 <entry>Foreign key match type:
2266 <literal>f</> = full,
2267 <literal>p</> = partial,
2268 <literal>s</> = simple
2273 <entry><structfield>conislocal</structfield></entry>
2274 <entry><type>bool</type></entry>
2277 This constraint is defined locally for the relation. Note that a
2278 constraint can be locally defined and inherited simultaneously.
2283 <entry><structfield>coninhcount</structfield></entry>
2284 <entry><type>int4</type></entry>
2287 The number of direct inheritance ancestors this constraint has.
2289 a nonzero number of ancestors cannot be dropped nor renamed.
2294 <entry><structfield>connoinherit</structfield></entry>
2295 <entry><type>bool</type></entry>
2298 This constraint is defined locally for the relation. It is a
2299 non-inheritable constraint.
2304 <entry><structfield>conkey</structfield></entry>
2305 <entry><type>int2[]</type></entry>
2306 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2307 <entry>If a table constraint (including foreign keys, but not constraint
2308 triggers), list of the constrained columns</entry>
2312 <entry><structfield>confkey</structfield></entry>
2313 <entry><type>int2[]</type></entry>
2314 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2315 <entry>If a foreign key, list of the referenced columns</entry>
2319 <entry><structfield>conpfeqop</structfield></entry>
2320 <entry><type>oid[]</type></entry>
2321 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2322 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2326 <entry><structfield>conppeqop</structfield></entry>
2327 <entry><type>oid[]</type></entry>
2328 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2329 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2333 <entry><structfield>conffeqop</structfield></entry>
2334 <entry><type>oid[]</type></entry>
2335 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2336 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2340 <entry><structfield>conexclop</structfield></entry>
2341 <entry><type>oid[]</type></entry>
2342 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2343 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2347 <entry><structfield>conbin</structfield></entry>
2348 <entry><type>pg_node_tree</type></entry>
2350 <entry>If a check constraint, an internal representation of the expression</entry>
2354 <entry><structfield>consrc</structfield></entry>
2355 <entry><type>text</type></entry>
2357 <entry>If a check constraint, a human-readable representation of the expression</entry>
2364 In the case of an exclusion constraint, <structfield>conkey</structfield>
2365 is only useful for constraint elements that are simple column references.
2366 For other cases, a zero appears in <structfield>conkey</structfield>
2367 and the associated index must be consulted to discover the expression
2368 that is constrained. (<structfield>conkey</structfield> thus has the
2369 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2375 <structfield>consrc</structfield> is not updated when referenced objects
2376 change; for example, it won't track renaming of columns. Rather than
2377 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2378 to extract the definition of a check constraint.
2384 <literal>pg_class.relchecks</literal> needs to agree with the
2385 number of check-constraint entries found in this table for each
2392 <sect1 id="catalog-pg-conversion">
2393 <title><structname>pg_conversion</structname></title>
2395 <indexterm zone="catalog-pg-conversion">
2396 <primary>pg_conversion</primary>
2400 The catalog <structname>pg_conversion</structname> describes
2401 encoding conversion procedures. See <xref linkend="sql-createconversion">
2402 for more information.
2406 <title><structname>pg_conversion</> Columns</title>
2413 <entry>References</entry>
2414 <entry>Description</entry>
2420 <entry><structfield>oid</structfield></entry>
2421 <entry><type>oid</type></entry>
2423 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2427 <entry><structfield>conname</structfield></entry>
2428 <entry><type>name</type></entry>
2430 <entry>Conversion name (unique within a namespace)</entry>
2434 <entry><structfield>connamespace</structfield></entry>
2435 <entry><type>oid</type></entry>
2436 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2438 The OID of the namespace that contains this conversion
2443 <entry><structfield>conowner</structfield></entry>
2444 <entry><type>oid</type></entry>
2445 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2446 <entry>Owner of the conversion</entry>
2450 <entry><structfield>conforencoding</structfield></entry>
2451 <entry><type>int4</type></entry>
2453 <entry>Source encoding ID</entry>
2457 <entry><structfield>contoencoding</structfield></entry>
2458 <entry><type>int4</type></entry>
2460 <entry>Destination encoding ID</entry>
2464 <entry><structfield>conproc</structfield></entry>
2465 <entry><type>regproc</type></entry>
2466 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2467 <entry>Conversion procedure</entry>
2471 <entry><structfield>condefault</structfield></entry>
2472 <entry><type>bool</type></entry>
2474 <entry>True if this is the default conversion</entry>
2483 <sect1 id="catalog-pg-database">
2484 <title><structname>pg_database</structname></title>
2486 <indexterm zone="catalog-pg-database">
2487 <primary>pg_database</primary>
2491 The catalog <structname>pg_database</structname> stores information about
2492 the available databases. Databases are created with the <xref
2493 linkend="sql-createdatabase"> command.
2494 Consult <xref linkend="managing-databases"> for details about the meaning
2495 of some of the parameters.
2499 Unlike most system catalogs, <structname>pg_database</structname>
2500 is shared across all databases of a cluster: there is only one
2501 copy of <structname>pg_database</structname> per cluster, not
2506 <title><structname>pg_database</> Columns</title>
2513 <entry>References</entry>
2514 <entry>Description</entry>
2520 <entry><structfield>oid</structfield></entry>
2521 <entry><type>oid</type></entry>
2523 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2527 <entry><structfield>datname</structfield></entry>
2528 <entry><type>name</type></entry>
2530 <entry>Database name</entry>
2534 <entry><structfield>datdba</structfield></entry>
2535 <entry><type>oid</type></entry>
2536 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2537 <entry>Owner of the database, usually the user who created it</entry>
2541 <entry><structfield>encoding</structfield></entry>
2542 <entry><type>int4</type></entry>
2544 <entry>Character encoding for this database
2545 (<function>pg_encoding_to_char()</function> can translate
2546 this number to the encoding name)</entry>
2550 <entry><structfield>datcollate</structfield></entry>
2551 <entry><type>name</type></entry>
2553 <entry>LC_COLLATE for this database</entry>
2557 <entry><structfield>datctype</structfield></entry>
2558 <entry><type>name</type></entry>
2560 <entry>LC_CTYPE for this database</entry>
2564 <entry><structfield>datistemplate</structfield></entry>
2565 <entry><type>bool</type></entry>
2568 If true, then this database can be cloned by
2569 any user with <literal>CREATEDB</> privileges;
2570 if false, then only superusers or the owner of
2571 the database can clone it.
2576 <entry><structfield>datallowconn</structfield></entry>
2577 <entry><type>bool</type></entry>
2580 If false then no one can connect to this database. This is
2581 used to protect the <literal>template0</> database from being altered.
2586 <entry><structfield>datconnlimit</structfield></entry>
2587 <entry><type>int4</type></entry>
2590 Sets maximum number of concurrent connections that can be made
2591 to this database. -1 means no limit.
2596 <entry><structfield>datlastsysoid</structfield></entry>
2597 <entry><type>oid</type></entry>
2600 Last system OID in the database; useful
2601 particularly to <application>pg_dump</application>
2606 <entry><structfield>datfrozenxid</structfield></entry>
2607 <entry><type>xid</type></entry>
2610 All transaction IDs before this one have been replaced with a permanent
2611 (<quote>frozen</>) transaction ID in this database. This is used to
2612 track whether the database needs to be vacuumed in order to prevent
2613 transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
2614 It is the minimum of the per-table
2615 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2620 <entry><structfield>datminmxid</structfield></entry>
2621 <entry><type>xid</type></entry>
2624 All multixact IDs before this one have been replaced with a
2625 transaction ID in this database. This is used to
2626 track whether the database needs to be vacuumed in order to prevent
2627 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2628 It is the minimum of the per-table
2629 <structname>pg_class</>.<structfield>relminmxid</> values.
2634 <entry><structfield>dattablespace</structfield></entry>
2635 <entry><type>oid</type></entry>
2636 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2638 The default tablespace for the database.
2639 Within this database, all tables for which
2640 <structname>pg_class</>.<structfield>reltablespace</> is zero
2641 will be stored in this tablespace; in particular, all the non-shared
2642 system catalogs will be there.
2647 <entry><structfield>datacl</structfield></entry>
2648 <entry><type>aclitem[]</type></entry>
2651 Access privileges; see
2652 <xref linkend="sql-grant"> and
2653 <xref linkend="sql-revoke">
2663 <sect1 id="catalog-pg-db-role-setting">
2664 <title><structname>pg_db_role_setting</structname></title>
2666 <indexterm zone="catalog-pg-db-role-setting">
2667 <primary>pg_db_role_setting</primary>
2671 The catalog <structname>pg_db_role_setting</structname> records the default
2672 values that have been set for run-time configuration variables,
2673 for each role and database combination.
2677 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2678 is shared across all databases of a cluster: there is only one
2679 copy of <structname>pg_db_role_setting</structname> per cluster, not
2684 <title><structname>pg_db_role_setting</> Columns</title>
2691 <entry>References</entry>
2692 <entry>Description</entry>
2698 <entry><structfield>setdatabase</structfield></entry>
2699 <entry><type>oid</type></entry>
2700 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2701 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2705 <entry><structfield>setrole</structfield></entry>
2706 <entry><type>oid</type></entry>
2707 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2708 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2712 <entry><structfield>setconfig</structfield></entry>
2713 <entry><type>text[]</type></entry>
2715 <entry>Defaults for run-time configuration variables</entry>
2723 <sect1 id="catalog-pg-default-acl">
2724 <title><structname>pg_default_acl</structname></title>
2726 <indexterm zone="catalog-pg-default-acl">
2727 <primary>pg_default_acl</primary>
2731 The catalog <structname>pg_default_acl</> stores initial
2732 privileges to be assigned to newly created objects.
2736 <title><structname>pg_default_acl</> Columns</title>
2743 <entry>References</entry>
2744 <entry>Description</entry>
2750 <entry><structfield>oid</structfield></entry>
2751 <entry><type>oid</type></entry>
2753 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2757 <entry><structfield>defaclrole</structfield></entry>
2758 <entry><type>oid</type></entry>
2759 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2760 <entry>The OID of the role associated with this entry</entry>
2764 <entry><structfield>defaclnamespace</structfield></entry>
2765 <entry><type>oid</type></entry>
2766 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2767 <entry>The OID of the namespace associated with this entry,
2768 or 0 if none</entry>
2772 <entry><structfield>defaclobjtype</structfield></entry>
2773 <entry><type>char</type></entry>
2776 Type of object this entry is for:
2777 <literal>r</> = relation (table, view),
2778 <literal>S</> = sequence,
2779 <literal>f</> = function,
2780 <literal>T</> = type
2785 <entry><structfield>defaclacl</structfield></entry>
2786 <entry><type>aclitem[]</type></entry>
2789 Access privileges that this type of object should have on creation
2797 A <structname>pg_default_acl</> entry shows the initial privileges to
2798 be assigned to an object belonging to the indicated user. There are
2799 currently two types of entry: <quote>global</> entries with
2800 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2801 that reference a particular schema. If a global entry is present then
2802 it <emphasis>overrides</> the normal hard-wired default privileges
2803 for the object type. A per-schema entry, if present, represents privileges
2804 to be <emphasis>added to</> the global or hard-wired default privileges.
2808 Note that when an ACL entry in another catalog is null, it is taken
2809 to represent the hard-wired default privileges for its object,
2810 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2811 at the moment. <structname>pg_default_acl</> is only consulted during
2818 <sect1 id="catalog-pg-depend">
2819 <title><structname>pg_depend</structname></title>
2821 <indexterm zone="catalog-pg-depend">
2822 <primary>pg_depend</primary>
2826 The catalog <structname>pg_depend</structname> records the dependency
2827 relationships between database objects. This information allows
2828 <command>DROP</> commands to find which other objects must be dropped
2829 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2834 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2835 which performs a similar function for dependencies involving objects
2836 that are shared across a database cluster.
2840 <title><structname>pg_depend</> Columns</title>
2847 <entry>References</entry>
2848 <entry>Description</entry>
2854 <entry><structfield>classid</structfield></entry>
2855 <entry><type>oid</type></entry>
2856 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2857 <entry>The OID of the system catalog the dependent object is in</entry>
2861 <entry><structfield>objid</structfield></entry>
2862 <entry><type>oid</type></entry>
2863 <entry>any OID column</entry>
2864 <entry>The OID of the specific dependent object</entry>
2868 <entry><structfield>objsubid</structfield></entry>
2869 <entry><type>int4</type></entry>
2872 For a table column, this is the column number (the
2873 <structfield>objid</> and <structfield>classid</> refer to the
2874 table itself). For all other object types, this column is
2880 <entry><structfield>refclassid</structfield></entry>
2881 <entry><type>oid</type></entry>
2882 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2883 <entry>The OID of the system catalog the referenced object is in</entry>
2887 <entry><structfield>refobjid</structfield></entry>
2888 <entry><type>oid</type></entry>
2889 <entry>any OID column</entry>
2890 <entry>The OID of the specific referenced object</entry>
2894 <entry><structfield>refobjsubid</structfield></entry>
2895 <entry><type>int4</type></entry>
2898 For a table column, this is the column number (the
2899 <structfield>refobjid</> and <structfield>refclassid</> refer
2900 to the table itself). For all other object types, this column
2906 <entry><structfield>deptype</structfield></entry>
2907 <entry><type>char</type></entry>
2910 A code defining the specific semantics of this dependency relationship; see text
2919 In all cases, a <structname>pg_depend</structname> entry indicates that the
2920 referenced object cannot be dropped without also dropping the dependent
2921 object. However, there are several subflavors identified by
2922 <structfield>deptype</>:
2926 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2929 A normal relationship between separately-created objects. The
2930 dependent object can be dropped without affecting the
2931 referenced object. The referenced object can only be dropped
2932 by specifying <literal>CASCADE</>, in which case the dependent
2933 object is dropped, too. Example: a table column has a normal
2934 dependency on its data type.
2940 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2943 The dependent object can be dropped separately from the
2944 referenced object, and should be automatically dropped
2945 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2946 mode) if the referenced object is dropped. Example: a named
2947 constraint on a table is made autodependent on the table, so
2948 that it will go away if the table is dropped.
2954 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2957 The dependent object was created as part of creation of the
2958 referenced object, and is really just a part of its internal
2959 implementation. A <command>DROP</> of the dependent object
2960 will be disallowed outright (we'll tell the user to issue a
2961 <command>DROP</> against the referenced object, instead). A
2962 <command>DROP</> of the referenced object will be propagated
2963 through to drop the dependent object whether
2964 <command>CASCADE</> is specified or not. Example: a trigger
2965 that's created to enforce a foreign-key constraint is made
2966 internally dependent on the constraint's
2967 <structname>pg_constraint</> entry.
2973 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2976 The dependent object is a member of the <firstterm>extension</> that is
2977 the referenced object (see
2978 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2979 The dependent object can be dropped only via
2980 <command>DROP EXTENSION</> on the referenced object. Functionally
2981 this dependency type acts the same as an internal dependency, but
2982 it's kept separate for clarity and to simplify <application>pg_dump</>.
2988 <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2991 The dependent object is not a member of the extension that is the
2992 referenced object (and so should not be ignored by pg_dump), but
2993 cannot function without it and should be dropped when the
2994 extension itself is. The dependent object may be dropped on its
3001 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3004 There is no dependent object; this type of entry is a signal
3005 that the system itself depends on the referenced object, and so
3006 that object must never be deleted. Entries of this type are
3007 created only by <command>initdb</command>. The columns for the
3008 dependent object contain zeroes.
3014 Other dependency flavors might be needed in future.
3020 <sect1 id="catalog-pg-description">
3021 <title><structname>pg_description</structname></title>
3023 <indexterm zone="catalog-pg-description">
3024 <primary>pg_description</primary>
3028 The catalog <structname>pg_description</> stores optional descriptions
3029 (comments) for each database object. Descriptions can be manipulated
3030 with the <xref linkend="sql-comment"> command and viewed with
3031 <application>psql</application>'s <literal>\d</literal> commands.
3032 Descriptions of many built-in system objects are provided in the initial
3033 contents of <structname>pg_description</structname>.
3037 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3038 which performs a similar function for descriptions involving objects that
3039 are shared across a database cluster.
3043 <title><structname>pg_description</> Columns</title>
3050 <entry>References</entry>
3051 <entry>Description</entry>
3057 <entry><structfield>objoid</structfield></entry>
3058 <entry><type>oid</type></entry>
3059 <entry>any OID column</entry>
3060 <entry>The OID of the object this description pertains to</entry>
3064 <entry><structfield>classoid</structfield></entry>
3065 <entry><type>oid</type></entry>
3066 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3067 <entry>The OID of the system catalog this object appears in</entry>
3071 <entry><structfield>objsubid</structfield></entry>
3072 <entry><type>int4</type></entry>
3075 For a comment on a table column, this is the column number (the
3076 <structfield>objoid</> and <structfield>classoid</> refer to
3077 the table itself). For all other object types, this column is
3083 <entry><structfield>description</structfield></entry>
3084 <entry><type>text</type></entry>
3086 <entry>Arbitrary text that serves as the description of this object</entry>
3095 <sect1 id="catalog-pg-enum">
3096 <title><structname>pg_enum</structname></title>
3098 <indexterm zone="catalog-pg-enum">
3099 <primary>pg_enum</primary>
3103 The <structname>pg_enum</structname> catalog contains entries
3104 showing the values and labels for each enum type. The
3105 internal representation of a given enum value is actually the OID
3106 of its associated row in <structname>pg_enum</structname>.
3110 <title><structname>pg_enum</> Columns</title>
3117 <entry>References</entry>
3118 <entry>Description</entry>
3124 <entry><structfield>oid</structfield></entry>
3125 <entry><type>oid</type></entry>
3127 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3131 <entry><structfield>enumtypid</structfield></entry>
3132 <entry><type>oid</type></entry>
3133 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3134 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3138 <entry><structfield>enumsortorder</structfield></entry>
3139 <entry><type>float4</type></entry>
3141 <entry>The sort position of this enum value within its enum type</entry>
3145 <entry><structfield>enumlabel</structfield></entry>
3146 <entry><type>name</type></entry>
3148 <entry>The textual label for this enum value</entry>
3155 The OIDs for <structname>pg_enum</structname> rows follow a special
3156 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3157 as the sort ordering of their enum type. That is, if two even OIDs
3158 belong to the same enum type, the smaller OID must have the smaller
3159 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3160 need bear no relationship to the sort order. This rule allows the
3161 enum comparison routines to avoid catalog lookups in many common cases.
3162 The routines that create and alter enum types attempt to assign even
3163 OIDs to enum values whenever possible.
3167 When an enum type is created, its members are assigned sort-order
3168 positions 1..<replaceable>n</>. But members added later might be given
3169 negative or fractional values of <structfield>enumsortorder</structfield>.
3170 The only requirement on these values is that they be correctly
3171 ordered and unique within each enum type.
3176 <sect1 id="catalog-pg-event-trigger">
3177 <title><structname>pg_event_trigger</structname></title>
3179 <indexterm zone="catalog-pg-event-trigger">
3180 <primary>pg_event_trigger</primary>
3184 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3185 See <xref linkend="event-triggers"> for more information.
3189 <title><structname>pg_event_trigger</> Columns</title>
3196 <entry>References</entry>
3197 <entry>Description</entry>
3203 <entry><structfield>evtname</structfield></entry>
3204 <entry><type>name</type></entry>
3206 <entry>Trigger name (must be unique)</entry>
3210 <entry><structfield>evtevent</structfield></entry>
3211 <entry><type>name</type></entry>
3213 <entry>Identifies the event for which this trigger fires</entry>
3217 <entry><structfield>evtowner</structfield></entry>
3218 <entry><type>oid</type></entry>
3219 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3220 <entry>Owner of the event trigger</entry>
3224 <entry><structfield>evtfoid</structfield></entry>
3225 <entry><type>oid</type></entry>
3226 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3227 <entry>The function to be called</entry>
3231 <entry><structfield>evtenabled</structfield></entry>
3232 <entry><type>char</type></entry>
3235 Controls in which <xref linkend="guc-session-replication-role"> modes
3236 the event trigger fires.
3237 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3238 <literal>D</> = trigger is disabled,
3239 <literal>R</> = trigger fires in <quote>replica</> mode,
3240 <literal>A</> = trigger fires always.
3245 <entry><structfield>evttags</structfield></entry>
3246 <entry><type>text[]</type></entry>
3249 Command tags for which this trigger will fire. If NULL, the firing
3250 of this trigger is not restricted on the basis of the command tag.
3259 <sect1 id="catalog-pg-extension">
3260 <title><structname>pg_extension</structname></title>
3262 <indexterm zone="catalog-pg-extension">
3263 <primary>pg_extension</primary>
3267 The catalog <structname>pg_extension</structname> stores information
3268 about the installed extensions. See <xref linkend="extend-extensions">
3269 for details about extensions.
3273 <title><structname>pg_extension</> Columns</title>
3280 <entry>References</entry>
3281 <entry>Description</entry>
3287 <entry><structfield>oid</structfield></entry>
3288 <entry><type>oid</type></entry>
3290 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3294 <entry><structfield>extname</structfield></entry>
3295 <entry><type>name</type></entry>
3297 <entry>Name of the extension</entry>
3301 <entry><structfield>extowner</structfield></entry>
3302 <entry><type>oid</type></entry>
3303 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3304 <entry>Owner of the extension</entry>
3308 <entry><structfield>extnamespace</structfield></entry>
3309 <entry><type>oid</type></entry>
3310 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3311 <entry>Schema containing the extension's exported objects</entry>
3315 <entry><structfield>extrelocatable</structfield></entry>
3316 <entry><type>bool</type></entry>
3318 <entry>True if extension can be relocated to another schema</entry>
3322 <entry><structfield>extversion</structfield></entry>
3323 <entry><type>text</type></entry>
3325 <entry>Version name for the extension</entry>
3329 <entry><structfield>extconfig</structfield></entry>
3330 <entry><type>oid[]</type></entry>
3331 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3332 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3333 table(s), or <literal>NULL</> if none</entry>
3337 <entry><structfield>extcondition</structfield></entry>
3338 <entry><type>text[]</type></entry>
3340 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3341 extension's configuration table(s), or <literal>NULL</> if none</entry>
3349 Note that unlike most catalogs with a <quote>namespace</> column,
3350 <structfield>extnamespace</structfield> is not meant to imply
3351 that the extension belongs to that schema. Extension names are never
3352 schema-qualified. Rather, <structfield>extnamespace</structfield>
3353 indicates the schema that contains most or all of the extension's
3354 objects. If <structfield>extrelocatable</structfield> is true, then
3355 this schema must in fact contain all schema-qualifiable objects
3356 belonging to the extension.
3361 <sect1 id="catalog-pg-foreign-data-wrapper">
3362 <title><structname>pg_foreign_data_wrapper</structname></title>
3364 <indexterm zone="catalog-pg-foreign-data-wrapper">
3365 <primary>pg_foreign_data_wrapper</primary>
3369 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3370 foreign-data wrapper definitions. A foreign-data wrapper is the
3371 mechanism by which external data, residing on foreign servers, is
3376 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3383 <entry>References</entry>
3384 <entry>Description</entry>
3390 <entry><structfield>oid</structfield></entry>
3391 <entry><type>oid</type></entry>
3393 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3397 <entry><structfield>fdwname</structfield></entry>
3398 <entry><type>name</type></entry>
3400 <entry>Name of the foreign-data wrapper</entry>
3404 <entry><structfield>fdwowner</structfield></entry>
3405 <entry><type>oid</type></entry>
3406 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3407 <entry>Owner of the foreign-data wrapper</entry>
3411 <entry><structfield>fdwhandler</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 handler function that is responsible for
3416 supplying execution routines for the foreign-data wrapper.
3417 Zero if no handler is provided
3422 <entry><structfield>fdwvalidator</structfield></entry>
3423 <entry><type>oid</type></entry>
3424 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3426 References a validator function that is responsible for
3427 checking the validity of the options given to the
3428 foreign-data wrapper, as well as options for foreign servers and user
3429 mappings using the foreign-data wrapper. Zero if no validator
3435 <entry><structfield>fdwacl</structfield></entry>
3436 <entry><type>aclitem[]</type></entry>
3439 Access privileges; see
3440 <xref linkend="sql-grant"> and
3441 <xref linkend="sql-revoke">
3447 <entry><structfield>fdwoptions</structfield></entry>
3448 <entry><type>text[]</type></entry>
3451 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3460 <sect1 id="catalog-pg-foreign-server">
3461 <title><structname>pg_foreign_server</structname></title>
3463 <indexterm zone="catalog-pg-foreign-server">
3464 <primary>pg_foreign_server</primary>
3468 The catalog <structname>pg_foreign_server</structname> stores
3469 foreign server definitions. A foreign server describes a source
3470 of external data, such as a remote server. Foreign
3471 servers are accessed via foreign-data wrappers.
3475 <title><structname>pg_foreign_server</> Columns</title>
3482 <entry>References</entry>
3483 <entry>Description</entry>
3489 <entry><structfield>oid</structfield></entry>
3490 <entry><type>oid</type></entry>
3492 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3496 <entry><structfield>srvname</structfield></entry>
3497 <entry><type>name</type></entry>
3499 <entry>Name of the foreign server</entry>
3503 <entry><structfield>srvowner</structfield></entry>
3504 <entry><type>oid</type></entry>
3505 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3506 <entry>Owner of the foreign server</entry>
3510 <entry><structfield>srvfdw</structfield></entry>
3511 <entry><type>oid</type></entry>
3512 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3513 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3517 <entry><structfield>srvtype</structfield></entry>
3518 <entry><type>text</type></entry>
3520 <entry>Type of the server (optional)</entry>
3524 <entry><structfield>srvversion</structfield></entry>
3525 <entry><type>text</type></entry>
3527 <entry>Version of the server (optional)</entry>
3531 <entry><structfield>srvacl</structfield></entry>
3532 <entry><type>aclitem[]</type></entry>
3535 Access privileges; see
3536 <xref linkend="sql-grant"> and
3537 <xref linkend="sql-revoke">
3543 <entry><structfield>srvoptions</structfield></entry>
3544 <entry><type>text[]</type></entry>
3547 Foreign server specific options, as <quote>keyword=value</> strings
3556 <sect1 id="catalog-pg-foreign-table">
3557 <title><structname>pg_foreign_table</structname></title>
3559 <indexterm zone="catalog-pg-foreign-table">
3560 <primary>pg_foreign_table</primary>
3564 The catalog <structname>pg_foreign_table</structname> contains
3565 auxiliary information about foreign tables. A foreign table is
3566 primarily represented by a <structname>pg_class</structname> entry,
3567 just like a regular table. Its <structname>pg_foreign_table</structname>
3568 entry contains the information that is pertinent only to foreign tables
3569 and not any other kind of relation.
3573 <title><structname>pg_foreign_table</> Columns</title>
3580 <entry>References</entry>
3581 <entry>Description</entry>
3587 <entry><structfield>ftrelid</structfield></entry>
3588 <entry><type>oid</type></entry>
3589 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3590 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3594 <entry><structfield>ftserver</structfield></entry>
3595 <entry><type>oid</type></entry>
3596 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3597 <entry>OID of the foreign server for this foreign table</entry>
3601 <entry><structfield>ftoptions</structfield></entry>
3602 <entry><type>text[]</type></entry>
3605 Foreign table options, as <quote>keyword=value</> strings
3614 <sect1 id="catalog-pg-index">
3615 <title><structname>pg_index</structname></title>
3617 <indexterm zone="catalog-pg-index">
3618 <primary>pg_index</primary>
3622 The catalog <structname>pg_index</structname> contains part of the information
3623 about indexes. The rest is mostly in
3624 <structname>pg_class</structname>.
3628 <title><structname>pg_index</> Columns</title>
3635 <entry>References</entry>
3636 <entry>Description</entry>
3642 <entry><structfield>indexrelid</structfield></entry>
3643 <entry><type>oid</type></entry>
3644 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3645 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3649 <entry><structfield>indrelid</structfield></entry>
3650 <entry><type>oid</type></entry>
3651 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3652 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3656 <entry><structfield>indnatts</structfield></entry>
3657 <entry><type>int2</type></entry>
3659 <entry>The number of columns in the index (duplicates
3660 <literal>pg_class.relnatts</literal>)</entry>
3664 <entry><structfield>indisunique</structfield></entry>
3665 <entry><type>bool</type></entry>
3667 <entry>If true, this is a unique index</entry>
3671 <entry><structfield>indisprimary</structfield></entry>
3672 <entry><type>bool</type></entry>
3674 <entry>If true, this index represents the primary key of the table
3675 (<structfield>indisunique</> should always be true when this is true)</entry>
3679 <entry><structfield>indisexclusion</structfield></entry>
3680 <entry><type>bool</type></entry>
3682 <entry>If true, this index supports an exclusion constraint</entry>
3686 <entry><structfield>indimmediate</structfield></entry>
3687 <entry><type>bool</type></entry>
3689 <entry>If true, the uniqueness check is enforced immediately on
3691 (irrelevant if <structfield>indisunique</> is not true)</entry>
3695 <entry><structfield>indisclustered</structfield></entry>
3696 <entry><type>bool</type></entry>
3698 <entry>If true, the table was last clustered on this index</entry>
3702 <entry><structfield>indisvalid</structfield></entry>
3703 <entry><type>bool</type></entry>
3706 If true, the index is currently valid for queries. False means the
3707 index is possibly incomplete: it must still be modified by
3708 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3709 be used for queries. If it is unique, the uniqueness property is not
3710 guaranteed true either.
3715 <entry><structfield>indcheckxmin</structfield></entry>
3716 <entry><type>bool</type></entry>
3719 If true, queries must not use the index until the <structfield>xmin</>
3720 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3721 event horizon, because the table may contain broken HOT chains with
3722 incompatible rows that they can see
3727 <entry><structfield>indisready</structfield></entry>
3728 <entry><type>bool</type></entry>
3731 If true, the index is currently ready for inserts. False means the
3732 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3738 <entry><structfield>indislive</structfield></entry>
3739 <entry><type>bool</type></entry>
3742 If false, the index is in process of being dropped, and should be
3743 ignored for all purposes (including HOT-safety decisions)
3748 <entry><structfield>indisreplident</structfield></entry>
3749 <entry><type>bool</type></entry>
3752 If true this index has been chosen as <quote>replica identity</>
3753 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3759 <entry><structfield>indkey</structfield></entry>
3760 <entry><type>int2vector</type></entry>
3761 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3763 This is an array of <structfield>indnatts</structfield> values that
3764 indicate which table columns this index indexes. For example a value
3765 of <literal>1 3</literal> would mean that the first and the third table
3766 columns make up the index key. A zero in this array indicates that the
3767 corresponding index attribute is an expression over the table columns,
3768 rather than a simple column reference.
3773 <entry><structfield>indcollation</structfield></entry>
3774 <entry><type>oidvector</type></entry>
3775 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3777 For each column in the index key, this contains the OID of the
3778 collation to use for the index.
3783 <entry><structfield>indclass</structfield></entry>
3784 <entry><type>oidvector</type></entry>
3785 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3787 For each column in the index key, this contains the OID of
3788 the operator class to use. See
3789 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3794 <entry><structfield>indoption</structfield></entry>
3795 <entry><type>int2vector</type></entry>
3798 This is an array of <structfield>indnatts</structfield> values that
3799 store per-column flag bits. The meaning of the bits is defined by
3800 the index's access method.
3805 <entry><structfield>indexprs</structfield></entry>
3806 <entry><type>pg_node_tree</type></entry>
3809 Expression trees (in <function>nodeToString()</function>
3810 representation) for index attributes that are not simple column
3811 references. This is a list with one element for each zero
3812 entry in <structfield>indkey</>. Null if all index attributes
3813 are simple references.
3818 <entry><structfield>indpred</structfield></entry>
3819 <entry><type>pg_node_tree</type></entry>
3822 Expression tree (in <function>nodeToString()</function>
3823 representation) for partial index predicate. Null if not a
3834 <sect1 id="catalog-pg-inherits">
3835 <title><structname>pg_inherits</structname></title>
3837 <indexterm zone="catalog-pg-inherits">
3838 <primary>pg_inherits</primary>
3842 The catalog <structname>pg_inherits</> records information about
3843 table inheritance hierarchies. There is one entry for each direct
3844 child table in the database. (Indirect inheritance can be determined
3845 by following chains of entries.)
3849 <title><structname>pg_inherits</> Columns</title>
3856 <entry>References</entry>
3857 <entry>Description</entry>
3863 <entry><structfield>inhrelid</structfield></entry>
3864 <entry><type>oid</type></entry>
3865 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3867 The OID of the child table
3872 <entry><structfield>inhparent</structfield></entry>
3873 <entry><type>oid</type></entry>
3874 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3876 The OID of the parent table
3881 <entry><structfield>inhseqno</structfield></entry>
3882 <entry><type>int4</type></entry>
3885 If there is more than one direct parent for a child table (multiple
3886 inheritance), this number tells the order in which the
3887 inherited columns are to be arranged. The count starts at 1.
3896 <sect1 id="catalog-pg-init-privs">
3897 <title><structname>pg_init_privs</structname></title>
3899 <indexterm zone="catalog-pg-init-privs">
3900 <primary>pg_init_privs</primary>
3904 The catalog <structname>pg_init_privs</> records information about
3905 the initial privileges of objects in the system. There is one entry
3906 for each object in the database which has a non-default (non-NULL)
3907 initial set of privileges.
3911 Objects can have initial privileges either by having those privileges set
3912 when the system is initialized (by <application>initdb</>) or when the
3913 object is created during a <command>CREATE EXTENSION</command> and the
3914 extension script sets initial privileges using the <command>GRANT</command>
3915 system. Note that the system will automatically handle recording of the
3916 privileges during the extension script and that extension authors need
3917 only use the <command>GRANT</command> and <command>REVOKE</command>
3918 statements in their script to have the privileges recorded. The
3919 <literal>privtype</literal> column indicates if the initial privilege was
3920 set by <application>initdb</> or during a
3921 <command>CREATE EXTENSION</command> command.
3925 Objects which have initial privileges set by <application>initdb</> will
3926 have entries where <literal>privtype</literal> is
3927 <literal>'i'</literal>, while objects which have initial privileges set
3928 by <command>CREATE EXTENSION</command> will have entries where
3929 <literal>privtype</literal> is <literal>'e'</literal>.
3933 <title><structname>pg_init_privs</> Columns</title>
3940 <entry>References</entry>
3941 <entry>Description</entry>
3947 <entry><structfield>objoid</structfield></entry>
3948 <entry><type>oid</type></entry>
3949 <entry>any OID column</entry>
3950 <entry>The OID of the specific object</entry>
3954 <entry><structfield>classoid</structfield></entry>
3955 <entry><type>oid</type></entry>
3956 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3957 <entry>The OID of the system catalog the object is in</entry>
3961 <entry><structfield>objsubid</structfield></entry>
3962 <entry><type>int4</type></entry>
3965 For a table column, this is the column number (the
3966 <structfield>objoid</> and <structfield>classoid</> refer to the
3967 table itself). For all other object types, this column is
3973 <entry><structfield>privtype</structfield></entry>
3974 <entry><type>char</type></entry>
3977 A code defining the type of initial privilege of this object; see text
3982 <entry><structfield>initprivs</structfield></entry>
3983 <entry><type>aclitem[]</type></entry>
3986 The initial access privileges; see
3987 <xref linkend="sql-grant"> and
3988 <xref linkend="sql-revoke">
4000 <sect1 id="catalog-pg-language">
4001 <title><structname>pg_language</structname></title>
4003 <indexterm zone="catalog-pg-language">
4004 <primary>pg_language</primary>
4008 The catalog <structname>pg_language</structname> registers
4009 languages in which you can write functions or stored procedures.
4010 See <xref linkend="sql-createlanguage">
4011 and <xref linkend="xplang"> for more information about language handlers.
4015 <title><structname>pg_language</> Columns</title>
4022 <entry>References</entry>
4023 <entry>Description</entry>
4029 <entry><structfield>oid</structfield></entry>
4030 <entry><type>oid</type></entry>
4032 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4036 <entry><structfield>lanname</structfield></entry>
4037 <entry><type>name</type></entry>
4039 <entry>Name of the language</entry>
4043 <entry><structfield>lanowner</structfield></entry>
4044 <entry><type>oid</type></entry>
4045 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4046 <entry>Owner of the language</entry>
4050 <entry><structfield>lanispl</structfield></entry>
4051 <entry><type>bool</type></entry>
4054 This is false for internal languages (such as
4055 <acronym>SQL</acronym>) and true for user-defined languages.
4056 Currently, <application>pg_dump</application> still uses this
4057 to determine which languages need to be dumped, but this might be
4058 replaced by a different mechanism in the future.
4063 <entry><structfield>lanpltrusted</structfield></entry>
4064 <entry><type>bool</type></entry>
4067 True if this is a trusted language, which means that it is believed
4068 not to grant access to anything outside the normal SQL execution
4069 environment. Only superusers can create functions in untrusted
4075 <entry><structfield>lanplcallfoid</structfield></entry>
4076 <entry><type>oid</type></entry>
4077 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4079 For noninternal languages this references the language
4080 handler, which is a special function that is responsible for
4081 executing all functions that are written in the particular
4087 <entry><structfield>laninline</structfield></entry>
4088 <entry><type>oid</type></entry>
4089 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4091 This references a function that is responsible for executing
4092 <quote>inline</> anonymous code blocks
4093 (<xref linkend="sql-do"> blocks).
4094 Zero if inline blocks are not supported.
4099 <entry><structfield>lanvalidator</structfield></entry>
4100 <entry><type>oid</type></entry>
4101 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4103 This references a language validator function that is responsible
4104 for checking the syntax and validity of new functions when they
4105 are created. Zero if no validator is provided.
4110 <entry><structfield>lanacl</structfield></entry>
4111 <entry><type>aclitem[]</type></entry>
4114 Access privileges; see
4115 <xref linkend="sql-grant"> and
4116 <xref linkend="sql-revoke">
4127 <sect1 id="catalog-pg-largeobject">
4128 <title><structname>pg_largeobject</structname></title>
4130 <indexterm zone="catalog-pg-largeobject">
4131 <primary>pg_largeobject</primary>
4135 The catalog <structname>pg_largeobject</structname> holds the data making up
4136 <quote>large objects</quote>. A large object is identified by an OID
4137 assigned when it is created. Each large object is broken into
4138 segments or <quote>pages</> small enough to be conveniently stored as rows
4139 in <structname>pg_largeobject</structname>.
4140 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4141 <literal>BLCKSZ/4</>, or typically 2 kB).
4145 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4146 associated with large objects. As a result,
4147 <structname>pg_largeobject</structname> was publicly readable and could be
4148 used to obtain the OIDs (and contents) of all large objects in the system.
4149 This is no longer the case; use
4150 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4151 to obtain a list of large object OIDs.
4155 <title><structname>pg_largeobject</> Columns</title>
4162 <entry>References</entry>
4163 <entry>Description</entry>
4169 <entry><structfield>loid</structfield></entry>
4170 <entry><type>oid</type></entry>
4171 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4172 <entry>Identifier of the large object that includes this page</entry>
4176 <entry><structfield>pageno</structfield></entry>
4177 <entry><type>int4</type></entry>
4179 <entry>Page number of this page within its large object
4180 (counting from zero)</entry>
4184 <entry><structfield>data</structfield></entry>
4185 <entry><type>bytea</type></entry>
4188 Actual data stored in the large object.
4189 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4197 Each row of <structname>pg_largeobject</structname> holds data
4198 for one page of a large object, beginning at
4199 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4200 allows sparse storage: pages might be missing, and might be shorter than
4201 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4202 Missing regions within a large object read as zeroes.
4207 <sect1 id="catalog-pg-largeobject-metadata">
4208 <title><structname>pg_largeobject_metadata</structname></title>
4210 <indexterm zone="catalog-pg-largeobject-metadata">
4211 <primary>pg_largeobject_metadata</primary>
4215 The catalog <structname>pg_largeobject_metadata</structname>
4216 holds metadata associated with large objects. The actual large object
4218 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4222 <title><structname>pg_largeobject_metadata</> Columns</title>
4229 <entry>References</entry>
4230 <entry>Description</entry>
4236 <entry><structfield>oid</structfield></entry>
4237 <entry><type>oid</type></entry>
4239 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4243 <entry><structfield>lomowner</structfield></entry>
4244 <entry><type>oid</type></entry>
4245 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4246 <entry>Owner of the large object</entry>
4250 <entry><structfield>lomacl</structfield></entry>
4251 <entry><type>aclitem[]</type></entry>
4254 Access privileges; see
4255 <xref linkend="sql-grant"> and
4256 <xref linkend="sql-revoke">
4266 <sect1 id="catalog-pg-statistic-ext">
4267 <title><structname>pg_statistic_ext</structname></title>
4269 <indexterm zone="catalog-pg-statistic-ext">
4270 <primary>pg_statistic_ext</primary>
4274 The catalog <structname>pg_statistic_ext</structname>
4275 holds extended planner statistics.
4279 <title><structname>pg_statistic_ext</> Columns</title>
4286 <entry>References</entry>
4287 <entry>Description</entry>
4294 <entry><structfield>stxrelid</structfield></entry>
4295 <entry><type>oid</type></entry>
4296 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4297 <entry>The table that the described columns belongs to</entry>
4301 <entry><structfield>stxname</structfield></entry>
4302 <entry><type>name</type></entry>
4304 <entry>Name of the statistic.</entry>
4308 <entry><structfield>stxnamespace</structfield></entry>
4309 <entry><type>oid</type></entry>
4310 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4312 The OID of the namespace that contains this statistic
4317 <entry><structfield>stxowner</structfield></entry>
4318 <entry><type>oid</type></entry>
4319 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4320 <entry>Owner of the statistic</entry>
4324 <entry><structfield>stxkind</structfield></entry>
4325 <entry><type>char[]</type></entry>
4328 An array with the modes of the enabled statistic types. Valid values
4330 <literal>d</literal> for ndistinct coefficients,
4331 <literal>f</literal> for functional dependencies.
4336 <entry><structfield>stxkeys</structfield></entry>
4337 <entry><type>int2vector</type></entry>
4338 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4340 This is an array of values that indicate which table columns this
4341 statistic covers. For example a value of <literal>1 3</literal> would
4342 mean that the first and the third table columns make up the statistic key.
4347 <entry><structfield>stxndistinct</structfield></entry>
4348 <entry><type>pg_ndistinct</type></entry>
4351 N-distinct coefficients, serialized as <structname>pg_ndistinct</> type.
4356 <entry><structfield>stxdependencies</structfield></entry>
4357 <entry><type>pg_dependencies</type></entry>
4360 Functional dependencies, serialized as <structname>pg_dependencies</> type.
4369 <sect1 id="catalog-pg-namespace">
4370 <title><structname>pg_namespace</structname></title>
4372 <indexterm zone="catalog-pg-namespace">
4373 <primary>pg_namespace</primary>
4377 The catalog <structname>pg_namespace</> stores namespaces.
4378 A namespace is the structure underlying SQL schemas: each namespace
4379 can have a separate collection of relations, types, etc. without name
4384 <title><structname>pg_namespace</> Columns</title>
4391 <entry>References</entry>
4392 <entry>Description</entry>
4398 <entry><structfield>oid</structfield></entry>
4399 <entry><type>oid</type></entry>
4401 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4405 <entry><structfield>nspname</structfield></entry>
4406 <entry><type>name</type></entry>
4408 <entry>Name of the namespace</entry>
4412 <entry><structfield>nspowner</structfield></entry>
4413 <entry><type>oid</type></entry>
4414 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4415 <entry>Owner of the namespace</entry>
4419 <entry><structfield>nspacl</structfield></entry>
4420 <entry><type>aclitem[]</type></entry>
4423 Access privileges; see
4424 <xref linkend="sql-grant"> and
4425 <xref linkend="sql-revoke">
4436 <sect1 id="catalog-pg-opclass">
4437 <title><structname>pg_opclass</structname></title>
4439 <indexterm zone="catalog-pg-opclass">
4440 <primary>pg_opclass</primary>
4444 The catalog <structname>pg_opclass</structname> defines
4445 index access method operator classes. Each operator class defines
4446 semantics for index columns of a particular data type and a particular
4447 index access method. An operator class essentially specifies that a
4448 particular operator family is applicable to a particular indexable column
4449 data type. The set of operators from the family that are actually usable
4450 with the indexed column are whichever ones accept the column's data type
4451 as their left-hand input.
4455 Operator classes are described at length in <xref linkend="xindex">.
4459 <title><structname>pg_opclass</> Columns</title>
4466 <entry>References</entry>
4467 <entry>Description</entry>
4473 <entry><structfield>oid</structfield></entry>
4474 <entry><type>oid</type></entry>
4476 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4480 <entry><structfield>opcmethod</structfield></entry>
4481 <entry><type>oid</type></entry>
4482 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4483 <entry>Index access method operator class is for</entry>
4487 <entry><structfield>opcname</structfield></entry>
4488 <entry><type>name</type></entry>
4490 <entry>Name of this operator class</entry>
4494 <entry><structfield>opcnamespace</structfield></entry>
4495 <entry><type>oid</type></entry>
4496 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4497 <entry>Namespace of this operator class</entry>
4501 <entry><structfield>opcowner</structfield></entry>
4502 <entry><type>oid</type></entry>
4503 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4504 <entry>Owner of the operator class</entry>
4508 <entry><structfield>opcfamily</structfield></entry>
4509 <entry><type>oid</type></entry>
4510 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4511 <entry>Operator family containing the operator class</entry>
4515 <entry><structfield>opcintype</structfield></entry>
4516 <entry><type>oid</type></entry>
4517 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4518 <entry>Data type that the operator class indexes</entry>
4522 <entry><structfield>opcdefault</structfield></entry>
4523 <entry><type>bool</type></entry>
4525 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4529 <entry><structfield>opckeytype</structfield></entry>
4530 <entry><type>oid</type></entry>
4531 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4532 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4540 An operator class's <structfield>opcmethod</> must match the
4541 <structname>opfmethod</> of its containing operator family.
4542 Also, there must be no more than one <structname>pg_opclass</structname>
4543 row having <structname>opcdefault</> true for any given combination of
4544 <structname>opcmethod</> and <structname>opcintype</>.
4550 <sect1 id="catalog-pg-operator">
4551 <title><structname>pg_operator</structname></title>
4553 <indexterm zone="catalog-pg-operator">
4554 <primary>pg_operator</primary>
4558 The catalog <structname>pg_operator</> stores information about operators.
4559 See <xref linkend="sql-createoperator">
4560 and <xref linkend="xoper"> for more information.
4564 <title><structname>pg_operator</> Columns</title>
4571 <entry>References</entry>
4572 <entry>Description</entry>
4578 <entry><structfield>oid</structfield></entry>
4579 <entry><type>oid</type></entry>
4581 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4585 <entry><structfield>oprname</structfield></entry>
4586 <entry><type>name</type></entry>
4588 <entry>Name of the operator</entry>
4592 <entry><structfield>oprnamespace</structfield></entry>
4593 <entry><type>oid</type></entry>
4594 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4596 The OID of the namespace that contains this operator
4601 <entry><structfield>oprowner</structfield></entry>
4602 <entry><type>oid</type></entry>
4603 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4604 <entry>Owner of the operator</entry>
4608 <entry><structfield>oprkind</structfield></entry>
4609 <entry><type>char</type></entry>
4612 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4613 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4618 <entry><structfield>oprcanmerge</structfield></entry>
4619 <entry><type>bool</type></entry>
4621 <entry>This operator supports merge joins</entry>
4625 <entry><structfield>oprcanhash</structfield></entry>
4626 <entry><type>bool</type></entry>
4628 <entry>This operator supports hash joins</entry>
4632 <entry><structfield>oprleft</structfield></entry>
4633 <entry><type>oid</type></entry>
4634 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4635 <entry>Type of the left operand</entry>
4639 <entry><structfield>oprright</structfield></entry>
4640 <entry><type>oid</type></entry>
4641 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4642 <entry>Type of the right operand</entry>
4646 <entry><structfield>oprresult</structfield></entry>
4647 <entry><type>oid</type></entry>
4648 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4649 <entry>Type of the result</entry>
4653 <entry><structfield>oprcom</structfield></entry>
4654 <entry><type>oid</type></entry>
4655 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4656 <entry>Commutator of this operator, if any</entry>
4660 <entry><structfield>oprnegate</structfield></entry>
4661 <entry><type>oid</type></entry>
4662 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4663 <entry>Negator of this operator, if any</entry>
4667 <entry><structfield>oprcode</structfield></entry>
4668 <entry><type>regproc</type></entry>
4669 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4670 <entry>Function that implements this operator</entry>
4674 <entry><structfield>oprrest</structfield></entry>
4675 <entry><type>regproc</type></entry>
4676 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4677 <entry>Restriction selectivity estimation function for this operator</entry>
4681 <entry><structfield>oprjoin</structfield></entry>
4682 <entry><type>regproc</type></entry>
4683 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4684 <entry>Join selectivity estimation function for this operator</entry>
4691 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4692 is zero for a prefix operator.
4698 <sect1 id="catalog-pg-opfamily">
4699 <title><structname>pg_opfamily</structname></title>
4701 <indexterm zone="catalog-pg-opfamily">
4702 <primary>pg_opfamily</primary>
4706 The catalog <structname>pg_opfamily</structname> defines operator families.
4707 Each operator family is a collection of operators and associated
4708 support routines that implement the semantics specified for a particular
4709 index access method. Furthermore, the operators in a family are all
4710 <quote>compatible</>, in a way that is specified by the access method.
4711 The operator family concept allows cross-data-type operators to be used
4712 with indexes and to be reasoned about using knowledge of access method
4717 Operator families are described at length in <xref linkend="xindex">.
4721 <title><structname>pg_opfamily</> Columns</title>
4728 <entry>References</entry>
4729 <entry>Description</entry>
4735 <entry><structfield>oid</structfield></entry>
4736 <entry><type>oid</type></entry>
4738 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4742 <entry><structfield>opfmethod</structfield></entry>
4743 <entry><type>oid</type></entry>
4744 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4745 <entry>Index access method operator family is for</entry>
4749 <entry><structfield>opfname</structfield></entry>
4750 <entry><type>name</type></entry>
4752 <entry>Name of this operator family</entry>
4756 <entry><structfield>opfnamespace</structfield></entry>
4757 <entry><type>oid</type></entry>
4758 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4759 <entry>Namespace of this operator family</entry>
4763 <entry><structfield>opfowner</structfield></entry>
4764 <entry><type>oid</type></entry>
4765 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4766 <entry>Owner of the operator family</entry>
4774 The majority of the information defining an operator family is not in its
4775 <structname>pg_opfamily</structname> row, but in the associated rows in
4776 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4777 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4779 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4785 <sect1 id="catalog-pg-pltemplate">
4786 <title><structname>pg_pltemplate</structname></title>
4788 <indexterm zone="catalog-pg-pltemplate">
4789 <primary>pg_pltemplate</primary>
4793 The catalog <structname>pg_pltemplate</structname> stores
4794 <quote>template</> information for procedural languages.
4795 A template for a language allows the language to be created in a
4796 particular database by a simple <command>CREATE LANGUAGE</> command,
4797 with no need to specify implementation details.
4801 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4802 is shared across all databases of a cluster: there is only one
4803 copy of <structname>pg_pltemplate</structname> per cluster, not
4804 one per database. This allows the information to be accessible in
4805 each database as it is needed.
4809 <title><structname>pg_pltemplate</> Columns</title>
4816 <entry>Description</entry>
4822 <entry><structfield>tmplname</structfield></entry>
4823 <entry><type>name</type></entry>
4824 <entry>Name of the language this template is for</entry>
4828 <entry><structfield>tmpltrusted</structfield></entry>
4829 <entry><type>boolean</type></entry>
4830 <entry>True if language is considered trusted</entry>
4834 <entry><structfield>tmpldbacreate</structfield></entry>
4835 <entry><type>boolean</type></entry>
4836 <entry>True if language may be created by a database owner</entry>
4840 <entry><structfield>tmplhandler</structfield></entry>
4841 <entry><type>text</type></entry>
4842 <entry>Name of call handler function</entry>
4846 <entry><structfield>tmplinline</structfield></entry>
4847 <entry><type>text</type></entry>
4848 <entry>Name of anonymous-block handler function, or null if none</entry>
4852 <entry><structfield>tmplvalidator</structfield></entry>
4853 <entry><type>text</type></entry>
4854 <entry>Name of validator function, or null if none</entry>
4858 <entry><structfield>tmpllibrary</structfield></entry>
4859 <entry><type>text</type></entry>
4860 <entry>Path of shared library that implements language</entry>
4864 <entry><structfield>tmplacl</structfield></entry>
4865 <entry><type>aclitem[]</type></entry>
4866 <entry>Access privileges for template (not actually used)</entry>
4874 There are not currently any commands that manipulate procedural language
4875 templates; to change the built-in information, a superuser must modify
4876 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4877 or <command>UPDATE</command> commands.
4882 It is likely that <structname>pg_pltemplate</> will be removed in some
4883 future release of <productname>PostgreSQL</productname>, in favor of
4884 keeping this knowledge about procedural languages in their respective
4885 extension installation scripts.
4891 <sect1 id="catalog-pg-partitioned-table">
4892 <title><structname>pg_partitioned_table</structname></title>
4894 <indexterm zone="catalog-pg-partitioned-table">
4895 <primary>pg_partitioned_table</primary>
4899 The catalog <structname>pg_partitioned_table</structname> stores
4900 information about how tables are partitioned.
4904 <title><structname>pg_partitioned_table</> Columns</title>
4911 <entry>References</entry>
4912 <entry>Description</entry>
4919 <entry><structfield>partrelid</structfield></entry>
4920 <entry><type>oid</type></entry>
4921 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4922 <entry>The OID of the <structname>pg_class</> entry for this partitioned table</entry>
4926 <entry><structfield>partstrat</structfield></entry>
4927 <entry><type>char</type></entry>
4930 Partitioning strategy; <literal>l</> = list partitioned table,
4931 <literal>r</> = range partitioned table
4936 <entry><structfield>partnatts</structfield></entry>
4937 <entry><type>int2</type></entry>
4939 <entry>The number of columns in partition key</entry>
4943 <entry><structfield>partattrs</structfield></entry>
4944 <entry><type>int2vector</type></entry>
4945 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4947 This is an array of <structfield>partnatts</structfield> values that
4948 indicate which table columns are part of the partition key. For
4949 example, a value of <literal>1 3</literal> would mean that the first
4950 and the third table columns make up the partition key. A zero in this
4951 array indicates that the corresponding partition key column is an
4952 expression, rather than a simple column reference.
4957 <entry><structfield>partclass</structfield></entry>
4958 <entry><type>oidvector</type></entry>
4959 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4961 For each column in the partition key, this contains the OID of the
4962 operator class to use. See
4963 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4968 <entry><structfield>partcollation</structfield></entry>
4969 <entry><type>oidvector</type></entry>
4970 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4972 For each column in the partition key, this contains the OID of the
4973 the collation to use for partitioning.
4978 <entry><structfield>partexprs</structfield></entry>
4979 <entry><type>pg_node_tree</type></entry>
4982 Expression trees (in <function>nodeToString()</function>
4983 representation) for partition key columns that are not simple column
4984 references. This is a list with one element for each zero
4985 entry in <structfield>partattrs</>. Null if all partition key columns
4986 are simple references.
4995 <sect1 id="catalog-pg-policy">
4996 <title><structname>pg_policy</structname></title>
4998 <indexterm zone="catalog-pg-policy">
4999 <primary>pg_policy</primary>
5003 The catalog <structname>pg_policy</structname> stores row level
5004 security policies for tables. A policy includes the kind of
5005 command that it applies to (possibly all commands), the roles that it
5006 applies to, the expression to be added as a security-barrier
5007 qualification to queries that include the table, and the expression
5008 to be added as a <literal>WITH CHECK</> option for queries that attempt to
5009 add new records to the table.
5014 <title><structname>pg_policy</structname> Columns</title>
5021 <entry>References</entry>
5022 <entry>Description</entry>
5028 <entry><structfield>polname</structfield></entry>
5029 <entry><type>name</type></entry>
5031 <entry>The name of the policy</entry>
5035 <entry><structfield>polrelid</structfield></entry>
5036 <entry><type>oid</type></entry>
5037 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5038 <entry>The table to which the policy applies</entry>
5042 <entry><structfield>polcmd</structfield></entry>
5043 <entry><type>char</type></entry>
5045 <entry>The command type to which the policy is applied:
5046 <literal>r</> for <command>SELECT</>,
5047 <literal>a</> for <command>INSERT</>,
5048 <literal>w</> for <command>UPDATE</>,
5049 <literal>d</> for <command>DELETE</>,
5050 or <literal>*</> for all</entry>
5054 <entry><structfield>polpermissive</structfield></entry>
5055 <entry><type>boolean</type></entry>
5057 <entry>Is the policy permissive or restrictive?</entry>
5061 <entry><structfield>polroles</structfield></entry>
5062 <entry><type>oid[]</type></entry>
5063 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5064 <entry>The roles to which the policy is applied</entry>
5068 <entry><structfield>polqual</structfield></entry>
5069 <entry><type>pg_node_tree</type></entry>
5071 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
5075 <entry><structfield>polwithcheck</structfield></entry>
5076 <entry><type>pg_node_tree</type></entry>
5078 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
5087 Policies stored in <structname>pg_policy</> are applied only when
5088 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
5095 <sect1 id="catalog-pg-proc">
5096 <title><structname>pg_proc</structname></title>
5098 <indexterm zone="catalog-pg-proc">
5099 <primary>pg_proc</primary>
5103 The catalog <structname>pg_proc</> stores information about functions (or procedures).
5104 See <xref linkend="sql-createfunction">
5105 and <xref linkend="xfunc"> for more information.
5109 The table contains data for aggregate functions as well as plain functions.
5110 If <structfield>proisagg</structfield> is true, there should be a matching
5111 row in <structfield>pg_aggregate</structfield>.
5115 <title><structname>pg_proc</> Columns</title>
5122 <entry>References</entry>
5123 <entry>Description</entry>
5129 <entry><structfield>oid</structfield></entry>
5130 <entry><type>oid</type></entry>
5132 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5136 <entry><structfield>proname</structfield></entry>
5137 <entry><type>name</type></entry>
5139 <entry>Name of the function</entry>
5143 <entry><structfield>pronamespace</structfield></entry>
5144 <entry><type>oid</type></entry>
5145 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5147 The OID of the namespace that contains this function
5152 <entry><structfield>proowner</structfield></entry>
5153 <entry><type>oid</type></entry>
5154 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5155 <entry>Owner of the function</entry>
5159 <entry><structfield>prolang</structfield></entry>
5160 <entry><type>oid</type></entry>
5161 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
5162 <entry>Implementation language or call interface of this function</entry>
5166 <entry><structfield>procost</structfield></entry>
5167 <entry><type>float4</type></entry>
5169 <entry>Estimated execution cost (in units of
5170 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
5171 this is cost per row returned</entry>
5175 <entry><structfield>prorows</structfield></entry>
5176 <entry><type>float4</type></entry>
5178 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
5182 <entry><structfield>provariadic</structfield></entry>
5183 <entry><type>oid</type></entry>
5184 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5185 <entry>Data type of the variadic array parameter's elements,
5186 or zero if the function does not have a variadic parameter</entry>
5190 <entry><structfield>protransform</structfield></entry>
5191 <entry><type>regproc</type></entry>
5192 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5193 <entry>Calls to this function can be simplified by this other function
5194 (see <xref linkend="xfunc-transform-functions">)</entry>
5198 <entry><structfield>proisagg</structfield></entry>
5199 <entry><type>bool</type></entry>
5201 <entry>Function is an aggregate function</entry>
5205 <entry><structfield>proiswindow</structfield></entry>
5206 <entry><type>bool</type></entry>
5208 <entry>Function is a window function</entry>
5212 <entry><structfield>prosecdef</structfield></entry>
5213 <entry><type>bool</type></entry>
5215 <entry>Function is a security definer (i.e., a <quote>setuid</>
5220 <entry><structfield>proleakproof</structfield></entry>
5221 <entry><type>bool</type></entry>
5224 The function has no side effects. No information about the
5225 arguments is conveyed except via the return value. Any function
5226 that might throw an error depending on the values of its arguments
5232 <entry><structfield>proisstrict</structfield></entry>
5233 <entry><type>bool</type></entry>
5236 Function returns null if any call argument is null. In that
5237 case the function won't actually be called at all. Functions
5238 that are not <quote>strict</quote> must be prepared to handle
5244 <entry><structfield>proretset</structfield></entry>
5245 <entry><type>bool</type></entry>
5247 <entry>Function returns a set (i.e., multiple values of the specified
5252 <entry><structfield>provolatile</structfield></entry>
5253 <entry><type>char</type></entry>
5256 <structfield>provolatile</structfield> tells whether the function's
5257 result depends only on its input arguments, or is affected by outside
5259 It is <literal>i</literal> for <quote>immutable</> functions,
5260 which always deliver the same result for the same inputs.
5261 It is <literal>s</literal> for <quote>stable</> functions,
5262 whose results (for fixed inputs) do not change within a scan.
5263 It is <literal>v</literal> for <quote>volatile</> functions,
5264 whose results might change at any time. (Use <literal>v</literal> also
5265 for functions with side-effects, so that calls to them cannot get
5271 <entry><structfield>proparallel</structfield></entry>
5272 <entry><type>char</type></entry>
5275 <structfield>proparallel</structfield> tells whether the function
5276 can be safely run in parallel mode.
5277 It is <literal>s</literal> for functions which are safe to run in
5278 parallel mode without restriction.
5279 It is <literal>r</literal> for functions which can be run in parallel
5280 mode, but their execution is restricted to the parallel group leader;
5281 parallel worker processes cannot invoke these functions.
5282 It is <literal>u</literal> for functions which are unsafe in parallel
5283 mode; the presence of such a function forces a serial execution plan.
5288 <entry><structfield>pronargs</structfield></entry>
5289 <entry><type>int2</type></entry>
5291 <entry>Number of input arguments</entry>
5295 <entry><structfield>pronargdefaults</structfield></entry>
5296 <entry><type>int2</type></entry>
5298 <entry>Number of arguments that have defaults</entry>
5302 <entry><structfield>prorettype</structfield></entry>
5303 <entry><type>oid</type></entry>
5304 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5305 <entry>Data type of the return value</entry>
5309 <entry><structfield>proargtypes</structfield></entry>
5310 <entry><type>oidvector</type></entry>
5311 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5313 An array with the data types of the function arguments. This includes
5314 only input arguments (including <literal>INOUT</literal> and
5315 <literal>VARIADIC</> arguments), and thus represents
5316 the call signature of the function.
5321 <entry><structfield>proallargtypes</structfield></entry>
5322 <entry><type>oid[]</type></entry>
5323 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5325 An array with the data types of the function arguments. This includes
5326 all arguments (including <literal>OUT</literal> and
5327 <literal>INOUT</literal> arguments); however, if all the
5328 arguments are <literal>IN</literal> arguments, this field will be null.
5329 Note that subscripting is 1-based, whereas for historical reasons
5330 <structfield>proargtypes</> is subscripted from 0.
5335 <entry><structfield>proargmodes</structfield></entry>
5336 <entry><type>char[]</type></entry>
5339 An array with the modes of the function arguments, encoded as
5340 <literal>i</literal> for <literal>IN</> arguments,
5341 <literal>o</literal> for <literal>OUT</> arguments,
5342 <literal>b</literal> for <literal>INOUT</> arguments,
5343 <literal>v</literal> for <literal>VARIADIC</> arguments,
5344 <literal>t</literal> for <literal>TABLE</> arguments.
5345 If all the arguments are <literal>IN</literal> arguments,
5346 this field will be null.
5347 Note that subscripts correspond to positions of
5348 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5353 <entry><structfield>proargnames</structfield></entry>
5354 <entry><type>text[]</type></entry>
5357 An array with the names of the function arguments.
5358 Arguments without a name are set to empty strings in the array.
5359 If none of the arguments have a name, this field will be null.
5360 Note that subscripts correspond to positions of
5361 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5366 <entry><structfield>proargdefaults</structfield></entry>
5367 <entry><type>pg_node_tree</type></entry>
5370 Expression trees (in <function>nodeToString()</function> representation)
5371 for default values. This is a list with
5372 <structfield>pronargdefaults</> elements, corresponding to the last
5373 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5374 <replaceable>N</> <structfield>proargtypes</> positions).
5375 If none of the arguments have defaults, this field will be null.
5380 <entry><structfield>protrftypes</structfield></entry>
5381 <entry><type>oid[]</type></entry>
5384 Data type OIDs for which to apply transforms.
5389 <entry><structfield>prosrc</structfield></entry>
5390 <entry><type>text</type></entry>
5393 This tells the function handler how to invoke the function. It
5394 might be the actual source code of the function for interpreted
5395 languages, a link symbol, a file name, or just about anything
5396 else, depending on the implementation language/call convention.
5401 <entry><structfield>probin</structfield></entry>
5402 <entry><type>text</type></entry>
5405 Additional information about how to invoke the function.
5406 Again, the interpretation is language-specific.
5411 <entry><structfield>proconfig</structfield></entry>
5412 <entry><type>text[]</type></entry>
5414 <entry>Function's local settings for run-time configuration variables</entry>
5418 <entry><structfield>proacl</structfield></entry>
5419 <entry><type>aclitem[]</type></entry>
5422 Access privileges; see
5423 <xref linkend="sql-grant"> and
5424 <xref linkend="sql-revoke">
5433 For compiled functions, both built-in and dynamically loaded,
5434 <structfield>prosrc</structfield> contains the function's C-language
5435 name (link symbol). For all other currently-known language types,
5436 <structfield>prosrc</structfield> contains the function's source
5437 text. <structfield>probin</structfield> is unused except for
5438 dynamically-loaded C functions, for which it gives the name of the
5439 shared library file containing the function.
5444 <sect1 id="catalog-pg-publication">
5445 <title><structname>pg_publication</structname></title>
5447 <indexterm zone="catalog-pg-publication">
5448 <primary>pg_publication</primary>
5452 The catalog <structname>pg_publication</structname> contains all
5453 publications created in the database. For more on publications see
5454 <xref linkend="logical-replication-publication">.
5458 <title><structname>pg_publication</structname> Columns</title>
5465 <entry>References</entry>
5466 <entry>Description</entry>
5472 <entry><structfield>oid</structfield></entry>
5473 <entry><type>oid</type></entry>
5475 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5479 <entry><structfield>pubname</structfield></entry>
5480 <entry><type>Name</type></entry>
5482 <entry>Name of the publication</entry>
5486 <entry><structfield>pubowner</structfield></entry>
5487 <entry><type>oid</type></entry>
5488 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5489 <entry>Owner of the publication</entry>
5493 <entry><structfield>puballtables</structfield></entry>
5494 <entry><type>bool</type></entry>
5496 <entry>If true, this publication automatically includes all tables
5497 in the database, including any that will be created in the future.
5502 <entry><structfield>pubinsert</structfield></entry>
5503 <entry><type>bool</type></entry>
5505 <entry>If true, <command>INSERT</command> operations are replicated for
5506 tables in the publication.</entry>
5510 <entry><structfield>pubupdate</structfield></entry>
5511 <entry><type>bool</type></entry>
5513 <entry>If true, <command>UPDATE</command> operations are replicated for
5514 tables in the publication.</entry>
5518 <entry><structfield>pubdelete</structfield></entry>
5519 <entry><type>bool</type></entry>
5521 <entry>If true, <command>DELETE</command> operations are replicated for
5522 tables in the publication.</entry>
5529 <sect1 id="catalog-pg-publication-rel">
5530 <title><structname>pg_publication_rel</structname></title>
5532 <indexterm zone="catalog-pg-publication-rel">
5533 <primary>pg_publication_rel</primary>
5537 The catalog <structname>pg_publication_rel</structname> contains the
5538 mapping between relations and publications in the database. This is a
5539 many-to-many mapping. See also <xref linkend="view-pg-publication-tables">
5540 for a more user-friendly view of this information.
5544 <title><structname>pg_publication_rel</structname> Columns</title>
5551 <entry>References</entry>
5552 <entry>Description</entry>
5558 <entry><structfield>prpubid</structfield></entry>
5559 <entry><type>oid</type></entry>
5560 <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
5561 <entry>Reference to publication</entry>
5565 <entry><structfield>prrelid</structfield></entry>
5566 <entry><type>oid</type></entry>
5567 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5568 <entry>Reference to relation</entry>
5575 <sect1 id="catalog-pg-range">
5576 <title><structname>pg_range</structname></title>
5578 <indexterm zone="catalog-pg-range">
5579 <primary>pg_range</primary>
5583 The catalog <structname>pg_range</structname> stores information about
5584 range types. This is in addition to the types' entries in
5585 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5589 <title><structname>pg_range</> Columns</title>
5596 <entry>References</entry>
5597 <entry>Description</entry>
5603 <entry><structfield>rngtypid</structfield></entry>
5604 <entry><type>oid</type></entry>
5605 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5606 <entry>OID of the range type</entry>
5610 <entry><structfield>rngsubtype</structfield></entry>
5611 <entry><type>oid</type></entry>
5612 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5613 <entry>OID of the element type (subtype) of this range type</entry>
5617 <entry><structfield>rngcollation</structfield></entry>
5618 <entry><type>oid</type></entry>
5619 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5620 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5624 <entry><structfield>rngsubopc</structfield></entry>
5625 <entry><type>oid</type></entry>
5626 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5627 <entry>OID of the subtype's operator class used for range comparisons</entry>
5631 <entry><structfield>rngcanonical</structfield></entry>
5632 <entry><type>regproc</type></entry>
5633 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5634 <entry>OID of the function to convert a range value into canonical form,
5635 or 0 if none</entry>
5639 <entry><structfield>rngsubdiff</structfield></entry>
5640 <entry><type>regproc</type></entry>
5641 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5642 <entry>OID of the function to return the difference between two element
5643 values as <type>double precision</type>, or 0 if none</entry>
5650 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5651 element type is collatable) determines the sort ordering used by the range
5652 type. <structfield>rngcanonical</> is used when the element type is
5653 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5654 improve performance of GiST indexes on the range type.
5659 <sect1 id="catalog-pg-replication-origin">
5660 <title><structname>pg_replication_origin</structname></title>
5662 <indexterm zone="catalog-pg-replication-origin">
5663 <primary>pg_replication_origin</primary>
5667 The <structname>pg_replication_origin</structname> catalog contains
5668 all replication origins created. For more on replication origins
5669 see <xref linkend="replication-origins">.
5674 <title><structname>pg_replication_origin</structname> Columns</title>
5681 <entry>References</entry>
5682 <entry>Description</entry>
5688 <entry><structfield>roident</structfield></entry>
5689 <entry><type>Oid</type></entry>
5691 <entry>A unique, cluster-wide identifier for the replication
5692 origin. Should never leave the system.</entry>
5696 <entry><structfield>roname</structfield></entry>
5697 <entry><type>text</type></entry>
5699 <entry>The external, user defined, name of a replication
5707 <sect1 id="catalog-pg-rewrite">
5708 <title><structname>pg_rewrite</structname></title>
5710 <indexterm zone="catalog-pg-rewrite">
5711 <primary>pg_rewrite</primary>
5715 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5719 <title><structname>pg_rewrite</> Columns</title>
5726 <entry>References</entry>
5727 <entry>Description</entry>
5733 <entry><structfield>oid</structfield></entry>
5734 <entry><type>oid</type></entry>
5736 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5740 <entry><structfield>rulename</structfield></entry>
5741 <entry><type>name</type></entry>
5743 <entry>Rule name</entry>
5747 <entry><structfield>ev_class</structfield></entry>
5748 <entry><type>oid</type></entry>
5749 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5750 <entry>The table this rule is for</entry>
5754 <entry><structfield>ev_type</structfield></entry>
5755 <entry><type>char</type></entry>
5758 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5759 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5765 <entry><structfield>ev_enabled</structfield></entry>
5766 <entry><type>char</type></entry>
5769 Controls in which <xref linkend="guc-session-replication-role"> modes
5771 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5772 <literal>D</> = rule is disabled,
5773 <literal>R</> = rule fires in <quote>replica</> mode,
5774 <literal>A</> = rule fires always.
5779 <entry><structfield>is_instead</structfield></entry>
5780 <entry><type>bool</type></entry>
5782 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5786 <entry><structfield>ev_qual</structfield></entry>
5787 <entry><type>pg_node_tree</type></entry>
5790 Expression tree (in the form of a
5791 <function>nodeToString()</function> representation) for the
5792 rule's qualifying condition
5797 <entry><structfield>ev_action</structfield></entry>
5798 <entry><type>pg_node_tree</type></entry>
5801 Query tree (in the form of a
5802 <function>nodeToString()</function> representation) for the
5812 <literal>pg_class.relhasrules</literal>
5813 must be true if a table has any rules in this catalog.
5819 <sect1 id="catalog-pg-seclabel">
5820 <title><structname>pg_seclabel</structname></title>
5822 <indexterm zone="catalog-pg-seclabel">
5823 <primary>pg_seclabel</primary>
5827 The catalog <structname>pg_seclabel</structname> stores security
5828 labels on database objects. Security labels can be manipulated
5829 with the <xref linkend="sql-security-label"> command. For an easier
5830 way to view security labels, see <xref linkend="view-pg-seclabels">.
5834 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5835 which performs a similar function for security labels of database objects
5836 that are shared across a database cluster.
5840 <title><structname>pg_seclabel</structname> Columns</title>
5847 <entry>References</entry>
5848 <entry>Description</entry>
5854 <entry><structfield>objoid</structfield></entry>
5855 <entry><type>oid</type></entry>
5856 <entry>any OID column</entry>
5857 <entry>The OID of the object this security label pertains to</entry>
5861 <entry><structfield>classoid</structfield></entry>
5862 <entry><type>oid</type></entry>
5863 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5864 <entry>The OID of the system catalog this object appears in</entry>
5868 <entry><structfield>objsubid</structfield></entry>
5869 <entry><type>int4</type></entry>
5872 For a security label on a table column, this is the column number (the
5873 <structfield>objoid</> and <structfield>classoid</> refer to
5874 the table itself). For all other object types, this column is
5880 <entry><structfield>provider</structfield></entry>
5881 <entry><type>text</type></entry>
5883 <entry>The label provider associated with this label.</entry>
5887 <entry><structfield>label</structfield></entry>
5888 <entry><type>text</type></entry>
5890 <entry>The security label applied to this object.</entry>
5897 <sect1 id="catalog-pg-sequence">
5898 <title><structname>pg_sequence</structname></title>
5900 <indexterm zone="catalog-pg-sequence">
5901 <primary>pg_sequence</primary>
5905 The catalog <structname>pg_sequence</structname> contains information about
5906 sequences. Some of the information about sequences, such as the name and
5907 the schema, is in <structname>pg_class</structname>.
5911 <title><structname>pg_sequence</> Columns</title>
5918 <entry>References</entry>
5919 <entry>Description</entry>
5925 <entry><structfield>seqrelid</structfield></entry>
5926 <entry><type>oid</type></entry>
5927 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5928 <entry>The OID of the <structname>pg_class</> entry for this sequence</entry>
5932 <entry><structfield>seqtypid</structfield></entry>
5933 <entry><type>oid</type></entry>
5934 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5935 <entry>Data type of the sequence</entry>
5939 <entry><structfield>seqstart</structfield></entry>
5940 <entry><type>int8</type></entry>
5942 <entry>Start value of the sequence</entry>
5946 <entry><structfield>seqincrement</structfield></entry>
5947 <entry><type>int8</type></entry>
5949 <entry>Increment value of the sequence</entry>
5953 <entry><structfield>seqmax</structfield></entry>
5954 <entry><type>int8</type></entry>
5956 <entry>Maximum value of the sequence</entry>
5960 <entry><structfield>seqmin</structfield></entry>
5961 <entry><type>int8</type></entry>
5963 <entry>Minimum value of the sequence</entry>
5967 <entry><structfield>seqcache</structfield></entry>
5968 <entry><type>int8</type></entry>
5970 <entry>Cache size of the sequence</entry>
5974 <entry><structfield>seqcycle</structfield></entry>
5975 <entry><type>bool</type></entry>
5977 <entry>Whether the sequence cycles</entry>
5984 <sect1 id="catalog-pg-shdepend">
5985 <title><structname>pg_shdepend</structname></title>
5987 <indexterm zone="catalog-pg-shdepend">
5988 <primary>pg_shdepend</primary>
5992 The catalog <structname>pg_shdepend</structname> records the
5993 dependency relationships between database objects and shared objects,
5994 such as roles. This information allows
5995 <productname>PostgreSQL</productname> to ensure that those objects are
5996 unreferenced before attempting to delete them.
6000 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
6001 which performs a similar function for dependencies involving objects
6002 within a single database.
6006 Unlike most system catalogs, <structname>pg_shdepend</structname>
6007 is shared across all databases of a cluster: there is only one
6008 copy of <structname>pg_shdepend</structname> per cluster, not
6013 <title><structname>pg_shdepend</> Columns</title>
6020 <entry>References</entry>
6021 <entry>Description</entry>
6027 <entry><structfield>dbid</structfield></entry>
6028 <entry><type>oid</type></entry>
6029 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6030 <entry>The OID of the database the dependent object is in,
6031 or zero for a shared object</entry>
6035 <entry><structfield>classid</structfield></entry>
6036 <entry><type>oid</type></entry>
6037 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6038 <entry>The OID of the system catalog the dependent object is in</entry>
6042 <entry><structfield>objid</structfield></entry>
6043 <entry><type>oid</type></entry>
6044 <entry>any OID column</entry>
6045 <entry>The OID of the specific dependent object</entry>
6049 <entry><structfield>objsubid</structfield></entry>
6050 <entry><type>int4</type></entry>
6053 For a table column, this is the column number (the
6054 <structfield>objid</> and <structfield>classid</> refer to the
6055 table itself). For all other object types, this column is zero.
6060 <entry><structfield>refclassid</structfield></entry>
6061 <entry><type>oid</type></entry>
6062 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6063 <entry>The OID of the system catalog the referenced object is in
6064 (must be a shared catalog)</entry>
6068 <entry><structfield>refobjid</structfield></entry>
6069 <entry><type>oid</type></entry>
6070 <entry>any OID column</entry>
6071 <entry>The OID of the specific referenced object</entry>
6075 <entry><structfield>deptype</structfield></entry>
6076 <entry><type>char</type></entry>
6079 A code defining the specific semantics of this dependency relationship; see text
6088 In all cases, a <structname>pg_shdepend</structname> entry indicates that
6089 the referenced object cannot be dropped without also dropping the dependent
6090 object. However, there are several subflavors identified by
6091 <structfield>deptype</>:
6095 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
6098 The referenced object (which must be a role) is the owner of the
6105 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
6108 The referenced object (which must be a role) is mentioned in the
6109 ACL (access control list, i.e., privileges list) of the
6110 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
6111 not made for the owner of the object, since the owner will have
6112 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
6118 <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
6121 The referenced object (which must be a role) is mentioned as the
6122 target of a dependent policy object.
6128 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
6131 There is no dependent object; this type of entry is a signal
6132 that the system itself depends on the referenced object, and so
6133 that object must never be deleted. Entries of this type are
6134 created only by <command>initdb</command>. The columns for the
6135 dependent object contain zeroes.
6141 Other dependency flavors might be needed in future. Note in particular
6142 that the current definition only supports roles as referenced objects.
6147 <sect1 id="catalog-pg-shdescription">
6148 <title><structname>pg_shdescription</structname></title>
6150 <indexterm zone="catalog-pg-shdescription">
6151 <primary>pg_shdescription</primary>
6155 The catalog <structname>pg_shdescription</structname> stores optional
6156 descriptions (comments) for shared database objects. Descriptions can be
6157 manipulated with the <xref linkend="sql-comment"> command and viewed with
6158 <application>psql</application>'s <literal>\d</literal> commands.
6162 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6163 which performs a similar function for descriptions involving objects
6164 within a single database.
6168 Unlike most system catalogs, <structname>pg_shdescription</structname>
6169 is shared across all databases of a cluster: there is only one
6170 copy of <structname>pg_shdescription</structname> per cluster, not
6175 <title><structname>pg_shdescription</> Columns</title>
6182 <entry>References</entry>
6183 <entry>Description</entry>
6189 <entry><structfield>objoid</structfield></entry>
6190 <entry><type>oid</type></entry>
6191 <entry>any OID column</entry>
6192 <entry>The OID of the object this description pertains to</entry>
6196 <entry><structfield>classoid</structfield></entry>
6197 <entry><type>oid</type></entry>
6198 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6199 <entry>The OID of the system catalog this object appears in</entry>
6203 <entry><structfield>description</structfield></entry>
6204 <entry><type>text</type></entry>
6206 <entry>Arbitrary text that serves as the description of this object</entry>
6214 <sect1 id="catalog-pg-shseclabel">
6215 <title><structname>pg_shseclabel</structname></title>
6217 <indexterm zone="catalog-pg-shseclabel">
6218 <primary>pg_shseclabel</primary>
6222 The catalog <structname>pg_shseclabel</structname> stores security
6223 labels on shared database objects. Security labels can be manipulated
6224 with the <xref linkend="sql-security-label"> command. For an easier
6225 way to view security labels, see <xref linkend="view-pg-seclabels">.
6229 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6230 which performs a similar function for security labels involving objects
6231 within a single database.
6235 Unlike most system catalogs, <structname>pg_shseclabel</structname>
6236 is shared across all databases of a cluster: there is only one
6237 copy of <structname>pg_shseclabel</structname> per cluster, not
6242 <title><structname>pg_shseclabel</structname> Columns</title>
6248 <entry>References</entry>
6249 <entry>Description</entry>
6254 <entry><structfield>objoid</structfield></entry>
6255 <entry><type>oid</type></entry>
6256 <entry>any OID column</entry>
6257 <entry>The OID of the object this security label pertains to</entry>
6260 <entry><structfield>classoid</structfield></entry>
6261 <entry><type>oid</type></entry>
6262 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6263 <entry>The OID of the system catalog this object appears in</entry>
6266 <entry><structfield>provider</structfield></entry>
6267 <entry><type>text</type></entry>
6269 <entry>The label provider associated with this label.</entry>
6272 <entry><structfield>label</structfield></entry>
6273 <entry><type>text</type></entry>
6275 <entry>The security label applied to this object.</entry>
6282 <sect1 id="catalog-pg-statistic">
6283 <title><structname>pg_statistic</structname></title>
6285 <indexterm zone="catalog-pg-statistic">
6286 <primary>pg_statistic</primary>
6290 The catalog <structname>pg_statistic</structname> stores
6291 statistical data about the contents of the database. Entries are
6292 created by <xref linkend="sql-analyze">
6293 and subsequently used by the query planner. Note that all the
6294 statistical data is inherently approximate, even assuming that it
6299 Normally there is one entry, with <structfield>stainherit</> =
6300 <literal>false</>, for each table column that has been analyzed.
6301 If the table has inheritance children, a second entry with
6302 <structfield>stainherit</> = <literal>true</> is also created. This row
6303 represents the column's statistics over the inheritance tree, i.e.,
6304 statistics for the data you'd see with
6305 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
6306 whereas the <structfield>stainherit</> = <literal>false</> row represents
6308 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
6312 <structname>pg_statistic</structname> also stores statistical data about
6313 the values of index expressions. These are described as if they were
6314 actual data columns; in particular, <structfield>starelid</structfield>
6315 references the index. No entry is made for an ordinary non-expression
6316 index column, however, since it would be redundant with the entry
6317 for the underlying table column. Currently, entries for index expressions
6318 always have <structfield>stainherit</> = <literal>false</>.
6322 Since different kinds of statistics might be appropriate for different
6323 kinds of data, <structname>pg_statistic</structname> is designed not
6324 to assume very much about what sort of statistics it stores. Only
6325 extremely general statistics (such as nullness) are given dedicated
6326 columns in <structname>pg_statistic</structname>. Everything else
6327 is stored in <quote>slots</quote>, which are groups of associated columns
6328 whose content is identified by a code number in one of the slot's columns.
6329 For more information see
6330 <filename>src/include/catalog/pg_statistic.h</filename>.
6334 <structname>pg_statistic</structname> should not be readable by the
6335 public, since even statistical information about a table's contents
6336 might be considered sensitive. (Example: minimum and maximum values
6337 of a salary column might be quite interesting.)
6338 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6339 is a publicly readable view on
6340 <structname>pg_statistic</structname> that only exposes information
6341 about those tables that are readable by the current user.
6345 <title><structname>pg_statistic</> Columns</title>
6352 <entry>References</entry>
6353 <entry>Description</entry>
6359 <entry><structfield>starelid</structfield></entry>
6360 <entry><type>oid</type></entry>
6361 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6362 <entry>The table or index that the described column belongs to</entry>
6366 <entry><structfield>staattnum</structfield></entry>
6367 <entry><type>int2</type></entry>
6368 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6369 <entry>The number of the described column</entry>
6373 <entry><structfield>stainherit</structfield></entry>
6374 <entry><type>bool</type></entry>
6376 <entry>If true, the stats include inheritance child columns, not just the
6377 values in the specified relation</entry>
6381 <entry><structfield>stanullfrac</structfield></entry>
6382 <entry><type>float4</type></entry>
6384 <entry>The fraction of the column's entries that are null</entry>
6388 <entry><structfield>stawidth</structfield></entry>
6389 <entry><type>int4</type></entry>
6391 <entry>The average stored width, in bytes, of nonnull entries</entry>
6395 <entry><structfield>stadistinct</structfield></entry>
6396 <entry><type>float4</type></entry>
6398 <entry>The number of distinct nonnull data values in the column.
6399 A value greater than zero is the actual number of distinct values.
6400 A value less than zero is the negative of a multiplier for the number
6401 of rows in the table; for example, a column in which about 80% of the
6402 values are nonnull and each nonnull value appears about twice on
6403 average could be represented by <structfield>stadistinct</> = -0.4.
6404 A zero value means the number of distinct values is unknown.
6409 <entry><structfield>stakind<replaceable>N</></structfield></entry>
6410 <entry><type>int2</type></entry>
6413 A code number indicating the kind of statistics stored in the
6414 <replaceable>N</>th <quote>slot</quote> of the
6415 <structname>pg_statistic</structname> row.
6420 <entry><structfield>staop<replaceable>N</></structfield></entry>
6421 <entry><type>oid</type></entry>
6422 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6424 An operator used to derive the statistics stored in the
6425 <replaceable>N</>th <quote>slot</quote>. For example, a
6426 histogram slot would show the <literal><</literal> operator
6427 that defines the sort order of the data.
6432 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6433 <entry><type>float4[]</type></entry>
6436 Numerical statistics of the appropriate kind for the
6437 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6438 kind does not involve numerical values
6443 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6444 <entry><type>anyarray</type></entry>
6447 Column data values of the appropriate kind for the
6448 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6449 kind does not store any data values. Each array's element
6450 values are actually of the specific column's data type, or a related
6451 type such as an array's element type, so there is no way to define
6452 these columns' type more specifically than <type>anyarray</>.
6461 <sect1 id="catalog-pg-subscription">
6462 <title><structname>pg_subscription</structname></title>
6464 <indexterm zone="catalog-pg-subscription">
6465 <primary>pg_subscription</primary>
6469 The catalog <structname>pg_subscription</structname> contains all existing
6470 logical replication subscriptions. For more information about logical
6471 replication see <xref linkend="logical-replication">.
6475 Unlike most system catalogs, <structname>pg_subscription</structname> is
6476 shared across all databases of a cluster: There is only one copy
6477 of <structname>pg_subscription</structname> per cluster, not one per
6482 Access to the column <structfield>subconninfo</structfield> is revoked from
6483 normal users, because it could contain plain-text passwords.
6487 <title><structname>pg_subscription</structname> Columns</title>
6494 <entry>References</entry>
6495 <entry>Description</entry>
6501 <entry><structfield>oid</structfield></entry>
6502 <entry><type>oid</type></entry>
6504 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6508 <entry><structfield>subdbid</structfield></entry>
6509 <entry><type>oid</type></entry>
6510 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6511 <entry>OID of the database which the subscription resides in</entry>
6515 <entry><structfield>subname</structfield></entry>
6516 <entry><type>name</type></entry>
6518 <entry>Name of the subscription</entry>
6522 <entry><structfield>subowner</structfield></entry>
6523 <entry><type>oid</type></entry>
6524 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6525 <entry>Owner of the subscription</entry>
6529 <entry><structfield>subenabled</structfield></entry>
6530 <entry><type>bool</type></entry>
6532 <entry>If true, the subscription is enabled and should be replicating.</entry>
6536 <entry><structfield>subsynccommit</structfield></entry>
6537 <entry><type>text</type></entry>
6540 Contains the value of the <varname>synchronous_commit</varname>
6541 setting for the subscription workers.
6546 <entry><structfield>subconninfo</structfield></entry>
6547 <entry><type>text</type></entry>
6549 <entry>Connection string to the upstream database</entry>
6553 <entry><structfield>subslotname</structfield></entry>
6554 <entry><type>name</type></entry>
6556 <entry>Name of the replication slot in the upstream database. Also used
6557 for local replication origin name.</entry>
6561 <entry><structfield>subpublications</structfield></entry>
6562 <entry><type>text[]</type></entry>
6564 <entry>Array of subscribed publication names. These reference the
6565 publications on the publisher server. For more on publications
6566 see <xref linkend="logical-replication-publication">.
6574 <sect1 id="catalog-pg-subscription-rel">
6575 <title><structname>pg_subscription_rel</structname></title>
6577 <indexterm zone="catalog-pg-subscription-rel">
6578 <primary>pg_subscription_rel</primary>
6582 The catalog <structname>pg_subscription_rel</structname> contains the
6583 state for each replicated relation in each subscription. This is a
6584 many-to-many mapping.
6588 This catalog only contains tables known to the subscription after running
6589 either <command>CREATE SUBSCRIPTION</command> or
6590 <command>ALTER SUBSCRIPTION ... REFRESH</command>.
6594 <title><structname>pg_subscription_rel</structname> Columns</title>
6601 <entry>References</entry>
6602 <entry>Description</entry>
6608 <entry><structfield>srsubid</structfield></entry>
6609 <entry><type>oid</type></entry>
6610 <entry><literal><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.oid</literal></entry>
6611 <entry>Reference to subscription</entry>
6615 <entry><structfield>srrelid</structfield></entry>
6616 <entry><type>oid</type></entry>
6617 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6618 <entry>Reference to relation</entry>
6622 <entry><structfield>srsubstate</structfield></entry>
6623 <entry><type>char</type></entry>
6627 <literal>i</> = initialize,
6628 <literal>d</> = data is being copied,
6629 <literal>s</> = synchronized,
6630 <literal>r</> = ready (normal replication)
6635 <entry><structfield>srsublsn</structfield></entry>
6636 <entry><type>pg_lsn</type></entry>
6639 End LSN for <literal>s</> and <literal>r</> states.
6647 <sect1 id="catalog-pg-tablespace">
6648 <title><structname>pg_tablespace</structname></title>
6650 <indexterm zone="catalog-pg-tablespace">
6651 <primary>pg_tablespace</primary>
6655 The catalog <structname>pg_tablespace</structname> stores information
6656 about the available tablespaces. Tables can be placed in particular
6657 tablespaces to aid administration of disk layout.
6661 Unlike most system catalogs, <structname>pg_tablespace</structname>
6662 is shared across all databases of a cluster: there is only one
6663 copy of <structname>pg_tablespace</structname> per cluster, not
6668 <title><structname>pg_tablespace</> Columns</title>
6675 <entry>References</entry>
6676 <entry>Description</entry>
6682 <entry><structfield>oid</structfield></entry>
6683 <entry><type>oid</type></entry>
6685 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6689 <entry><structfield>spcname</structfield></entry>
6690 <entry><type>name</type></entry>
6692 <entry>Tablespace name</entry>
6696 <entry><structfield>spcowner</structfield></entry>
6697 <entry><type>oid</type></entry>
6698 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6699 <entry>Owner of the tablespace, usually the user who created it</entry>
6703 <entry><structfield>spcacl</structfield></entry>
6704 <entry><type>aclitem[]</type></entry>
6707 Access privileges; see
6708 <xref linkend="sql-grant"> and
6709 <xref linkend="sql-revoke">
6715 <entry><structfield>spcoptions</structfield></entry>
6716 <entry><type>text[]</type></entry>
6719 Tablespace-level options, as <quote>keyword=value</> strings
6728 <sect1 id="catalog-pg-transform">
6729 <title><structname>pg_transform</structname></title>
6731 <indexterm zone="catalog-pg-transform">
6732 <primary>pg_transform</primary>
6736 The catalog <structname>pg_transform</structname> stores information about
6737 transforms, which are a mechanism to adapt data types to procedural
6738 languages. See <xref linkend="sql-createtransform"> for more information.
6742 <title><structname>pg_transform</> Columns</title>
6749 <entry>References</entry>
6750 <entry>Description</entry>
6756 <entry><structfield>trftype</structfield></entry>
6757 <entry><type>oid</type></entry>
6758 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6759 <entry>OID of the data type this transform is for</entry>
6763 <entry><structfield>trflang</structfield></entry>
6764 <entry><type>oid</type></entry>
6765 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6766 <entry>OID of the language this transform is for</entry>
6770 <entry><structfield>trffromsql</structfield></entry>
6771 <entry><type>regproc</type></entry>
6772 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6774 The OID of the function to use when converting the data type for input
6775 to the procedural language (e.g., function parameters). Zero is stored
6776 if this operation is not supported.
6781 <entry><structfield>trftosql</structfield></entry>
6782 <entry><type>regproc</type></entry>
6783 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6785 The OID of the function to use when converting output from the
6786 procedural language (e.g., return values) to the data type. Zero is
6787 stored if this operation is not supported.
6796 <sect1 id="catalog-pg-trigger">
6797 <title><structname>pg_trigger</structname></title>
6799 <indexterm zone="catalog-pg-trigger">
6800 <primary>pg_trigger</primary>
6804 The catalog <structname>pg_trigger</structname> stores triggers on tables
6806 See <xref linkend="sql-createtrigger">
6807 for more information.
6811 <title><structname>pg_trigger</> Columns</title>
6818 <entry>References</entry>
6819 <entry>Description</entry>
6825 <entry><structfield>oid</structfield></entry>
6826 <entry><type>oid</type></entry>
6828 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6832 <entry><structfield>tgrelid</structfield></entry>
6833 <entry><type>oid</type></entry>
6834 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6835 <entry>The table this trigger is on</entry>
6839 <entry><structfield>tgname</structfield></entry>
6840 <entry><type>name</type></entry>
6842 <entry>Trigger name (must be unique among triggers of same table)</entry>
6846 <entry><structfield>tgfoid</structfield></entry>
6847 <entry><type>oid</type></entry>
6848 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6849 <entry>The function to be called</entry>
6853 <entry><structfield>tgtype</structfield></entry>
6854 <entry><type>int2</type></entry>
6856 <entry>Bit mask identifying trigger firing conditions</entry>
6860 <entry><structfield>tgenabled</structfield></entry>
6861 <entry><type>char</type></entry>
6864 Controls in which <xref linkend="guc-session-replication-role"> modes
6866 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6867 <literal>D</> = trigger is disabled,
6868 <literal>R</> = trigger fires in <quote>replica</> mode,
6869 <literal>A</> = trigger fires always.
6874 <entry><structfield>tgisinternal</structfield></entry>
6875 <entry><type>bool</type></entry>
6877 <entry>True if trigger is internally generated (usually, to enforce
6878 the constraint identified by <structfield>tgconstraint</>)</entry>
6882 <entry><structfield>tgconstrrelid</structfield></entry>
6883 <entry><type>oid</type></entry>
6884 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6885 <entry>The table referenced by a referential integrity constraint</entry>
6889 <entry><structfield>tgconstrindid</structfield></entry>
6890 <entry><type>oid</type></entry>
6891 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6892 <entry>The index supporting a unique, primary key, referential integrity,
6893 or exclusion constraint</entry>
6897 <entry><structfield>tgconstraint</structfield></entry>
6898 <entry><type>oid</type></entry>
6899 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6900 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6904 <entry><structfield>tgdeferrable</structfield></entry>
6905 <entry><type>bool</type></entry>
6907 <entry>True if constraint trigger is deferrable</entry>
6911 <entry><structfield>tginitdeferred</structfield></entry>
6912 <entry><type>bool</type></entry>
6914 <entry>True if constraint trigger is initially deferred</entry>
6918 <entry><structfield>tgnargs</structfield></entry>
6919 <entry><type>int2</type></entry>
6921 <entry>Number of argument strings passed to trigger function</entry>
6925 <entry><structfield>tgattr</structfield></entry>
6926 <entry><type>int2vector</type></entry>
6927 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6928 <entry>Column numbers, if trigger is column-specific; otherwise an
6933 <entry><structfield>tgargs</structfield></entry>
6934 <entry><type>bytea</type></entry>
6936 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6940 <entry><structfield>tgqual</structfield></entry>
6941 <entry><type>pg_node_tree</type></entry>
6943 <entry>Expression tree (in <function>nodeToString()</function>
6944 representation) for the trigger's <literal>WHEN</> condition, or null
6949 <entry><structfield>tgoldtable</structfield></entry>
6950 <entry><type>name</type></entry>
6952 <entry><literal>REFERENCING</> clause name for <literal>OLD TABLE</>,
6953 or null if none</entry>
6957 <entry><structfield>tgnewtable</structfield></entry>
6958 <entry><type>name</type></entry>
6960 <entry><literal>REFERENCING</> clause name for <literal>NEW TABLE</>,
6961 or null if none</entry>
6968 Currently, column-specific triggering is supported only for
6969 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6970 only for that event type. <structfield>tgtype</structfield> might
6971 contain bits for other event types as well, but those are presumed
6972 to be table-wide regardless of what is in <structfield>tgattr</>.
6977 When <structfield>tgconstraint</> is nonzero,
6978 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6979 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6980 largely redundant with the referenced <structname>pg_constraint</> entry.
6981 However, it is possible for a non-deferrable trigger to be associated
6982 with a deferrable constraint: foreign key constraints can have some
6983 deferrable and some non-deferrable triggers.
6989 <literal>pg_class.relhastriggers</literal>
6990 must be true if a relation has any triggers in this catalog.
6997 <sect1 id="catalog-pg-ts-config">
6998 <title><structname>pg_ts_config</structname></title>
7000 <indexterm zone="catalog-pg-ts-config">
7001 <primary>pg_ts_config</primary>
7005 The <structname>pg_ts_config</structname> catalog contains entries
7006 representing text search configurations. A configuration specifies
7007 a particular text search parser and a list of dictionaries to use
7008 for each of the parser's output token types. The parser is shown
7009 in the <structname>pg_ts_config</structname> entry, but the
7010 token-to-dictionary mapping is defined by subsidiary entries in <link
7011 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
7015 <productname>PostgreSQL</productname>'s text search features are
7016 described at length in <xref linkend="textsearch">.
7020 <title><structname>pg_ts_config</> Columns</title>
7027 <entry>References</entry>
7028 <entry>Description</entry>
7034 <entry><structfield>oid</structfield></entry>
7035 <entry><type>oid</type></entry>
7037 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7041 <entry><structfield>cfgname</structfield></entry>
7042 <entry><type>name</type></entry>
7044 <entry>Text search configuration name</entry>
7048 <entry><structfield>cfgnamespace</structfield></entry>
7049 <entry><type>oid</type></entry>
7050 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7052 The OID of the namespace that contains this configuration
7057 <entry><structfield>cfgowner</structfield></entry>
7058 <entry><type>oid</type></entry>
7059 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7060 <entry>Owner of the configuration</entry>
7064 <entry><structfield>cfgparser</structfield></entry>
7065 <entry><type>oid</type></entry>
7066 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
7067 <entry>The OID of the text search parser for this configuration</entry>
7075 <sect1 id="catalog-pg-ts-config-map">
7076 <title><structname>pg_ts_config_map</structname></title>
7078 <indexterm zone="catalog-pg-ts-config-map">
7079 <primary>pg_ts_config_map</primary>
7083 The <structname>pg_ts_config_map</structname> catalog contains entries
7084 showing which text search dictionaries should be consulted, and in
7085 what order, for each output token type of each text search configuration's
7090 <productname>PostgreSQL</productname>'s text search features are
7091 described at length in <xref linkend="textsearch">.
7095 <title><structname>pg_ts_config_map</> Columns</title>
7102 <entry>References</entry>
7103 <entry>Description</entry>
7109 <entry><structfield>mapcfg</structfield></entry>
7110 <entry><type>oid</type></entry>
7111 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
7112 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
7116 <entry><structfield>maptokentype</structfield></entry>
7117 <entry><type>integer</type></entry>
7119 <entry>A token type emitted by the configuration's parser</entry>
7123 <entry><structfield>mapseqno</structfield></entry>
7124 <entry><type>integer</type></entry>
7126 <entry>Order in which to consult this entry (lower
7127 <structfield>mapseqno</>s first)</entry>
7131 <entry><structfield>mapdict</structfield></entry>
7132 <entry><type>oid</type></entry>
7133 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
7134 <entry>The OID of the text search dictionary to consult</entry>
7142 <sect1 id="catalog-pg-ts-dict">
7143 <title><structname>pg_ts_dict</structname></title>
7145 <indexterm zone="catalog-pg-ts-dict">
7146 <primary>pg_ts_dict</primary>
7150 The <structname>pg_ts_dict</structname> catalog contains entries
7151 defining text search dictionaries. A dictionary depends on a text
7152 search template, which specifies all the implementation functions
7153 needed; the dictionary itself provides values for the user-settable
7154 parameters supported by the template. This division of labor allows
7155 dictionaries to be created by unprivileged users. The parameters
7156 are specified by a text string <structfield>dictinitoption</>,
7157 whose format and meaning vary depending on the template.
7161 <productname>PostgreSQL</productname>'s text search features are
7162 described at length in <xref linkend="textsearch">.
7166 <title><structname>pg_ts_dict</> Columns</title>
7173 <entry>References</entry>
7174 <entry>Description</entry>
7180 <entry><structfield>oid</structfield></entry>
7181 <entry><type>oid</type></entry>
7183 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7187 <entry><structfield>dictname</structfield></entry>
7188 <entry><type>name</type></entry>
7190 <entry>Text search dictionary name</entry>
7194 <entry><structfield>dictnamespace</structfield></entry>
7195 <entry><type>oid</type></entry>
7196 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7198 The OID of the namespace that contains this dictionary
7203 <entry><structfield>dictowner</structfield></entry>
7204 <entry><type>oid</type></entry>
7205 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7206 <entry>Owner of the dictionary</entry>
7210 <entry><structfield>dicttemplate</structfield></entry>
7211 <entry><type>oid</type></entry>
7212 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
7213 <entry>The OID of the text search template for this dictionary</entry>
7217 <entry><structfield>dictinitoption</structfield></entry>
7218 <entry><type>text</type></entry>
7220 <entry>Initialization option string for the template</entry>
7228 <sect1 id="catalog-pg-ts-parser">
7229 <title><structname>pg_ts_parser</structname></title>
7231 <indexterm zone="catalog-pg-ts-parser">
7232 <primary>pg_ts_parser</primary>
7236 The <structname>pg_ts_parser</structname> catalog contains entries
7237 defining text search parsers. A parser is responsible for splitting
7238 input text into lexemes and assigning a token type to each lexeme.
7239 Since a parser must be implemented by C-language-level functions,
7240 creation of new parsers is restricted to database superusers.
7244 <productname>PostgreSQL</productname>'s text search features are
7245 described at length in <xref linkend="textsearch">.
7249 <title><structname>pg_ts_parser</> Columns</title>
7256 <entry>References</entry>
7257 <entry>Description</entry>
7263 <entry><structfield>oid</structfield></entry>
7264 <entry><type>oid</type></entry>
7266 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7270 <entry><structfield>prsname</structfield></entry>
7271 <entry><type>name</type></entry>
7273 <entry>Text search parser name</entry>
7277 <entry><structfield>prsnamespace</structfield></entry>
7278 <entry><type>oid</type></entry>
7279 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7281 The OID of the namespace that contains this parser
7286 <entry><structfield>prsstart</structfield></entry>
7287 <entry><type>regproc</type></entry>
7288 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7289 <entry>OID of the parser's startup function</entry>
7293 <entry><structfield>prstoken</structfield></entry>
7294 <entry><type>regproc</type></entry>
7295 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7296 <entry>OID of the parser's next-token function</entry>
7300 <entry><structfield>prsend</structfield></entry>
7301 <entry><type>regproc</type></entry>
7302 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7303 <entry>OID of the parser's shutdown function</entry>
7307 <entry><structfield>prsheadline</structfield></entry>
7308 <entry><type>regproc</type></entry>
7309 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7310 <entry>OID of the parser's headline function</entry>
7314 <entry><structfield>prslextype</structfield></entry>
7315 <entry><type>regproc</type></entry>
7316 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7317 <entry>OID of the parser's lextype function</entry>
7325 <sect1 id="catalog-pg-ts-template">
7326 <title><structname>pg_ts_template</structname></title>
7328 <indexterm zone="catalog-pg-ts-template">
7329 <primary>pg_ts_template</primary>
7333 The <structname>pg_ts_template</structname> catalog contains entries
7334 defining text search templates. A template is the implementation
7335 skeleton for a class of text search dictionaries.
7336 Since a template must be implemented by C-language-level functions,
7337 creation of new templates is restricted to database superusers.
7341 <productname>PostgreSQL</productname>'s text search features are
7342 described at length in <xref linkend="textsearch">.
7346 <title><structname>pg_ts_template</> Columns</title>
7353 <entry>References</entry>
7354 <entry>Description</entry>
7360 <entry><structfield>oid</structfield></entry>
7361 <entry><type>oid</type></entry>
7363 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7367 <entry><structfield>tmplname</structfield></entry>
7368 <entry><type>name</type></entry>
7370 <entry>Text search template name</entry>
7374 <entry><structfield>tmplnamespace</structfield></entry>
7375 <entry><type>oid</type></entry>
7376 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7378 The OID of the namespace that contains this template
7383 <entry><structfield>tmplinit</structfield></entry>
7384 <entry><type>regproc</type></entry>
7385 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7386 <entry>OID of the template's initialization function</entry>
7390 <entry><structfield>tmpllexize</structfield></entry>
7391 <entry><type>regproc</type></entry>
7392 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7393 <entry>OID of the template's lexize function</entry>
7401 <sect1 id="catalog-pg-type">
7402 <title><structname>pg_type</structname></title>
7404 <indexterm zone="catalog-pg-type">
7405 <primary>pg_type</primary>
7409 The catalog <structname>pg_type</structname> stores information about data
7410 types. Base types and enum types (scalar types) are created with
7411 <xref linkend="sql-createtype">, and
7413 <xref linkend="sql-createdomain">.
7414 A composite type is automatically created for each table in the database, to
7415 represent the row structure of the table. It is also possible to create
7416 composite types with <command>CREATE TYPE AS</command>.
7420 <title><structname>pg_type</> Columns</title>
7427 <entry>References</entry>
7428 <entry>Description</entry>
7434 <entry><structfield>oid</structfield></entry>
7435 <entry><type>oid</type></entry>
7437 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7441 <entry><structfield>typname</structfield></entry>
7442 <entry><type>name</type></entry>
7444 <entry>Data type name</entry>
7448 <entry><structfield>typnamespace</structfield></entry>
7449 <entry><type>oid</type></entry>
7450 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7452 The OID of the namespace that contains this type
7457 <entry><structfield>typowner</structfield></entry>
7458 <entry><type>oid</type></entry>
7459 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7460 <entry>Owner of the type</entry>
7464 <entry><structfield>typlen</structfield></entry>
7465 <entry><type>int2</type></entry>
7468 For a fixed-size type, <structfield>typlen</structfield> is the number
7469 of bytes in the internal representation of the type. But for a
7470 variable-length type, <structfield>typlen</structfield> is negative.
7471 -1 indicates a <quote>varlena</> type (one that has a length word),
7472 -2 indicates a null-terminated C string.
7477 <entry><structfield>typbyval</structfield></entry>
7478 <entry><type>bool</type></entry>
7481 <structfield>typbyval</structfield> determines whether internal
7482 routines pass a value of this type by value or by reference.
7483 <structfield>typbyval</structfield> had better be false if
7484 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7485 where Datum is 8 bytes).
7486 Variable-length types are always passed by reference. Note that
7487 <structfield>typbyval</structfield> can be false even if the
7488 length would allow pass-by-value.
7493 <entry><structfield>typtype</structfield></entry>
7494 <entry><type>char</type></entry>
7497 <structfield>typtype</structfield> is
7498 <literal>b</literal> for a base type,
7499 <literal>c</literal> for a composite type (e.g., a table's row type),
7500 <literal>d</literal> for a domain,
7501 <literal>e</literal> for an enum type,
7502 <literal>p</literal> for a pseudo-type, or
7503 <literal>r</literal> for a range type.
7504 See also <structfield>typrelid</structfield> and
7505 <structfield>typbasetype</structfield>.
7510 <entry><structfield>typcategory</structfield></entry>
7511 <entry><type>char</type></entry>
7514 <structfield>typcategory</structfield> is an arbitrary classification
7515 of data types that is used by the parser to determine which implicit
7516 casts should be <quote>preferred</>.
7517 See <xref linkend="catalog-typcategory-table">.
7522 <entry><structfield>typispreferred</structfield></entry>
7523 <entry><type>bool</type></entry>
7526 True if the type is a preferred cast target within its
7527 <structfield>typcategory</structfield>
7532 <entry><structfield>typisdefined</structfield></entry>
7533 <entry><type>bool</type></entry>
7536 True if the type is defined, false if this is a placeholder
7537 entry for a not-yet-defined type. When
7538 <structfield>typisdefined</structfield> is false, nothing
7539 except the type name, namespace, and OID can be relied on.
7544 <entry><structfield>typdelim</structfield></entry>
7545 <entry><type>char</type></entry>
7548 Character that separates two values of this type when parsing
7549 array input. Note that the delimiter is associated with the array
7550 element data type, not the array data type.
7555 <entry><structfield>typrelid</structfield></entry>
7556 <entry><type>oid</type></entry>
7557 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7559 If this is a composite type (see
7560 <structfield>typtype</structfield>), then this column points to
7561 the <structname>pg_class</structname> entry that defines the
7562 corresponding table. (For a free-standing composite type, the
7563 <structname>pg_class</structname> entry doesn't really represent
7564 a table, but it is needed anyway for the type's
7565 <structname>pg_attribute</structname> entries to link to.)
7566 Zero for non-composite types.
7571 <entry><structfield>typelem</structfield></entry>
7572 <entry><type>oid</type></entry>
7573 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7575 If <structfield>typelem</structfield> is not 0 then it
7576 identifies another row in <structname>pg_type</structname>.
7577 The current type can then be subscripted like an array yielding
7578 values of type <structfield>typelem</structfield>. A
7579 <quote>true</quote> array type is variable length
7580 (<structfield>typlen</structfield> = -1),
7581 but some fixed-length (<structfield>typlen</structfield> > 0) types
7582 also have nonzero <structfield>typelem</structfield>, for example
7583 <type>name</type> and <type>point</type>.
7584 If a fixed-length type has a <structfield>typelem</structfield> then
7585 its internal representation must be some number of values of the
7586 <structfield>typelem</structfield> data type with no other data.
7587 Variable-length array types have a header defined by the array
7593 <entry><structfield>typarray</structfield></entry>
7594 <entry><type>oid</type></entry>
7595 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7597 If <structfield>typarray</structfield> is not 0 then it
7598 identifies another row in <structname>pg_type</structname>, which
7599 is the <quote>true</quote> array type having this type as element
7604 <entry><structfield>typinput</structfield></entry>
7605 <entry><type>regproc</type></entry>
7606 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7607 <entry>Input conversion function (text format)</entry>
7611 <entry><structfield>typoutput</structfield></entry>
7612 <entry><type>regproc</type></entry>
7613 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7614 <entry>Output conversion function (text format)</entry>
7618 <entry><structfield>typreceive</structfield></entry>
7619 <entry><type>regproc</type></entry>
7620 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7621 <entry>Input conversion function (binary format), or 0 if none</entry>
7625 <entry><structfield>typsend</structfield></entry>
7626 <entry><type>regproc</type></entry>
7627 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7628 <entry>Output conversion function (binary format), or 0 if none</entry>
7632 <entry><structfield>typmodin</structfield></entry>
7633 <entry><type>regproc</type></entry>
7634 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7635 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7639 <entry><structfield>typmodout</structfield></entry>
7640 <entry><type>regproc</type></entry>
7641 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7642 <entry>Type modifier output function, or 0 to use the standard format</entry>
7646 <entry><structfield>typanalyze</structfield></entry>
7647 <entry><type>regproc</type></entry>
7648 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7649 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7653 <entry><structfield>typalign</structfield></entry>
7654 <entry><type>char</type></entry>
7658 <structfield>typalign</structfield> is the alignment required
7659 when storing a value of this type. It applies to storage on
7660 disk as well as most representations of the value inside
7661 <productname>PostgreSQL</>.
7662 When multiple values are stored consecutively, such
7663 as in the representation of a complete row on disk, padding is
7664 inserted before a datum of this type so that it begins on the
7665 specified boundary. The alignment reference is the beginning
7666 of the first datum in the sequence.
7670 Possible values are:
7673 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7676 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7679 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7682 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7687 For types used in system tables, it is critical that the size
7688 and alignment defined in <structname>pg_type</structname>
7689 agree with the way that the compiler will lay out the column in
7690 a structure representing a table row.
7696 <entry><structfield>typstorage</structfield></entry>
7697 <entry><type>char</type></entry>
7700 <structfield>typstorage</structfield> tells for varlena
7701 types (those with <structfield>typlen</structfield> = -1) if
7702 the type is prepared for toasting and what the default strategy
7703 for attributes of this type should be.
7707 <para><literal>p</>: Value must always be stored plain.</para>
7711 <literal>e</>: Value can be stored in a <quote>secondary</quote>
7712 relation (if relation has one, see
7713 <literal>pg_class.reltoastrelid</literal>).
7717 <para><literal>m</>: Value can be stored compressed inline.</para>
7720 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7723 Note that <literal>m</> columns can also be moved out to secondary
7724 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7730 <entry><structfield>typnotnull</structfield></entry>
7731 <entry><type>bool</type></entry>
7734 <structfield>typnotnull</structfield> represents a not-null
7735 constraint on a type. Used for domains only.
7740 <entry><structfield>typbasetype</structfield></entry>
7741 <entry><type>oid</type></entry>
7742 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7744 If this is a domain (see <structfield>typtype</structfield>), then
7745 <structfield>typbasetype</structfield> identifies the type that this
7746 one is based on. Zero if this type is not a domain.
7751 <entry><structfield>typtypmod</structfield></entry>
7752 <entry><type>int4</type></entry>
7755 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7756 to be applied to their base type (-1 if base type does not use a
7757 <literal>typmod</>). -1 if this type is not a domain.
7762 <entry><structfield>typndims</structfield></entry>
7763 <entry><type>int4</type></entry>
7766 <structfield>typndims</structfield> is the number of array dimensions
7767 for a domain over an array (that is, <structfield>typbasetype</> is
7769 Zero for types other than domains over array types.
7774 <entry><structfield>typcollation</structfield></entry>
7775 <entry><type>oid</type></entry>
7776 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7778 <structfield>typcollation</structfield> specifies the collation
7779 of the type. If the type does not support collations, this will
7780 be zero. A base type that supports collations will have
7781 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7782 collatable type can have some other collation OID, if one was
7783 specified for the domain.
7788 <entry><structfield>typdefaultbin</structfield></entry>
7789 <entry><type>pg_node_tree</type></entry>
7792 If <structfield>typdefaultbin</> is not null, it is the
7793 <function>nodeToString()</function>
7794 representation of a default expression for the type. This is
7795 only used for domains.
7800 <entry><structfield>typdefault</structfield></entry>
7801 <entry><type>text</type></entry>
7804 <structfield>typdefault</> is null if the type has no associated
7805 default value. If <structfield>typdefaultbin</> is not null,
7806 <structfield>typdefault</> must contain a human-readable version of the
7807 default expression represented by <structfield>typdefaultbin</>. If
7808 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7809 not, then <structfield>typdefault</> is the external representation of
7810 the type's default value, which can be fed to the type's input
7811 converter to produce a constant.
7816 <entry><structfield>typacl</structfield></entry>
7817 <entry><type>aclitem[]</type></entry>
7820 Access privileges; see
7821 <xref linkend="sql-grant"> and
7822 <xref linkend="sql-revoke">
7831 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7832 of <structfield>typcategory</>. Any future additions to this list will
7833 also be upper-case ASCII letters. All other ASCII characters are reserved
7834 for user-defined categories.
7837 <table id="catalog-typcategory-table">
7838 <title><structfield>typcategory</> Codes</title>
7844 <entry>Category</entry>
7850 <entry><literal>A</literal></entry>
7851 <entry>Array types</entry>
7854 <entry><literal>B</literal></entry>
7855 <entry>Boolean types</entry>
7858 <entry><literal>C</literal></entry>
7859 <entry>Composite types</entry>
7862 <entry><literal>D</literal></entry>
7863 <entry>Date/time types</entry>
7866 <entry><literal>E</literal></entry>
7867 <entry>Enum types</entry>
7870 <entry><literal>G</literal></entry>
7871 <entry>Geometric types</entry>
7874 <entry><literal>I</literal></entry>
7875 <entry>Network address types</entry>
7878 <entry><literal>N</literal></entry>
7879 <entry>Numeric types</entry>
7882 <entry><literal>P</literal></entry>
7883 <entry>Pseudo-types</entry>
7886 <entry><literal>R</literal></entry>
7887 <entry>Range types</entry>
7890 <entry><literal>S</literal></entry>
7891 <entry>String types</entry>
7894 <entry><literal>T</literal></entry>
7895 <entry>Timespan types</entry>
7898 <entry><literal>U</literal></entry>
7899 <entry>User-defined types</entry>
7902 <entry><literal>V</literal></entry>
7903 <entry>Bit-string types</entry>
7906 <entry><literal>X</literal></entry>
7907 <entry><type>unknown</> type</entry>
7916 <sect1 id="catalog-pg-user-mapping">
7917 <title><structname>pg_user_mapping</structname></title>
7919 <indexterm zone="catalog-pg-user-mapping">
7920 <primary>pg_user_mapping</primary>
7924 The catalog <structname>pg_user_mapping</structname> stores
7925 the mappings from local user to remote. Access to this catalog is
7926 restricted from normal users, use the view
7927 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7932 <title><structname>pg_user_mapping</> Columns</title>
7939 <entry>References</entry>
7940 <entry>Description</entry>
7946 <entry><structfield>oid</structfield></entry>
7947 <entry><type>oid</type></entry>
7949 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7953 <entry><structfield>umuser</structfield></entry>
7954 <entry><type>oid</type></entry>
7955 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7956 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7960 <entry><structfield>umserver</structfield></entry>
7961 <entry><type>oid</type></entry>
7962 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7964 The OID of the foreign server that contains this mapping
7969 <entry><structfield>umoptions</structfield></entry>
7970 <entry><type>text[]</type></entry>
7973 User mapping specific options, as <quote>keyword=value</> strings
7982 <sect1 id="views-overview">
7983 <title>System Views</title>
7986 In addition to the system catalogs, <productname>PostgreSQL</productname>
7987 provides a number of built-in views. Some system views provide convenient
7988 access to some commonly used queries on the system catalogs. Other views
7989 provide access to internal server state.
7993 The information schema (<xref linkend="information-schema">) provides
7994 an alternative set of views which overlap the functionality of the system
7995 views. Since the information schema is SQL-standard whereas the views
7996 described here are <productname>PostgreSQL</productname>-specific,
7997 it's usually better to use the information schema if it provides all
7998 the information you need.
8002 <xref linkend="view-table"> lists the system views described here.
8003 More detailed documentation of each view follows below.
8004 There are some additional views that provide access to the results of
8005 the statistics collector; they are described in <xref
8006 linkend="monitoring-stats-views-table">.
8010 Except where noted, all the views described here are read-only.
8013 <table id="view-table">
8014 <title>System Views</title>
8019 <entry>View Name</entry>
8020 <entry>Purpose</entry>
8026 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
8027 <entry>available extensions</entry>
8031 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
8032 <entry>available versions of extensions</entry>
8036 <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
8037 <entry>compile-time configuration parameters</entry>
8041 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
8042 <entry>open cursors</entry>
8046 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
8047 <entry>summary of configuration file contents</entry>
8051 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
8052 <entry>groups of database users</entry>
8056 <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
8057 <entry>summary of client authentication configuration file contents</entry>
8061 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
8062 <entry>indexes</entry>
8066 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
8067 <entry>locks currently held or awaited</entry>
8071 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
8072 <entry>materialized views</entry>
8076 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
8077 <entry>policies</entry>
8081 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
8082 <entry>prepared statements</entry>
8086 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
8087 <entry>prepared transactions</entry>
8091 <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
8092 <entry>publications and their associated tables</entry>
8096 <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
8097 <entry>information about replication origins, including replication progress</entry>
8101 <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
8102 <entry>replication slot information</entry>
8106 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
8107 <entry>database roles</entry>
8111 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
8112 <entry>rules</entry>
8116 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
8117 <entry>security labels</entry>
8121 <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
8122 <entry>sequences</entry>
8126 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
8127 <entry>parameter settings</entry>
8131 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
8132 <entry>database users</entry>
8136 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
8137 <entry>planner statistics</entry>
8141 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
8142 <entry>tables</entry>
8146 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
8147 <entry>time zone abbreviations</entry>
8151 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
8152 <entry>time zone names</entry>
8156 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
8157 <entry>database users</entry>
8161 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
8162 <entry>user mappings</entry>
8166 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
8167 <entry>views</entry>
8175 <sect1 id="view-pg-available-extensions">
8176 <title><structname>pg_available_extensions</structname></title>
8178 <indexterm zone="view-pg-available-extensions">
8179 <primary>pg_available_extensions</primary>
8183 The <structname>pg_available_extensions</structname> view lists the
8184 extensions that are available for installation.
8186 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8187 catalog, which shows the extensions currently installed.
8191 <title><structname>pg_available_extensions</> Columns</title>
8198 <entry>Description</entry>
8204 <entry><structfield>name</structfield></entry>
8205 <entry><type>name</type></entry>
8206 <entry>Extension name</entry>
8210 <entry><structfield>default_version</structfield></entry>
8211 <entry><type>text</type></entry>
8212 <entry>Name of default version, or <literal>NULL</literal> if none is
8217 <entry><structfield>installed_version</structfield></entry>
8218 <entry><type>text</type></entry>
8219 <entry>Currently installed version of the extension,
8220 or <literal>NULL</literal> if not installed</entry>
8224 <entry><structfield>comment</structfield></entry>
8225 <entry><type>text</type></entry>
8226 <entry>Comment string from the extension's control file</entry>
8233 The <structname>pg_available_extensions</structname> view is read only.
8237 <sect1 id="view-pg-available-extension-versions">
8238 <title><structname>pg_available_extension_versions</structname></title>
8240 <indexterm zone="view-pg-available-extension-versions">
8241 <primary>pg_available_extension_versions</primary>
8245 The <structname>pg_available_extension_versions</structname> view lists the
8246 specific extension versions that are available for installation.
8248 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8249 catalog, which shows the extensions currently installed.
8253 <title><structname>pg_available_extension_versions</> Columns</title>
8260 <entry>Description</entry>
8266 <entry><structfield>name</structfield></entry>
8267 <entry><type>name</type></entry>
8268 <entry>Extension name</entry>
8272 <entry><structfield>version</structfield></entry>
8273 <entry><type>text</type></entry>
8274 <entry>Version name</entry>
8278 <entry><structfield>installed</structfield></entry>
8279 <entry><type>bool</type></entry>
8280 <entry>True if this version of this extension is currently
8285 <entry><structfield>superuser</structfield></entry>
8286 <entry><type>bool</type></entry>
8287 <entry>True if only superusers are allowed to install this extension</entry>
8291 <entry><structfield>relocatable</structfield></entry>
8292 <entry><type>bool</type></entry>
8293 <entry>True if extension can be relocated to another schema</entry>
8297 <entry><structfield>schema</structfield></entry>
8298 <entry><type>name</type></entry>
8299 <entry>Name of the schema that the extension must be installed into,
8300 or <literal>NULL</literal> if partially or fully relocatable</entry>
8304 <entry><structfield>requires</structfield></entry>
8305 <entry><type>name[]</type></entry>
8306 <entry>Names of prerequisite extensions,
8307 or <literal>NULL</literal> if none</entry>
8311 <entry><structfield>comment</structfield></entry>
8312 <entry><type>text</type></entry>
8313 <entry>Comment string from the extension's control file</entry>
8320 The <structname>pg_available_extension_versions</structname> view is read
8325 <sect1 id="view-pg-config">
8326 <title><structname>pg_config</structname></title>
8328 <indexterm zone="view-pg-config">
8329 <primary>pg_config</primary>
8333 The view <structname>pg_config</structname> describes the
8334 compile-time configuration parameters of the currently installed
8335 version of <productname>PostgreSQL</>. It is intended, for example, to
8336 be used by software packages that want to interface to
8337 <productname>PostgreSQL</> to facilitate finding the required header
8338 files and libraries. It provides the same basic information as the
8339 <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
8344 By default, the <structname>pg_config</structname> view can be read
8349 <title><structname>pg_config</> Columns</title>
8355 <entry>Description</entry>
8361 <entry><structfield>name</structfield></entry>
8362 <entry><type>text</type></entry>
8363 <entry>The parameter name</entry>
8367 <entry><structfield>setting</structfield></entry>
8368 <entry><type>text</type></entry>
8369 <entry>The parameter value</entry>
8377 <sect1 id="view-pg-cursors">
8378 <title><structname>pg_cursors</structname></title>
8380 <indexterm zone="view-pg-cursors">
8381 <primary>pg_cursors</primary>
8385 The <structname>pg_cursors</structname> view lists the cursors that
8386 are currently available. Cursors can be defined in several ways:
8390 via the <xref linkend="sql-declare">
8397 via the Bind message in the frontend/backend protocol, as
8398 described in <xref linkend="protocol-flow-ext-query">
8404 via the Server Programming Interface (SPI), as described in
8405 <xref linkend="spi-interface">
8410 The <structname>pg_cursors</structname> view displays cursors
8411 created by any of these means. Cursors only exist for the duration
8412 of the transaction that defines them, unless they have been
8413 declared <literal>WITH HOLD</literal>. Therefore non-holdable
8414 cursors are only present in the view until the end of their
8415 creating transaction.
8419 Cursors are used internally to implement some of the components
8420 of <productname>PostgreSQL</>, such as procedural languages.
8421 Therefore, the <structname>pg_cursors</> view might include cursors
8422 that have not been explicitly created by the user.
8428 <title><structname>pg_cursors</> Columns</title>
8435 <entry>Description</entry>
8441 <entry><structfield>name</structfield></entry>
8442 <entry><type>text</type></entry>
8443 <entry>The name of the cursor</entry>
8447 <entry><structfield>statement</structfield></entry>
8448 <entry><type>text</type></entry>
8449 <entry>The verbatim query string submitted to declare this cursor</entry>
8453 <entry><structfield>is_holdable</structfield></entry>
8454 <entry><type>boolean</type></entry>
8456 <literal>true</literal> if the cursor is holdable (that is, it
8457 can be accessed after the transaction that declared the cursor
8458 has committed); <literal>false</literal> otherwise
8463 <entry><structfield>is_binary</structfield></entry>
8464 <entry><type>boolean</type></entry>
8466 <literal>true</literal> if the cursor was declared
8467 <literal>BINARY</literal>; <literal>false</literal>
8473 <entry><structfield>is_scrollable</structfield></entry>
8474 <entry><type>boolean</type></entry>
8476 <literal>true</> if the cursor is scrollable (that is, it
8477 allows rows to be retrieved in a nonsequential manner);
8478 <literal>false</literal> otherwise
8483 <entry><structfield>creation_time</structfield></entry>
8484 <entry><type>timestamptz</type></entry>
8485 <entry>The time at which the cursor was declared</entry>
8492 The <structname>pg_cursors</structname> view is read only.
8497 <sect1 id="view-pg-file-settings">
8498 <title><structname>pg_file_settings</structname></title>
8500 <indexterm zone="view-pg-file-settings">
8501 <primary>pg_file_settings</primary>
8505 The view <structname>pg_file_settings</structname> provides a summary of
8506 the contents of the server's configuration file(s). A row appears in
8507 this view for each <quote>name = value</> entry appearing in the files,
8508 with annotations indicating whether the value could be applied
8509 successfully. Additional row(s) may appear for problems not linked to
8510 a <quote>name = value</> entry, such as syntax errors in the files.
8514 This view is helpful for checking whether planned changes in the
8515 configuration files will work, or for diagnosing a previous failure.
8516 Note that this view reports on the <emphasis>current</> contents of the
8517 files, not on what was last applied by the server. (The
8518 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
8519 view is usually sufficient to determine that.)
8523 By default, the <structname>pg_file_settings</structname> view can be read
8528 <title><structname>pg_file_settings</> Columns</title>
8535 <entry>Description</entry>
8540 <entry><structfield>sourcefile</structfield></entry>
8541 <entry><structfield>text</structfield></entry>
8542 <entry>Full path name of the configuration file</entry>
8545 <entry><structfield>sourceline</structfield></entry>
8546 <entry><structfield>integer</structfield></entry>
8548 Line number within the configuration file where the entry appears
8552 <entry><structfield>seqno</structfield></entry>
8553 <entry><structfield>integer</structfield></entry>
8554 <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
8557 <entry><structfield>name</structfield></entry>
8558 <entry><structfield>text</structfield></entry>
8559 <entry>Configuration parameter name</entry>
8562 <entry><structfield>setting</structfield></entry>
8563 <entry><structfield>text</structfield></entry>
8564 <entry>Value to be assigned to the parameter</entry>
8567 <entry><structfield>applied</structfield></entry>
8568 <entry><structfield>boolean</structfield></entry>
8569 <entry>True if the value can be applied successfully</entry>
8572 <entry><structfield>error</structfield></entry>
8573 <entry><structfield>text</structfield></entry>
8574 <entry>If not null, an error message indicating why this entry could
8575 not be applied</entry>
8582 If the configuration file contains syntax errors or invalid parameter
8583 names, the server will not attempt to apply any settings from it, and
8584 therefore all the <structfield>applied</> fields will read as false.
8585 In such a case there will be one or more rows with
8586 non-null <structfield>error</structfield> fields indicating the
8587 problem(s). Otherwise, individual settings will be applied if possible.
8588 If an individual setting cannot be applied (e.g., invalid value, or the
8589 setting cannot be changed after server start) it will have an appropriate
8590 message in the <structfield>error</structfield> field. Another way that
8591 an entry might have <structfield>applied</> = false is that it is
8592 overridden by a later entry for the same parameter name; this case is not
8593 considered an error so nothing appears in
8594 the <structfield>error</structfield> field.
8598 See <xref linkend="config-setting"> for more information about the various
8599 ways to change run-time parameters.
8604 <sect1 id="view-pg-group">
8605 <title><structname>pg_group</structname></title>
8607 <indexterm zone="view-pg-group">
8608 <primary>pg_group</primary>
8612 The view <structname>pg_group</structname> exists for backwards
8613 compatibility: it emulates a catalog that existed in
8614 <productname>PostgreSQL</productname> before version 8.1.
8615 It shows the names and members of all roles that are marked as not
8616 <structfield>rolcanlogin</>, which is an approximation to the set
8617 of roles that are being used as groups.
8621 <title><structname>pg_group</> Columns</title>
8628 <entry>References</entry>
8629 <entry>Description</entry>
8635 <entry><structfield>groname</structfield></entry>
8636 <entry><type>name</type></entry>
8637 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8638 <entry>Name of the group</entry>
8642 <entry><structfield>grosysid</structfield></entry>
8643 <entry><type>oid</type></entry>
8644 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8645 <entry>ID of this group</entry>
8649 <entry><structfield>grolist</structfield></entry>
8650 <entry><type>oid[]</type></entry>
8651 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8652 <entry>An array containing the IDs of the roles in this group</entry>
8660 <sect1 id="view-pg-hba-file-rules">
8661 <title><structname>pg_hba_file_rules</structname></title>
8663 <indexterm zone="view-pg-hba-file-rules">
8664 <primary>pg_hba_file_rules</primary>
8668 The view <structname>pg_hba_file_rules</structname> provides a summary of
8669 the contents of the client authentication configuration
8670 file, <filename>pg_hba.conf</>. A row appears in this view for each
8671 non-empty, non-comment line in the file, with annotations indicating
8672 whether the rule could be applied successfully.
8676 This view can be helpful for checking whether planned changes in the
8677 authentication configuration file will work, or for diagnosing a previous
8678 failure. Note that this view reports on the <emphasis>current</> contents
8679 of the file, not on what was last loaded by the server.
8683 By default, the <structname>pg_hba_file_rules</structname> view can be read
8688 <title><structname>pg_hba_file_rules</> Columns</title>
8695 <entry>Description</entry>
8700 <entry><structfield>line_number</structfield></entry>
8701 <entry><structfield>integer</structfield></entry>
8703 Line number of this rule in <filename>pg_hba.conf</>
8707 <entry><structfield>type</structfield></entry>
8708 <entry><structfield>text</structfield></entry>
8709 <entry>Type of connection</entry>
8712 <entry><structfield>database</structfield></entry>
8713 <entry><structfield>text[]</structfield></entry>
8714 <entry>List of database name(s) to which this rule applies</entry>
8717 <entry><structfield>user_name</structfield></entry>
8718 <entry><structfield>text[]</structfield></entry>
8719 <entry>List of user and group name(s) to which this rule applies</entry>
8722 <entry><structfield>address</structfield></entry>
8723 <entry><structfield>text</structfield></entry>
8725 Host name or IP address, or one
8726 of <literal>all</literal>, <literal>samehost</literal>,
8727 or <literal>samenet</literal>, or null for local connections
8731 <entry><structfield>netmask</structfield></entry>
8732 <entry><structfield>text</structfield></entry>
8733 <entry>IP address mask, or null if not applicable</entry>
8736 <entry><structfield>auth_method</structfield></entry>
8737 <entry><type>text</type></entry>
8738 <entry>Authentication method</entry>
8741 <entry><structfield>options</structfield></entry>
8742 <entry><type>text[]</type></entry>
8743 <entry>Options specified for authentication method, if any</entry>
8746 <entry><structfield>error</structfield></entry>
8747 <entry><structfield>text</structfield></entry>
8749 If not null, an error message indicating why this
8750 line could not be processed
8758 Usually, a row reflecting an incorrect entry will have values for only
8759 the <structfield>line_number</> and <structfield>error</> fields.
8763 See <xref linkend="client-authentication"> for more information about
8764 client authentication configuration.
8768 <sect1 id="view-pg-indexes">
8769 <title><structname>pg_indexes</structname></title>
8771 <indexterm zone="view-pg-indexes">
8772 <primary>pg_indexes</primary>
8776 The view <structname>pg_indexes</structname> provides access to
8777 useful information about each index in the database.
8781 <title><structname>pg_indexes</> Columns</title>
8788 <entry>References</entry>
8789 <entry>Description</entry>
8794 <entry><structfield>schemaname</structfield></entry>
8795 <entry><type>name</type></entry>
8796 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8797 <entry>Name of schema containing table and index</entry>
8800 <entry><structfield>tablename</structfield></entry>
8801 <entry><type>name</type></entry>
8802 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8803 <entry>Name of table the index is for</entry>
8806 <entry><structfield>indexname</structfield></entry>
8807 <entry><type>name</type></entry>
8808 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8809 <entry>Name of index</entry>
8812 <entry><structfield>tablespace</structfield></entry>
8813 <entry><type>name</type></entry>
8814 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8815 <entry>Name of tablespace containing index (null if default for database)</entry>
8818 <entry><structfield>indexdef</structfield></entry>
8819 <entry><type>text</type></entry>
8821 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8830 <sect1 id="view-pg-locks">
8831 <title><structname>pg_locks</structname></title>
8833 <indexterm zone="view-pg-locks">
8834 <primary>pg_locks</primary>
8838 The view <structname>pg_locks</structname> provides access to
8839 information about the locks held by active processes within the
8840 database server. See <xref linkend="mvcc"> for more discussion
8845 <structname>pg_locks</structname> contains one row per active lockable
8846 object, requested lock mode, and relevant process. Thus, the same
8847 lockable object might
8848 appear many times, if multiple processes are holding or waiting
8849 for locks on it. However, an object that currently has no locks on it
8850 will not appear at all.
8854 There are several distinct types of lockable objects:
8855 whole relations (e.g., tables), individual pages of relations,
8856 individual tuples of relations,
8857 transaction IDs (both virtual and permanent IDs),
8858 and general database objects (identified by class OID and object OID,
8859 in the same way as in <structname>pg_description</structname> or
8860 <structname>pg_depend</structname>). Also, the right to extend a
8861 relation is represented as a separate lockable object.
8862 Also, <quote>advisory</> locks can be taken on numbers that have
8863 user-defined meanings.
8867 <title><structname>pg_locks</> Columns</title>
8874 <entry>References</entry>
8875 <entry>Description</entry>
8880 <entry><structfield>locktype</structfield></entry>
8881 <entry><type>text</type></entry>
8884 Type of the lockable object:
8885 <literal>relation</>,
8889 <literal>transactionid</>,
8890 <literal>virtualxid</>,
8892 <literal>userlock</>, or
8893 <literal>advisory</>
8897 <entry><structfield>database</structfield></entry>
8898 <entry><type>oid</type></entry>
8899 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8901 OID of the database in which the lock target exists, or
8902 zero if the target is a shared object, or
8903 null if the target is a transaction ID
8907 <entry><structfield>relation</structfield></entry>
8908 <entry><type>oid</type></entry>
8909 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8911 OID of the relation targeted by the lock, or null if the target is not
8912 a relation or part of a relation
8916 <entry><structfield>page</structfield></entry>
8917 <entry><type>integer</type></entry>
8920 Page number targeted by the lock within the relation,
8921 or null if the target is not a relation page or tuple
8925 <entry><structfield>tuple</structfield></entry>
8926 <entry><type>smallint</type></entry>
8929 Tuple number targeted by the lock within the page,
8930 or null if the target is not a tuple
8934 <entry><structfield>virtualxid</structfield></entry>
8935 <entry><type>text</type></entry>
8938 Virtual ID of the transaction targeted by the lock,
8939 or null if the target is not a virtual transaction ID
8943 <entry><structfield>transactionid</structfield></entry>
8944 <entry><type>xid</type></entry>
8947 ID of the transaction targeted by the lock,
8948 or null if the target is not a transaction ID
8952 <entry><structfield>classid</structfield></entry>
8953 <entry><type>oid</type></entry>
8954 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8956 OID of the system catalog containing the lock target, or null if the
8957 target is not a general database object
8961 <entry><structfield>objid</structfield></entry>
8962 <entry><type>oid</type></entry>
8963 <entry>any OID column</entry>
8965 OID of the lock target within its system catalog, or null if the
8966 target is not a general database object
8970 <entry><structfield>objsubid</structfield></entry>
8971 <entry><type>smallint</type></entry>
8974 Column number targeted by the lock (the
8975 <structfield>classid</> and <structfield>objid</> refer to the
8977 or zero if the target is some other general database object,
8978 or null if the target is not a general database object
8982 <entry><structfield>virtualtransaction</structfield></entry>
8983 <entry><type>text</type></entry>
8986 Virtual ID of the transaction that is holding or awaiting this lock
8990 <entry><structfield>pid</structfield></entry>
8991 <entry><type>integer</type></entry>
8994 Process ID of the server process holding or awaiting this
8995 lock, or null if the lock is held by a prepared transaction
8999 <entry><structfield>mode</structfield></entry>
9000 <entry><type>text</type></entry>
9002 <entry>Name of the lock mode held or desired by this process (see <xref
9003 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
9006 <entry><structfield>granted</structfield></entry>
9007 <entry><type>boolean</type></entry>
9009 <entry>True if lock is held, false if lock is awaited</entry>
9012 <entry><structfield>fastpath</structfield></entry>
9013 <entry><type>boolean</type></entry>
9015 <entry>True if lock was taken via fast path, false if taken via main
9023 <structfield>granted</structfield> is true in a row representing a lock
9024 held by the indicated process. False indicates that this process is
9025 currently waiting to acquire this lock, which implies that at least one
9026 other process is holding or waiting for a conflicting lock mode on the same
9027 lockable object. The waiting process will sleep until the other lock is
9028 released (or a deadlock situation is detected). A single process can be
9029 waiting to acquire at most one lock at a time.
9033 Throughout running a transaction, a server process holds an exclusive lock
9034 on the transaction's virtual transaction ID. If a permanent ID is assigned
9035 to the transaction (which normally happens only if the transaction changes
9036 the state of the database), it also holds an exclusive lock on the
9037 transaction's permanent transaction ID until it ends. When a process finds
9038 it necessary to wait specifically for another transaction to end, it does
9039 so by attempting to acquire share lock on the other transaction's ID
9040 (either virtual or permanent ID depending on the situation). That will
9041 succeed only when the other transaction terminates and releases its locks.
9045 Although tuples are a lockable type of object,
9046 information about row-level locks is stored on disk, not in memory,
9047 and therefore row-level locks normally do not appear in this view.
9048 If a process is waiting for a
9049 row-level lock, it will usually appear in the view as waiting for the
9050 permanent transaction ID of the current holder of that row lock.
9054 Advisory locks can be acquired on keys consisting of either a single
9055 <type>bigint</type> value or two integer values.
9056 A <type>bigint</type> key is displayed with its
9057 high-order half in the <structfield>classid</> column, its low-order half
9058 in the <structfield>objid</> column, and <structfield>objsubid</> equal
9059 to 1. The original <type>bigint</type> value can be reassembled with the
9060 expression <literal>(classid::bigint << 32) |
9061 objid::bigint</literal>. Integer keys are displayed with the
9063 <structfield>classid</> column, the second key in the <structfield>objid</>
9064 column, and <structfield>objsubid</> equal to 2. The actual meaning of
9065 the keys is up to the user. Advisory locks are local to each database,
9066 so the <structfield>database</> column is meaningful for an advisory lock.
9070 <structname>pg_locks</structname> provides a global view of all locks
9071 in the database cluster, not only those relevant to the current database.
9072 Although its <structfield>relation</structfield> column can be joined
9073 against <structname>pg_class</>.<structfield>oid</> to identify locked
9074 relations, this will only work correctly for relations in the current
9075 database (those for which the <structfield>database</structfield> column
9076 is either the current database's OID or zero).
9080 The <structfield>pid</structfield> column can be joined to the
9081 <structfield>pid</structfield> column of the <link
9082 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
9084 information on the session holding or awaiting each lock,
9087 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
9088 ON pl.pid = psa.pid;
9090 Also, if you are using prepared transactions, the
9091 <structfield>virtualtransaction</> column can be joined to the
9092 <structfield>transaction</structfield> column of the <link
9093 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
9094 view to get more information on prepared transactions that hold locks.
9095 (A prepared transaction can never be waiting for a lock,
9096 but it continues to hold the locks it acquired while running.)
9099 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
9100 ON pl.virtualtransaction = '-1/' || ppx.transaction;
9105 While it is possible to obtain information about which processes block
9106 which other processes by joining <structname>pg_locks</structname> against
9107 itself, this is very difficult to get right in detail. Such a query would
9108 have to encode knowledge about which lock modes conflict with which
9109 others. Worse, the <structname>pg_locks</structname> view does not expose
9110 information about which processes are ahead of which others in lock wait
9111 queues, nor information about which processes are parallel workers running
9112 on behalf of which other client sessions. It is better to use
9113 the <function>pg_blocking_pids()</> function
9114 (see <xref linkend="functions-info-session-table">) to identify which
9115 process(es) a waiting process is blocked behind.
9119 The <structname>pg_locks</structname> view displays data from both the
9120 regular lock manager and the predicate lock manager, which are
9121 separate systems; in addition, the regular lock manager subdivides its
9122 locks into regular and <firstterm>fast-path</> locks.
9123 This data is not guaranteed to be entirely consistent.
9124 When the view is queried,
9125 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
9126 is gathered from each backend one at a time, without freezing the state of
9127 the entire lock manager, so it is possible for locks to be taken or
9128 released while information is gathered. Note, however, that these locks are
9129 known not to conflict with any other lock currently in place. After
9130 all backends have been queried for fast-path locks, the remainder of the
9131 regular lock manager is locked as a unit, and a consistent snapshot of all
9132 remaining locks is collected as an atomic action. After unlocking the
9133 regular lock manager, the predicate lock manager is similarly locked and all
9134 predicate locks are collected as an atomic action. Thus, with the exception
9135 of fast-path locks, each lock manager will deliver a consistent set of
9136 results, but as we do not lock both lock managers simultaneously, it is
9137 possible for locks to be taken or released after we interrogate the regular
9138 lock manager and before we interrogate the predicate lock manager.
9142 Locking the regular and/or predicate lock manager could have some
9143 impact on database performance if this view is very frequently accessed.
9144 The locks are held only for the minimum amount of time necessary to
9145 obtain data from the lock managers, but this does not completely eliminate
9146 the possibility of a performance impact.
9151 <sect1 id="view-pg-matviews">
9152 <title><structname>pg_matviews</structname></title>
9154 <indexterm zone="view-pg-matviews">
9155 <primary>pg_matviews</primary>
9158 <indexterm zone="view-pg-matviews">
9159 <primary>materialized views</primary>
9163 The view <structname>pg_matviews</structname> provides access to
9164 useful information about each materialized view in the database.
9168 <title><structname>pg_matviews</> Columns</title>
9175 <entry>References</entry>
9176 <entry>Description</entry>
9181 <entry><structfield>schemaname</structfield></entry>
9182 <entry><type>name</type></entry>
9183 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9184 <entry>Name of schema containing materialized view</entry>
9187 <entry><structfield>matviewname</structfield></entry>
9188 <entry><type>name</type></entry>
9189 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9190 <entry>Name of materialized view</entry>
9193 <entry><structfield>matviewowner</structfield></entry>
9194 <entry><type>name</type></entry>
9195 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9196 <entry>Name of materialized view's owner</entry>
9199 <entry><structfield>tablespace</structfield></entry>
9200 <entry><type>name</type></entry>
9201 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9202 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
9205 <entry><structfield>hasindexes</structfield></entry>
9206 <entry><type>boolean</type></entry>
9208 <entry>True if materialized view has (or recently had) any indexes</entry>
9211 <entry><structfield>ispopulated</structfield></entry>
9212 <entry><type>boolean</type></entry>
9214 <entry>True if materialized view is currently populated</entry>
9217 <entry><structfield>definition</structfield></entry>
9218 <entry><type>text</type></entry>
9220 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
9228 <sect1 id="view-pg-policies">
9229 <title><structname>pg_policies</structname></title>
9231 <indexterm zone="view-pg-policies">
9232 <primary>pg_policies</primary>
9236 The view <structname>pg_policies</structname> provides access to
9237 useful information about each row-level security policy in the database.
9241 <title><structname>pg_policies</> Columns</title>
9248 <entry>References</entry>
9249 <entry>Description</entry>
9254 <entry><structfield>schemaname</structfield></entry>
9255 <entry><type>name</type></entry>
9256 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9257 <entry>Name of schema containing table policy is on</entry>
9260 <entry><structfield>tablename</structfield></entry>
9261 <entry><type>name</type></entry>
9262 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9263 <entry>Name of table policy is on</entry>
9266 <entry><structfield>policyname</structfield></entry>
9267 <entry><type>name</type></entry>
9268 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
9269 <entry>Name of policy</entry>
9272 <entry><structfield>polpermissive</structfield></entry>
9273 <entry><type>text</type></entry>
9275 <entry>Is the policy permissive or restrictive?</entry>
9278 <entry><structfield>roles</structfield></entry>
9279 <entry><type>name[]</type></entry>
9281 <entry>The roles to which this policy applies</entry>
9284 <entry><structfield>cmd</structfield></entry>
9285 <entry><type>text</type></entry>
9287 <entry>The command type to which the policy is applied</entry>
9290 <entry><structfield>qual</structfield></entry>
9291 <entry><type>text</type></entry>
9293 <entry>The expression added to the security barrier qualifications for
9294 queries that this policy applies to</entry>
9297 <entry><structfield>with_check</structfield></entry>
9298 <entry><type>text</type></entry>
9300 <entry>The expression added to the WITH CHECK qualifications for
9301 queries that attempt to add rows to this table</entry>
9309 <sect1 id="view-pg-prepared-statements">
9310 <title><structname>pg_prepared_statements</structname></title>
9312 <indexterm zone="view-pg-prepared-statements">
9313 <primary>pg_prepared_statements</primary>
9317 The <structname>pg_prepared_statements</structname> view displays
9318 all the prepared statements that are available in the current
9319 session. See <xref linkend="sql-prepare"> for more information about prepared
9324 <structname>pg_prepared_statements</structname> contains one row
9325 for each prepared statement. Rows are added to the view when a new
9326 prepared statement is created and removed when a prepared statement
9327 is released (for example, via the <xref linkend="sql-deallocate"> command).
9331 <title><structname>pg_prepared_statements</> Columns</title>
9338 <entry>Description</entry>
9343 <entry><structfield>name</structfield></entry>
9344 <entry><type>text</type></entry>
9346 The identifier of the prepared statement
9350 <entry><structfield>statement</structfield></entry>
9351 <entry><type>text</type></entry>
9353 The query string submitted by the client to create this
9354 prepared statement. For prepared statements created via SQL,
9355 this is the <command>PREPARE</command> statement submitted by
9356 the client. For prepared statements created via the
9357 frontend/backend protocol, this is the text of the prepared
9362 <entry><structfield>prepare_time</structfield></entry>
9363 <entry><type>timestamptz</type></entry>
9365 The time at which the prepared statement was created
9369 <entry><structfield>parameter_types</structfield></entry>
9370 <entry><type>regtype[]</type></entry>
9372 The expected parameter types for the prepared statement in the
9373 form of an array of <type>regtype</type>. The OID corresponding
9374 to an element of this array can be obtained by casting the
9375 <type>regtype</type> value to <type>oid</type>.
9379 <entry><structfield>from_sql</structfield></entry>
9380 <entry><type>boolean</type></entry>
9382 <literal>true</literal> if the prepared statement was created
9383 via the <command>PREPARE</command> SQL command;
9384 <literal>false</literal> if the statement was prepared via the
9385 frontend/backend protocol
9393 The <structname>pg_prepared_statements</structname> view is read only.
9397 <sect1 id="view-pg-prepared-xacts">
9398 <title><structname>pg_prepared_xacts</structname></title>
9400 <indexterm zone="view-pg-prepared-xacts">
9401 <primary>pg_prepared_xacts</primary>
9405 The view <structname>pg_prepared_xacts</structname> displays
9406 information about transactions that are currently prepared for two-phase
9407 commit (see <xref linkend="sql-prepare-transaction"> for details).
9411 <structname>pg_prepared_xacts</structname> contains one row per prepared
9412 transaction. An entry is removed when the transaction is committed or
9417 <title><structname>pg_prepared_xacts</> Columns</title>
9424 <entry>References</entry>
9425 <entry>Description</entry>
9430 <entry><structfield>transaction</structfield></entry>
9431 <entry><type>xid</type></entry>
9434 Numeric transaction identifier of the prepared transaction
9438 <entry><structfield>gid</structfield></entry>
9439 <entry><type>text</type></entry>
9442 Global transaction identifier that was assigned to the transaction
9446 <entry><structfield>prepared</structfield></entry>
9447 <entry><type>timestamp with time zone</type></entry>
9450 Time at which the transaction was prepared for commit
9454 <entry><structfield>owner</structfield></entry>
9455 <entry><type>name</type></entry>
9456 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9458 Name of the user that executed the transaction
9462 <entry><structfield>database</structfield></entry>
9463 <entry><type>name</type></entry>
9464 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9466 Name of the database in which the transaction was executed
9474 When the <structname>pg_prepared_xacts</structname> view is accessed, the
9475 internal transaction manager data structures are momentarily locked, and
9476 a copy is made for the view to display. This ensures that the
9477 view produces a consistent set of results, while not blocking
9478 normal operations longer than necessary. Nonetheless
9479 there could be some impact on database performance if this view is
9480 frequently accessed.
9485 <sect1 id="view-pg-publication-tables">
9486 <title><structname>pg_publication_tables</structname></title>
9488 <indexterm zone="view-pg-publication-tables">
9489 <primary>pg_publication_tables</primary>
9493 The view <structname>pg_publication_tables</structname> provides
9494 information about the mapping between publications and the tables they
9495 contain. Unlike the underlying
9496 catalog <structname>pg_publication_rel</structname>, this view expands
9497 publications defined as <literal>FOR ALL TABLES</literal>, so for such
9498 publications there will be a row for each eligible table.
9502 <title><structname>pg_publication_tables</structname> Columns</title>
9509 <entry>References</entry>
9510 <entry>Description</entry>
9516 <entry><structfield>pubname</structfield></entry>
9517 <entry><type>name</type></entry>
9518 <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
9519 <entry>Name of publication</entry>
9523 <entry><structfield>schemaname</structfield></entry>
9524 <entry><type>name</type></entry>
9525 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9526 <entry>Name of schema containing table</entry>
9530 <entry><structfield>tablename</structfield></entry>
9531 <entry><type>name</type></entry>
9532 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9533 <entry>Name of table</entry>
9540 <sect1 id="view-pg-replication-origin-status">
9541 <title><structname>pg_replication_origin_status</structname></title>
9543 <indexterm zone="view-pg-replication-origin-status">
9544 <primary>pg_replication_origin_status</primary>
9548 The <structname>pg_replication_origin_status</structname> view
9549 contains information about how far replay for a certain origin has
9550 progressed. For more on replication origins
9551 see <xref linkend="replication-origins">.
9556 <title><structname>pg_replication_origin_status</structname> Columns</title>
9563 <entry>References</entry>
9564 <entry>Description</entry>
9570 <entry><structfield>local_id</structfield></entry>
9571 <entry><type>Oid</type></entry>
9572 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
9573 <entry>internal node identifier</entry>
9577 <entry><structfield>external_id</structfield></entry>
9578 <entry><type>text</type></entry>
9579 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
9580 <entry>external node identifier</entry>
9584 <entry><structfield>remote_lsn</structfield></entry>
9585 <entry><type>pg_lsn</type></entry>
9587 <entry>The origin node's LSN up to which data has been replicated.</entry>
9591 <entry><structfield>local_lsn</structfield></entry>
9592 <entry><type>pg_lsn</type></entry>
9595 This node's LSN at which <literal>remote_lsn</literal> has
9596 been replicated. Used to flush commit records before persisting
9597 data to disk when using asynchronous commits.
9605 <sect1 id="view-pg-replication-slots">
9606 <title><structname>pg_replication_slots</structname></title>
9608 <indexterm zone="view-pg-replication-slots">
9609 <primary>pg_replication_slots</primary>
9613 The <structname>pg_replication_slots</structname> view provides a listing
9614 of all replication slots that currently exist on the database cluster,
9615 along with their current state.
9619 For more on replication slots,
9620 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
9625 <title><structname>pg_replication_slots</structname> Columns</title>
9632 <entry>References</entry>
9633 <entry>Description</entry>
9639 <entry><structfield>slot_name</structfield></entry>
9640 <entry><type>name</type></entry>
9642 <entry>A unique, cluster-wide identifier for the replication slot</entry>
9646 <entry><structfield>plugin</structfield></entry>
9647 <entry><type>name</type></entry>
9649 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
9653 <entry><structfield>slot_type</structfield></entry>
9654 <entry><type>text</type></entry>
9656 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
9660 <entry><structfield>datoid</structfield></entry>
9661 <entry><type>oid</type></entry>
9662 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9663 <entry>The OID of the database this slot is associated with, or
9664 null. Only logical slots have an associated database.</entry>
9668 <entry><structfield>database</structfield></entry>
9669 <entry><type>text</type></entry>
9670 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9671 <entry>The name of the database this slot is associated with, or
9672 null. Only logical slots have an associated database.</entry>
9676 <entry><structfield>temporary</structfield></entry>
9677 <entry><type>boolean</type></entry>
9679 <entry>True if this is a temporary replication slot. Temporary slots are
9680 not saved to disk and are automatically dropped on error or when
9681 the session has finished.</entry>
9685 <entry><structfield>active</structfield></entry>
9686 <entry><type>boolean</type></entry>
9688 <entry>True if this slot is currently actively being used</entry>
9692 <entry><structfield>active_pid</structfield></entry>
9693 <entry><type>integer</type></entry>
9695 <entry>The process ID of the session using this slot if the slot
9696 is currently actively being used. <literal>NULL</literal> if
9702 <entry><structfield>xmin</structfield></entry>
9703 <entry><type>xid</type></entry>
9705 <entry>The oldest transaction that this slot needs the database to
9706 retain. <literal>VACUUM</literal> cannot remove tuples deleted
9707 by any later transaction.
9712 <entry><structfield>catalog_xmin</structfield></entry>
9713 <entry><type>xid</type></entry>
9715 <entry>The oldest transaction affecting the system catalogs that this
9716 slot needs the database to retain. <literal>VACUUM</literal> cannot
9717 remove catalog tuples deleted by any later transaction.
9722 <entry><structfield>restart_lsn</structfield></entry>
9723 <entry><type>pg_lsn</type></entry>
9725 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
9726 might be required by the consumer of this slot and thus won't be
9727 automatically removed during checkpoints.
9732 <entry><structfield>confirmed_flush_lsn</structfield></entry>
9733 <entry><type>pg_lsn</type></entry>
9735 <entry>The address (<literal>LSN</literal>) up to which the logical
9736 slot's consumer has confirmed receiving data. Data older than this is
9737 not available anymore. <literal>NULL</> for physical slots.
9746 <sect1 id="view-pg-roles">
9747 <title><structname>pg_roles</structname></title>
9749 <indexterm zone="view-pg-roles">
9750 <primary>pg_roles</primary>
9754 The view <structname>pg_roles</structname> provides access to
9755 information about database roles. This is simply a publicly
9757 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9758 that blanks out the password field.
9762 This view explicitly exposes the OID column of the underlying table,
9763 since that is needed to do joins to other catalogs.
9767 <title><structname>pg_roles</> Columns</title>
9774 <entry>References</entry>
9775 <entry>Description</entry>
9781 <entry><structfield>rolname</structfield></entry>
9782 <entry><type>name</type></entry>
9784 <entry>Role name</entry>
9788 <entry><structfield>rolsuper</structfield></entry>
9789 <entry><type>bool</type></entry>
9791 <entry>Role has superuser privileges</entry>
9795 <entry><structfield>rolinherit</structfield></entry>
9796 <entry><type>bool</type></entry>
9798 <entry>Role automatically inherits privileges of roles it is a
9803 <entry><structfield>rolcreaterole</structfield></entry>
9804 <entry><type>bool</type></entry>
9806 <entry>Role can create more roles</entry>
9810 <entry><structfield>rolcreatedb</structfield></entry>
9811 <entry><type>bool</type></entry>
9813 <entry>Role can create databases</entry>
9817 <entry><structfield>rolcanlogin</structfield></entry>
9818 <entry><type>bool</type></entry>
9821 Role can log in. That is, this role can be given as the initial
9822 session authorization identifier
9827 <entry><structfield>rolreplication</structfield></entry>
9828 <entry><type>bool</type></entry>
9831 Role is a replication role. That is, this role can initiate streaming
9832 replication (see <xref linkend="streaming-replication">) and set/unset
9833 the system backup mode using <function>pg_start_backup</> and
9834 <function>pg_stop_backup</>
9839 <entry><structfield>rolconnlimit</structfield></entry>
9840 <entry><type>int4</type></entry>
9843 For roles that can log in, this sets maximum number of concurrent
9844 connections this role can make. -1 means no limit.
9849 <entry><structfield>rolpassword</structfield></entry>
9850 <entry><type>text</type></entry>
9852 <entry>Not the password (always reads as <literal>********</>)</entry>
9856 <entry><structfield>rolvaliduntil</structfield></entry>
9857 <entry><type>timestamptz</type></entry>
9859 <entry>Password expiry time (only used for password authentication);
9860 null if no expiration</entry>
9864 <entry><structfield>rolbypassrls</structfield></entry>
9865 <entry><type>bool</type></entry>
9868 Role bypasses every row level security policy, see
9869 <xref linkend="ddl-rowsecurity"> for more information.
9874 <entry><structfield>rolconfig</structfield></entry>
9875 <entry><type>text[]</type></entry>
9877 <entry>Role-specific defaults for run-time configuration variables</entry>
9881 <entry><structfield>oid</structfield></entry>
9882 <entry><type>oid</type></entry>
9883 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9884 <entry>ID of role</entry>
9892 <sect1 id="view-pg-rules">
9893 <title><structname>pg_rules</structname></title>
9895 <indexterm zone="view-pg-rules">
9896 <primary>pg_rules</primary>
9900 The view <structname>pg_rules</structname> provides access to
9901 useful information about query rewrite rules.
9905 <title><structname>pg_rules</> Columns</title>
9912 <entry>References</entry>
9913 <entry>Description</entry>
9918 <entry><structfield>schemaname</structfield></entry>
9919 <entry><type>name</type></entry>
9920 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9921 <entry>Name of schema containing table</entry>
9924 <entry><structfield>tablename</structfield></entry>
9925 <entry><type>name</type></entry>
9926 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9927 <entry>Name of table the rule is for</entry>
9930 <entry><structfield>rulename</structfield></entry>
9931 <entry><type>name</type></entry>
9932 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
9933 <entry>Name of rule</entry>
9936 <entry><structfield>definition</structfield></entry>
9937 <entry><type>text</type></entry>
9939 <entry>Rule definition (a reconstructed creation command)</entry>
9946 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
9947 of views and materialized views; those can be seen in
9948 <structname>pg_views</> and <structname>pg_matviews</>.
9953 <sect1 id="view-pg-seclabels">
9954 <title><structname>pg_seclabels</structname></title>
9956 <indexterm zone="view-pg-seclabels">
9957 <primary>pg_seclabels</primary>
9961 The view <structname>pg_seclabels</structname> provides information about
9962 security labels. It as an easier-to-query version of the
9963 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9967 <title><structname>pg_seclabels</> Columns</title>
9974 <entry>References</entry>
9975 <entry>Description</entry>
9980 <entry><structfield>objoid</structfield></entry>
9981 <entry><type>oid</type></entry>
9982 <entry>any OID column</entry>
9983 <entry>The OID of the object this security label pertains to</entry>
9986 <entry><structfield>classoid</structfield></entry>
9987 <entry><type>oid</type></entry>
9988 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9989 <entry>The OID of the system catalog this object appears in</entry>
9992 <entry><structfield>objsubid</structfield></entry>
9993 <entry><type>int4</type></entry>
9996 For a security label on a table column, this is the column number (the
9997 <structfield>objoid</> and <structfield>classoid</> refer to
9998 the table itself). For all other object types, this column is
10003 <entry><structfield>objtype</structfield></entry>
10004 <entry><type>text</type></entry>
10007 The type of object to which this label applies, as text.
10011 <entry><structfield>objnamespace</structfield></entry>
10012 <entry><type>oid</type></entry>
10013 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
10015 The OID of the namespace for this object, if applicable;
10020 <entry><structfield>objname</structfield></entry>
10021 <entry><type>text</type></entry>
10024 The name of the object to which this label applies, as text.
10028 <entry><structfield>provider</structfield></entry>
10029 <entry><type>text</type></entry>
10030 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
10031 <entry>The label provider associated with this label.</entry>
10034 <entry><structfield>label</structfield></entry>
10035 <entry><type>text</type></entry>
10036 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
10037 <entry>The security label applied to this object.</entry>
10044 <sect1 id="view-pg-sequences">
10045 <title><structname>pg_sequences</structname></title>
10047 <indexterm zone="view-pg-sequences">
10048 <primary>pg_sequences</primary>
10052 The view <structname>pg_sequences</structname> provides access to
10053 useful information about each sequence in the database.
10057 <title><structname>pg_sequences</> Columns</title>
10062 <entry>Name</entry>
10063 <entry>Type</entry>
10064 <entry>References</entry>
10065 <entry>Description</entry>
10070 <entry><structfield>schemaname</structfield></entry>
10071 <entry><type>name</type></entry>
10072 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10073 <entry>Name of schema containing sequence</entry>
10076 <entry><structfield>sequencename</structfield></entry>
10077 <entry><type>name</type></entry>
10078 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10079 <entry>Name of sequence</entry>
10082 <entry><structfield>sequenceowner</structfield></entry>
10083 <entry><type>name</type></entry>
10084 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10085 <entry>Name of sequence's owner</entry>
10088 <entry><structfield>data_type</structfield></entry>
10089 <entry><type>regtype</type></entry>
10090 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_type</structname></link>.oid</literal></entry>
10091 <entry>Data type of the sequence</entry>
10094 <entry><structfield>start_value</structfield></entry>
10095 <entry><type>bigint</type></entry>
10097 <entry>Start value of the sequence</entry>
10100 <entry><structfield>min_value</structfield></entry>
10101 <entry><type>bigint</type></entry>
10103 <entry>Minimum value of the sequence</entry>
10106 <entry><structfield>max_value</structfield></entry>
10107 <entry><type>bigint</type></entry>
10109 <entry>Maximum value of the sequence</entry>
10112 <entry><structfield>increment_by</structfield></entry>
10113 <entry><type>bigint</type></entry>
10115 <entry>Increment value of the sequence</entry>
10118 <entry><structfield>cycle</structfield></entry>
10119 <entry><type>boolean</type></entry>
10121 <entry>Whether the sequence cycles</entry>
10124 <entry><structfield>cache_size</structfield></entry>
10125 <entry><type>bigint</type></entry>
10127 <entry>Cache size of the sequence</entry>
10130 <entry><structfield>last_value</structfield></entry>
10131 <entry><type>bigint</type></entry>
10133 <entry>The last sequence value written to disk. If caching is used,
10134 this value can be greater than the last value handed out from the
10135 sequence. Null if the sequence has not been read from yet. Also, if
10136 the current user does not have <literal>USAGE</literal>
10137 or <literal>SELECT</literal> privilege on the sequence, the value is
10145 <sect1 id="view-pg-settings">
10146 <title><structname>pg_settings</structname></title>
10148 <indexterm zone="view-pg-settings">
10149 <primary>pg_settings</primary>
10153 The view <structname>pg_settings</structname> provides access to
10154 run-time parameters of the server. It is essentially an alternative
10155 interface to the <xref linkend="sql-show">
10156 and <xref linkend="sql-set"> commands.
10157 It also provides access to some facts about each parameter that are
10158 not directly available from <command>SHOW</>, such as minimum and
10163 <title><structname>pg_settings</> Columns</title>
10168 <entry>Name</entry>
10169 <entry>Type</entry>
10170 <entry>Description</entry>
10175 <entry><structfield>name</structfield></entry>
10176 <entry><type>text</type></entry>
10177 <entry>Run-time configuration parameter name</entry>
10180 <entry><structfield>setting</structfield></entry>
10181 <entry><type>text</type></entry>
10182 <entry>Current value of the parameter</entry>
10185 <entry><structfield>unit</structfield></entry>
10186 <entry><type>text</type></entry>
10187 <entry>Implicit unit of the parameter</entry>
10190 <entry><structfield>category</structfield></entry>
10191 <entry><type>text</type></entry>
10192 <entry>Logical group of the parameter</entry>
10195 <entry><structfield>short_desc</structfield></entry>
10196 <entry><type>text</type></entry>
10197 <entry>A brief description of the parameter</entry>
10200 <entry><structfield>extra_desc</structfield></entry>
10201 <entry><type>text</type></entry>
10202 <entry>Additional, more detailed, description of the parameter</entry>
10205 <entry><structfield>context</structfield></entry>
10206 <entry><type>text</type></entry>
10207 <entry>Context required to set the parameter's value (see below)</entry>
10210 <entry><structfield>vartype</structfield></entry>
10211 <entry><type>text</type></entry>
10212 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
10213 <literal>integer</>, <literal>real</>, or <literal>string</>)
10217 <entry><structfield>source</structfield></entry>
10218 <entry><type>text</type></entry>
10219 <entry>Source of the current parameter value</entry>
10222 <entry><structfield>min_val</structfield></entry>
10223 <entry><type>text</type></entry>
10224 <entry>Minimum allowed value of the parameter (null for non-numeric
10228 <entry><structfield>max_val</structfield></entry>
10229 <entry><type>text</type></entry>
10230 <entry>Maximum allowed value of the parameter (null for non-numeric
10234 <entry><structfield>enumvals</structfield></entry>
10235 <entry><type>text[]</type></entry>
10236 <entry>Allowed values of an enum parameter (null for non-enum
10240 <entry><structfield>boot_val</structfield></entry>
10241 <entry><type>text</type></entry>
10242 <entry>Parameter value assumed at server startup if the parameter is
10243 not otherwise set</entry>
10246 <entry><structfield>reset_val</structfield></entry>
10247 <entry><type>text</type></entry>
10248 <entry>Value that <command>RESET</command> would reset the parameter to
10249 in the current session</entry>
10252 <entry><structfield>sourcefile</structfield></entry>
10253 <entry><type>text</type></entry>
10254 <entry>Configuration file the current value was set in (null for
10255 values set from sources other than configuration files, or when
10256 examined by a user who is neither a superuser or a member of
10257 <literal>pg_read_all_settings</literal>); helpful when using
10258 <literal>include</> directives in configuration files</entry>
10261 <entry><structfield>sourceline</structfield></entry>
10262 <entry><type>integer</type></entry>
10263 <entry>Line number within the configuration file the current value was
10264 set at (null for values set from sources other than configuration files,
10265 or when examined by a user who is neither a superuser or a member of
10266 <literal>pg_read_all_settings</literal>).
10270 <entry><structfield>pending_restart</structfield></entry>
10271 <entry><type>boolean</type></entry>
10272 <entry><literal>true</literal> if the value has been changed in the
10273 configuration file but needs a restart; or <literal>false</literal>
10282 There are several possible values of <structfield>context</structfield>.
10283 In order of decreasing difficulty of changing the setting, they are:
10288 <!-- PGC_INTERNAL -->
10289 <term><literal>internal</literal></term>
10292 These settings cannot be changed directly; they reflect internally
10293 determined values. Some of them may be adjustable by rebuilding the
10294 server with different configuration options, or by changing options
10295 supplied to <command>initdb</command>.
10300 <!-- PGC_POSTMASTER -->
10301 <term><literal>postmaster</literal></term>
10304 These settings can only be applied when the server starts, so any change
10305 requires restarting the server. Values for these settings are typically
10306 stored in the <filename>postgresql.conf</filename> file, or passed on
10307 the command line when starting the server. Of course, settings with any
10308 of the lower <structfield>context</structfield> types can also be
10309 set at server start time.
10314 <!-- PGC_SIGHUP -->
10315 <term><literal>sighup</literal></term>
10318 Changes to these settings can be made in
10319 <filename>postgresql.conf</filename> without restarting the server.
10320 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
10321 cause it to re-read <filename>postgresql.conf</filename> and apply
10322 the changes. The postmaster will also forward the
10323 <systemitem>SIGHUP</systemitem> signal to its child processes so that
10324 they all pick up the new value.
10329 <!-- PGC_SU_BACKEND -->
10330 <term><literal>superuser-backend</literal></term>
10333 Changes to these settings can be made in
10334 <filename>postgresql.conf</filename> without restarting the server.
10335 They can also be set for a particular session in the connection request
10336 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10337 environment variable), but only if the connecting user is a superuser.
10338 However, these settings never change in a session after it is started.
10339 If you change them in <filename>postgresql.conf</filename>, send a
10340 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10341 re-read <filename>postgresql.conf</filename>. The new values will only
10342 affect subsequently-launched sessions.
10347 <!-- PGC_BACKEND -->
10348 <term><literal>backend</literal></term>
10351 Changes to these settings can be made in
10352 <filename>postgresql.conf</filename> without restarting the server.
10353 They can also be set for a particular session in the connection request
10354 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10355 environment variable); any user can make such a change for their session.
10356 However, these settings never change in a session after it is started.
10357 If you change them in <filename>postgresql.conf</filename>, send a
10358 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10359 re-read <filename>postgresql.conf</filename>. The new values will only
10360 affect subsequently-launched sessions.
10366 <term><literal>superuser</literal></term>
10369 These settings can be set from <filename>postgresql.conf</filename>,
10370 or within a session via the <command>SET</> command; but only superusers
10371 can change them via <command>SET</>. Changes in
10372 <filename>postgresql.conf</filename> will affect existing sessions
10373 only if no session-local value has been established with <command>SET</>.
10378 <!-- PGC_USERSET -->
10379 <term><literal>user</literal></term>
10382 These settings can be set from <filename>postgresql.conf</filename>,
10383 or within a session via the <command>SET</> command. Any user is
10384 allowed to change their session-local value. Changes in
10385 <filename>postgresql.conf</filename> will affect existing sessions
10386 only if no session-local value has been established with <command>SET</>.
10393 See <xref linkend="config-setting"> for more information about the various
10394 ways to change these parameters.
10398 The <structname>pg_settings</structname> view cannot be inserted into or
10399 deleted from, but it can be updated. An <command>UPDATE</command> applied
10400 to a row of <structname>pg_settings</structname> is equivalent to executing
10401 the <xref linkend="sql-set"> command on that named
10402 parameter. The change only affects the value used by the current
10403 session. If an <command>UPDATE</command> is issued within a transaction
10404 that is later aborted, the effects of the <command>UPDATE</command> command
10405 disappear when the transaction is rolled back. Once the surrounding
10406 transaction is committed, the effects will persist until the end of the
10407 session, unless overridden by another <command>UPDATE</command> or
10408 <command>SET</command>.
10413 <sect1 id="view-pg-shadow">
10414 <title><structname>pg_shadow</structname></title>
10416 <indexterm zone="view-pg-shadow">
10417 <primary>pg_shadow</primary>
10421 The view <structname>pg_shadow</structname> exists for backwards
10422 compatibility: it emulates a catalog that existed in
10423 <productname>PostgreSQL</productname> before version 8.1.
10424 It shows properties of all roles that are marked as
10425 <structfield>rolcanlogin</> in
10426 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
10430 The name stems from the fact that this table
10431 should not be readable by the public since it contains passwords.
10432 <link linkend="view-pg-user"><structname>pg_user</structname></link>
10433 is a publicly readable view on
10434 <structname>pg_shadow</structname> that blanks out the password field.
10438 <title><structname>pg_shadow</> Columns</title>
10443 <entry>Name</entry>
10444 <entry>Type</entry>
10445 <entry>References</entry>
10446 <entry>Description</entry>
10452 <entry><structfield>usename</structfield></entry>
10453 <entry><type>name</type></entry>
10454 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10455 <entry>User name</entry>
10459 <entry><structfield>usesysid</structfield></entry>
10460 <entry><type>oid</type></entry>
10461 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10462 <entry>ID of this user</entry>
10466 <entry><structfield>usecreatedb</structfield></entry>
10467 <entry><type>bool</type></entry>
10469 <entry>User can create databases</entry>
10473 <entry><structfield>usesuper</structfield></entry>
10474 <entry><type>bool</type></entry>
10476 <entry>User is a superuser</entry>
10480 <entry><structfield>userepl</structfield></entry>
10481 <entry><type>bool</type></entry>
10484 User can initiate streaming replication and put the system in and
10485 out of backup mode.
10490 <entry><structfield>usebypassrls</structfield></entry>
10491 <entry><type>bool</type></entry>
10494 User bypasses every row level security policy, see
10495 <xref linkend="ddl-rowsecurity"> for more information.
10500 <entry><structfield>passwd</structfield></entry>
10501 <entry><type>text</type></entry>
10503 <entry>Password (possibly encrypted); null if none. See
10504 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
10505 for details of how encrypted passwords are stored.</entry>
10509 <entry><structfield>valuntil</structfield></entry>
10510 <entry><type>abstime</type></entry>
10512 <entry>Password expiry time (only used for password authentication)</entry>
10516 <entry><structfield>useconfig</structfield></entry>
10517 <entry><type>text[]</type></entry>
10519 <entry>Session defaults for run-time configuration variables</entry>
10527 <sect1 id="view-pg-stats">
10528 <title><structname>pg_stats</structname></title>
10530 <indexterm zone="view-pg-stats">
10531 <primary>pg_stats</primary>
10535 The view <structname>pg_stats</structname> provides access to
10536 the information stored in the <link
10537 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
10538 catalog. This view allows access only to rows of
10539 <structname>pg_statistic</structname> that correspond to tables the
10540 user has permission to read, and therefore it is safe to allow public
10541 read access to this view.
10545 <structname>pg_stats</structname> is also designed to present the
10546 information in a more readable format than the underlying catalog
10547 — at the cost that its schema must be extended whenever new slot types
10548 are defined for <structname>pg_statistic</structname>.
10552 <title><structname>pg_stats</> Columns</title>
10557 <entry>Name</entry>
10558 <entry>Type</entry>
10559 <entry>References</entry>
10560 <entry>Description</entry>
10565 <entry><structfield>schemaname</structfield></entry>
10566 <entry><type>name</type></entry>
10567 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10568 <entry>Name of schema containing table</entry>
10572 <entry><structfield>tablename</structfield></entry>
10573 <entry><type>name</type></entry>
10574 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10575 <entry>Name of table</entry>
10579 <entry><structfield>attname</structfield></entry>
10580 <entry><type>name</type></entry>
10581 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
10582 <entry>Name of the column described by this row</entry>
10586 <entry><structfield>inherited</structfield></entry>
10587 <entry><type>bool</type></entry>
10589 <entry>If true, this row includes inheritance child columns, not just the
10590 values in the specified table</entry>
10594 <entry><structfield>null_frac</structfield></entry>
10595 <entry><type>real</type></entry>
10597 <entry>Fraction of column entries that are null</entry>
10601 <entry><structfield>avg_width</structfield></entry>
10602 <entry><type>integer</type></entry>
10604 <entry>Average width in bytes of column's entries</entry>
10608 <entry><structfield>n_distinct</structfield></entry>
10609 <entry><type>real</type></entry>
10612 If greater than zero, the estimated number of distinct values in the
10613 column. If less than zero, the negative of the number of distinct
10614 values divided by the number of rows. (The negated form is used when
10615 <command>ANALYZE</> believes that the number of distinct values is
10616 likely to increase as the table grows; the positive form is used when
10617 the column seems to have a fixed number of possible values.) For
10618 example, -1 indicates a unique column in which the number of distinct
10619 values is the same as the number of rows.
10624 <entry><structfield>most_common_vals</structfield></entry>
10625 <entry><type>anyarray</type></entry>
10628 A list of the most common values in the column. (Null if
10629 no values seem to be more common than any others.)
10634 <entry><structfield>most_common_freqs</structfield></entry>
10635 <entry><type>real[]</type></entry>
10638 A list of the frequencies of the most common values,
10639 i.e., number of occurrences of each divided by total number of rows.
10640 (Null when <structfield>most_common_vals</structfield> is.)
10645 <entry><structfield>histogram_bounds</structfield></entry>
10646 <entry><type>anyarray</type></entry>
10649 A list of values that divide the column's values into groups of
10650 approximately equal population. The values in
10651 <structfield>most_common_vals</>, if present, are omitted from this
10652 histogram calculation. (This column is null if the column data type
10653 does not have a <literal><</> operator or if the
10654 <structfield>most_common_vals</> list accounts for the entire
10660 <entry><structfield>correlation</structfield></entry>
10661 <entry><type>real</type></entry>
10664 Statistical correlation between physical row ordering and
10665 logical ordering of the column values. This ranges from -1 to +1.
10666 When the value is near -1 or +1, an index scan on the column will
10667 be estimated to be cheaper than when it is near zero, due to reduction
10668 of random access to the disk. (This column is null if the column data
10669 type does not have a <literal><</> operator.)
10674 <entry><structfield>most_common_elems</structfield></entry>
10675 <entry><type>anyarray</type></entry>
10678 A list of non-null element values most often appearing within values of
10679 the column. (Null for scalar types.)
10684 <entry><structfield>most_common_elem_freqs</structfield></entry>
10685 <entry><type>real[]</type></entry>
10688 A list of the frequencies of the most common element values, i.e., the
10689 fraction of rows containing at least one instance of the given value.
10690 Two or three additional values follow the per-element frequencies;
10691 these are the minimum and maximum of the preceding per-element
10692 frequencies, and optionally the frequency of null elements.
10693 (Null when <structfield>most_common_elems</structfield> is.)
10698 <entry><structfield>elem_count_histogram</structfield></entry>
10699 <entry><type>real[]</type></entry>
10702 A histogram of the counts of distinct non-null element values within the
10703 values of the column, followed by the average number of distinct
10704 non-null elements. (Null for scalar types.)
10712 The maximum number of entries in the array fields can be controlled on a
10713 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
10714 command, or globally by setting the
10715 <xref linkend="guc-default-statistics-target"> run-time parameter.
10720 <sect1 id="view-pg-tables">
10721 <title><structname>pg_tables</structname></title>
10723 <indexterm zone="view-pg-tables">
10724 <primary>pg_tables</primary>
10728 The view <structname>pg_tables</structname> provides access to
10729 useful information about each table in the database.
10733 <title><structname>pg_tables</> Columns</title>
10738 <entry>Name</entry>
10739 <entry>Type</entry>
10740 <entry>References</entry>
10741 <entry>Description</entry>
10746 <entry><structfield>schemaname</structfield></entry>
10747 <entry><type>name</type></entry>
10748 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10749 <entry>Name of schema containing table</entry>
10752 <entry><structfield>tablename</structfield></entry>
10753 <entry><type>name</type></entry>
10754 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10755 <entry>Name of table</entry>
10758 <entry><structfield>tableowner</structfield></entry>
10759 <entry><type>name</type></entry>
10760 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10761 <entry>Name of table's owner</entry>
10764 <entry><structfield>tablespace</structfield></entry>
10765 <entry><type>name</type></entry>
10766 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
10767 <entry>Name of tablespace containing table (null if default for database)</entry>
10770 <entry><structfield>hasindexes</structfield></entry>
10771 <entry><type>boolean</type></entry>
10772 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
10773 <entry>True if table has (or recently had) any indexes</entry>
10776 <entry><structfield>hasrules</structfield></entry>
10777 <entry><type>boolean</type></entry>
10778 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
10779 <entry>True if table has (or once had) rules</entry>
10782 <entry><structfield>hastriggers</structfield></entry>
10783 <entry><type>boolean</type></entry>
10784 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
10785 <entry>True if table has (or once had) triggers</entry>
10788 <entry><structfield>rowsecurity</structfield></entry>
10789 <entry><type>boolean</type></entry>
10790 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
10791 <entry>True if row security is enabled on the table</entry>
10799 <sect1 id="view-pg-timezone-abbrevs">
10800 <title><structname>pg_timezone_abbrevs</structname></title>
10802 <indexterm zone="view-pg-timezone-abbrevs">
10803 <primary>pg_timezone_abbrevs</primary>
10807 The view <structname>pg_timezone_abbrevs</structname> provides a list
10808 of time zone abbreviations that are currently recognized by the datetime
10809 input routines. The contents of this view change when the
10810 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
10814 <title><structname>pg_timezone_abbrevs</> Columns</title>
10819 <entry>Name</entry>
10820 <entry>Type</entry>
10821 <entry>Description</entry>
10826 <entry><structfield>abbrev</structfield></entry>
10827 <entry><type>text</type></entry>
10828 <entry>Time zone abbreviation</entry>
10831 <entry><structfield>utc_offset</structfield></entry>
10832 <entry><type>interval</type></entry>
10833 <entry>Offset from UTC (positive means east of Greenwich)</entry>
10836 <entry><structfield>is_dst</structfield></entry>
10837 <entry><type>boolean</type></entry>
10838 <entry>True if this is a daylight-savings abbreviation</entry>
10845 While most timezone abbreviations represent fixed offsets from UTC,
10846 there are some that have historically varied in value
10847 (see <xref linkend="datetime-config-files"> for more information).
10848 In such cases this view presents their current meaning.
10853 <sect1 id="view-pg-timezone-names">
10854 <title><structname>pg_timezone_names</structname></title>
10856 <indexterm zone="view-pg-timezone-names">
10857 <primary>pg_timezone_names</primary>
10861 The view <structname>pg_timezone_names</structname> provides a list
10862 of time zone names that are recognized by <command>SET TIMEZONE</>,
10863 along with their associated abbreviations, UTC offsets,
10864 and daylight-savings status. (Technically,
10865 <productname>PostgreSQL</productname> does not use UTC because leap
10866 seconds are not handled.)
10867 Unlike the abbreviations shown in <link
10868 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
10869 date rules. Therefore, the associated information changes across local DST
10870 boundaries. The displayed information is computed based on the current
10871 value of <function>CURRENT_TIMESTAMP</>.
10875 <title><structname>pg_timezone_names</> Columns</title>
10880 <entry>Name</entry>
10881 <entry>Type</entry>
10882 <entry>Description</entry>
10887 <entry><structfield>name</structfield></entry>
10888 <entry><type>text</type></entry>
10889 <entry>Time zone name</entry>
10892 <entry><structfield>abbrev</structfield></entry>
10893 <entry><type>text</type></entry>
10894 <entry>Time zone abbreviation</entry>
10897 <entry><structfield>utc_offset</structfield></entry>
10898 <entry><type>interval</type></entry>
10899 <entry>Offset from UTC (positive means east of Greenwich)</entry>
10902 <entry><structfield>is_dst</structfield></entry>
10903 <entry><type>boolean</type></entry>
10904 <entry>True if currently observing daylight savings</entry>
10912 <sect1 id="view-pg-user">
10913 <title><structname>pg_user</structname></title>
10915 <indexterm zone="view-pg-user">
10916 <primary>pg_user</primary>
10920 The view <structname>pg_user</structname> provides access to
10921 information about database users. This is simply a publicly
10923 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
10924 that blanks out the password field.
10928 <title><structname>pg_user</> Columns</title>
10933 <entry>Name</entry>
10934 <entry>Type</entry>
10935 <entry>Description</entry>
10940 <entry><structfield>usename</structfield></entry>
10941 <entry><type>name</type></entry>
10942 <entry>User name</entry>
10946 <entry><structfield>usesysid</structfield></entry>
10947 <entry><type>oid</type></entry>
10948 <entry>ID of this user</entry>
10952 <entry><structfield>usecreatedb</structfield></entry>
10953 <entry><type>bool</type></entry>
10954 <entry>User can create databases</entry>
10958 <entry><structfield>usesuper</structfield></entry>
10959 <entry><type>bool</type></entry>
10960 <entry>User is a superuser</entry>
10964 <entry><structfield>userepl</structfield></entry>
10965 <entry><type>bool</type></entry>
10967 User can initiate streaming replication and put the system in and
10968 out of backup mode.
10973 <entry><structfield>usebypassrls</structfield></entry>
10974 <entry><type>bool</type></entry>
10976 User bypasses every row level security policy, see
10977 <xref linkend="ddl-rowsecurity"> for more information.
10982 <entry><structfield>passwd</structfield></entry>
10983 <entry><type>text</type></entry>
10984 <entry>Not the password (always reads as <literal>********</>)</entry>
10988 <entry><structfield>valuntil</structfield></entry>
10989 <entry><type>abstime</type></entry>
10990 <entry>Password expiry time (only used for password authentication)</entry>
10994 <entry><structfield>useconfig</structfield></entry>
10995 <entry><type>text[]</type></entry>
10996 <entry>Session defaults for run-time configuration variables</entry>
11004 <sect1 id="view-pg-user-mappings">
11005 <title><structname>pg_user_mappings</structname></title>
11007 <indexterm zone="view-pg-user-mappings">
11008 <primary>pg_user_mappings</primary>
11012 The view <structname>pg_user_mappings</structname> provides access
11013 to information about user mappings. This is essentially a publicly
11015 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
11016 that leaves out the options field if the user has no rights to use
11021 <title><structname>pg_user_mappings</> Columns</title>
11026 <entry>Name</entry>
11027 <entry>Type</entry>
11028 <entry>References</entry>
11029 <entry>Description</entry>
11035 <entry><structfield>umid</structfield></entry>
11036 <entry><type>oid</type></entry>
11037 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
11038 <entry>OID of the user mapping</entry>
11042 <entry><structfield>srvid</structfield></entry>
11043 <entry><type>oid</type></entry>
11044 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
11046 The OID of the foreign server that contains this mapping
11051 <entry><structfield>srvname</structfield></entry>
11052 <entry><type>name</type></entry>
11053 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
11055 Name of the foreign server
11060 <entry><structfield>umuser</structfield></entry>
11061 <entry><type>oid</type></entry>
11062 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
11063 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
11067 <entry><structfield>usename</structfield></entry>
11068 <entry><type>name</type></entry>
11070 <entry>Name of the local user to be mapped</entry>
11074 <entry><structfield>umoptions</structfield></entry>
11075 <entry><type>text[]</type></entry>
11078 User mapping specific options, as <quote>keyword=value</>
11079 strings, if the current user is the owner of the foreign
11089 <sect1 id="view-pg-views">
11090 <title><structname>pg_views</structname></title>
11092 <indexterm zone="view-pg-views">
11093 <primary>pg_views</primary>
11097 The view <structname>pg_views</structname> provides access to
11098 useful information about each view in the database.
11102 <title><structname>pg_views</> Columns</title>
11107 <entry>Name</entry>
11108 <entry>Type</entry>
11109 <entry>References</entry>
11110 <entry>Description</entry>
11115 <entry><structfield>schemaname</structfield></entry>
11116 <entry><type>name</type></entry>
11117 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
11118 <entry>Name of schema containing view</entry>
11121 <entry><structfield>viewname</structfield></entry>
11122 <entry><type>name</type></entry>
11123 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
11124 <entry>Name of view</entry>
11127 <entry><structfield>viewowner</structfield></entry>
11128 <entry><type>name</type></entry>
11129 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
11130 <entry>Name of view's owner</entry>
11133 <entry><structfield>definition</structfield></entry>
11134 <entry><type>text</type></entry>
11136 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>