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-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
225 <entry>information about partition key of tables</entry>
229 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
230 <entry>template data for procedural languages</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</>.
1383 If the password is encrypted with SCRAM-SHA-256, it has the format:
1385 SCRAM-SHA-256$<replaceable><iteration count></>:<replaceable><salt></>$<replaceable><StoredKey></>:<replaceable><ServerKey></>
1387 where <replaceable>salt</>, <replaceable>StoredKey</> and
1388 <replaceable>ServerKey</> are in Base64 encoded format. This format is
1389 the same as that specified by RFC 5803.
1393 A password that does not follow either of those formats is assumed to be
1399 <sect1 id="catalog-pg-auth-members">
1400 <title><structname>pg_auth_members</structname></title>
1402 <indexterm zone="catalog-pg-auth-members">
1403 <primary>pg_auth_members</primary>
1407 The catalog <structname>pg_auth_members</structname> shows the membership
1408 relations between roles. Any non-circular set of relationships is allowed.
1412 Because user identities are cluster-wide,
1413 <structname>pg_auth_members</structname>
1414 is shared across all databases of a cluster: there is only one
1415 copy of <structname>pg_auth_members</structname> per cluster, not
1420 <title><structname>pg_auth_members</> Columns</title>
1427 <entry>References</entry>
1428 <entry>Description</entry>
1434 <entry><structfield>roleid</structfield></entry>
1435 <entry><type>oid</type></entry>
1436 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1437 <entry>ID of a role that has a member</entry>
1441 <entry><structfield>member</structfield></entry>
1442 <entry><type>oid</type></entry>
1443 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1444 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1448 <entry><structfield>grantor</structfield></entry>
1449 <entry><type>oid</type></entry>
1450 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1451 <entry>ID of the role that granted this membership</entry>
1455 <entry><structfield>admin_option</structfield></entry>
1456 <entry><type>bool</type></entry>
1458 <entry>True if <structfield>member</> can grant membership in
1459 <structfield>roleid</> to others</entry>
1468 <sect1 id="catalog-pg-cast">
1469 <title><structname>pg_cast</structname></title>
1471 <indexterm zone="catalog-pg-cast">
1472 <primary>pg_cast</primary>
1476 The catalog <structname>pg_cast</structname> stores data type conversion
1477 paths, both built-in and user-defined.
1481 It should be noted that <structname>pg_cast</structname> does not represent
1482 every type conversion that the system knows how to perform; only those that
1483 cannot be deduced from some generic rule. For example, casting between a
1484 domain and its base type is not explicitly represented in
1485 <structname>pg_cast</structname>. Another important exception is that
1486 <quote>automatic I/O conversion casts</>, those performed using a data
1487 type's own I/O functions to convert to or from <type>text</> or other
1488 string types, are not explicitly represented in
1489 <structname>pg_cast</structname>.
1493 <title><structname>pg_cast</> Columns</title>
1500 <entry>References</entry>
1501 <entry>Description</entry>
1507 <entry><structfield>oid</structfield></entry>
1508 <entry><type>oid</type></entry>
1510 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1514 <entry><structfield>castsource</structfield></entry>
1515 <entry><type>oid</type></entry>
1516 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1517 <entry>OID of the source data type</entry>
1521 <entry><structfield>casttarget</structfield></entry>
1522 <entry><type>oid</type></entry>
1523 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1524 <entry>OID of the target data type</entry>
1528 <entry><structfield>castfunc</structfield></entry>
1529 <entry><type>oid</type></entry>
1530 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1532 The OID of the function to use to perform this cast. Zero is
1533 stored if the cast method doesn't require a function.
1538 <entry><structfield>castcontext</structfield></entry>
1539 <entry><type>char</type></entry>
1542 Indicates what contexts the cast can be invoked in.
1543 <literal>e</> means only as an explicit cast (using
1544 <literal>CAST</> or <literal>::</> syntax).
1545 <literal>a</> means implicitly in assignment
1546 to a target column, as well as explicitly.
1547 <literal>i</> means implicitly in expressions, as well as the
1552 <entry><structfield>castmethod</structfield></entry>
1553 <entry><type>char</type></entry>
1556 Indicates how the cast is performed.
1557 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1558 <literal>i</> means that the input/output functions are used.
1559 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1567 The cast functions listed in <structname>pg_cast</structname> must
1568 always take the cast source type as their first argument type, and
1569 return the cast destination type as their result type. A cast
1570 function can have up to three arguments. The second argument,
1571 if present, must be type <type>integer</>; it receives the type
1572 modifier associated with the destination type, or -1
1573 if there is none. The third argument,
1574 if present, must be type <type>boolean</>; it receives <literal>true</>
1575 if the cast is an explicit cast, <literal>false</> otherwise.
1579 It is legitimate to create a <structname>pg_cast</structname> entry
1580 in which the source and target types are the same, if the associated
1581 function takes more than one argument. Such entries represent
1582 <quote>length coercion functions</> that coerce values of the type
1583 to be legal for a particular type modifier value.
1587 When a <structname>pg_cast</structname> entry has different source and
1588 target types and a function that takes more than one argument, it
1589 represents converting from one type to another and applying a length
1590 coercion in a single step. When no such entry is available, coercion
1591 to a type that uses a type modifier involves two steps, one to
1592 convert between data types and a second to apply the modifier.
1596 <sect1 id="catalog-pg-class">
1597 <title><structname>pg_class</structname></title>
1599 <indexterm zone="catalog-pg-class">
1600 <primary>pg_class</primary>
1604 The catalog <structname>pg_class</structname> catalogs tables and most
1605 everything else that has columns or is otherwise similar to a
1606 table. This includes indexes (but see also
1607 <structname>pg_index</structname>), sequences (but see also
1608 <structname>pg_sequence</structname>), views, materialized
1609 views, composite types, and TOAST tables; see <structfield>relkind</>.
1610 Below, when we mean all of these
1611 kinds of objects we speak of <quote>relations</quote>. Not all
1612 columns are meaningful for all relation types.
1616 <title><structname>pg_class</> Columns</title>
1623 <entry>References</entry>
1624 <entry>Description</entry>
1630 <entry><structfield>oid</structfield></entry>
1631 <entry><type>oid</type></entry>
1633 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1637 <entry><structfield>relname</structfield></entry>
1638 <entry><type>name</type></entry>
1640 <entry>Name of the table, index, view, etc.</entry>
1644 <entry><structfield>relnamespace</structfield></entry>
1645 <entry><type>oid</type></entry>
1646 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1648 The OID of the namespace that contains this relation
1653 <entry><structfield>reltype</structfield></entry>
1654 <entry><type>oid</type></entry>
1655 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1657 The OID of the data type that corresponds to this table's row type,
1658 if any (zero for indexes, which have no <structname>pg_type</> entry)
1663 <entry><structfield>reloftype</structfield></entry>
1664 <entry><type>oid</type></entry>
1665 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1667 For typed tables, the OID of the underlying composite type,
1668 zero for all other relations
1673 <entry><structfield>relowner</structfield></entry>
1674 <entry><type>oid</type></entry>
1675 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1676 <entry>Owner of the relation</entry>
1680 <entry><structfield>relam</structfield></entry>
1681 <entry><type>oid</type></entry>
1682 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1683 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1687 <entry><structfield>relfilenode</structfield></entry>
1688 <entry><type>oid</type></entry>
1690 <entry>Name of the on-disk file of this relation; zero means this
1691 is a <quote>mapped</> relation whose disk file name is determined
1692 by low-level state</entry>
1696 <entry><structfield>reltablespace</structfield></entry>
1697 <entry><type>oid</type></entry>
1698 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1700 The tablespace in which this relation is stored. If zero,
1701 the database's default tablespace is implied. (Not meaningful
1702 if the relation has no on-disk file.)
1707 <entry><structfield>relpages</structfield></entry>
1708 <entry><type>int4</type></entry>
1711 Size of the on-disk representation of this table in pages (of size
1712 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1713 planner. It is updated by <command>VACUUM</command>,
1714 <command>ANALYZE</command>, and a few DDL commands such as
1715 <command>CREATE INDEX</command>.
1720 <entry><structfield>reltuples</structfield></entry>
1721 <entry><type>float4</type></entry>
1724 Number of rows in the table. This is only an estimate used by the
1725 planner. It is updated by <command>VACUUM</command>,
1726 <command>ANALYZE</command>, and a few DDL commands such as
1727 <command>CREATE INDEX</command>.
1732 <entry><structfield>relallvisible</structfield></entry>
1733 <entry><type>int4</type></entry>
1736 Number of pages that are marked all-visible in the table's
1737 visibility map. This is only an estimate used by the
1738 planner. It is updated by <command>VACUUM</command>,
1739 <command>ANALYZE</command>, and a few DDL commands such as
1740 <command>CREATE INDEX</command>.
1745 <entry><structfield>reltoastrelid</structfield></entry>
1746 <entry><type>oid</type></entry>
1747 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1749 OID of the TOAST table associated with this table, 0 if none. The
1750 TOAST table stores large attributes <quote>out of line</quote> in a
1756 <entry><structfield>relhasindex</structfield></entry>
1757 <entry><type>bool</type></entry>
1760 True if this is a table and it has (or recently had) any indexes
1765 <entry><structfield>relisshared</structfield></entry>
1766 <entry><type>bool</type></entry>
1769 True if this table is shared across all databases in the cluster. Only
1770 certain system catalogs (such as <structname>pg_database</structname>)
1776 <entry><structfield>relpersistence</structfield></entry>
1777 <entry><type>char</type></entry>
1780 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1781 <literal>t</> = temporary table
1786 <entry><structfield>relkind</structfield></entry>
1787 <entry><type>char</type></entry>
1790 <literal>r</> = ordinary table,
1791 <literal>i</> = index,
1792 <literal>S</> = sequence,
1793 <literal>t</> = TOAST table,
1794 <literal>v</> = view,
1795 <literal>m</> = materialized view,
1796 <literal>c</> = composite type,
1797 <literal>f</> = foreign table,
1798 <literal>p</> = partitioned table
1803 <entry><structfield>relnatts</structfield></entry>
1804 <entry><type>int2</type></entry>
1807 Number of user columns in the relation (system columns not
1808 counted). There must be this many corresponding entries in
1809 <structname>pg_attribute</structname>. See also
1810 <literal>pg_attribute.attnum</literal>.
1815 <entry><structfield>relchecks</structfield></entry>
1816 <entry><type>int2</type></entry>
1819 Number of <literal>CHECK</> constraints on the table; see
1820 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1825 <entry><structfield>relhasoids</structfield></entry>
1826 <entry><type>bool</type></entry>
1829 True if we generate an OID for each row of the relation
1834 <entry><structfield>relhaspkey</structfield></entry>
1835 <entry><type>bool</type></entry>
1838 True if the table has (or once had) a primary key
1843 <entry><structfield>relhasrules</structfield></entry>
1844 <entry><type>bool</type></entry>
1847 True if table has (or once had) rules; see
1848 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1853 <entry><structfield>relhastriggers</structfield></entry>
1854 <entry><type>bool</type></entry>
1857 True if table has (or once had) triggers; see
1858 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1863 <entry><structfield>relhassubclass</structfield></entry>
1864 <entry><type>bool</type></entry>
1866 <entry>True if table has (or once had) any inheritance children</entry>
1870 <entry><structfield>relrowsecurity</structfield></entry>
1871 <entry><type>bool</type></entry>
1874 True if table has row level security enabled; see
1875 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1880 <entry><structfield>relforcerowsecurity</structfield></entry>
1881 <entry><type>bool</type></entry>
1884 True if row level security (when enabled) will also apply to table owner; see
1885 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1890 <entry><structfield>relispopulated</structfield></entry>
1891 <entry><type>bool</type></entry>
1893 <entry>True if relation is populated (this is true for all
1894 relations other than some materialized views)</entry>
1898 <entry><structfield>relreplident</structfield></entry>
1899 <entry><type>char</type></entry>
1902 Columns used to form <quote>replica identity</> for rows:
1903 <literal>d</> = default (primary key, if any),
1904 <literal>n</> = nothing,
1905 <literal>f</> = all columns
1906 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1911 <entry><structfield>relispartition</structfield></entry>
1912 <entry><type>bool</type></entry>
1914 <entry>True if table is a partition</entry>
1918 <entry><structfield>relfrozenxid</structfield></entry>
1919 <entry><type>xid</type></entry>
1922 All transaction IDs before this one have been replaced with a permanent
1923 (<quote>frozen</>) transaction ID in this table. This is used to track
1924 whether the table needs to be vacuumed in order to prevent transaction
1925 ID wraparound or to allow <literal>pg_xact</> to be shrunk. Zero
1926 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1931 <entry><structfield>relminmxid</structfield></entry>
1932 <entry><type>xid</type></entry>
1935 All multixact IDs before this one have been replaced by a
1936 transaction ID in this table. This is used to track
1937 whether the table needs to be vacuumed in order to prevent multixact ID
1938 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
1939 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1944 <entry><structfield>relacl</structfield></entry>
1945 <entry><type>aclitem[]</type></entry>
1948 Access privileges; see
1949 <xref linkend="sql-grant"> and
1950 <xref linkend="sql-revoke">
1956 <entry><structfield>reloptions</structfield></entry>
1957 <entry><type>text[]</type></entry>
1960 Access-method-specific options, as <quote>keyword=value</> strings
1965 <entry><structfield>relpartbound</structfield></entry>
1966 <entry><type>pg_node_tree</type></entry>
1969 If table is a partition (see <structfield>relispartition</structfield>),
1970 internal representation of the partition bound
1978 Several of the Boolean flags in <structname>pg_class</> are maintained
1979 lazily: they are guaranteed to be true if that's the correct state, but
1980 may not be reset to false immediately when the condition is no longer
1981 true. For example, <structfield>relhasindex</> is set by
1982 <command>CREATE INDEX</command>, but it is never cleared by
1983 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1984 <structfield>relhasindex</> if it finds the table has no indexes. This
1985 arrangement avoids race conditions and improves concurrency.
1989 <sect1 id="catalog-pg-collation">
1990 <title><structname>pg_collation</structname></title>
1992 <indexterm zone="catalog-pg-collation">
1993 <primary>pg_collation</primary>
1997 The catalog <structname>pg_collation</structname> describes the
1998 available collations, which are essentially mappings from an SQL
1999 name to operating system locale categories.
2000 See <xref linkend="collation"> for more information.
2004 <title><structname>pg_collation</> Columns</title>
2011 <entry>References</entry>
2012 <entry>Description</entry>
2018 <entry><structfield>oid</structfield></entry>
2019 <entry><type>oid</type></entry>
2021 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2025 <entry><structfield>collname</structfield></entry>
2026 <entry><type>name</type></entry>
2028 <entry>Collation name (unique per namespace and encoding)</entry>
2032 <entry><structfield>collnamespace</structfield></entry>
2033 <entry><type>oid</type></entry>
2034 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2036 The OID of the namespace that contains this collation
2041 <entry><structfield>collowner</structfield></entry>
2042 <entry><type>oid</type></entry>
2043 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2044 <entry>Owner of the collation</entry>
2048 <entry><structfield>collprovider</structfield></entry>
2049 <entry><type>char</type></entry>
2051 <entry>Provider of the collation: <literal>d</literal> = database
2052 default, <literal>c</literal> = libc, <literal>i</literal> = icu</entry>
2056 <entry><structfield>collencoding</structfield></entry>
2057 <entry><type>int4</type></entry>
2059 <entry>Encoding in which the collation is applicable, or -1 if it
2060 works for any encoding</entry>
2064 <entry><structfield>collcollate</structfield></entry>
2065 <entry><type>name</type></entry>
2067 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2071 <entry><structfield>collctype</structfield></entry>
2072 <entry><type>name</type></entry>
2074 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2078 <entry><structfield>collversion</structfield></entry>
2079 <entry><type>text</type></entry>
2082 Provider-specific version of the collation. This is recorded when the
2083 collation is created and then checked when it is used, to detect
2084 changes in the collation definition that could lead to data corruption.
2092 Note that the unique key on this catalog is (<structfield>collname</>,
2093 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2094 (<structfield>collname</>, <structfield>collnamespace</>).
2095 <productname>PostgreSQL</productname> generally ignores all
2096 collations that do not have <structfield>collencoding</> equal to
2097 either the current database's encoding or -1, and creation of new entries
2098 with the same name as an entry with <structfield>collencoding</> = -1
2099 is forbidden. Therefore it is sufficient to use a qualified SQL name
2100 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2101 even though this is not unique according to the catalog definition.
2102 The reason for defining the catalog this way is that
2103 <application>initdb</> fills it in at cluster initialization time with
2104 entries for all locales available on the system, so it must be able to
2105 hold entries for all encodings that might ever be used in the cluster.
2109 In the <literal>template0</> database, it could be useful to create
2110 collations whose encoding does not match the database encoding,
2111 since they could match the encodings of databases later cloned from
2112 <literal>template0</>. This would currently have to be done manually.
2116 <sect1 id="catalog-pg-constraint">
2117 <title><structname>pg_constraint</structname></title>
2119 <indexterm zone="catalog-pg-constraint">
2120 <primary>pg_constraint</primary>
2124 The catalog <structname>pg_constraint</structname> stores check, primary
2125 key, unique, foreign key, and exclusion constraints on tables.
2126 (Column constraints are not treated specially. Every column constraint is
2127 equivalent to some table constraint.)
2128 Not-null constraints are represented in the <structname>pg_attribute</>
2133 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2134 TRIGGER</>) also give rise to an entry in this table.
2138 Check constraints on domains are stored here, too.
2142 <title><structname>pg_constraint</> Columns</title>
2149 <entry>References</entry>
2150 <entry>Description</entry>
2156 <entry><structfield>oid</structfield></entry>
2157 <entry><type>oid</type></entry>
2159 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2163 <entry><structfield>conname</structfield></entry>
2164 <entry><type>name</type></entry>
2166 <entry>Constraint name (not necessarily unique!)</entry>
2170 <entry><structfield>connamespace</structfield></entry>
2171 <entry><type>oid</type></entry>
2172 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2174 The OID of the namespace that contains this constraint
2179 <entry><structfield>contype</structfield></entry>
2180 <entry><type>char</type></entry>
2183 <literal>c</> = check constraint,
2184 <literal>f</> = foreign key constraint,
2185 <literal>p</> = primary key constraint,
2186 <literal>u</> = unique constraint,
2187 <literal>t</> = constraint trigger,
2188 <literal>x</> = exclusion constraint
2193 <entry><structfield>condeferrable</structfield></entry>
2194 <entry><type>bool</type></entry>
2196 <entry>Is the constraint deferrable?</entry>
2200 <entry><structfield>condeferred</structfield></entry>
2201 <entry><type>bool</type></entry>
2203 <entry>Is the constraint deferred by default?</entry>
2207 <entry><structfield>convalidated</structfield></entry>
2208 <entry><type>bool</type></entry>
2210 <entry>Has the constraint been validated?
2211 Currently, can only be false for foreign keys and CHECK constraints</entry>
2215 <entry><structfield>conrelid</structfield></entry>
2216 <entry><type>oid</type></entry>
2217 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2218 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2222 <entry><structfield>contypid</structfield></entry>
2223 <entry><type>oid</type></entry>
2224 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2225 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2229 <entry><structfield>conindid</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>The index supporting this constraint, if it's a unique, primary
2233 key, foreign key, or exclusion constraint; else 0</entry>
2237 <entry><structfield>confrelid</structfield></entry>
2238 <entry><type>oid</type></entry>
2239 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2240 <entry>If a foreign key, the referenced table; else 0</entry>
2244 <entry><structfield>confupdtype</structfield></entry>
2245 <entry><type>char</type></entry>
2247 <entry>Foreign key update action code:
2248 <literal>a</> = no action,
2249 <literal>r</> = restrict,
2250 <literal>c</> = cascade,
2251 <literal>n</> = set null,
2252 <literal>d</> = set default
2257 <entry><structfield>confdeltype</structfield></entry>
2258 <entry><type>char</type></entry>
2260 <entry>Foreign key deletion action code:
2261 <literal>a</> = no action,
2262 <literal>r</> = restrict,
2263 <literal>c</> = cascade,
2264 <literal>n</> = set null,
2265 <literal>d</> = set default
2270 <entry><structfield>confmatchtype</structfield></entry>
2271 <entry><type>char</type></entry>
2273 <entry>Foreign key match type:
2274 <literal>f</> = full,
2275 <literal>p</> = partial,
2276 <literal>s</> = simple
2281 <entry><structfield>conislocal</structfield></entry>
2282 <entry><type>bool</type></entry>
2285 This constraint is defined locally for the relation. Note that a
2286 constraint can be locally defined and inherited simultaneously.
2291 <entry><structfield>coninhcount</structfield></entry>
2292 <entry><type>int4</type></entry>
2295 The number of direct inheritance ancestors this constraint has.
2297 a nonzero number of ancestors cannot be dropped nor renamed.
2302 <entry><structfield>connoinherit</structfield></entry>
2303 <entry><type>bool</type></entry>
2306 This constraint is defined locally for the relation. It is a
2307 non-inheritable constraint.
2312 <entry><structfield>conkey</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 table constraint (including foreign keys, but not constraint
2316 triggers), list of the constrained columns</entry>
2320 <entry><structfield>confkey</structfield></entry>
2321 <entry><type>int2[]</type></entry>
2322 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2323 <entry>If a foreign key, list of the referenced columns</entry>
2327 <entry><structfield>conpfeqop</structfield></entry>
2328 <entry><type>oid[]</type></entry>
2329 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2330 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2334 <entry><structfield>conppeqop</structfield></entry>
2335 <entry><type>oid[]</type></entry>
2336 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2337 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2341 <entry><structfield>conffeqop</structfield></entry>
2342 <entry><type>oid[]</type></entry>
2343 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2344 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2348 <entry><structfield>conexclop</structfield></entry>
2349 <entry><type>oid[]</type></entry>
2350 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2351 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2355 <entry><structfield>conbin</structfield></entry>
2356 <entry><type>pg_node_tree</type></entry>
2358 <entry>If a check constraint, an internal representation of the expression</entry>
2362 <entry><structfield>consrc</structfield></entry>
2363 <entry><type>text</type></entry>
2365 <entry>If a check constraint, a human-readable representation of the expression</entry>
2372 In the case of an exclusion constraint, <structfield>conkey</structfield>
2373 is only useful for constraint elements that are simple column references.
2374 For other cases, a zero appears in <structfield>conkey</structfield>
2375 and the associated index must be consulted to discover the expression
2376 that is constrained. (<structfield>conkey</structfield> thus has the
2377 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2383 <structfield>consrc</structfield> is not updated when referenced objects
2384 change; for example, it won't track renaming of columns. Rather than
2385 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2386 to extract the definition of a check constraint.
2392 <literal>pg_class.relchecks</literal> needs to agree with the
2393 number of check-constraint entries found in this table for each
2400 <sect1 id="catalog-pg-conversion">
2401 <title><structname>pg_conversion</structname></title>
2403 <indexterm zone="catalog-pg-conversion">
2404 <primary>pg_conversion</primary>
2408 The catalog <structname>pg_conversion</structname> describes
2409 encoding conversion procedures. See <xref linkend="sql-createconversion">
2410 for more information.
2414 <title><structname>pg_conversion</> Columns</title>
2421 <entry>References</entry>
2422 <entry>Description</entry>
2428 <entry><structfield>oid</structfield></entry>
2429 <entry><type>oid</type></entry>
2431 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2435 <entry><structfield>conname</structfield></entry>
2436 <entry><type>name</type></entry>
2438 <entry>Conversion name (unique within a namespace)</entry>
2442 <entry><structfield>connamespace</structfield></entry>
2443 <entry><type>oid</type></entry>
2444 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2446 The OID of the namespace that contains this conversion
2451 <entry><structfield>conowner</structfield></entry>
2452 <entry><type>oid</type></entry>
2453 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2454 <entry>Owner of the conversion</entry>
2458 <entry><structfield>conforencoding</structfield></entry>
2459 <entry><type>int4</type></entry>
2461 <entry>Source encoding ID</entry>
2465 <entry><structfield>contoencoding</structfield></entry>
2466 <entry><type>int4</type></entry>
2468 <entry>Destination encoding ID</entry>
2472 <entry><structfield>conproc</structfield></entry>
2473 <entry><type>regproc</type></entry>
2474 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2475 <entry>Conversion procedure</entry>
2479 <entry><structfield>condefault</structfield></entry>
2480 <entry><type>bool</type></entry>
2482 <entry>True if this is the default conversion</entry>
2491 <sect1 id="catalog-pg-database">
2492 <title><structname>pg_database</structname></title>
2494 <indexterm zone="catalog-pg-database">
2495 <primary>pg_database</primary>
2499 The catalog <structname>pg_database</structname> stores information about
2500 the available databases. Databases are created with the <xref
2501 linkend="sql-createdatabase"> command.
2502 Consult <xref linkend="managing-databases"> for details about the meaning
2503 of some of the parameters.
2507 Unlike most system catalogs, <structname>pg_database</structname>
2508 is shared across all databases of a cluster: there is only one
2509 copy of <structname>pg_database</structname> per cluster, not
2514 <title><structname>pg_database</> Columns</title>
2521 <entry>References</entry>
2522 <entry>Description</entry>
2528 <entry><structfield>oid</structfield></entry>
2529 <entry><type>oid</type></entry>
2531 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2535 <entry><structfield>datname</structfield></entry>
2536 <entry><type>name</type></entry>
2538 <entry>Database name</entry>
2542 <entry><structfield>datdba</structfield></entry>
2543 <entry><type>oid</type></entry>
2544 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2545 <entry>Owner of the database, usually the user who created it</entry>
2549 <entry><structfield>encoding</structfield></entry>
2550 <entry><type>int4</type></entry>
2552 <entry>Character encoding for this database
2553 (<function>pg_encoding_to_char()</function> can translate
2554 this number to the encoding name)</entry>
2558 <entry><structfield>datcollate</structfield></entry>
2559 <entry><type>name</type></entry>
2561 <entry>LC_COLLATE for this database</entry>
2565 <entry><structfield>datctype</structfield></entry>
2566 <entry><type>name</type></entry>
2568 <entry>LC_CTYPE for this database</entry>
2572 <entry><structfield>datistemplate</structfield></entry>
2573 <entry><type>bool</type></entry>
2576 If true, then this database can be cloned by
2577 any user with <literal>CREATEDB</> privileges;
2578 if false, then only superusers or the owner of
2579 the database can clone it.
2584 <entry><structfield>datallowconn</structfield></entry>
2585 <entry><type>bool</type></entry>
2588 If false then no one can connect to this database. This is
2589 used to protect the <literal>template0</> database from being altered.
2594 <entry><structfield>datconnlimit</structfield></entry>
2595 <entry><type>int4</type></entry>
2598 Sets maximum number of concurrent connections that can be made
2599 to this database. -1 means no limit.
2604 <entry><structfield>datlastsysoid</structfield></entry>
2605 <entry><type>oid</type></entry>
2608 Last system OID in the database; useful
2609 particularly to <application>pg_dump</application>
2614 <entry><structfield>datfrozenxid</structfield></entry>
2615 <entry><type>xid</type></entry>
2618 All transaction IDs before this one have been replaced with a permanent
2619 (<quote>frozen</>) transaction ID in this database. This is used to
2620 track whether the database needs to be vacuumed in order to prevent
2621 transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
2622 It is the minimum of the per-table
2623 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2628 <entry><structfield>datminmxid</structfield></entry>
2629 <entry><type>xid</type></entry>
2632 All multixact IDs before this one have been replaced with a
2633 transaction ID in this database. This is used to
2634 track whether the database needs to be vacuumed in order to prevent
2635 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2636 It is the minimum of the per-table
2637 <structname>pg_class</>.<structfield>relminmxid</> values.
2642 <entry><structfield>dattablespace</structfield></entry>
2643 <entry><type>oid</type></entry>
2644 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2646 The default tablespace for the database.
2647 Within this database, all tables for which
2648 <structname>pg_class</>.<structfield>reltablespace</> is zero
2649 will be stored in this tablespace; in particular, all the non-shared
2650 system catalogs will be there.
2655 <entry><structfield>datacl</structfield></entry>
2656 <entry><type>aclitem[]</type></entry>
2659 Access privileges; see
2660 <xref linkend="sql-grant"> and
2661 <xref linkend="sql-revoke">
2671 <sect1 id="catalog-pg-db-role-setting">
2672 <title><structname>pg_db_role_setting</structname></title>
2674 <indexterm zone="catalog-pg-db-role-setting">
2675 <primary>pg_db_role_setting</primary>
2679 The catalog <structname>pg_db_role_setting</structname> records the default
2680 values that have been set for run-time configuration variables,
2681 for each role and database combination.
2685 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2686 is shared across all databases of a cluster: there is only one
2687 copy of <structname>pg_db_role_setting</structname> per cluster, not
2692 <title><structname>pg_db_role_setting</> Columns</title>
2699 <entry>References</entry>
2700 <entry>Description</entry>
2706 <entry><structfield>setdatabase</structfield></entry>
2707 <entry><type>oid</type></entry>
2708 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2709 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2713 <entry><structfield>setrole</structfield></entry>
2714 <entry><type>oid</type></entry>
2715 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2716 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2720 <entry><structfield>setconfig</structfield></entry>
2721 <entry><type>text[]</type></entry>
2723 <entry>Defaults for run-time configuration variables</entry>
2731 <sect1 id="catalog-pg-default-acl">
2732 <title><structname>pg_default_acl</structname></title>
2734 <indexterm zone="catalog-pg-default-acl">
2735 <primary>pg_default_acl</primary>
2739 The catalog <structname>pg_default_acl</> stores initial
2740 privileges to be assigned to newly created objects.
2744 <title><structname>pg_default_acl</> Columns</title>
2751 <entry>References</entry>
2752 <entry>Description</entry>
2758 <entry><structfield>oid</structfield></entry>
2759 <entry><type>oid</type></entry>
2761 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2765 <entry><structfield>defaclrole</structfield></entry>
2766 <entry><type>oid</type></entry>
2767 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2768 <entry>The OID of the role associated with this entry</entry>
2772 <entry><structfield>defaclnamespace</structfield></entry>
2773 <entry><type>oid</type></entry>
2774 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2775 <entry>The OID of the namespace associated with this entry,
2776 or 0 if none</entry>
2780 <entry><structfield>defaclobjtype</structfield></entry>
2781 <entry><type>char</type></entry>
2784 Type of object this entry is for:
2785 <literal>r</> = relation (table, view),
2786 <literal>S</> = sequence,
2787 <literal>f</> = function,
2788 <literal>T</> = type
2793 <entry><structfield>defaclacl</structfield></entry>
2794 <entry><type>aclitem[]</type></entry>
2797 Access privileges that this type of object should have on creation
2805 A <structname>pg_default_acl</> entry shows the initial privileges to
2806 be assigned to an object belonging to the indicated user. There are
2807 currently two types of entry: <quote>global</> entries with
2808 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2809 that reference a particular schema. If a global entry is present then
2810 it <emphasis>overrides</> the normal hard-wired default privileges
2811 for the object type. A per-schema entry, if present, represents privileges
2812 to be <emphasis>added to</> the global or hard-wired default privileges.
2816 Note that when an ACL entry in another catalog is null, it is taken
2817 to represent the hard-wired default privileges for its object,
2818 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2819 at the moment. <structname>pg_default_acl</> is only consulted during
2826 <sect1 id="catalog-pg-depend">
2827 <title><structname>pg_depend</structname></title>
2829 <indexterm zone="catalog-pg-depend">
2830 <primary>pg_depend</primary>
2834 The catalog <structname>pg_depend</structname> records the dependency
2835 relationships between database objects. This information allows
2836 <command>DROP</> commands to find which other objects must be dropped
2837 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2842 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2843 which performs a similar function for dependencies involving objects
2844 that are shared across a database cluster.
2848 <title><structname>pg_depend</> Columns</title>
2855 <entry>References</entry>
2856 <entry>Description</entry>
2862 <entry><structfield>classid</structfield></entry>
2863 <entry><type>oid</type></entry>
2864 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2865 <entry>The OID of the system catalog the dependent object is in</entry>
2869 <entry><structfield>objid</structfield></entry>
2870 <entry><type>oid</type></entry>
2871 <entry>any OID column</entry>
2872 <entry>The OID of the specific dependent object</entry>
2876 <entry><structfield>objsubid</structfield></entry>
2877 <entry><type>int4</type></entry>
2880 For a table column, this is the column number (the
2881 <structfield>objid</> and <structfield>classid</> refer to the
2882 table itself). For all other object types, this column is
2888 <entry><structfield>refclassid</structfield></entry>
2889 <entry><type>oid</type></entry>
2890 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2891 <entry>The OID of the system catalog the referenced object is in</entry>
2895 <entry><structfield>refobjid</structfield></entry>
2896 <entry><type>oid</type></entry>
2897 <entry>any OID column</entry>
2898 <entry>The OID of the specific referenced object</entry>
2902 <entry><structfield>refobjsubid</structfield></entry>
2903 <entry><type>int4</type></entry>
2906 For a table column, this is the column number (the
2907 <structfield>refobjid</> and <structfield>refclassid</> refer
2908 to the table itself). For all other object types, this column
2914 <entry><structfield>deptype</structfield></entry>
2915 <entry><type>char</type></entry>
2918 A code defining the specific semantics of this dependency relationship; see text
2927 In all cases, a <structname>pg_depend</structname> entry indicates that the
2928 referenced object cannot be dropped without also dropping the dependent
2929 object. However, there are several subflavors identified by
2930 <structfield>deptype</>:
2934 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2937 A normal relationship between separately-created objects. The
2938 dependent object can be dropped without affecting the
2939 referenced object. The referenced object can only be dropped
2940 by specifying <literal>CASCADE</>, in which case the dependent
2941 object is dropped, too. Example: a table column has a normal
2942 dependency on its data type.
2948 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2951 The dependent object can be dropped separately from the
2952 referenced object, and should be automatically dropped
2953 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2954 mode) if the referenced object is dropped. Example: a named
2955 constraint on a table is made autodependent on the table, so
2956 that it will go away if the table is dropped.
2962 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2965 The dependent object was created as part of creation of the
2966 referenced object, and is really just a part of its internal
2967 implementation. A <command>DROP</> of the dependent object
2968 will be disallowed outright (we'll tell the user to issue a
2969 <command>DROP</> against the referenced object, instead). A
2970 <command>DROP</> of the referenced object will be propagated
2971 through to drop the dependent object whether
2972 <command>CASCADE</> is specified or not. Example: a trigger
2973 that's created to enforce a foreign-key constraint is made
2974 internally dependent on the constraint's
2975 <structname>pg_constraint</> entry.
2981 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2984 The dependent object is a member of the <firstterm>extension</> that is
2985 the referenced object (see
2986 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2987 The dependent object can be dropped only via
2988 <command>DROP EXTENSION</> on the referenced object. Functionally
2989 this dependency type acts the same as an internal dependency, but
2990 it's kept separate for clarity and to simplify <application>pg_dump</>.
2996 <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2999 The dependent object is not a member of the extension that is the
3000 referenced object (and so should not be ignored by pg_dump), but
3001 cannot function without it and should be dropped when the
3002 extension itself is. The dependent object may be dropped on its
3009 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3012 There is no dependent object; this type of entry is a signal
3013 that the system itself depends on the referenced object, and so
3014 that object must never be deleted. Entries of this type are
3015 created only by <command>initdb</command>. The columns for the
3016 dependent object contain zeroes.
3022 Other dependency flavors might be needed in future.
3028 <sect1 id="catalog-pg-description">
3029 <title><structname>pg_description</structname></title>
3031 <indexterm zone="catalog-pg-description">
3032 <primary>pg_description</primary>
3036 The catalog <structname>pg_description</> stores optional descriptions
3037 (comments) for each database object. Descriptions can be manipulated
3038 with the <xref linkend="sql-comment"> command and viewed with
3039 <application>psql</application>'s <literal>\d</literal> commands.
3040 Descriptions of many built-in system objects are provided in the initial
3041 contents of <structname>pg_description</structname>.
3045 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3046 which performs a similar function for descriptions involving objects that
3047 are shared across a database cluster.
3051 <title><structname>pg_description</> Columns</title>
3058 <entry>References</entry>
3059 <entry>Description</entry>
3065 <entry><structfield>objoid</structfield></entry>
3066 <entry><type>oid</type></entry>
3067 <entry>any OID column</entry>
3068 <entry>The OID of the object this description pertains to</entry>
3072 <entry><structfield>classoid</structfield></entry>
3073 <entry><type>oid</type></entry>
3074 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3075 <entry>The OID of the system catalog this object appears in</entry>
3079 <entry><structfield>objsubid</structfield></entry>
3080 <entry><type>int4</type></entry>
3083 For a comment on a table column, this is the column number (the
3084 <structfield>objoid</> and <structfield>classoid</> refer to
3085 the table itself). For all other object types, this column is
3091 <entry><structfield>description</structfield></entry>
3092 <entry><type>text</type></entry>
3094 <entry>Arbitrary text that serves as the description of this object</entry>
3103 <sect1 id="catalog-pg-enum">
3104 <title><structname>pg_enum</structname></title>
3106 <indexterm zone="catalog-pg-enum">
3107 <primary>pg_enum</primary>
3111 The <structname>pg_enum</structname> catalog contains entries
3112 showing the values and labels for each enum type. The
3113 internal representation of a given enum value is actually the OID
3114 of its associated row in <structname>pg_enum</structname>.
3118 <title><structname>pg_enum</> Columns</title>
3125 <entry>References</entry>
3126 <entry>Description</entry>
3132 <entry><structfield>oid</structfield></entry>
3133 <entry><type>oid</type></entry>
3135 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3139 <entry><structfield>enumtypid</structfield></entry>
3140 <entry><type>oid</type></entry>
3141 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3142 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3146 <entry><structfield>enumsortorder</structfield></entry>
3147 <entry><type>float4</type></entry>
3149 <entry>The sort position of this enum value within its enum type</entry>
3153 <entry><structfield>enumlabel</structfield></entry>
3154 <entry><type>name</type></entry>
3156 <entry>The textual label for this enum value</entry>
3163 The OIDs for <structname>pg_enum</structname> rows follow a special
3164 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3165 as the sort ordering of their enum type. That is, if two even OIDs
3166 belong to the same enum type, the smaller OID must have the smaller
3167 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3168 need bear no relationship to the sort order. This rule allows the
3169 enum comparison routines to avoid catalog lookups in many common cases.
3170 The routines that create and alter enum types attempt to assign even
3171 OIDs to enum values whenever possible.
3175 When an enum type is created, its members are assigned sort-order
3176 positions 1..<replaceable>n</>. But members added later might be given
3177 negative or fractional values of <structfield>enumsortorder</structfield>.
3178 The only requirement on these values is that they be correctly
3179 ordered and unique within each enum type.
3184 <sect1 id="catalog-pg-event-trigger">
3185 <title><structname>pg_event_trigger</structname></title>
3187 <indexterm zone="catalog-pg-event-trigger">
3188 <primary>pg_event_trigger</primary>
3192 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3193 See <xref linkend="event-triggers"> for more information.
3197 <title><structname>pg_event_trigger</> Columns</title>
3204 <entry>References</entry>
3205 <entry>Description</entry>
3211 <entry><structfield>evtname</structfield></entry>
3212 <entry><type>name</type></entry>
3214 <entry>Trigger name (must be unique)</entry>
3218 <entry><structfield>evtevent</structfield></entry>
3219 <entry><type>name</type></entry>
3221 <entry>Identifies the event for which this trigger fires</entry>
3225 <entry><structfield>evtowner</structfield></entry>
3226 <entry><type>oid</type></entry>
3227 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3228 <entry>Owner of the event trigger</entry>
3232 <entry><structfield>evtfoid</structfield></entry>
3233 <entry><type>oid</type></entry>
3234 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3235 <entry>The function to be called</entry>
3239 <entry><structfield>evtenabled</structfield></entry>
3240 <entry><type>char</type></entry>
3243 Controls in which <xref linkend="guc-session-replication-role"> modes
3244 the event trigger fires.
3245 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3246 <literal>D</> = trigger is disabled,
3247 <literal>R</> = trigger fires in <quote>replica</> mode,
3248 <literal>A</> = trigger fires always.
3253 <entry><structfield>evttags</structfield></entry>
3254 <entry><type>text[]</type></entry>
3257 Command tags for which this trigger will fire. If NULL, the firing
3258 of this trigger is not restricted on the basis of the command tag.
3267 <sect1 id="catalog-pg-extension">
3268 <title><structname>pg_extension</structname></title>
3270 <indexterm zone="catalog-pg-extension">
3271 <primary>pg_extension</primary>
3275 The catalog <structname>pg_extension</structname> stores information
3276 about the installed extensions. See <xref linkend="extend-extensions">
3277 for details about extensions.
3281 <title><structname>pg_extension</> Columns</title>
3288 <entry>References</entry>
3289 <entry>Description</entry>
3295 <entry><structfield>oid</structfield></entry>
3296 <entry><type>oid</type></entry>
3298 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3302 <entry><structfield>extname</structfield></entry>
3303 <entry><type>name</type></entry>
3305 <entry>Name of the extension</entry>
3309 <entry><structfield>extowner</structfield></entry>
3310 <entry><type>oid</type></entry>
3311 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3312 <entry>Owner of the extension</entry>
3316 <entry><structfield>extnamespace</structfield></entry>
3317 <entry><type>oid</type></entry>
3318 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3319 <entry>Schema containing the extension's exported objects</entry>
3323 <entry><structfield>extrelocatable</structfield></entry>
3324 <entry><type>bool</type></entry>
3326 <entry>True if extension can be relocated to another schema</entry>
3330 <entry><structfield>extversion</structfield></entry>
3331 <entry><type>text</type></entry>
3333 <entry>Version name for the extension</entry>
3337 <entry><structfield>extconfig</structfield></entry>
3338 <entry><type>oid[]</type></entry>
3339 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3340 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3341 table(s), or <literal>NULL</> if none</entry>
3345 <entry><structfield>extcondition</structfield></entry>
3346 <entry><type>text[]</type></entry>
3348 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3349 extension's configuration table(s), or <literal>NULL</> if none</entry>
3357 Note that unlike most catalogs with a <quote>namespace</> column,
3358 <structfield>extnamespace</structfield> is not meant to imply
3359 that the extension belongs to that schema. Extension names are never
3360 schema-qualified. Rather, <structfield>extnamespace</structfield>
3361 indicates the schema that contains most or all of the extension's
3362 objects. If <structfield>extrelocatable</structfield> is true, then
3363 this schema must in fact contain all schema-qualifiable objects
3364 belonging to the extension.
3369 <sect1 id="catalog-pg-foreign-data-wrapper">
3370 <title><structname>pg_foreign_data_wrapper</structname></title>
3372 <indexterm zone="catalog-pg-foreign-data-wrapper">
3373 <primary>pg_foreign_data_wrapper</primary>
3377 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3378 foreign-data wrapper definitions. A foreign-data wrapper is the
3379 mechanism by which external data, residing on foreign servers, is
3384 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3391 <entry>References</entry>
3392 <entry>Description</entry>
3398 <entry><structfield>oid</structfield></entry>
3399 <entry><type>oid</type></entry>
3401 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3405 <entry><structfield>fdwname</structfield></entry>
3406 <entry><type>name</type></entry>
3408 <entry>Name of the foreign-data wrapper</entry>
3412 <entry><structfield>fdwowner</structfield></entry>
3413 <entry><type>oid</type></entry>
3414 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3415 <entry>Owner of the foreign-data wrapper</entry>
3419 <entry><structfield>fdwhandler</structfield></entry>
3420 <entry><type>oid</type></entry>
3421 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3423 References a handler function that is responsible for
3424 supplying execution routines for the foreign-data wrapper.
3425 Zero if no handler is provided
3430 <entry><structfield>fdwvalidator</structfield></entry>
3431 <entry><type>oid</type></entry>
3432 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3434 References a validator function that is responsible for
3435 checking the validity of the options given to the
3436 foreign-data wrapper, as well as options for foreign servers and user
3437 mappings using the foreign-data wrapper. Zero if no validator
3443 <entry><structfield>fdwacl</structfield></entry>
3444 <entry><type>aclitem[]</type></entry>
3447 Access privileges; see
3448 <xref linkend="sql-grant"> and
3449 <xref linkend="sql-revoke">
3455 <entry><structfield>fdwoptions</structfield></entry>
3456 <entry><type>text[]</type></entry>
3459 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3468 <sect1 id="catalog-pg-foreign-server">
3469 <title><structname>pg_foreign_server</structname></title>
3471 <indexterm zone="catalog-pg-foreign-server">
3472 <primary>pg_foreign_server</primary>
3476 The catalog <structname>pg_foreign_server</structname> stores
3477 foreign server definitions. A foreign server describes a source
3478 of external data, such as a remote server. Foreign
3479 servers are accessed via foreign-data wrappers.
3483 <title><structname>pg_foreign_server</> Columns</title>
3490 <entry>References</entry>
3491 <entry>Description</entry>
3497 <entry><structfield>oid</structfield></entry>
3498 <entry><type>oid</type></entry>
3500 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3504 <entry><structfield>srvname</structfield></entry>
3505 <entry><type>name</type></entry>
3507 <entry>Name of the foreign server</entry>
3511 <entry><structfield>srvowner</structfield></entry>
3512 <entry><type>oid</type></entry>
3513 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3514 <entry>Owner of the foreign server</entry>
3518 <entry><structfield>srvfdw</structfield></entry>
3519 <entry><type>oid</type></entry>
3520 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3521 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3525 <entry><structfield>srvtype</structfield></entry>
3526 <entry><type>text</type></entry>
3528 <entry>Type of the server (optional)</entry>
3532 <entry><structfield>srvversion</structfield></entry>
3533 <entry><type>text</type></entry>
3535 <entry>Version of the server (optional)</entry>
3539 <entry><structfield>srvacl</structfield></entry>
3540 <entry><type>aclitem[]</type></entry>
3543 Access privileges; see
3544 <xref linkend="sql-grant"> and
3545 <xref linkend="sql-revoke">
3551 <entry><structfield>srvoptions</structfield></entry>
3552 <entry><type>text[]</type></entry>
3555 Foreign server specific options, as <quote>keyword=value</> strings
3564 <sect1 id="catalog-pg-foreign-table">
3565 <title><structname>pg_foreign_table</structname></title>
3567 <indexterm zone="catalog-pg-foreign-table">
3568 <primary>pg_foreign_table</primary>
3572 The catalog <structname>pg_foreign_table</structname> contains
3573 auxiliary information about foreign tables. A foreign table is
3574 primarily represented by a <structname>pg_class</structname> entry,
3575 just like a regular table. Its <structname>pg_foreign_table</structname>
3576 entry contains the information that is pertinent only to foreign tables
3577 and not any other kind of relation.
3581 <title><structname>pg_foreign_table</> Columns</title>
3588 <entry>References</entry>
3589 <entry>Description</entry>
3595 <entry><structfield>ftrelid</structfield></entry>
3596 <entry><type>oid</type></entry>
3597 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3598 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3602 <entry><structfield>ftserver</structfield></entry>
3603 <entry><type>oid</type></entry>
3604 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3605 <entry>OID of the foreign server for this foreign table</entry>
3609 <entry><structfield>ftoptions</structfield></entry>
3610 <entry><type>text[]</type></entry>
3613 Foreign table options, as <quote>keyword=value</> strings
3622 <sect1 id="catalog-pg-index">
3623 <title><structname>pg_index</structname></title>
3625 <indexterm zone="catalog-pg-index">
3626 <primary>pg_index</primary>
3630 The catalog <structname>pg_index</structname> contains part of the information
3631 about indexes. The rest is mostly in
3632 <structname>pg_class</structname>.
3636 <title><structname>pg_index</> Columns</title>
3643 <entry>References</entry>
3644 <entry>Description</entry>
3650 <entry><structfield>indexrelid</structfield></entry>
3651 <entry><type>oid</type></entry>
3652 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3653 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3657 <entry><structfield>indrelid</structfield></entry>
3658 <entry><type>oid</type></entry>
3659 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3660 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3664 <entry><structfield>indnatts</structfield></entry>
3665 <entry><type>int2</type></entry>
3667 <entry>The number of columns in the index (duplicates
3668 <literal>pg_class.relnatts</literal>)</entry>
3672 <entry><structfield>indisunique</structfield></entry>
3673 <entry><type>bool</type></entry>
3675 <entry>If true, this is a unique index</entry>
3679 <entry><structfield>indisprimary</structfield></entry>
3680 <entry><type>bool</type></entry>
3682 <entry>If true, this index represents the primary key of the table
3683 (<structfield>indisunique</> should always be true when this is true)</entry>
3687 <entry><structfield>indisexclusion</structfield></entry>
3688 <entry><type>bool</type></entry>
3690 <entry>If true, this index supports an exclusion constraint</entry>
3694 <entry><structfield>indimmediate</structfield></entry>
3695 <entry><type>bool</type></entry>
3697 <entry>If true, the uniqueness check is enforced immediately on
3699 (irrelevant if <structfield>indisunique</> is not true)</entry>
3703 <entry><structfield>indisclustered</structfield></entry>
3704 <entry><type>bool</type></entry>
3706 <entry>If true, the table was last clustered on this index</entry>
3710 <entry><structfield>indisvalid</structfield></entry>
3711 <entry><type>bool</type></entry>
3714 If true, the index is currently valid for queries. False means the
3715 index is possibly incomplete: it must still be modified by
3716 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3717 be used for queries. If it is unique, the uniqueness property is not
3718 guaranteed true either.
3723 <entry><structfield>indcheckxmin</structfield></entry>
3724 <entry><type>bool</type></entry>
3727 If true, queries must not use the index until the <structfield>xmin</>
3728 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3729 event horizon, because the table may contain broken HOT chains with
3730 incompatible rows that they can see
3735 <entry><structfield>indisready</structfield></entry>
3736 <entry><type>bool</type></entry>
3739 If true, the index is currently ready for inserts. False means the
3740 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3746 <entry><structfield>indislive</structfield></entry>
3747 <entry><type>bool</type></entry>
3750 If false, the index is in process of being dropped, and should be
3751 ignored for all purposes (including HOT-safety decisions)
3756 <entry><structfield>indisreplident</structfield></entry>
3757 <entry><type>bool</type></entry>
3760 If true this index has been chosen as <quote>replica identity</>
3761 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3767 <entry><structfield>indkey</structfield></entry>
3768 <entry><type>int2vector</type></entry>
3769 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3771 This is an array of <structfield>indnatts</structfield> values that
3772 indicate which table columns this index indexes. For example a value
3773 of <literal>1 3</literal> would mean that the first and the third table
3774 columns make up the index key. A zero in this array indicates that the
3775 corresponding index attribute is an expression over the table columns,
3776 rather than a simple column reference.
3781 <entry><structfield>indcollation</structfield></entry>
3782 <entry><type>oidvector</type></entry>
3783 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3785 For each column in the index key, this contains the OID of the
3786 collation to use for the index, or zero if the column is not
3787 of a collatable data type.
3792 <entry><structfield>indclass</structfield></entry>
3793 <entry><type>oidvector</type></entry>
3794 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3796 For each column in the index key, this contains the OID of
3797 the operator class to use. See
3798 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3803 <entry><structfield>indoption</structfield></entry>
3804 <entry><type>int2vector</type></entry>
3807 This is an array of <structfield>indnatts</structfield> values that
3808 store per-column flag bits. The meaning of the bits is defined by
3809 the index's access method.
3814 <entry><structfield>indexprs</structfield></entry>
3815 <entry><type>pg_node_tree</type></entry>
3818 Expression trees (in <function>nodeToString()</function>
3819 representation) for index attributes that are not simple column
3820 references. This is a list with one element for each zero
3821 entry in <structfield>indkey</>. Null if all index attributes
3822 are simple references.
3827 <entry><structfield>indpred</structfield></entry>
3828 <entry><type>pg_node_tree</type></entry>
3831 Expression tree (in <function>nodeToString()</function>
3832 representation) for partial index predicate. Null if not a
3843 <sect1 id="catalog-pg-inherits">
3844 <title><structname>pg_inherits</structname></title>
3846 <indexterm zone="catalog-pg-inherits">
3847 <primary>pg_inherits</primary>
3851 The catalog <structname>pg_inherits</> records information about
3852 table inheritance hierarchies. There is one entry for each direct
3853 child table in the database. (Indirect inheritance can be determined
3854 by following chains of entries.)
3858 <title><structname>pg_inherits</> Columns</title>
3865 <entry>References</entry>
3866 <entry>Description</entry>
3872 <entry><structfield>inhrelid</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 child table
3881 <entry><structfield>inhparent</structfield></entry>
3882 <entry><type>oid</type></entry>
3883 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3885 The OID of the parent table
3890 <entry><structfield>inhseqno</structfield></entry>
3891 <entry><type>int4</type></entry>
3894 If there is more than one direct parent for a child table (multiple
3895 inheritance), this number tells the order in which the
3896 inherited columns are to be arranged. The count starts at 1.
3905 <sect1 id="catalog-pg-init-privs">
3906 <title><structname>pg_init_privs</structname></title>
3908 <indexterm zone="catalog-pg-init-privs">
3909 <primary>pg_init_privs</primary>
3913 The catalog <structname>pg_init_privs</> records information about
3914 the initial privileges of objects in the system. There is one entry
3915 for each object in the database which has a non-default (non-NULL)
3916 initial set of privileges.
3920 Objects can have initial privileges either by having those privileges set
3921 when the system is initialized (by <application>initdb</>) or when the
3922 object is created during a <command>CREATE EXTENSION</command> and the
3923 extension script sets initial privileges using the <command>GRANT</command>
3924 system. Note that the system will automatically handle recording of the
3925 privileges during the extension script and that extension authors need
3926 only use the <command>GRANT</command> and <command>REVOKE</command>
3927 statements in their script to have the privileges recorded. The
3928 <literal>privtype</literal> column indicates if the initial privilege was
3929 set by <application>initdb</> or during a
3930 <command>CREATE EXTENSION</command> command.
3934 Objects which have initial privileges set by <application>initdb</> will
3935 have entries where <literal>privtype</literal> is
3936 <literal>'i'</literal>, while objects which have initial privileges set
3937 by <command>CREATE EXTENSION</command> will have entries where
3938 <literal>privtype</literal> is <literal>'e'</literal>.
3942 <title><structname>pg_init_privs</> Columns</title>
3949 <entry>References</entry>
3950 <entry>Description</entry>
3956 <entry><structfield>objoid</structfield></entry>
3957 <entry><type>oid</type></entry>
3958 <entry>any OID column</entry>
3959 <entry>The OID of the specific object</entry>
3963 <entry><structfield>classoid</structfield></entry>
3964 <entry><type>oid</type></entry>
3965 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3966 <entry>The OID of the system catalog the object is in</entry>
3970 <entry><structfield>objsubid</structfield></entry>
3971 <entry><type>int4</type></entry>
3974 For a table column, this is the column number (the
3975 <structfield>objoid</> and <structfield>classoid</> refer to the
3976 table itself). For all other object types, this column is
3982 <entry><structfield>privtype</structfield></entry>
3983 <entry><type>char</type></entry>
3986 A code defining the type of initial privilege of this object; see text
3991 <entry><structfield>initprivs</structfield></entry>
3992 <entry><type>aclitem[]</type></entry>
3995 The initial access privileges; see
3996 <xref linkend="sql-grant"> and
3997 <xref linkend="sql-revoke">
4009 <sect1 id="catalog-pg-language">
4010 <title><structname>pg_language</structname></title>
4012 <indexterm zone="catalog-pg-language">
4013 <primary>pg_language</primary>
4017 The catalog <structname>pg_language</structname> registers
4018 languages in which you can write functions or stored procedures.
4019 See <xref linkend="sql-createlanguage">
4020 and <xref linkend="xplang"> for more information about language handlers.
4024 <title><structname>pg_language</> Columns</title>
4031 <entry>References</entry>
4032 <entry>Description</entry>
4038 <entry><structfield>oid</structfield></entry>
4039 <entry><type>oid</type></entry>
4041 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4045 <entry><structfield>lanname</structfield></entry>
4046 <entry><type>name</type></entry>
4048 <entry>Name of the language</entry>
4052 <entry><structfield>lanowner</structfield></entry>
4053 <entry><type>oid</type></entry>
4054 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4055 <entry>Owner of the language</entry>
4059 <entry><structfield>lanispl</structfield></entry>
4060 <entry><type>bool</type></entry>
4063 This is false for internal languages (such as
4064 <acronym>SQL</acronym>) and true for user-defined languages.
4065 Currently, <application>pg_dump</application> still uses this
4066 to determine which languages need to be dumped, but this might be
4067 replaced by a different mechanism in the future.
4072 <entry><structfield>lanpltrusted</structfield></entry>
4073 <entry><type>bool</type></entry>
4076 True if this is a trusted language, which means that it is believed
4077 not to grant access to anything outside the normal SQL execution
4078 environment. Only superusers can create functions in untrusted
4084 <entry><structfield>lanplcallfoid</structfield></entry>
4085 <entry><type>oid</type></entry>
4086 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4088 For noninternal languages this references the language
4089 handler, which is a special function that is responsible for
4090 executing all functions that are written in the particular
4096 <entry><structfield>laninline</structfield></entry>
4097 <entry><type>oid</type></entry>
4098 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4100 This references a function that is responsible for executing
4101 <quote>inline</> anonymous code blocks
4102 (<xref linkend="sql-do"> blocks).
4103 Zero if inline blocks are not supported.
4108 <entry><structfield>lanvalidator</structfield></entry>
4109 <entry><type>oid</type></entry>
4110 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4112 This references a language validator function that is responsible
4113 for checking the syntax and validity of new functions when they
4114 are created. Zero if no validator is provided.
4119 <entry><structfield>lanacl</structfield></entry>
4120 <entry><type>aclitem[]</type></entry>
4123 Access privileges; see
4124 <xref linkend="sql-grant"> and
4125 <xref linkend="sql-revoke">
4136 <sect1 id="catalog-pg-largeobject">
4137 <title><structname>pg_largeobject</structname></title>
4139 <indexterm zone="catalog-pg-largeobject">
4140 <primary>pg_largeobject</primary>
4144 The catalog <structname>pg_largeobject</structname> holds the data making up
4145 <quote>large objects</quote>. A large object is identified by an OID
4146 assigned when it is created. Each large object is broken into
4147 segments or <quote>pages</> small enough to be conveniently stored as rows
4148 in <structname>pg_largeobject</structname>.
4149 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4150 <literal>BLCKSZ/4</>, or typically 2 kB).
4154 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4155 associated with large objects. As a result,
4156 <structname>pg_largeobject</structname> was publicly readable and could be
4157 used to obtain the OIDs (and contents) of all large objects in the system.
4158 This is no longer the case; use
4159 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4160 to obtain a list of large object OIDs.
4164 <title><structname>pg_largeobject</> Columns</title>
4171 <entry>References</entry>
4172 <entry>Description</entry>
4178 <entry><structfield>loid</structfield></entry>
4179 <entry><type>oid</type></entry>
4180 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4181 <entry>Identifier of the large object that includes this page</entry>
4185 <entry><structfield>pageno</structfield></entry>
4186 <entry><type>int4</type></entry>
4188 <entry>Page number of this page within its large object
4189 (counting from zero)</entry>
4193 <entry><structfield>data</structfield></entry>
4194 <entry><type>bytea</type></entry>
4197 Actual data stored in the large object.
4198 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4206 Each row of <structname>pg_largeobject</structname> holds data
4207 for one page of a large object, beginning at
4208 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4209 allows sparse storage: pages might be missing, and might be shorter than
4210 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4211 Missing regions within a large object read as zeroes.
4216 <sect1 id="catalog-pg-largeobject-metadata">
4217 <title><structname>pg_largeobject_metadata</structname></title>
4219 <indexterm zone="catalog-pg-largeobject-metadata">
4220 <primary>pg_largeobject_metadata</primary>
4224 The catalog <structname>pg_largeobject_metadata</structname>
4225 holds metadata associated with large objects. The actual large object
4227 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4231 <title><structname>pg_largeobject_metadata</> Columns</title>
4238 <entry>References</entry>
4239 <entry>Description</entry>
4245 <entry><structfield>oid</structfield></entry>
4246 <entry><type>oid</type></entry>
4248 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4252 <entry><structfield>lomowner</structfield></entry>
4253 <entry><type>oid</type></entry>
4254 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4255 <entry>Owner of the large object</entry>
4259 <entry><structfield>lomacl</structfield></entry>
4260 <entry><type>aclitem[]</type></entry>
4263 Access privileges; see
4264 <xref linkend="sql-grant"> and
4265 <xref linkend="sql-revoke">
4276 <sect1 id="catalog-pg-namespace">
4277 <title><structname>pg_namespace</structname></title>
4279 <indexterm zone="catalog-pg-namespace">
4280 <primary>pg_namespace</primary>
4284 The catalog <structname>pg_namespace</> stores namespaces.
4285 A namespace is the structure underlying SQL schemas: each namespace
4286 can have a separate collection of relations, types, etc. without name
4291 <title><structname>pg_namespace</> Columns</title>
4298 <entry>References</entry>
4299 <entry>Description</entry>
4305 <entry><structfield>oid</structfield></entry>
4306 <entry><type>oid</type></entry>
4308 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4312 <entry><structfield>nspname</structfield></entry>
4313 <entry><type>name</type></entry>
4315 <entry>Name of the namespace</entry>
4319 <entry><structfield>nspowner</structfield></entry>
4320 <entry><type>oid</type></entry>
4321 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4322 <entry>Owner of the namespace</entry>
4326 <entry><structfield>nspacl</structfield></entry>
4327 <entry><type>aclitem[]</type></entry>
4330 Access privileges; see
4331 <xref linkend="sql-grant"> and
4332 <xref linkend="sql-revoke">
4343 <sect1 id="catalog-pg-opclass">
4344 <title><structname>pg_opclass</structname></title>
4346 <indexterm zone="catalog-pg-opclass">
4347 <primary>pg_opclass</primary>
4351 The catalog <structname>pg_opclass</structname> defines
4352 index access method operator classes. Each operator class defines
4353 semantics for index columns of a particular data type and a particular
4354 index access method. An operator class essentially specifies that a
4355 particular operator family is applicable to a particular indexable column
4356 data type. The set of operators from the family that are actually usable
4357 with the indexed column are whichever ones accept the column's data type
4358 as their left-hand input.
4362 Operator classes are described at length in <xref linkend="xindex">.
4366 <title><structname>pg_opclass</> Columns</title>
4373 <entry>References</entry>
4374 <entry>Description</entry>
4380 <entry><structfield>oid</structfield></entry>
4381 <entry><type>oid</type></entry>
4383 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4387 <entry><structfield>opcmethod</structfield></entry>
4388 <entry><type>oid</type></entry>
4389 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4390 <entry>Index access method operator class is for</entry>
4394 <entry><structfield>opcname</structfield></entry>
4395 <entry><type>name</type></entry>
4397 <entry>Name of this operator class</entry>
4401 <entry><structfield>opcnamespace</structfield></entry>
4402 <entry><type>oid</type></entry>
4403 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4404 <entry>Namespace of this operator class</entry>
4408 <entry><structfield>opcowner</structfield></entry>
4409 <entry><type>oid</type></entry>
4410 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4411 <entry>Owner of the operator class</entry>
4415 <entry><structfield>opcfamily</structfield></entry>
4416 <entry><type>oid</type></entry>
4417 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4418 <entry>Operator family containing the operator class</entry>
4422 <entry><structfield>opcintype</structfield></entry>
4423 <entry><type>oid</type></entry>
4424 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4425 <entry>Data type that the operator class indexes</entry>
4429 <entry><structfield>opcdefault</structfield></entry>
4430 <entry><type>bool</type></entry>
4432 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4436 <entry><structfield>opckeytype</structfield></entry>
4437 <entry><type>oid</type></entry>
4438 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4439 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4447 An operator class's <structfield>opcmethod</> must match the
4448 <structname>opfmethod</> of its containing operator family.
4449 Also, there must be no more than one <structname>pg_opclass</structname>
4450 row having <structname>opcdefault</> true for any given combination of
4451 <structname>opcmethod</> and <structname>opcintype</>.
4457 <sect1 id="catalog-pg-operator">
4458 <title><structname>pg_operator</structname></title>
4460 <indexterm zone="catalog-pg-operator">
4461 <primary>pg_operator</primary>
4465 The catalog <structname>pg_operator</> stores information about operators.
4466 See <xref linkend="sql-createoperator">
4467 and <xref linkend="xoper"> for more information.
4471 <title><structname>pg_operator</> Columns</title>
4478 <entry>References</entry>
4479 <entry>Description</entry>
4485 <entry><structfield>oid</structfield></entry>
4486 <entry><type>oid</type></entry>
4488 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4492 <entry><structfield>oprname</structfield></entry>
4493 <entry><type>name</type></entry>
4495 <entry>Name of the operator</entry>
4499 <entry><structfield>oprnamespace</structfield></entry>
4500 <entry><type>oid</type></entry>
4501 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4503 The OID of the namespace that contains this operator
4508 <entry><structfield>oprowner</structfield></entry>
4509 <entry><type>oid</type></entry>
4510 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4511 <entry>Owner of the operator</entry>
4515 <entry><structfield>oprkind</structfield></entry>
4516 <entry><type>char</type></entry>
4519 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4520 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4525 <entry><structfield>oprcanmerge</structfield></entry>
4526 <entry><type>bool</type></entry>
4528 <entry>This operator supports merge joins</entry>
4532 <entry><structfield>oprcanhash</structfield></entry>
4533 <entry><type>bool</type></entry>
4535 <entry>This operator supports hash joins</entry>
4539 <entry><structfield>oprleft</structfield></entry>
4540 <entry><type>oid</type></entry>
4541 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4542 <entry>Type of the left operand</entry>
4546 <entry><structfield>oprright</structfield></entry>
4547 <entry><type>oid</type></entry>
4548 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4549 <entry>Type of the right operand</entry>
4553 <entry><structfield>oprresult</structfield></entry>
4554 <entry><type>oid</type></entry>
4555 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4556 <entry>Type of the result</entry>
4560 <entry><structfield>oprcom</structfield></entry>
4561 <entry><type>oid</type></entry>
4562 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4563 <entry>Commutator of this operator, if any</entry>
4567 <entry><structfield>oprnegate</structfield></entry>
4568 <entry><type>oid</type></entry>
4569 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4570 <entry>Negator of this operator, if any</entry>
4574 <entry><structfield>oprcode</structfield></entry>
4575 <entry><type>regproc</type></entry>
4576 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4577 <entry>Function that implements this operator</entry>
4581 <entry><structfield>oprrest</structfield></entry>
4582 <entry><type>regproc</type></entry>
4583 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4584 <entry>Restriction selectivity estimation function for this operator</entry>
4588 <entry><structfield>oprjoin</structfield></entry>
4589 <entry><type>regproc</type></entry>
4590 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4591 <entry>Join selectivity estimation function for this operator</entry>
4598 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4599 is zero for a prefix operator.
4605 <sect1 id="catalog-pg-opfamily">
4606 <title><structname>pg_opfamily</structname></title>
4608 <indexterm zone="catalog-pg-opfamily">
4609 <primary>pg_opfamily</primary>
4613 The catalog <structname>pg_opfamily</structname> defines operator families.
4614 Each operator family is a collection of operators and associated
4615 support routines that implement the semantics specified for a particular
4616 index access method. Furthermore, the operators in a family are all
4617 <quote>compatible</>, in a way that is specified by the access method.
4618 The operator family concept allows cross-data-type operators to be used
4619 with indexes and to be reasoned about using knowledge of access method
4624 Operator families are described at length in <xref linkend="xindex">.
4628 <title><structname>pg_opfamily</> Columns</title>
4635 <entry>References</entry>
4636 <entry>Description</entry>
4642 <entry><structfield>oid</structfield></entry>
4643 <entry><type>oid</type></entry>
4645 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4649 <entry><structfield>opfmethod</structfield></entry>
4650 <entry><type>oid</type></entry>
4651 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4652 <entry>Index access method operator family is for</entry>
4656 <entry><structfield>opfname</structfield></entry>
4657 <entry><type>name</type></entry>
4659 <entry>Name of this operator family</entry>
4663 <entry><structfield>opfnamespace</structfield></entry>
4664 <entry><type>oid</type></entry>
4665 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4666 <entry>Namespace of this operator family</entry>
4670 <entry><structfield>opfowner</structfield></entry>
4671 <entry><type>oid</type></entry>
4672 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4673 <entry>Owner of the operator family</entry>
4681 The majority of the information defining an operator family is not in its
4682 <structname>pg_opfamily</structname> row, but in the associated rows in
4683 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4684 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4686 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4692 <sect1 id="catalog-pg-partitioned-table">
4693 <title><structname>pg_partitioned_table</structname></title>
4695 <indexterm zone="catalog-pg-partitioned-table">
4696 <primary>pg_partitioned_table</primary>
4700 The catalog <structname>pg_partitioned_table</structname> stores
4701 information about how tables are partitioned.
4705 <title><structname>pg_partitioned_table</> Columns</title>
4712 <entry>References</entry>
4713 <entry>Description</entry>
4720 <entry><structfield>partrelid</structfield></entry>
4721 <entry><type>oid</type></entry>
4722 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4723 <entry>The OID of the <structname>pg_class</> entry for this partitioned table</entry>
4727 <entry><structfield>partstrat</structfield></entry>
4728 <entry><type>char</type></entry>
4731 Partitioning strategy; <literal>l</> = list partitioned table,
4732 <literal>r</> = range partitioned table
4737 <entry><structfield>partnatts</structfield></entry>
4738 <entry><type>int2</type></entry>
4740 <entry>The number of columns in partition key</entry>
4744 <entry><structfield>partattrs</structfield></entry>
4745 <entry><type>int2vector</type></entry>
4746 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4748 This is an array of <structfield>partnatts</structfield> values that
4749 indicate which table columns are part of the partition key. For
4750 example, a value of <literal>1 3</literal> would mean that the first
4751 and the third table columns make up the partition key. A zero in this
4752 array indicates that the corresponding partition key column is an
4753 expression, rather than a simple column reference.
4758 <entry><structfield>partclass</structfield></entry>
4759 <entry><type>oidvector</type></entry>
4760 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4762 For each column in the partition key, this contains the OID of the
4763 operator class to use. See
4764 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4769 <entry><structfield>partcollation</structfield></entry>
4770 <entry><type>oidvector</type></entry>
4771 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4773 For each column in the partition key, this contains the OID of the
4774 collation to use for partitioning, or zero if the column is not
4775 of a collatable data type.
4780 <entry><structfield>partexprs</structfield></entry>
4781 <entry><type>pg_node_tree</type></entry>
4784 Expression trees (in <function>nodeToString()</function>
4785 representation) for partition key columns that are not simple column
4786 references. This is a list with one element for each zero
4787 entry in <structfield>partattrs</>. Null if all partition key columns
4788 are simple references.
4798 <sect1 id="catalog-pg-pltemplate">
4799 <title><structname>pg_pltemplate</structname></title>
4801 <indexterm zone="catalog-pg-pltemplate">
4802 <primary>pg_pltemplate</primary>
4806 The catalog <structname>pg_pltemplate</structname> stores
4807 <quote>template</> information for procedural languages.
4808 A template for a language allows the language to be created in a
4809 particular database by a simple <command>CREATE LANGUAGE</> command,
4810 with no need to specify implementation details.
4814 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4815 is shared across all databases of a cluster: there is only one
4816 copy of <structname>pg_pltemplate</structname> per cluster, not
4817 one per database. This allows the information to be accessible in
4818 each database as it is needed.
4822 <title><structname>pg_pltemplate</> Columns</title>
4829 <entry>Description</entry>
4835 <entry><structfield>tmplname</structfield></entry>
4836 <entry><type>name</type></entry>
4837 <entry>Name of the language this template is for</entry>
4841 <entry><structfield>tmpltrusted</structfield></entry>
4842 <entry><type>boolean</type></entry>
4843 <entry>True if language is considered trusted</entry>
4847 <entry><structfield>tmpldbacreate</structfield></entry>
4848 <entry><type>boolean</type></entry>
4849 <entry>True if language may be created by a database owner</entry>
4853 <entry><structfield>tmplhandler</structfield></entry>
4854 <entry><type>text</type></entry>
4855 <entry>Name of call handler function</entry>
4859 <entry><structfield>tmplinline</structfield></entry>
4860 <entry><type>text</type></entry>
4861 <entry>Name of anonymous-block handler function, or null if none</entry>
4865 <entry><structfield>tmplvalidator</structfield></entry>
4866 <entry><type>text</type></entry>
4867 <entry>Name of validator function, or null if none</entry>
4871 <entry><structfield>tmpllibrary</structfield></entry>
4872 <entry><type>text</type></entry>
4873 <entry>Path of shared library that implements language</entry>
4877 <entry><structfield>tmplacl</structfield></entry>
4878 <entry><type>aclitem[]</type></entry>
4879 <entry>Access privileges for template (not actually used)</entry>
4887 There are not currently any commands that manipulate procedural language
4888 templates; to change the built-in information, a superuser must modify
4889 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4890 or <command>UPDATE</command> commands.
4895 It is likely that <structname>pg_pltemplate</> will be removed in some
4896 future release of <productname>PostgreSQL</productname>, in favor of
4897 keeping this knowledge about procedural languages in their respective
4898 extension installation scripts.
4905 <sect1 id="catalog-pg-policy">
4906 <title><structname>pg_policy</structname></title>
4908 <indexterm zone="catalog-pg-policy">
4909 <primary>pg_policy</primary>
4913 The catalog <structname>pg_policy</structname> stores row level
4914 security policies for tables. A policy includes the kind of
4915 command that it applies to (possibly all commands), the roles that it
4916 applies to, the expression to be added as a security-barrier
4917 qualification to queries that include the table, and the expression
4918 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4919 add new records to the table.
4924 <title><structname>pg_policy</structname> Columns</title>
4931 <entry>References</entry>
4932 <entry>Description</entry>
4938 <entry><structfield>polname</structfield></entry>
4939 <entry><type>name</type></entry>
4941 <entry>The name of the policy</entry>
4945 <entry><structfield>polrelid</structfield></entry>
4946 <entry><type>oid</type></entry>
4947 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4948 <entry>The table to which the policy applies</entry>
4952 <entry><structfield>polcmd</structfield></entry>
4953 <entry><type>char</type></entry>
4955 <entry>The command type to which the policy is applied:
4956 <literal>r</> for <command>SELECT</>,
4957 <literal>a</> for <command>INSERT</>,
4958 <literal>w</> for <command>UPDATE</>,
4959 <literal>d</> for <command>DELETE</>,
4960 or <literal>*</> for all</entry>
4964 <entry><structfield>polpermissive</structfield></entry>
4965 <entry><type>boolean</type></entry>
4967 <entry>Is the policy permissive or restrictive?</entry>
4971 <entry><structfield>polroles</structfield></entry>
4972 <entry><type>oid[]</type></entry>
4973 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4974 <entry>The roles to which the policy is applied</entry>
4978 <entry><structfield>polqual</structfield></entry>
4979 <entry><type>pg_node_tree</type></entry>
4981 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4985 <entry><structfield>polwithcheck</structfield></entry>
4986 <entry><type>pg_node_tree</type></entry>
4988 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4997 Policies stored in <structname>pg_policy</> are applied only when
4998 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
5005 <sect1 id="catalog-pg-proc">
5006 <title><structname>pg_proc</structname></title>
5008 <indexterm zone="catalog-pg-proc">
5009 <primary>pg_proc</primary>
5013 The catalog <structname>pg_proc</> stores information about functions (or procedures).
5014 See <xref linkend="sql-createfunction">
5015 and <xref linkend="xfunc"> for more information.
5019 The table contains data for aggregate functions as well as plain functions.
5020 If <structfield>proisagg</structfield> is true, there should be a matching
5021 row in <structfield>pg_aggregate</structfield>.
5025 <title><structname>pg_proc</> Columns</title>
5032 <entry>References</entry>
5033 <entry>Description</entry>
5039 <entry><structfield>oid</structfield></entry>
5040 <entry><type>oid</type></entry>
5042 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5046 <entry><structfield>proname</structfield></entry>
5047 <entry><type>name</type></entry>
5049 <entry>Name of the function</entry>
5053 <entry><structfield>pronamespace</structfield></entry>
5054 <entry><type>oid</type></entry>
5055 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5057 The OID of the namespace that contains this function
5062 <entry><structfield>proowner</structfield></entry>
5063 <entry><type>oid</type></entry>
5064 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5065 <entry>Owner of the function</entry>
5069 <entry><structfield>prolang</structfield></entry>
5070 <entry><type>oid</type></entry>
5071 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
5072 <entry>Implementation language or call interface of this function</entry>
5076 <entry><structfield>procost</structfield></entry>
5077 <entry><type>float4</type></entry>
5079 <entry>Estimated execution cost (in units of
5080 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
5081 this is cost per row returned</entry>
5085 <entry><structfield>prorows</structfield></entry>
5086 <entry><type>float4</type></entry>
5088 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
5092 <entry><structfield>provariadic</structfield></entry>
5093 <entry><type>oid</type></entry>
5094 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5095 <entry>Data type of the variadic array parameter's elements,
5096 or zero if the function does not have a variadic parameter</entry>
5100 <entry><structfield>protransform</structfield></entry>
5101 <entry><type>regproc</type></entry>
5102 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5103 <entry>Calls to this function can be simplified by this other function
5104 (see <xref linkend="xfunc-transform-functions">)</entry>
5108 <entry><structfield>proisagg</structfield></entry>
5109 <entry><type>bool</type></entry>
5111 <entry>Function is an aggregate function</entry>
5115 <entry><structfield>proiswindow</structfield></entry>
5116 <entry><type>bool</type></entry>
5118 <entry>Function is a window function</entry>
5122 <entry><structfield>prosecdef</structfield></entry>
5123 <entry><type>bool</type></entry>
5125 <entry>Function is a security definer (i.e., a <quote>setuid</>
5130 <entry><structfield>proleakproof</structfield></entry>
5131 <entry><type>bool</type></entry>
5134 The function has no side effects. No information about the
5135 arguments is conveyed except via the return value. Any function
5136 that might throw an error depending on the values of its arguments
5142 <entry><structfield>proisstrict</structfield></entry>
5143 <entry><type>bool</type></entry>
5146 Function returns null if any call argument is null. In that
5147 case the function won't actually be called at all. Functions
5148 that are not <quote>strict</quote> must be prepared to handle
5154 <entry><structfield>proretset</structfield></entry>
5155 <entry><type>bool</type></entry>
5157 <entry>Function returns a set (i.e., multiple values of the specified
5162 <entry><structfield>provolatile</structfield></entry>
5163 <entry><type>char</type></entry>
5166 <structfield>provolatile</structfield> tells whether the function's
5167 result depends only on its input arguments, or is affected by outside
5169 It is <literal>i</literal> for <quote>immutable</> functions,
5170 which always deliver the same result for the same inputs.
5171 It is <literal>s</literal> for <quote>stable</> functions,
5172 whose results (for fixed inputs) do not change within a scan.
5173 It is <literal>v</literal> for <quote>volatile</> functions,
5174 whose results might change at any time. (Use <literal>v</literal> also
5175 for functions with side-effects, so that calls to them cannot get
5181 <entry><structfield>proparallel</structfield></entry>
5182 <entry><type>char</type></entry>
5185 <structfield>proparallel</structfield> tells whether the function
5186 can be safely run in parallel mode.
5187 It is <literal>s</literal> for functions which are safe to run in
5188 parallel mode without restriction.
5189 It is <literal>r</literal> for functions which can be run in parallel
5190 mode, but their execution is restricted to the parallel group leader;
5191 parallel worker processes cannot invoke these functions.
5192 It is <literal>u</literal> for functions which are unsafe in parallel
5193 mode; the presence of such a function forces a serial execution plan.
5198 <entry><structfield>pronargs</structfield></entry>
5199 <entry><type>int2</type></entry>
5201 <entry>Number of input arguments</entry>
5205 <entry><structfield>pronargdefaults</structfield></entry>
5206 <entry><type>int2</type></entry>
5208 <entry>Number of arguments that have defaults</entry>
5212 <entry><structfield>prorettype</structfield></entry>
5213 <entry><type>oid</type></entry>
5214 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5215 <entry>Data type of the return value</entry>
5219 <entry><structfield>proargtypes</structfield></entry>
5220 <entry><type>oidvector</type></entry>
5221 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5223 An array with the data types of the function arguments. This includes
5224 only input arguments (including <literal>INOUT</literal> and
5225 <literal>VARIADIC</> arguments), and thus represents
5226 the call signature of the function.
5231 <entry><structfield>proallargtypes</structfield></entry>
5232 <entry><type>oid[]</type></entry>
5233 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5235 An array with the data types of the function arguments. This includes
5236 all arguments (including <literal>OUT</literal> and
5237 <literal>INOUT</literal> arguments); however, if all the
5238 arguments are <literal>IN</literal> arguments, this field will be null.
5239 Note that subscripting is 1-based, whereas for historical reasons
5240 <structfield>proargtypes</> is subscripted from 0.
5245 <entry><structfield>proargmodes</structfield></entry>
5246 <entry><type>char[]</type></entry>
5249 An array with the modes of the function arguments, encoded as
5250 <literal>i</literal> for <literal>IN</> arguments,
5251 <literal>o</literal> for <literal>OUT</> arguments,
5252 <literal>b</literal> for <literal>INOUT</> arguments,
5253 <literal>v</literal> for <literal>VARIADIC</> arguments,
5254 <literal>t</literal> for <literal>TABLE</> arguments.
5255 If all the arguments are <literal>IN</literal> arguments,
5256 this field will be null.
5257 Note that subscripts correspond to positions of
5258 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5263 <entry><structfield>proargnames</structfield></entry>
5264 <entry><type>text[]</type></entry>
5267 An array with the names of the function arguments.
5268 Arguments without a name are set to empty strings in the array.
5269 If none of the arguments have a name, this field will be null.
5270 Note that subscripts correspond to positions of
5271 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5276 <entry><structfield>proargdefaults</structfield></entry>
5277 <entry><type>pg_node_tree</type></entry>
5280 Expression trees (in <function>nodeToString()</function> representation)
5281 for default values. This is a list with
5282 <structfield>pronargdefaults</> elements, corresponding to the last
5283 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5284 <replaceable>N</> <structfield>proargtypes</> positions).
5285 If none of the arguments have defaults, this field will be null.
5290 <entry><structfield>protrftypes</structfield></entry>
5291 <entry><type>oid[]</type></entry>
5294 Data type OIDs for which to apply transforms.
5299 <entry><structfield>prosrc</structfield></entry>
5300 <entry><type>text</type></entry>
5303 This tells the function handler how to invoke the function. It
5304 might be the actual source code of the function for interpreted
5305 languages, a link symbol, a file name, or just about anything
5306 else, depending on the implementation language/call convention.
5311 <entry><structfield>probin</structfield></entry>
5312 <entry><type>text</type></entry>
5315 Additional information about how to invoke the function.
5316 Again, the interpretation is language-specific.
5321 <entry><structfield>proconfig</structfield></entry>
5322 <entry><type>text[]</type></entry>
5324 <entry>Function's local settings for run-time configuration variables</entry>
5328 <entry><structfield>proacl</structfield></entry>
5329 <entry><type>aclitem[]</type></entry>
5332 Access privileges; see
5333 <xref linkend="sql-grant"> and
5334 <xref linkend="sql-revoke">
5343 For compiled functions, both built-in and dynamically loaded,
5344 <structfield>prosrc</structfield> contains the function's C-language
5345 name (link symbol). For all other currently-known language types,
5346 <structfield>prosrc</structfield> contains the function's source
5347 text. <structfield>probin</structfield> is unused except for
5348 dynamically-loaded C functions, for which it gives the name of the
5349 shared library file containing the function.
5354 <sect1 id="catalog-pg-publication">
5355 <title><structname>pg_publication</structname></title>
5357 <indexterm zone="catalog-pg-publication">
5358 <primary>pg_publication</primary>
5362 The catalog <structname>pg_publication</structname> contains all
5363 publications created in the database. For more on publications see
5364 <xref linkend="logical-replication-publication">.
5368 <title><structname>pg_publication</structname> Columns</title>
5375 <entry>References</entry>
5376 <entry>Description</entry>
5382 <entry><structfield>oid</structfield></entry>
5383 <entry><type>oid</type></entry>
5385 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5389 <entry><structfield>pubname</structfield></entry>
5390 <entry><type>Name</type></entry>
5392 <entry>Name of the publication</entry>
5396 <entry><structfield>pubowner</structfield></entry>
5397 <entry><type>oid</type></entry>
5398 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5399 <entry>Owner of the publication</entry>
5403 <entry><structfield>puballtables</structfield></entry>
5404 <entry><type>bool</type></entry>
5406 <entry>If true, this publication automatically includes all tables
5407 in the database, including any that will be created in the future.
5412 <entry><structfield>pubinsert</structfield></entry>
5413 <entry><type>bool</type></entry>
5415 <entry>If true, <command>INSERT</command> operations are replicated for
5416 tables in the publication.</entry>
5420 <entry><structfield>pubupdate</structfield></entry>
5421 <entry><type>bool</type></entry>
5423 <entry>If true, <command>UPDATE</command> operations are replicated for
5424 tables in the publication.</entry>
5428 <entry><structfield>pubdelete</structfield></entry>
5429 <entry><type>bool</type></entry>
5431 <entry>If true, <command>DELETE</command> operations are replicated for
5432 tables in the publication.</entry>
5439 <sect1 id="catalog-pg-publication-rel">
5440 <title><structname>pg_publication_rel</structname></title>
5442 <indexterm zone="catalog-pg-publication-rel">
5443 <primary>pg_publication_rel</primary>
5447 The catalog <structname>pg_publication_rel</structname> contains the
5448 mapping between relations and publications in the database. This is a
5449 many-to-many mapping. See also <xref linkend="view-pg-publication-tables">
5450 for a more user-friendly view of this information.
5454 <title><structname>pg_publication_rel</structname> Columns</title>
5461 <entry>References</entry>
5462 <entry>Description</entry>
5468 <entry><structfield>prpubid</structfield></entry>
5469 <entry><type>oid</type></entry>
5470 <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
5471 <entry>Reference to publication</entry>
5475 <entry><structfield>prrelid</structfield></entry>
5476 <entry><type>oid</type></entry>
5477 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5478 <entry>Reference to relation</entry>
5485 <sect1 id="catalog-pg-range">
5486 <title><structname>pg_range</structname></title>
5488 <indexterm zone="catalog-pg-range">
5489 <primary>pg_range</primary>
5493 The catalog <structname>pg_range</structname> stores information about
5494 range types. This is in addition to the types' entries in
5495 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5499 <title><structname>pg_range</> Columns</title>
5506 <entry>References</entry>
5507 <entry>Description</entry>
5513 <entry><structfield>rngtypid</structfield></entry>
5514 <entry><type>oid</type></entry>
5515 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5516 <entry>OID of the range type</entry>
5520 <entry><structfield>rngsubtype</structfield></entry>
5521 <entry><type>oid</type></entry>
5522 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5523 <entry>OID of the element type (subtype) of this range type</entry>
5527 <entry><structfield>rngcollation</structfield></entry>
5528 <entry><type>oid</type></entry>
5529 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5530 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5534 <entry><structfield>rngsubopc</structfield></entry>
5535 <entry><type>oid</type></entry>
5536 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5537 <entry>OID of the subtype's operator class used for range comparisons</entry>
5541 <entry><structfield>rngcanonical</structfield></entry>
5542 <entry><type>regproc</type></entry>
5543 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5544 <entry>OID of the function to convert a range value into canonical form,
5545 or 0 if none</entry>
5549 <entry><structfield>rngsubdiff</structfield></entry>
5550 <entry><type>regproc</type></entry>
5551 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5552 <entry>OID of the function to return the difference between two element
5553 values as <type>double precision</type>, or 0 if none</entry>
5560 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5561 element type is collatable) determines the sort ordering used by the range
5562 type. <structfield>rngcanonical</> is used when the element type is
5563 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5564 improve performance of GiST indexes on the range type.
5569 <sect1 id="catalog-pg-replication-origin">
5570 <title><structname>pg_replication_origin</structname></title>
5572 <indexterm zone="catalog-pg-replication-origin">
5573 <primary>pg_replication_origin</primary>
5577 The <structname>pg_replication_origin</structname> catalog contains
5578 all replication origins created. For more on replication origins
5579 see <xref linkend="replication-origins">.
5584 <title><structname>pg_replication_origin</structname> Columns</title>
5591 <entry>References</entry>
5592 <entry>Description</entry>
5598 <entry><structfield>roident</structfield></entry>
5599 <entry><type>Oid</type></entry>
5601 <entry>A unique, cluster-wide identifier for the replication
5602 origin. Should never leave the system.</entry>
5606 <entry><structfield>roname</structfield></entry>
5607 <entry><type>text</type></entry>
5609 <entry>The external, user defined, name of a replication
5617 <sect1 id="catalog-pg-rewrite">
5618 <title><structname>pg_rewrite</structname></title>
5620 <indexterm zone="catalog-pg-rewrite">
5621 <primary>pg_rewrite</primary>
5625 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5629 <title><structname>pg_rewrite</> Columns</title>
5636 <entry>References</entry>
5637 <entry>Description</entry>
5643 <entry><structfield>oid</structfield></entry>
5644 <entry><type>oid</type></entry>
5646 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5650 <entry><structfield>rulename</structfield></entry>
5651 <entry><type>name</type></entry>
5653 <entry>Rule name</entry>
5657 <entry><structfield>ev_class</structfield></entry>
5658 <entry><type>oid</type></entry>
5659 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5660 <entry>The table this rule is for</entry>
5664 <entry><structfield>ev_type</structfield></entry>
5665 <entry><type>char</type></entry>
5668 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5669 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5675 <entry><structfield>ev_enabled</structfield></entry>
5676 <entry><type>char</type></entry>
5679 Controls in which <xref linkend="guc-session-replication-role"> modes
5681 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5682 <literal>D</> = rule is disabled,
5683 <literal>R</> = rule fires in <quote>replica</> mode,
5684 <literal>A</> = rule fires always.
5689 <entry><structfield>is_instead</structfield></entry>
5690 <entry><type>bool</type></entry>
5692 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5696 <entry><structfield>ev_qual</structfield></entry>
5697 <entry><type>pg_node_tree</type></entry>
5700 Expression tree (in the form of a
5701 <function>nodeToString()</function> representation) for the
5702 rule's qualifying condition
5707 <entry><structfield>ev_action</structfield></entry>
5708 <entry><type>pg_node_tree</type></entry>
5711 Query tree (in the form of a
5712 <function>nodeToString()</function> representation) for the
5722 <literal>pg_class.relhasrules</literal>
5723 must be true if a table has any rules in this catalog.
5729 <sect1 id="catalog-pg-seclabel">
5730 <title><structname>pg_seclabel</structname></title>
5732 <indexterm zone="catalog-pg-seclabel">
5733 <primary>pg_seclabel</primary>
5737 The catalog <structname>pg_seclabel</structname> stores security
5738 labels on database objects. Security labels can be manipulated
5739 with the <xref linkend="sql-security-label"> command. For an easier
5740 way to view security labels, see <xref linkend="view-pg-seclabels">.
5744 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5745 which performs a similar function for security labels of database objects
5746 that are shared across a database cluster.
5750 <title><structname>pg_seclabel</structname> Columns</title>
5757 <entry>References</entry>
5758 <entry>Description</entry>
5764 <entry><structfield>objoid</structfield></entry>
5765 <entry><type>oid</type></entry>
5766 <entry>any OID column</entry>
5767 <entry>The OID of the object this security label pertains to</entry>
5771 <entry><structfield>classoid</structfield></entry>
5772 <entry><type>oid</type></entry>
5773 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5774 <entry>The OID of the system catalog this object appears in</entry>
5778 <entry><structfield>objsubid</structfield></entry>
5779 <entry><type>int4</type></entry>
5782 For a security label on a table column, this is the column number (the
5783 <structfield>objoid</> and <structfield>classoid</> refer to
5784 the table itself). For all other object types, this column is
5790 <entry><structfield>provider</structfield></entry>
5791 <entry><type>text</type></entry>
5793 <entry>The label provider associated with this label.</entry>
5797 <entry><structfield>label</structfield></entry>
5798 <entry><type>text</type></entry>
5800 <entry>The security label applied to this object.</entry>
5807 <sect1 id="catalog-pg-sequence">
5808 <title><structname>pg_sequence</structname></title>
5810 <indexterm zone="catalog-pg-sequence">
5811 <primary>pg_sequence</primary>
5815 The catalog <structname>pg_sequence</structname> contains information about
5816 sequences. Some of the information about sequences, such as the name and
5817 the schema, is in <structname>pg_class</structname>.
5821 <title><structname>pg_sequence</> Columns</title>
5828 <entry>References</entry>
5829 <entry>Description</entry>
5835 <entry><structfield>seqrelid</structfield></entry>
5836 <entry><type>oid</type></entry>
5837 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5838 <entry>The OID of the <structname>pg_class</> entry for this sequence</entry>
5842 <entry><structfield>seqtypid</structfield></entry>
5843 <entry><type>oid</type></entry>
5844 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5845 <entry>Data type of the sequence</entry>
5849 <entry><structfield>seqstart</structfield></entry>
5850 <entry><type>int8</type></entry>
5852 <entry>Start value of the sequence</entry>
5856 <entry><structfield>seqincrement</structfield></entry>
5857 <entry><type>int8</type></entry>
5859 <entry>Increment value of the sequence</entry>
5863 <entry><structfield>seqmax</structfield></entry>
5864 <entry><type>int8</type></entry>
5866 <entry>Maximum value of the sequence</entry>
5870 <entry><structfield>seqmin</structfield></entry>
5871 <entry><type>int8</type></entry>
5873 <entry>Minimum value of the sequence</entry>
5877 <entry><structfield>seqcache</structfield></entry>
5878 <entry><type>int8</type></entry>
5880 <entry>Cache size of the sequence</entry>
5884 <entry><structfield>seqcycle</structfield></entry>
5885 <entry><type>bool</type></entry>
5887 <entry>Whether the sequence cycles</entry>
5894 <sect1 id="catalog-pg-shdepend">
5895 <title><structname>pg_shdepend</structname></title>
5897 <indexterm zone="catalog-pg-shdepend">
5898 <primary>pg_shdepend</primary>
5902 The catalog <structname>pg_shdepend</structname> records the
5903 dependency relationships between database objects and shared objects,
5904 such as roles. This information allows
5905 <productname>PostgreSQL</productname> to ensure that those objects are
5906 unreferenced before attempting to delete them.
5910 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5911 which performs a similar function for dependencies involving objects
5912 within a single database.
5916 Unlike most system catalogs, <structname>pg_shdepend</structname>
5917 is shared across all databases of a cluster: there is only one
5918 copy of <structname>pg_shdepend</structname> per cluster, not
5923 <title><structname>pg_shdepend</> Columns</title>
5930 <entry>References</entry>
5931 <entry>Description</entry>
5937 <entry><structfield>dbid</structfield></entry>
5938 <entry><type>oid</type></entry>
5939 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5940 <entry>The OID of the database the dependent object is in,
5941 or zero for a shared object</entry>
5945 <entry><structfield>classid</structfield></entry>
5946 <entry><type>oid</type></entry>
5947 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5948 <entry>The OID of the system catalog the dependent object is in</entry>
5952 <entry><structfield>objid</structfield></entry>
5953 <entry><type>oid</type></entry>
5954 <entry>any OID column</entry>
5955 <entry>The OID of the specific dependent object</entry>
5959 <entry><structfield>objsubid</structfield></entry>
5960 <entry><type>int4</type></entry>
5963 For a table column, this is the column number (the
5964 <structfield>objid</> and <structfield>classid</> refer to the
5965 table itself). For all other object types, this column is zero.
5970 <entry><structfield>refclassid</structfield></entry>
5971 <entry><type>oid</type></entry>
5972 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5973 <entry>The OID of the system catalog the referenced object is in
5974 (must be a shared catalog)</entry>
5978 <entry><structfield>refobjid</structfield></entry>
5979 <entry><type>oid</type></entry>
5980 <entry>any OID column</entry>
5981 <entry>The OID of the specific referenced object</entry>
5985 <entry><structfield>deptype</structfield></entry>
5986 <entry><type>char</type></entry>
5989 A code defining the specific semantics of this dependency relationship; see text
5998 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5999 the referenced object cannot be dropped without also dropping the dependent
6000 object. However, there are several subflavors identified by
6001 <structfield>deptype</>:
6005 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
6008 The referenced object (which must be a role) is the owner of the
6015 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
6018 The referenced object (which must be a role) is mentioned in the
6019 ACL (access control list, i.e., privileges list) of the
6020 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
6021 not made for the owner of the object, since the owner will have
6022 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
6028 <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
6031 The referenced object (which must be a role) is mentioned as the
6032 target of a dependent policy object.
6038 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
6041 There is no dependent object; this type of entry is a signal
6042 that the system itself depends on the referenced object, and so
6043 that object must never be deleted. Entries of this type are
6044 created only by <command>initdb</command>. The columns for the
6045 dependent object contain zeroes.
6051 Other dependency flavors might be needed in future. Note in particular
6052 that the current definition only supports roles as referenced objects.
6057 <sect1 id="catalog-pg-shdescription">
6058 <title><structname>pg_shdescription</structname></title>
6060 <indexterm zone="catalog-pg-shdescription">
6061 <primary>pg_shdescription</primary>
6065 The catalog <structname>pg_shdescription</structname> stores optional
6066 descriptions (comments) for shared database objects. Descriptions can be
6067 manipulated with the <xref linkend="sql-comment"> command and viewed with
6068 <application>psql</application>'s <literal>\d</literal> commands.
6072 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6073 which performs a similar function for descriptions involving objects
6074 within a single database.
6078 Unlike most system catalogs, <structname>pg_shdescription</structname>
6079 is shared across all databases of a cluster: there is only one
6080 copy of <structname>pg_shdescription</structname> per cluster, not
6085 <title><structname>pg_shdescription</> Columns</title>
6092 <entry>References</entry>
6093 <entry>Description</entry>
6099 <entry><structfield>objoid</structfield></entry>
6100 <entry><type>oid</type></entry>
6101 <entry>any OID column</entry>
6102 <entry>The OID of the object this description pertains to</entry>
6106 <entry><structfield>classoid</structfield></entry>
6107 <entry><type>oid</type></entry>
6108 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6109 <entry>The OID of the system catalog this object appears in</entry>
6113 <entry><structfield>description</structfield></entry>
6114 <entry><type>text</type></entry>
6116 <entry>Arbitrary text that serves as the description of this object</entry>
6124 <sect1 id="catalog-pg-shseclabel">
6125 <title><structname>pg_shseclabel</structname></title>
6127 <indexterm zone="catalog-pg-shseclabel">
6128 <primary>pg_shseclabel</primary>
6132 The catalog <structname>pg_shseclabel</structname> stores security
6133 labels on shared database objects. Security labels can be manipulated
6134 with the <xref linkend="sql-security-label"> command. For an easier
6135 way to view security labels, see <xref linkend="view-pg-seclabels">.
6139 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6140 which performs a similar function for security labels involving objects
6141 within a single database.
6145 Unlike most system catalogs, <structname>pg_shseclabel</structname>
6146 is shared across all databases of a cluster: there is only one
6147 copy of <structname>pg_shseclabel</structname> per cluster, not
6152 <title><structname>pg_shseclabel</structname> Columns</title>
6158 <entry>References</entry>
6159 <entry>Description</entry>
6164 <entry><structfield>objoid</structfield></entry>
6165 <entry><type>oid</type></entry>
6166 <entry>any OID column</entry>
6167 <entry>The OID of the object this security label pertains to</entry>
6170 <entry><structfield>classoid</structfield></entry>
6171 <entry><type>oid</type></entry>
6172 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6173 <entry>The OID of the system catalog this object appears in</entry>
6176 <entry><structfield>provider</structfield></entry>
6177 <entry><type>text</type></entry>
6179 <entry>The label provider associated with this label.</entry>
6182 <entry><structfield>label</structfield></entry>
6183 <entry><type>text</type></entry>
6185 <entry>The security label applied to this object.</entry>
6192 <sect1 id="catalog-pg-statistic">
6193 <title><structname>pg_statistic</structname></title>
6195 <indexterm zone="catalog-pg-statistic">
6196 <primary>pg_statistic</primary>
6200 The catalog <structname>pg_statistic</structname> stores
6201 statistical data about the contents of the database. Entries are
6202 created by <xref linkend="sql-analyze">
6203 and subsequently used by the query planner. Note that all the
6204 statistical data is inherently approximate, even assuming that it
6209 Normally there is one entry, with <structfield>stainherit</> =
6210 <literal>false</>, for each table column that has been analyzed.
6211 If the table has inheritance children, a second entry with
6212 <structfield>stainherit</> = <literal>true</> is also created. This row
6213 represents the column's statistics over the inheritance tree, i.e.,
6214 statistics for the data you'd see with
6215 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
6216 whereas the <structfield>stainherit</> = <literal>false</> row represents
6218 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
6222 <structname>pg_statistic</structname> also stores statistical data about
6223 the values of index expressions. These are described as if they were
6224 actual data columns; in particular, <structfield>starelid</structfield>
6225 references the index. No entry is made for an ordinary non-expression
6226 index column, however, since it would be redundant with the entry
6227 for the underlying table column. Currently, entries for index expressions
6228 always have <structfield>stainherit</> = <literal>false</>.
6232 Since different kinds of statistics might be appropriate for different
6233 kinds of data, <structname>pg_statistic</structname> is designed not
6234 to assume very much about what sort of statistics it stores. Only
6235 extremely general statistics (such as nullness) are given dedicated
6236 columns in <structname>pg_statistic</structname>. Everything else
6237 is stored in <quote>slots</quote>, which are groups of associated columns
6238 whose content is identified by a code number in one of the slot's columns.
6239 For more information see
6240 <filename>src/include/catalog/pg_statistic.h</filename>.
6244 <structname>pg_statistic</structname> should not be readable by the
6245 public, since even statistical information about a table's contents
6246 might be considered sensitive. (Example: minimum and maximum values
6247 of a salary column might be quite interesting.)
6248 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6249 is a publicly readable view on
6250 <structname>pg_statistic</structname> that only exposes information
6251 about those tables that are readable by the current user.
6255 <title><structname>pg_statistic</> Columns</title>
6262 <entry>References</entry>
6263 <entry>Description</entry>
6269 <entry><structfield>starelid</structfield></entry>
6270 <entry><type>oid</type></entry>
6271 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6272 <entry>The table or index that the described column belongs to</entry>
6276 <entry><structfield>staattnum</structfield></entry>
6277 <entry><type>int2</type></entry>
6278 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6279 <entry>The number of the described column</entry>
6283 <entry><structfield>stainherit</structfield></entry>
6284 <entry><type>bool</type></entry>
6286 <entry>If true, the stats include inheritance child columns, not just the
6287 values in the specified relation</entry>
6291 <entry><structfield>stanullfrac</structfield></entry>
6292 <entry><type>float4</type></entry>
6294 <entry>The fraction of the column's entries that are null</entry>
6298 <entry><structfield>stawidth</structfield></entry>
6299 <entry><type>int4</type></entry>
6301 <entry>The average stored width, in bytes, of nonnull entries</entry>
6305 <entry><structfield>stadistinct</structfield></entry>
6306 <entry><type>float4</type></entry>
6308 <entry>The number of distinct nonnull data values in the column.
6309 A value greater than zero is the actual number of distinct values.
6310 A value less than zero is the negative of a multiplier for the number
6311 of rows in the table; for example, a column in which about 80% of the
6312 values are nonnull and each nonnull value appears about twice on
6313 average could be represented by <structfield>stadistinct</> = -0.4.
6314 A zero value means the number of distinct values is unknown.
6319 <entry><structfield>stakind<replaceable>N</></structfield></entry>
6320 <entry><type>int2</type></entry>
6323 A code number indicating the kind of statistics stored in the
6324 <replaceable>N</>th <quote>slot</quote> of the
6325 <structname>pg_statistic</structname> row.
6330 <entry><structfield>staop<replaceable>N</></structfield></entry>
6331 <entry><type>oid</type></entry>
6332 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6334 An operator used to derive the statistics stored in the
6335 <replaceable>N</>th <quote>slot</quote>. For example, a
6336 histogram slot would show the <literal><</literal> operator
6337 that defines the sort order of the data.
6342 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6343 <entry><type>float4[]</type></entry>
6346 Numerical statistics of the appropriate kind for the
6347 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6348 kind does not involve numerical values
6353 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6354 <entry><type>anyarray</type></entry>
6357 Column data values of the appropriate kind for the
6358 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6359 kind does not store any data values. Each array's element
6360 values are actually of the specific column's data type, or a related
6361 type such as an array's element type, so there is no way to define
6362 these columns' type more specifically than <type>anyarray</>.
6371 <sect1 id="catalog-pg-statistic-ext">
6372 <title><structname>pg_statistic_ext</structname></title>
6374 <indexterm zone="catalog-pg-statistic-ext">
6375 <primary>pg_statistic_ext</primary>
6379 The catalog <structname>pg_statistic_ext</structname>
6380 holds extended planner statistics.
6381 Each row in this catalog corresponds to a <firstterm>statistics object</>
6382 created with <xref linkend="sql-createstatistics">.
6386 <title><structname>pg_statistic_ext</> Columns</title>
6393 <entry>References</entry>
6394 <entry>Description</entry>
6401 <entry><structfield>stxrelid</structfield></entry>
6402 <entry><type>oid</type></entry>
6403 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6404 <entry>Table containing the columns described by this object</entry>
6408 <entry><structfield>stxname</structfield></entry>
6409 <entry><type>name</type></entry>
6411 <entry>Name of the statistics object</entry>
6415 <entry><structfield>stxnamespace</structfield></entry>
6416 <entry><type>oid</type></entry>
6417 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6419 The OID of the namespace that contains this statistics object
6424 <entry><structfield>stxowner</structfield></entry>
6425 <entry><type>oid</type></entry>
6426 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6427 <entry>Owner of the statistics object</entry>
6431 <entry><structfield>stxkeys</structfield></entry>
6432 <entry><type>int2vector</type></entry>
6433 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6435 An array of attribute numbers, indicating which table columns are
6436 covered by this statistics object;
6437 for example a value of <literal>1 3</literal> would
6438 mean that the first and the third table columns are covered
6443 <entry><structfield>stxkind</structfield></entry>
6444 <entry><type>char[]</type></entry>
6447 An array containing codes for the enabled statistic types;
6449 <literal>d</literal> for n-distinct statistics,
6450 <literal>f</literal> for functional dependency statistics
6455 <entry><structfield>stxndistinct</structfield></entry>
6456 <entry><type>pg_ndistinct</type></entry>
6459 N-distinct counts, serialized as <structname>pg_ndistinct</> type
6464 <entry><structfield>stxdependencies</structfield></entry>
6465 <entry><type>pg_dependencies</type></entry>
6468 Functional dependency statistics, serialized
6469 as <structname>pg_dependencies</> type
6478 The <structfield>stxkind</structfield> field is filled at creation of the
6479 statistics object, indicating which statistic type(s) are desired.
6480 The fields after it are initially NULL and are filled only when the
6481 corresponding statistic has been computed by <command>ANALYZE</>.
6485 <sect1 id="catalog-pg-subscription">
6486 <title><structname>pg_subscription</structname></title>
6488 <indexterm zone="catalog-pg-subscription">
6489 <primary>pg_subscription</primary>
6493 The catalog <structname>pg_subscription</structname> contains all existing
6494 logical replication subscriptions. For more information about logical
6495 replication see <xref linkend="logical-replication">.
6499 Unlike most system catalogs, <structname>pg_subscription</structname> is
6500 shared across all databases of a cluster: There is only one copy
6501 of <structname>pg_subscription</structname> per cluster, not one per
6506 Access to the column <structfield>subconninfo</structfield> is revoked from
6507 normal users, because it could contain plain-text passwords.
6511 <title><structname>pg_subscription</structname> Columns</title>
6518 <entry>References</entry>
6519 <entry>Description</entry>
6525 <entry><structfield>oid</structfield></entry>
6526 <entry><type>oid</type></entry>
6528 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6532 <entry><structfield>subdbid</structfield></entry>
6533 <entry><type>oid</type></entry>
6534 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6535 <entry>OID of the database which the subscription resides in</entry>
6539 <entry><structfield>subname</structfield></entry>
6540 <entry><type>name</type></entry>
6542 <entry>Name of the subscription</entry>
6546 <entry><structfield>subowner</structfield></entry>
6547 <entry><type>oid</type></entry>
6548 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6549 <entry>Owner of the subscription</entry>
6553 <entry><structfield>subenabled</structfield></entry>
6554 <entry><type>bool</type></entry>
6556 <entry>If true, the subscription is enabled and should be replicating.</entry>
6560 <entry><structfield>subsynccommit</structfield></entry>
6561 <entry><type>text</type></entry>
6564 Contains the value of the <varname>synchronous_commit</varname>
6565 setting for the subscription workers.
6570 <entry><structfield>subconninfo</structfield></entry>
6571 <entry><type>text</type></entry>
6573 <entry>Connection string to the upstream database</entry>
6577 <entry><structfield>subslotname</structfield></entry>
6578 <entry><type>name</type></entry>
6580 <entry>Name of the replication slot in the upstream database. Also used
6581 for local replication origin name.</entry>
6585 <entry><structfield>subpublications</structfield></entry>
6586 <entry><type>text[]</type></entry>
6588 <entry>Array of subscribed publication names. These reference the
6589 publications on the publisher server. For more on publications
6590 see <xref linkend="logical-replication-publication">.
6598 <sect1 id="catalog-pg-subscription-rel">
6599 <title><structname>pg_subscription_rel</structname></title>
6601 <indexterm zone="catalog-pg-subscription-rel">
6602 <primary>pg_subscription_rel</primary>
6606 The catalog <structname>pg_subscription_rel</structname> contains the
6607 state for each replicated relation in each subscription. This is a
6608 many-to-many mapping.
6612 This catalog only contains tables known to the subscription after running
6613 either <command>CREATE SUBSCRIPTION</command> or
6614 <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command>.
6618 <title><structname>pg_subscription_rel</structname> Columns</title>
6625 <entry>References</entry>
6626 <entry>Description</entry>
6632 <entry><structfield>srsubid</structfield></entry>
6633 <entry><type>oid</type></entry>
6634 <entry><literal><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.oid</literal></entry>
6635 <entry>Reference to subscription</entry>
6639 <entry><structfield>srrelid</structfield></entry>
6640 <entry><type>oid</type></entry>
6641 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6642 <entry>Reference to relation</entry>
6646 <entry><structfield>srsubstate</structfield></entry>
6647 <entry><type>char</type></entry>
6651 <literal>i</> = initialize,
6652 <literal>d</> = data is being copied,
6653 <literal>s</> = synchronized,
6654 <literal>r</> = ready (normal replication)
6659 <entry><structfield>srsublsn</structfield></entry>
6660 <entry><type>pg_lsn</type></entry>
6663 End LSN for <literal>s</> and <literal>r</> states.
6671 <sect1 id="catalog-pg-tablespace">
6672 <title><structname>pg_tablespace</structname></title>
6674 <indexterm zone="catalog-pg-tablespace">
6675 <primary>pg_tablespace</primary>
6679 The catalog <structname>pg_tablespace</structname> stores information
6680 about the available tablespaces. Tables can be placed in particular
6681 tablespaces to aid administration of disk layout.
6685 Unlike most system catalogs, <structname>pg_tablespace</structname>
6686 is shared across all databases of a cluster: there is only one
6687 copy of <structname>pg_tablespace</structname> per cluster, not
6692 <title><structname>pg_tablespace</> Columns</title>
6699 <entry>References</entry>
6700 <entry>Description</entry>
6706 <entry><structfield>oid</structfield></entry>
6707 <entry><type>oid</type></entry>
6709 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6713 <entry><structfield>spcname</structfield></entry>
6714 <entry><type>name</type></entry>
6716 <entry>Tablespace name</entry>
6720 <entry><structfield>spcowner</structfield></entry>
6721 <entry><type>oid</type></entry>
6722 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6723 <entry>Owner of the tablespace, usually the user who created it</entry>
6727 <entry><structfield>spcacl</structfield></entry>
6728 <entry><type>aclitem[]</type></entry>
6731 Access privileges; see
6732 <xref linkend="sql-grant"> and
6733 <xref linkend="sql-revoke">
6739 <entry><structfield>spcoptions</structfield></entry>
6740 <entry><type>text[]</type></entry>
6743 Tablespace-level options, as <quote>keyword=value</> strings
6752 <sect1 id="catalog-pg-transform">
6753 <title><structname>pg_transform</structname></title>
6755 <indexterm zone="catalog-pg-transform">
6756 <primary>pg_transform</primary>
6760 The catalog <structname>pg_transform</structname> stores information about
6761 transforms, which are a mechanism to adapt data types to procedural
6762 languages. See <xref linkend="sql-createtransform"> for more information.
6766 <title><structname>pg_transform</> Columns</title>
6773 <entry>References</entry>
6774 <entry>Description</entry>
6780 <entry><structfield>trftype</structfield></entry>
6781 <entry><type>oid</type></entry>
6782 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6783 <entry>OID of the data type this transform is for</entry>
6787 <entry><structfield>trflang</structfield></entry>
6788 <entry><type>oid</type></entry>
6789 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6790 <entry>OID of the language this transform is for</entry>
6794 <entry><structfield>trffromsql</structfield></entry>
6795 <entry><type>regproc</type></entry>
6796 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6798 The OID of the function to use when converting the data type for input
6799 to the procedural language (e.g., function parameters). Zero is stored
6800 if this operation is not supported.
6805 <entry><structfield>trftosql</structfield></entry>
6806 <entry><type>regproc</type></entry>
6807 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6809 The OID of the function to use when converting output from the
6810 procedural language (e.g., return values) to the data type. Zero is
6811 stored if this operation is not supported.
6820 <sect1 id="catalog-pg-trigger">
6821 <title><structname>pg_trigger</structname></title>
6823 <indexterm zone="catalog-pg-trigger">
6824 <primary>pg_trigger</primary>
6828 The catalog <structname>pg_trigger</structname> stores triggers on tables
6830 See <xref linkend="sql-createtrigger">
6831 for more information.
6835 <title><structname>pg_trigger</> Columns</title>
6842 <entry>References</entry>
6843 <entry>Description</entry>
6849 <entry><structfield>oid</structfield></entry>
6850 <entry><type>oid</type></entry>
6852 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6856 <entry><structfield>tgrelid</structfield></entry>
6857 <entry><type>oid</type></entry>
6858 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6859 <entry>The table this trigger is on</entry>
6863 <entry><structfield>tgname</structfield></entry>
6864 <entry><type>name</type></entry>
6866 <entry>Trigger name (must be unique among triggers of same table)</entry>
6870 <entry><structfield>tgfoid</structfield></entry>
6871 <entry><type>oid</type></entry>
6872 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6873 <entry>The function to be called</entry>
6877 <entry><structfield>tgtype</structfield></entry>
6878 <entry><type>int2</type></entry>
6880 <entry>Bit mask identifying trigger firing conditions</entry>
6884 <entry><structfield>tgenabled</structfield></entry>
6885 <entry><type>char</type></entry>
6888 Controls in which <xref linkend="guc-session-replication-role"> modes
6890 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6891 <literal>D</> = trigger is disabled,
6892 <literal>R</> = trigger fires in <quote>replica</> mode,
6893 <literal>A</> = trigger fires always.
6898 <entry><structfield>tgisinternal</structfield></entry>
6899 <entry><type>bool</type></entry>
6901 <entry>True if trigger is internally generated (usually, to enforce
6902 the constraint identified by <structfield>tgconstraint</>)</entry>
6906 <entry><structfield>tgconstrrelid</structfield></entry>
6907 <entry><type>oid</type></entry>
6908 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6909 <entry>The table referenced by a referential integrity constraint</entry>
6913 <entry><structfield>tgconstrindid</structfield></entry>
6914 <entry><type>oid</type></entry>
6915 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6916 <entry>The index supporting a unique, primary key, referential integrity,
6917 or exclusion constraint</entry>
6921 <entry><structfield>tgconstraint</structfield></entry>
6922 <entry><type>oid</type></entry>
6923 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6924 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6928 <entry><structfield>tgdeferrable</structfield></entry>
6929 <entry><type>bool</type></entry>
6931 <entry>True if constraint trigger is deferrable</entry>
6935 <entry><structfield>tginitdeferred</structfield></entry>
6936 <entry><type>bool</type></entry>
6938 <entry>True if constraint trigger is initially deferred</entry>
6942 <entry><structfield>tgnargs</structfield></entry>
6943 <entry><type>int2</type></entry>
6945 <entry>Number of argument strings passed to trigger function</entry>
6949 <entry><structfield>tgattr</structfield></entry>
6950 <entry><type>int2vector</type></entry>
6951 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6952 <entry>Column numbers, if trigger is column-specific; otherwise an
6957 <entry><structfield>tgargs</structfield></entry>
6958 <entry><type>bytea</type></entry>
6960 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6964 <entry><structfield>tgqual</structfield></entry>
6965 <entry><type>pg_node_tree</type></entry>
6967 <entry>Expression tree (in <function>nodeToString()</function>
6968 representation) for the trigger's <literal>WHEN</> condition, or null
6973 <entry><structfield>tgoldtable</structfield></entry>
6974 <entry><type>name</type></entry>
6976 <entry><literal>REFERENCING</> clause name for <literal>OLD TABLE</>,
6977 or null if none</entry>
6981 <entry><structfield>tgnewtable</structfield></entry>
6982 <entry><type>name</type></entry>
6984 <entry><literal>REFERENCING</> clause name for <literal>NEW TABLE</>,
6985 or null if none</entry>
6992 Currently, column-specific triggering is supported only for
6993 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6994 only for that event type. <structfield>tgtype</structfield> might
6995 contain bits for other event types as well, but those are presumed
6996 to be table-wide regardless of what is in <structfield>tgattr</>.
7001 When <structfield>tgconstraint</> is nonzero,
7002 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
7003 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
7004 largely redundant with the referenced <structname>pg_constraint</> entry.
7005 However, it is possible for a non-deferrable trigger to be associated
7006 with a deferrable constraint: foreign key constraints can have some
7007 deferrable and some non-deferrable triggers.
7013 <literal>pg_class.relhastriggers</literal>
7014 must be true if a relation has any triggers in this catalog.
7021 <sect1 id="catalog-pg-ts-config">
7022 <title><structname>pg_ts_config</structname></title>
7024 <indexterm zone="catalog-pg-ts-config">
7025 <primary>pg_ts_config</primary>
7029 The <structname>pg_ts_config</structname> catalog contains entries
7030 representing text search configurations. A configuration specifies
7031 a particular text search parser and a list of dictionaries to use
7032 for each of the parser's output token types. The parser is shown
7033 in the <structname>pg_ts_config</structname> entry, but the
7034 token-to-dictionary mapping is defined by subsidiary entries in <link
7035 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
7039 <productname>PostgreSQL</productname>'s text search features are
7040 described at length in <xref linkend="textsearch">.
7044 <title><structname>pg_ts_config</> Columns</title>
7051 <entry>References</entry>
7052 <entry>Description</entry>
7058 <entry><structfield>oid</structfield></entry>
7059 <entry><type>oid</type></entry>
7061 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7065 <entry><structfield>cfgname</structfield></entry>
7066 <entry><type>name</type></entry>
7068 <entry>Text search configuration name</entry>
7072 <entry><structfield>cfgnamespace</structfield></entry>
7073 <entry><type>oid</type></entry>
7074 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7076 The OID of the namespace that contains this configuration
7081 <entry><structfield>cfgowner</structfield></entry>
7082 <entry><type>oid</type></entry>
7083 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7084 <entry>Owner of the configuration</entry>
7088 <entry><structfield>cfgparser</structfield></entry>
7089 <entry><type>oid</type></entry>
7090 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
7091 <entry>The OID of the text search parser for this configuration</entry>
7099 <sect1 id="catalog-pg-ts-config-map">
7100 <title><structname>pg_ts_config_map</structname></title>
7102 <indexterm zone="catalog-pg-ts-config-map">
7103 <primary>pg_ts_config_map</primary>
7107 The <structname>pg_ts_config_map</structname> catalog contains entries
7108 showing which text search dictionaries should be consulted, and in
7109 what order, for each output token type of each text search configuration's
7114 <productname>PostgreSQL</productname>'s text search features are
7115 described at length in <xref linkend="textsearch">.
7119 <title><structname>pg_ts_config_map</> Columns</title>
7126 <entry>References</entry>
7127 <entry>Description</entry>
7133 <entry><structfield>mapcfg</structfield></entry>
7134 <entry><type>oid</type></entry>
7135 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
7136 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
7140 <entry><structfield>maptokentype</structfield></entry>
7141 <entry><type>integer</type></entry>
7143 <entry>A token type emitted by the configuration's parser</entry>
7147 <entry><structfield>mapseqno</structfield></entry>
7148 <entry><type>integer</type></entry>
7150 <entry>Order in which to consult this entry (lower
7151 <structfield>mapseqno</>s first)</entry>
7155 <entry><structfield>mapdict</structfield></entry>
7156 <entry><type>oid</type></entry>
7157 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
7158 <entry>The OID of the text search dictionary to consult</entry>
7166 <sect1 id="catalog-pg-ts-dict">
7167 <title><structname>pg_ts_dict</structname></title>
7169 <indexterm zone="catalog-pg-ts-dict">
7170 <primary>pg_ts_dict</primary>
7174 The <structname>pg_ts_dict</structname> catalog contains entries
7175 defining text search dictionaries. A dictionary depends on a text
7176 search template, which specifies all the implementation functions
7177 needed; the dictionary itself provides values for the user-settable
7178 parameters supported by the template. This division of labor allows
7179 dictionaries to be created by unprivileged users. The parameters
7180 are specified by a text string <structfield>dictinitoption</>,
7181 whose format and meaning vary depending on the template.
7185 <productname>PostgreSQL</productname>'s text search features are
7186 described at length in <xref linkend="textsearch">.
7190 <title><structname>pg_ts_dict</> Columns</title>
7197 <entry>References</entry>
7198 <entry>Description</entry>
7204 <entry><structfield>oid</structfield></entry>
7205 <entry><type>oid</type></entry>
7207 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7211 <entry><structfield>dictname</structfield></entry>
7212 <entry><type>name</type></entry>
7214 <entry>Text search dictionary name</entry>
7218 <entry><structfield>dictnamespace</structfield></entry>
7219 <entry><type>oid</type></entry>
7220 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7222 The OID of the namespace that contains this dictionary
7227 <entry><structfield>dictowner</structfield></entry>
7228 <entry><type>oid</type></entry>
7229 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7230 <entry>Owner of the dictionary</entry>
7234 <entry><structfield>dicttemplate</structfield></entry>
7235 <entry><type>oid</type></entry>
7236 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
7237 <entry>The OID of the text search template for this dictionary</entry>
7241 <entry><structfield>dictinitoption</structfield></entry>
7242 <entry><type>text</type></entry>
7244 <entry>Initialization option string for the template</entry>
7252 <sect1 id="catalog-pg-ts-parser">
7253 <title><structname>pg_ts_parser</structname></title>
7255 <indexterm zone="catalog-pg-ts-parser">
7256 <primary>pg_ts_parser</primary>
7260 The <structname>pg_ts_parser</structname> catalog contains entries
7261 defining text search parsers. A parser is responsible for splitting
7262 input text into lexemes and assigning a token type to each lexeme.
7263 Since a parser must be implemented by C-language-level functions,
7264 creation of new parsers is restricted to database superusers.
7268 <productname>PostgreSQL</productname>'s text search features are
7269 described at length in <xref linkend="textsearch">.
7273 <title><structname>pg_ts_parser</> Columns</title>
7280 <entry>References</entry>
7281 <entry>Description</entry>
7287 <entry><structfield>oid</structfield></entry>
7288 <entry><type>oid</type></entry>
7290 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7294 <entry><structfield>prsname</structfield></entry>
7295 <entry><type>name</type></entry>
7297 <entry>Text search parser name</entry>
7301 <entry><structfield>prsnamespace</structfield></entry>
7302 <entry><type>oid</type></entry>
7303 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7305 The OID of the namespace that contains this parser
7310 <entry><structfield>prsstart</structfield></entry>
7311 <entry><type>regproc</type></entry>
7312 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7313 <entry>OID of the parser's startup function</entry>
7317 <entry><structfield>prstoken</structfield></entry>
7318 <entry><type>regproc</type></entry>
7319 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7320 <entry>OID of the parser's next-token function</entry>
7324 <entry><structfield>prsend</structfield></entry>
7325 <entry><type>regproc</type></entry>
7326 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7327 <entry>OID of the parser's shutdown function</entry>
7331 <entry><structfield>prsheadline</structfield></entry>
7332 <entry><type>regproc</type></entry>
7333 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7334 <entry>OID of the parser's headline function</entry>
7338 <entry><structfield>prslextype</structfield></entry>
7339 <entry><type>regproc</type></entry>
7340 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7341 <entry>OID of the parser's lextype function</entry>
7349 <sect1 id="catalog-pg-ts-template">
7350 <title><structname>pg_ts_template</structname></title>
7352 <indexterm zone="catalog-pg-ts-template">
7353 <primary>pg_ts_template</primary>
7357 The <structname>pg_ts_template</structname> catalog contains entries
7358 defining text search templates. A template is the implementation
7359 skeleton for a class of text search dictionaries.
7360 Since a template must be implemented by C-language-level functions,
7361 creation of new templates is restricted to database superusers.
7365 <productname>PostgreSQL</productname>'s text search features are
7366 described at length in <xref linkend="textsearch">.
7370 <title><structname>pg_ts_template</> Columns</title>
7377 <entry>References</entry>
7378 <entry>Description</entry>
7384 <entry><structfield>oid</structfield></entry>
7385 <entry><type>oid</type></entry>
7387 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7391 <entry><structfield>tmplname</structfield></entry>
7392 <entry><type>name</type></entry>
7394 <entry>Text search template name</entry>
7398 <entry><structfield>tmplnamespace</structfield></entry>
7399 <entry><type>oid</type></entry>
7400 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7402 The OID of the namespace that contains this template
7407 <entry><structfield>tmplinit</structfield></entry>
7408 <entry><type>regproc</type></entry>
7409 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7410 <entry>OID of the template's initialization function</entry>
7414 <entry><structfield>tmpllexize</structfield></entry>
7415 <entry><type>regproc</type></entry>
7416 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7417 <entry>OID of the template's lexize function</entry>
7425 <sect1 id="catalog-pg-type">
7426 <title><structname>pg_type</structname></title>
7428 <indexterm zone="catalog-pg-type">
7429 <primary>pg_type</primary>
7433 The catalog <structname>pg_type</structname> stores information about data
7434 types. Base types and enum types (scalar types) are created with
7435 <xref linkend="sql-createtype">, and
7437 <xref linkend="sql-createdomain">.
7438 A composite type is automatically created for each table in the database, to
7439 represent the row structure of the table. It is also possible to create
7440 composite types with <command>CREATE TYPE AS</command>.
7444 <title><structname>pg_type</> Columns</title>
7451 <entry>References</entry>
7452 <entry>Description</entry>
7458 <entry><structfield>oid</structfield></entry>
7459 <entry><type>oid</type></entry>
7461 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7465 <entry><structfield>typname</structfield></entry>
7466 <entry><type>name</type></entry>
7468 <entry>Data type name</entry>
7472 <entry><structfield>typnamespace</structfield></entry>
7473 <entry><type>oid</type></entry>
7474 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7476 The OID of the namespace that contains this type
7481 <entry><structfield>typowner</structfield></entry>
7482 <entry><type>oid</type></entry>
7483 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7484 <entry>Owner of the type</entry>
7488 <entry><structfield>typlen</structfield></entry>
7489 <entry><type>int2</type></entry>
7492 For a fixed-size type, <structfield>typlen</structfield> is the number
7493 of bytes in the internal representation of the type. But for a
7494 variable-length type, <structfield>typlen</structfield> is negative.
7495 -1 indicates a <quote>varlena</> type (one that has a length word),
7496 -2 indicates a null-terminated C string.
7501 <entry><structfield>typbyval</structfield></entry>
7502 <entry><type>bool</type></entry>
7505 <structfield>typbyval</structfield> determines whether internal
7506 routines pass a value of this type by value or by reference.
7507 <structfield>typbyval</structfield> had better be false if
7508 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7509 where Datum is 8 bytes).
7510 Variable-length types are always passed by reference. Note that
7511 <structfield>typbyval</structfield> can be false even if the
7512 length would allow pass-by-value.
7517 <entry><structfield>typtype</structfield></entry>
7518 <entry><type>char</type></entry>
7521 <structfield>typtype</structfield> is
7522 <literal>b</literal> for a base type,
7523 <literal>c</literal> for a composite type (e.g., a table's row type),
7524 <literal>d</literal> for a domain,
7525 <literal>e</literal> for an enum type,
7526 <literal>p</literal> for a pseudo-type, or
7527 <literal>r</literal> for a range type.
7528 See also <structfield>typrelid</structfield> and
7529 <structfield>typbasetype</structfield>.
7534 <entry><structfield>typcategory</structfield></entry>
7535 <entry><type>char</type></entry>
7538 <structfield>typcategory</structfield> is an arbitrary classification
7539 of data types that is used by the parser to determine which implicit
7540 casts should be <quote>preferred</>.
7541 See <xref linkend="catalog-typcategory-table">.
7546 <entry><structfield>typispreferred</structfield></entry>
7547 <entry><type>bool</type></entry>
7550 True if the type is a preferred cast target within its
7551 <structfield>typcategory</structfield>
7556 <entry><structfield>typisdefined</structfield></entry>
7557 <entry><type>bool</type></entry>
7560 True if the type is defined, false if this is a placeholder
7561 entry for a not-yet-defined type. When
7562 <structfield>typisdefined</structfield> is false, nothing
7563 except the type name, namespace, and OID can be relied on.
7568 <entry><structfield>typdelim</structfield></entry>
7569 <entry><type>char</type></entry>
7572 Character that separates two values of this type when parsing
7573 array input. Note that the delimiter is associated with the array
7574 element data type, not the array data type.
7579 <entry><structfield>typrelid</structfield></entry>
7580 <entry><type>oid</type></entry>
7581 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7583 If this is a composite type (see
7584 <structfield>typtype</structfield>), then this column points to
7585 the <structname>pg_class</structname> entry that defines the
7586 corresponding table. (For a free-standing composite type, the
7587 <structname>pg_class</structname> entry doesn't really represent
7588 a table, but it is needed anyway for the type's
7589 <structname>pg_attribute</structname> entries to link to.)
7590 Zero for non-composite types.
7595 <entry><structfield>typelem</structfield></entry>
7596 <entry><type>oid</type></entry>
7597 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7599 If <structfield>typelem</structfield> is not 0 then it
7600 identifies another row in <structname>pg_type</structname>.
7601 The current type can then be subscripted like an array yielding
7602 values of type <structfield>typelem</structfield>. A
7603 <quote>true</quote> array type is variable length
7604 (<structfield>typlen</structfield> = -1),
7605 but some fixed-length (<structfield>typlen</structfield> > 0) types
7606 also have nonzero <structfield>typelem</structfield>, for example
7607 <type>name</type> and <type>point</type>.
7608 If a fixed-length type has a <structfield>typelem</structfield> then
7609 its internal representation must be some number of values of the
7610 <structfield>typelem</structfield> data type with no other data.
7611 Variable-length array types have a header defined by the array
7617 <entry><structfield>typarray</structfield></entry>
7618 <entry><type>oid</type></entry>
7619 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7621 If <structfield>typarray</structfield> is not 0 then it
7622 identifies another row in <structname>pg_type</structname>, which
7623 is the <quote>true</quote> array type having this type as element
7628 <entry><structfield>typinput</structfield></entry>
7629 <entry><type>regproc</type></entry>
7630 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7631 <entry>Input conversion function (text format)</entry>
7635 <entry><structfield>typoutput</structfield></entry>
7636 <entry><type>regproc</type></entry>
7637 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7638 <entry>Output conversion function (text format)</entry>
7642 <entry><structfield>typreceive</structfield></entry>
7643 <entry><type>regproc</type></entry>
7644 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7645 <entry>Input conversion function (binary format), or 0 if none</entry>
7649 <entry><structfield>typsend</structfield></entry>
7650 <entry><type>regproc</type></entry>
7651 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7652 <entry>Output conversion function (binary format), or 0 if none</entry>
7656 <entry><structfield>typmodin</structfield></entry>
7657 <entry><type>regproc</type></entry>
7658 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7659 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7663 <entry><structfield>typmodout</structfield></entry>
7664 <entry><type>regproc</type></entry>
7665 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7666 <entry>Type modifier output function, or 0 to use the standard format</entry>
7670 <entry><structfield>typanalyze</structfield></entry>
7671 <entry><type>regproc</type></entry>
7672 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7673 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7677 <entry><structfield>typalign</structfield></entry>
7678 <entry><type>char</type></entry>
7682 <structfield>typalign</structfield> is the alignment required
7683 when storing a value of this type. It applies to storage on
7684 disk as well as most representations of the value inside
7685 <productname>PostgreSQL</>.
7686 When multiple values are stored consecutively, such
7687 as in the representation of a complete row on disk, padding is
7688 inserted before a datum of this type so that it begins on the
7689 specified boundary. The alignment reference is the beginning
7690 of the first datum in the sequence.
7694 Possible values are:
7697 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7700 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7703 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7706 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7711 For types used in system tables, it is critical that the size
7712 and alignment defined in <structname>pg_type</structname>
7713 agree with the way that the compiler will lay out the column in
7714 a structure representing a table row.
7720 <entry><structfield>typstorage</structfield></entry>
7721 <entry><type>char</type></entry>
7724 <structfield>typstorage</structfield> tells for varlena
7725 types (those with <structfield>typlen</structfield> = -1) if
7726 the type is prepared for toasting and what the default strategy
7727 for attributes of this type should be.
7731 <para><literal>p</>: Value must always be stored plain.</para>
7735 <literal>e</>: Value can be stored in a <quote>secondary</quote>
7736 relation (if relation has one, see
7737 <literal>pg_class.reltoastrelid</literal>).
7741 <para><literal>m</>: Value can be stored compressed inline.</para>
7744 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7747 Note that <literal>m</> columns can also be moved out to secondary
7748 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7754 <entry><structfield>typnotnull</structfield></entry>
7755 <entry><type>bool</type></entry>
7758 <structfield>typnotnull</structfield> represents a not-null
7759 constraint on a type. Used for domains only.
7764 <entry><structfield>typbasetype</structfield></entry>
7765 <entry><type>oid</type></entry>
7766 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7768 If this is a domain (see <structfield>typtype</structfield>), then
7769 <structfield>typbasetype</structfield> identifies the type that this
7770 one is based on. Zero if this type is not a domain.
7775 <entry><structfield>typtypmod</structfield></entry>
7776 <entry><type>int4</type></entry>
7779 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7780 to be applied to their base type (-1 if base type does not use a
7781 <literal>typmod</>). -1 if this type is not a domain.
7786 <entry><structfield>typndims</structfield></entry>
7787 <entry><type>int4</type></entry>
7790 <structfield>typndims</structfield> is the number of array dimensions
7791 for a domain over an array (that is, <structfield>typbasetype</> is
7793 Zero for types other than domains over array types.
7798 <entry><structfield>typcollation</structfield></entry>
7799 <entry><type>oid</type></entry>
7800 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7802 <structfield>typcollation</structfield> specifies the collation
7803 of the type. If the type does not support collations, this will
7804 be zero. A base type that supports collations will have
7805 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7806 collatable type can have some other collation OID, if one was
7807 specified for the domain.
7812 <entry><structfield>typdefaultbin</structfield></entry>
7813 <entry><type>pg_node_tree</type></entry>
7816 If <structfield>typdefaultbin</> is not null, it is the
7817 <function>nodeToString()</function>
7818 representation of a default expression for the type. This is
7819 only used for domains.
7824 <entry><structfield>typdefault</structfield></entry>
7825 <entry><type>text</type></entry>
7828 <structfield>typdefault</> is null if the type has no associated
7829 default value. If <structfield>typdefaultbin</> is not null,
7830 <structfield>typdefault</> must contain a human-readable version of the
7831 default expression represented by <structfield>typdefaultbin</>. If
7832 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7833 not, then <structfield>typdefault</> is the external representation of
7834 the type's default value, which can be fed to the type's input
7835 converter to produce a constant.
7840 <entry><structfield>typacl</structfield></entry>
7841 <entry><type>aclitem[]</type></entry>
7844 Access privileges; see
7845 <xref linkend="sql-grant"> and
7846 <xref linkend="sql-revoke">
7855 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7856 of <structfield>typcategory</>. Any future additions to this list will
7857 also be upper-case ASCII letters. All other ASCII characters are reserved
7858 for user-defined categories.
7861 <table id="catalog-typcategory-table">
7862 <title><structfield>typcategory</> Codes</title>
7868 <entry>Category</entry>
7874 <entry><literal>A</literal></entry>
7875 <entry>Array types</entry>
7878 <entry><literal>B</literal></entry>
7879 <entry>Boolean types</entry>
7882 <entry><literal>C</literal></entry>
7883 <entry>Composite types</entry>
7886 <entry><literal>D</literal></entry>
7887 <entry>Date/time types</entry>
7890 <entry><literal>E</literal></entry>
7891 <entry>Enum types</entry>
7894 <entry><literal>G</literal></entry>
7895 <entry>Geometric types</entry>
7898 <entry><literal>I</literal></entry>
7899 <entry>Network address types</entry>
7902 <entry><literal>N</literal></entry>
7903 <entry>Numeric types</entry>
7906 <entry><literal>P</literal></entry>
7907 <entry>Pseudo-types</entry>
7910 <entry><literal>R</literal></entry>
7911 <entry>Range types</entry>
7914 <entry><literal>S</literal></entry>
7915 <entry>String types</entry>
7918 <entry><literal>T</literal></entry>
7919 <entry>Timespan types</entry>
7922 <entry><literal>U</literal></entry>
7923 <entry>User-defined types</entry>
7926 <entry><literal>V</literal></entry>
7927 <entry>Bit-string types</entry>
7930 <entry><literal>X</literal></entry>
7931 <entry><type>unknown</> type</entry>
7940 <sect1 id="catalog-pg-user-mapping">
7941 <title><structname>pg_user_mapping</structname></title>
7943 <indexterm zone="catalog-pg-user-mapping">
7944 <primary>pg_user_mapping</primary>
7948 The catalog <structname>pg_user_mapping</structname> stores
7949 the mappings from local user to remote. Access to this catalog is
7950 restricted from normal users, use the view
7951 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7956 <title><structname>pg_user_mapping</> Columns</title>
7963 <entry>References</entry>
7964 <entry>Description</entry>
7970 <entry><structfield>oid</structfield></entry>
7971 <entry><type>oid</type></entry>
7973 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7977 <entry><structfield>umuser</structfield></entry>
7978 <entry><type>oid</type></entry>
7979 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7980 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7984 <entry><structfield>umserver</structfield></entry>
7985 <entry><type>oid</type></entry>
7986 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7988 The OID of the foreign server that contains this mapping
7993 <entry><structfield>umoptions</structfield></entry>
7994 <entry><type>text[]</type></entry>
7997 User mapping specific options, as <quote>keyword=value</> strings
8006 <sect1 id="views-overview">
8007 <title>System Views</title>
8010 In addition to the system catalogs, <productname>PostgreSQL</productname>
8011 provides a number of built-in views. Some system views provide convenient
8012 access to some commonly used queries on the system catalogs. Other views
8013 provide access to internal server state.
8017 The information schema (<xref linkend="information-schema">) provides
8018 an alternative set of views which overlap the functionality of the system
8019 views. Since the information schema is SQL-standard whereas the views
8020 described here are <productname>PostgreSQL</productname>-specific,
8021 it's usually better to use the information schema if it provides all
8022 the information you need.
8026 <xref linkend="view-table"> lists the system views described here.
8027 More detailed documentation of each view follows below.
8028 There are some additional views that provide access to the results of
8029 the statistics collector; they are described in <xref
8030 linkend="monitoring-stats-views-table">.
8034 Except where noted, all the views described here are read-only.
8037 <table id="view-table">
8038 <title>System Views</title>
8043 <entry>View Name</entry>
8044 <entry>Purpose</entry>
8050 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
8051 <entry>available extensions</entry>
8055 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
8056 <entry>available versions of extensions</entry>
8060 <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
8061 <entry>compile-time configuration parameters</entry>
8065 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
8066 <entry>open cursors</entry>
8070 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
8071 <entry>summary of configuration file contents</entry>
8075 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
8076 <entry>groups of database users</entry>
8080 <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
8081 <entry>summary of client authentication configuration file contents</entry>
8085 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
8086 <entry>indexes</entry>
8090 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
8091 <entry>locks currently held or awaited</entry>
8095 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
8096 <entry>materialized views</entry>
8100 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
8101 <entry>policies</entry>
8105 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
8106 <entry>prepared statements</entry>
8110 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
8111 <entry>prepared transactions</entry>
8115 <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
8116 <entry>publications and their associated tables</entry>
8120 <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
8121 <entry>information about replication origins, including replication progress</entry>
8125 <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
8126 <entry>replication slot information</entry>
8130 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
8131 <entry>database roles</entry>
8135 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
8136 <entry>rules</entry>
8140 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
8141 <entry>security labels</entry>
8145 <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
8146 <entry>sequences</entry>
8150 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
8151 <entry>parameter settings</entry>
8155 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
8156 <entry>database users</entry>
8160 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
8161 <entry>planner statistics</entry>
8165 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
8166 <entry>tables</entry>
8170 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
8171 <entry>time zone abbreviations</entry>
8175 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
8176 <entry>time zone names</entry>
8180 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
8181 <entry>database users</entry>
8185 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
8186 <entry>user mappings</entry>
8190 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
8191 <entry>views</entry>
8199 <sect1 id="view-pg-available-extensions">
8200 <title><structname>pg_available_extensions</structname></title>
8202 <indexterm zone="view-pg-available-extensions">
8203 <primary>pg_available_extensions</primary>
8207 The <structname>pg_available_extensions</structname> view lists the
8208 extensions that are available for installation.
8210 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8211 catalog, which shows the extensions currently installed.
8215 <title><structname>pg_available_extensions</> Columns</title>
8222 <entry>Description</entry>
8228 <entry><structfield>name</structfield></entry>
8229 <entry><type>name</type></entry>
8230 <entry>Extension name</entry>
8234 <entry><structfield>default_version</structfield></entry>
8235 <entry><type>text</type></entry>
8236 <entry>Name of default version, or <literal>NULL</literal> if none is
8241 <entry><structfield>installed_version</structfield></entry>
8242 <entry><type>text</type></entry>
8243 <entry>Currently installed version of the extension,
8244 or <literal>NULL</literal> if not installed</entry>
8248 <entry><structfield>comment</structfield></entry>
8249 <entry><type>text</type></entry>
8250 <entry>Comment string from the extension's control file</entry>
8257 The <structname>pg_available_extensions</structname> view is read only.
8261 <sect1 id="view-pg-available-extension-versions">
8262 <title><structname>pg_available_extension_versions</structname></title>
8264 <indexterm zone="view-pg-available-extension-versions">
8265 <primary>pg_available_extension_versions</primary>
8269 The <structname>pg_available_extension_versions</structname> view lists the
8270 specific extension versions that are available for installation.
8272 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8273 catalog, which shows the extensions currently installed.
8277 <title><structname>pg_available_extension_versions</> Columns</title>
8284 <entry>Description</entry>
8290 <entry><structfield>name</structfield></entry>
8291 <entry><type>name</type></entry>
8292 <entry>Extension name</entry>
8296 <entry><structfield>version</structfield></entry>
8297 <entry><type>text</type></entry>
8298 <entry>Version name</entry>
8302 <entry><structfield>installed</structfield></entry>
8303 <entry><type>bool</type></entry>
8304 <entry>True if this version of this extension is currently
8309 <entry><structfield>superuser</structfield></entry>
8310 <entry><type>bool</type></entry>
8311 <entry>True if only superusers are allowed to install this extension</entry>
8315 <entry><structfield>relocatable</structfield></entry>
8316 <entry><type>bool</type></entry>
8317 <entry>True if extension can be relocated to another schema</entry>
8321 <entry><structfield>schema</structfield></entry>
8322 <entry><type>name</type></entry>
8323 <entry>Name of the schema that the extension must be installed into,
8324 or <literal>NULL</literal> if partially or fully relocatable</entry>
8328 <entry><structfield>requires</structfield></entry>
8329 <entry><type>name[]</type></entry>
8330 <entry>Names of prerequisite extensions,
8331 or <literal>NULL</literal> if none</entry>
8335 <entry><structfield>comment</structfield></entry>
8336 <entry><type>text</type></entry>
8337 <entry>Comment string from the extension's control file</entry>
8344 The <structname>pg_available_extension_versions</structname> view is read
8349 <sect1 id="view-pg-config">
8350 <title><structname>pg_config</structname></title>
8352 <indexterm zone="view-pg-config">
8353 <primary>pg_config</primary>
8357 The view <structname>pg_config</structname> describes the
8358 compile-time configuration parameters of the currently installed
8359 version of <productname>PostgreSQL</>. It is intended, for example, to
8360 be used by software packages that want to interface to
8361 <productname>PostgreSQL</> to facilitate finding the required header
8362 files and libraries. It provides the same basic information as the
8363 <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
8368 By default, the <structname>pg_config</structname> view can be read
8373 <title><structname>pg_config</> Columns</title>
8379 <entry>Description</entry>
8385 <entry><structfield>name</structfield></entry>
8386 <entry><type>text</type></entry>
8387 <entry>The parameter name</entry>
8391 <entry><structfield>setting</structfield></entry>
8392 <entry><type>text</type></entry>
8393 <entry>The parameter value</entry>
8401 <sect1 id="view-pg-cursors">
8402 <title><structname>pg_cursors</structname></title>
8404 <indexterm zone="view-pg-cursors">
8405 <primary>pg_cursors</primary>
8409 The <structname>pg_cursors</structname> view lists the cursors that
8410 are currently available. Cursors can be defined in several ways:
8414 via the <xref linkend="sql-declare">
8421 via the Bind message in the frontend/backend protocol, as
8422 described in <xref linkend="protocol-flow-ext-query">
8428 via the Server Programming Interface (SPI), as described in
8429 <xref linkend="spi-interface">
8434 The <structname>pg_cursors</structname> view displays cursors
8435 created by any of these means. Cursors only exist for the duration
8436 of the transaction that defines them, unless they have been
8437 declared <literal>WITH HOLD</literal>. Therefore non-holdable
8438 cursors are only present in the view until the end of their
8439 creating transaction.
8443 Cursors are used internally to implement some of the components
8444 of <productname>PostgreSQL</>, such as procedural languages.
8445 Therefore, the <structname>pg_cursors</> view might include cursors
8446 that have not been explicitly created by the user.
8452 <title><structname>pg_cursors</> Columns</title>
8459 <entry>Description</entry>
8465 <entry><structfield>name</structfield></entry>
8466 <entry><type>text</type></entry>
8467 <entry>The name of the cursor</entry>
8471 <entry><structfield>statement</structfield></entry>
8472 <entry><type>text</type></entry>
8473 <entry>The verbatim query string submitted to declare this cursor</entry>
8477 <entry><structfield>is_holdable</structfield></entry>
8478 <entry><type>boolean</type></entry>
8480 <literal>true</literal> if the cursor is holdable (that is, it
8481 can be accessed after the transaction that declared the cursor
8482 has committed); <literal>false</literal> otherwise
8487 <entry><structfield>is_binary</structfield></entry>
8488 <entry><type>boolean</type></entry>
8490 <literal>true</literal> if the cursor was declared
8491 <literal>BINARY</literal>; <literal>false</literal>
8497 <entry><structfield>is_scrollable</structfield></entry>
8498 <entry><type>boolean</type></entry>
8500 <literal>true</> if the cursor is scrollable (that is, it
8501 allows rows to be retrieved in a nonsequential manner);
8502 <literal>false</literal> otherwise
8507 <entry><structfield>creation_time</structfield></entry>
8508 <entry><type>timestamptz</type></entry>
8509 <entry>The time at which the cursor was declared</entry>
8516 The <structname>pg_cursors</structname> view is read only.
8521 <sect1 id="view-pg-file-settings">
8522 <title><structname>pg_file_settings</structname></title>
8524 <indexterm zone="view-pg-file-settings">
8525 <primary>pg_file_settings</primary>
8529 The view <structname>pg_file_settings</structname> provides a summary of
8530 the contents of the server's configuration file(s). A row appears in
8531 this view for each <quote>name = value</> entry appearing in the files,
8532 with annotations indicating whether the value could be applied
8533 successfully. Additional row(s) may appear for problems not linked to
8534 a <quote>name = value</> entry, such as syntax errors in the files.
8538 This view is helpful for checking whether planned changes in the
8539 configuration files will work, or for diagnosing a previous failure.
8540 Note that this view reports on the <emphasis>current</> contents of the
8541 files, not on what was last applied by the server. (The
8542 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
8543 view is usually sufficient to determine that.)
8547 By default, the <structname>pg_file_settings</structname> view can be read
8552 <title><structname>pg_file_settings</> Columns</title>
8559 <entry>Description</entry>
8564 <entry><structfield>sourcefile</structfield></entry>
8565 <entry><structfield>text</structfield></entry>
8566 <entry>Full path name of the configuration file</entry>
8569 <entry><structfield>sourceline</structfield></entry>
8570 <entry><structfield>integer</structfield></entry>
8572 Line number within the configuration file where the entry appears
8576 <entry><structfield>seqno</structfield></entry>
8577 <entry><structfield>integer</structfield></entry>
8578 <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
8581 <entry><structfield>name</structfield></entry>
8582 <entry><structfield>text</structfield></entry>
8583 <entry>Configuration parameter name</entry>
8586 <entry><structfield>setting</structfield></entry>
8587 <entry><structfield>text</structfield></entry>
8588 <entry>Value to be assigned to the parameter</entry>
8591 <entry><structfield>applied</structfield></entry>
8592 <entry><structfield>boolean</structfield></entry>
8593 <entry>True if the value can be applied successfully</entry>
8596 <entry><structfield>error</structfield></entry>
8597 <entry><structfield>text</structfield></entry>
8598 <entry>If not null, an error message indicating why this entry could
8599 not be applied</entry>
8606 If the configuration file contains syntax errors or invalid parameter
8607 names, the server will not attempt to apply any settings from it, and
8608 therefore all the <structfield>applied</> fields will read as false.
8609 In such a case there will be one or more rows with
8610 non-null <structfield>error</structfield> fields indicating the
8611 problem(s). Otherwise, individual settings will be applied if possible.
8612 If an individual setting cannot be applied (e.g., invalid value, or the
8613 setting cannot be changed after server start) it will have an appropriate
8614 message in the <structfield>error</structfield> field. Another way that
8615 an entry might have <structfield>applied</> = false is that it is
8616 overridden by a later entry for the same parameter name; this case is not
8617 considered an error so nothing appears in
8618 the <structfield>error</structfield> field.
8622 See <xref linkend="config-setting"> for more information about the various
8623 ways to change run-time parameters.
8628 <sect1 id="view-pg-group">
8629 <title><structname>pg_group</structname></title>
8631 <indexterm zone="view-pg-group">
8632 <primary>pg_group</primary>
8636 The view <structname>pg_group</structname> exists for backwards
8637 compatibility: it emulates a catalog that existed in
8638 <productname>PostgreSQL</productname> before version 8.1.
8639 It shows the names and members of all roles that are marked as not
8640 <structfield>rolcanlogin</>, which is an approximation to the set
8641 of roles that are being used as groups.
8645 <title><structname>pg_group</> Columns</title>
8652 <entry>References</entry>
8653 <entry>Description</entry>
8659 <entry><structfield>groname</structfield></entry>
8660 <entry><type>name</type></entry>
8661 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8662 <entry>Name of the group</entry>
8666 <entry><structfield>grosysid</structfield></entry>
8667 <entry><type>oid</type></entry>
8668 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8669 <entry>ID of this group</entry>
8673 <entry><structfield>grolist</structfield></entry>
8674 <entry><type>oid[]</type></entry>
8675 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8676 <entry>An array containing the IDs of the roles in this group</entry>
8684 <sect1 id="view-pg-hba-file-rules">
8685 <title><structname>pg_hba_file_rules</structname></title>
8687 <indexterm zone="view-pg-hba-file-rules">
8688 <primary>pg_hba_file_rules</primary>
8692 The view <structname>pg_hba_file_rules</structname> provides a summary of
8693 the contents of the client authentication configuration
8694 file, <filename>pg_hba.conf</>. A row appears in this view for each
8695 non-empty, non-comment line in the file, with annotations indicating
8696 whether the rule could be applied successfully.
8700 This view can be helpful for checking whether planned changes in the
8701 authentication configuration file will work, or for diagnosing a previous
8702 failure. Note that this view reports on the <emphasis>current</> contents
8703 of the file, not on what was last loaded by the server.
8707 By default, the <structname>pg_hba_file_rules</structname> view can be read
8712 <title><structname>pg_hba_file_rules</> Columns</title>
8719 <entry>Description</entry>
8724 <entry><structfield>line_number</structfield></entry>
8725 <entry><structfield>integer</structfield></entry>
8727 Line number of this rule in <filename>pg_hba.conf</>
8731 <entry><structfield>type</structfield></entry>
8732 <entry><structfield>text</structfield></entry>
8733 <entry>Type of connection</entry>
8736 <entry><structfield>database</structfield></entry>
8737 <entry><structfield>text[]</structfield></entry>
8738 <entry>List of database name(s) to which this rule applies</entry>
8741 <entry><structfield>user_name</structfield></entry>
8742 <entry><structfield>text[]</structfield></entry>
8743 <entry>List of user and group name(s) to which this rule applies</entry>
8746 <entry><structfield>address</structfield></entry>
8747 <entry><structfield>text</structfield></entry>
8749 Host name or IP address, or one
8750 of <literal>all</literal>, <literal>samehost</literal>,
8751 or <literal>samenet</literal>, or null for local connections
8755 <entry><structfield>netmask</structfield></entry>
8756 <entry><structfield>text</structfield></entry>
8757 <entry>IP address mask, or null if not applicable</entry>
8760 <entry><structfield>auth_method</structfield></entry>
8761 <entry><type>text</type></entry>
8762 <entry>Authentication method</entry>
8765 <entry><structfield>options</structfield></entry>
8766 <entry><type>text[]</type></entry>
8767 <entry>Options specified for authentication method, if any</entry>
8770 <entry><structfield>error</structfield></entry>
8771 <entry><structfield>text</structfield></entry>
8773 If not null, an error message indicating why this
8774 line could not be processed
8782 Usually, a row reflecting an incorrect entry will have values for only
8783 the <structfield>line_number</> and <structfield>error</> fields.
8787 See <xref linkend="client-authentication"> for more information about
8788 client authentication configuration.
8792 <sect1 id="view-pg-indexes">
8793 <title><structname>pg_indexes</structname></title>
8795 <indexterm zone="view-pg-indexes">
8796 <primary>pg_indexes</primary>
8800 The view <structname>pg_indexes</structname> provides access to
8801 useful information about each index in the database.
8805 <title><structname>pg_indexes</> Columns</title>
8812 <entry>References</entry>
8813 <entry>Description</entry>
8818 <entry><structfield>schemaname</structfield></entry>
8819 <entry><type>name</type></entry>
8820 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8821 <entry>Name of schema containing table and index</entry>
8824 <entry><structfield>tablename</structfield></entry>
8825 <entry><type>name</type></entry>
8826 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8827 <entry>Name of table the index is for</entry>
8830 <entry><structfield>indexname</structfield></entry>
8831 <entry><type>name</type></entry>
8832 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8833 <entry>Name of index</entry>
8836 <entry><structfield>tablespace</structfield></entry>
8837 <entry><type>name</type></entry>
8838 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8839 <entry>Name of tablespace containing index (null if default for database)</entry>
8842 <entry><structfield>indexdef</structfield></entry>
8843 <entry><type>text</type></entry>
8845 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8854 <sect1 id="view-pg-locks">
8855 <title><structname>pg_locks</structname></title>
8857 <indexterm zone="view-pg-locks">
8858 <primary>pg_locks</primary>
8862 The view <structname>pg_locks</structname> provides access to
8863 information about the locks held by active processes within the
8864 database server. See <xref linkend="mvcc"> for more discussion
8869 <structname>pg_locks</structname> contains one row per active lockable
8870 object, requested lock mode, and relevant process. Thus, the same
8871 lockable object might
8872 appear many times, if multiple processes are holding or waiting
8873 for locks on it. However, an object that currently has no locks on it
8874 will not appear at all.
8878 There are several distinct types of lockable objects:
8879 whole relations (e.g., tables), individual pages of relations,
8880 individual tuples of relations,
8881 transaction IDs (both virtual and permanent IDs),
8882 and general database objects (identified by class OID and object OID,
8883 in the same way as in <structname>pg_description</structname> or
8884 <structname>pg_depend</structname>). Also, the right to extend a
8885 relation is represented as a separate lockable object.
8886 Also, <quote>advisory</> locks can be taken on numbers that have
8887 user-defined meanings.
8891 <title><structname>pg_locks</> Columns</title>
8898 <entry>References</entry>
8899 <entry>Description</entry>
8904 <entry><structfield>locktype</structfield></entry>
8905 <entry><type>text</type></entry>
8908 Type of the lockable object:
8909 <literal>relation</>,
8913 <literal>transactionid</>,
8914 <literal>virtualxid</>,
8916 <literal>userlock</>, or
8917 <literal>advisory</>
8921 <entry><structfield>database</structfield></entry>
8922 <entry><type>oid</type></entry>
8923 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8925 OID of the database in which the lock target exists, or
8926 zero if the target is a shared object, or
8927 null if the target is a transaction ID
8931 <entry><structfield>relation</structfield></entry>
8932 <entry><type>oid</type></entry>
8933 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8935 OID of the relation targeted by the lock, or null if the target is not
8936 a relation or part of a relation
8940 <entry><structfield>page</structfield></entry>
8941 <entry><type>integer</type></entry>
8944 Page number targeted by the lock within the relation,
8945 or null if the target is not a relation page or tuple
8949 <entry><structfield>tuple</structfield></entry>
8950 <entry><type>smallint</type></entry>
8953 Tuple number targeted by the lock within the page,
8954 or null if the target is not a tuple
8958 <entry><structfield>virtualxid</structfield></entry>
8959 <entry><type>text</type></entry>
8962 Virtual ID of the transaction targeted by the lock,
8963 or null if the target is not a virtual transaction ID
8967 <entry><structfield>transactionid</structfield></entry>
8968 <entry><type>xid</type></entry>
8971 ID of the transaction targeted by the lock,
8972 or null if the target is not a transaction ID
8976 <entry><structfield>classid</structfield></entry>
8977 <entry><type>oid</type></entry>
8978 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8980 OID of the system catalog containing the lock target, or null if the
8981 target is not a general database object
8985 <entry><structfield>objid</structfield></entry>
8986 <entry><type>oid</type></entry>
8987 <entry>any OID column</entry>
8989 OID of the lock target within its system catalog, or null if the
8990 target is not a general database object
8994 <entry><structfield>objsubid</structfield></entry>
8995 <entry><type>smallint</type></entry>
8998 Column number targeted by the lock (the
8999 <structfield>classid</> and <structfield>objid</> refer to the
9001 or zero if the target is some other general database object,
9002 or null if the target is not a general database object
9006 <entry><structfield>virtualtransaction</structfield></entry>
9007 <entry><type>text</type></entry>
9010 Virtual ID of the transaction that is holding or awaiting this lock
9014 <entry><structfield>pid</structfield></entry>
9015 <entry><type>integer</type></entry>
9018 Process ID of the server process holding or awaiting this
9019 lock, or null if the lock is held by a prepared transaction
9023 <entry><structfield>mode</structfield></entry>
9024 <entry><type>text</type></entry>
9026 <entry>Name of the lock mode held or desired by this process (see <xref
9027 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
9030 <entry><structfield>granted</structfield></entry>
9031 <entry><type>boolean</type></entry>
9033 <entry>True if lock is held, false if lock is awaited</entry>
9036 <entry><structfield>fastpath</structfield></entry>
9037 <entry><type>boolean</type></entry>
9039 <entry>True if lock was taken via fast path, false if taken via main
9047 <structfield>granted</structfield> is true in a row representing a lock
9048 held by the indicated process. False indicates that this process is
9049 currently waiting to acquire this lock, which implies that at least one
9050 other process is holding or waiting for a conflicting lock mode on the same
9051 lockable object. The waiting process will sleep until the other lock is
9052 released (or a deadlock situation is detected). A single process can be
9053 waiting to acquire at most one lock at a time.
9057 Throughout running a transaction, a server process holds an exclusive lock
9058 on the transaction's virtual transaction ID. If a permanent ID is assigned
9059 to the transaction (which normally happens only if the transaction changes
9060 the state of the database), it also holds an exclusive lock on the
9061 transaction's permanent transaction ID until it ends. When a process finds
9062 it necessary to wait specifically for another transaction to end, it does
9063 so by attempting to acquire share lock on the other transaction's ID
9064 (either virtual or permanent ID depending on the situation). That will
9065 succeed only when the other transaction terminates and releases its locks.
9069 Although tuples are a lockable type of object,
9070 information about row-level locks is stored on disk, not in memory,
9071 and therefore row-level locks normally do not appear in this view.
9072 If a process is waiting for a
9073 row-level lock, it will usually appear in the view as waiting for the
9074 permanent transaction ID of the current holder of that row lock.
9078 Advisory locks can be acquired on keys consisting of either a single
9079 <type>bigint</type> value or two integer values.
9080 A <type>bigint</type> key is displayed with its
9081 high-order half in the <structfield>classid</> column, its low-order half
9082 in the <structfield>objid</> column, and <structfield>objsubid</> equal
9083 to 1. The original <type>bigint</type> value can be reassembled with the
9084 expression <literal>(classid::bigint << 32) |
9085 objid::bigint</literal>. Integer keys are displayed with the
9087 <structfield>classid</> column, the second key in the <structfield>objid</>
9088 column, and <structfield>objsubid</> equal to 2. The actual meaning of
9089 the keys is up to the user. Advisory locks are local to each database,
9090 so the <structfield>database</> column is meaningful for an advisory lock.
9094 <structname>pg_locks</structname> provides a global view of all locks
9095 in the database cluster, not only those relevant to the current database.
9096 Although its <structfield>relation</structfield> column can be joined
9097 against <structname>pg_class</>.<structfield>oid</> to identify locked
9098 relations, this will only work correctly for relations in the current
9099 database (those for which the <structfield>database</structfield> column
9100 is either the current database's OID or zero).
9104 The <structfield>pid</structfield> column can be joined to the
9105 <structfield>pid</structfield> column of the <link
9106 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
9108 information on the session holding or awaiting each lock,
9111 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
9112 ON pl.pid = psa.pid;
9114 Also, if you are using prepared transactions, the
9115 <structfield>virtualtransaction</> column can be joined to the
9116 <structfield>transaction</structfield> column of the <link
9117 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
9118 view to get more information on prepared transactions that hold locks.
9119 (A prepared transaction can never be waiting for a lock,
9120 but it continues to hold the locks it acquired while running.)
9123 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
9124 ON pl.virtualtransaction = '-1/' || ppx.transaction;
9129 While it is possible to obtain information about which processes block
9130 which other processes by joining <structname>pg_locks</structname> against
9131 itself, this is very difficult to get right in detail. Such a query would
9132 have to encode knowledge about which lock modes conflict with which
9133 others. Worse, the <structname>pg_locks</structname> view does not expose
9134 information about which processes are ahead of which others in lock wait
9135 queues, nor information about which processes are parallel workers running
9136 on behalf of which other client sessions. It is better to use
9137 the <function>pg_blocking_pids()</> function
9138 (see <xref linkend="functions-info-session-table">) to identify which
9139 process(es) a waiting process is blocked behind.
9143 The <structname>pg_locks</structname> view displays data from both the
9144 regular lock manager and the predicate lock manager, which are
9145 separate systems; in addition, the regular lock manager subdivides its
9146 locks into regular and <firstterm>fast-path</> locks.
9147 This data is not guaranteed to be entirely consistent.
9148 When the view is queried,
9149 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
9150 is gathered from each backend one at a time, without freezing the state of
9151 the entire lock manager, so it is possible for locks to be taken or
9152 released while information is gathered. Note, however, that these locks are
9153 known not to conflict with any other lock currently in place. After
9154 all backends have been queried for fast-path locks, the remainder of the
9155 regular lock manager is locked as a unit, and a consistent snapshot of all
9156 remaining locks is collected as an atomic action. After unlocking the
9157 regular lock manager, the predicate lock manager is similarly locked and all
9158 predicate locks are collected as an atomic action. Thus, with the exception
9159 of fast-path locks, each lock manager will deliver a consistent set of
9160 results, but as we do not lock both lock managers simultaneously, it is
9161 possible for locks to be taken or released after we interrogate the regular
9162 lock manager and before we interrogate the predicate lock manager.
9166 Locking the regular and/or predicate lock manager could have some
9167 impact on database performance if this view is very frequently accessed.
9168 The locks are held only for the minimum amount of time necessary to
9169 obtain data from the lock managers, but this does not completely eliminate
9170 the possibility of a performance impact.
9175 <sect1 id="view-pg-matviews">
9176 <title><structname>pg_matviews</structname></title>
9178 <indexterm zone="view-pg-matviews">
9179 <primary>pg_matviews</primary>
9182 <indexterm zone="view-pg-matviews">
9183 <primary>materialized views</primary>
9187 The view <structname>pg_matviews</structname> provides access to
9188 useful information about each materialized view in the database.
9192 <title><structname>pg_matviews</> Columns</title>
9199 <entry>References</entry>
9200 <entry>Description</entry>
9205 <entry><structfield>schemaname</structfield></entry>
9206 <entry><type>name</type></entry>
9207 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9208 <entry>Name of schema containing materialized view</entry>
9211 <entry><structfield>matviewname</structfield></entry>
9212 <entry><type>name</type></entry>
9213 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9214 <entry>Name of materialized view</entry>
9217 <entry><structfield>matviewowner</structfield></entry>
9218 <entry><type>name</type></entry>
9219 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9220 <entry>Name of materialized view's owner</entry>
9223 <entry><structfield>tablespace</structfield></entry>
9224 <entry><type>name</type></entry>
9225 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9226 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
9229 <entry><structfield>hasindexes</structfield></entry>
9230 <entry><type>boolean</type></entry>
9232 <entry>True if materialized view has (or recently had) any indexes</entry>
9235 <entry><structfield>ispopulated</structfield></entry>
9236 <entry><type>boolean</type></entry>
9238 <entry>True if materialized view is currently populated</entry>
9241 <entry><structfield>definition</structfield></entry>
9242 <entry><type>text</type></entry>
9244 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
9252 <sect1 id="view-pg-policies">
9253 <title><structname>pg_policies</structname></title>
9255 <indexterm zone="view-pg-policies">
9256 <primary>pg_policies</primary>
9260 The view <structname>pg_policies</structname> provides access to
9261 useful information about each row-level security policy in the database.
9265 <title><structname>pg_policies</> Columns</title>
9272 <entry>References</entry>
9273 <entry>Description</entry>
9278 <entry><structfield>schemaname</structfield></entry>
9279 <entry><type>name</type></entry>
9280 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9281 <entry>Name of schema containing table policy is on</entry>
9284 <entry><structfield>tablename</structfield></entry>
9285 <entry><type>name</type></entry>
9286 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9287 <entry>Name of table policy is on</entry>
9290 <entry><structfield>policyname</structfield></entry>
9291 <entry><type>name</type></entry>
9292 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
9293 <entry>Name of policy</entry>
9296 <entry><structfield>polpermissive</structfield></entry>
9297 <entry><type>text</type></entry>
9299 <entry>Is the policy permissive or restrictive?</entry>
9302 <entry><structfield>roles</structfield></entry>
9303 <entry><type>name[]</type></entry>
9305 <entry>The roles to which this policy applies</entry>
9308 <entry><structfield>cmd</structfield></entry>
9309 <entry><type>text</type></entry>
9311 <entry>The command type to which the policy is applied</entry>
9314 <entry><structfield>qual</structfield></entry>
9315 <entry><type>text</type></entry>
9317 <entry>The expression added to the security barrier qualifications for
9318 queries that this policy applies to</entry>
9321 <entry><structfield>with_check</structfield></entry>
9322 <entry><type>text</type></entry>
9324 <entry>The expression added to the WITH CHECK qualifications for
9325 queries that attempt to add rows to this table</entry>
9333 <sect1 id="view-pg-prepared-statements">
9334 <title><structname>pg_prepared_statements</structname></title>
9336 <indexterm zone="view-pg-prepared-statements">
9337 <primary>pg_prepared_statements</primary>
9341 The <structname>pg_prepared_statements</structname> view displays
9342 all the prepared statements that are available in the current
9343 session. See <xref linkend="sql-prepare"> for more information about prepared
9348 <structname>pg_prepared_statements</structname> contains one row
9349 for each prepared statement. Rows are added to the view when a new
9350 prepared statement is created and removed when a prepared statement
9351 is released (for example, via the <xref linkend="sql-deallocate"> command).
9355 <title><structname>pg_prepared_statements</> Columns</title>
9362 <entry>Description</entry>
9367 <entry><structfield>name</structfield></entry>
9368 <entry><type>text</type></entry>
9370 The identifier of the prepared statement
9374 <entry><structfield>statement</structfield></entry>
9375 <entry><type>text</type></entry>
9377 The query string submitted by the client to create this
9378 prepared statement. For prepared statements created via SQL,
9379 this is the <command>PREPARE</command> statement submitted by
9380 the client. For prepared statements created via the
9381 frontend/backend protocol, this is the text of the prepared
9386 <entry><structfield>prepare_time</structfield></entry>
9387 <entry><type>timestamptz</type></entry>
9389 The time at which the prepared statement was created
9393 <entry><structfield>parameter_types</structfield></entry>
9394 <entry><type>regtype[]</type></entry>
9396 The expected parameter types for the prepared statement in the
9397 form of an array of <type>regtype</type>. The OID corresponding
9398 to an element of this array can be obtained by casting the
9399 <type>regtype</type> value to <type>oid</type>.
9403 <entry><structfield>from_sql</structfield></entry>
9404 <entry><type>boolean</type></entry>
9406 <literal>true</literal> if the prepared statement was created
9407 via the <command>PREPARE</command> SQL command;
9408 <literal>false</literal> if the statement was prepared via the
9409 frontend/backend protocol
9417 The <structname>pg_prepared_statements</structname> view is read only.
9421 <sect1 id="view-pg-prepared-xacts">
9422 <title><structname>pg_prepared_xacts</structname></title>
9424 <indexterm zone="view-pg-prepared-xacts">
9425 <primary>pg_prepared_xacts</primary>
9429 The view <structname>pg_prepared_xacts</structname> displays
9430 information about transactions that are currently prepared for two-phase
9431 commit (see <xref linkend="sql-prepare-transaction"> for details).
9435 <structname>pg_prepared_xacts</structname> contains one row per prepared
9436 transaction. An entry is removed when the transaction is committed or
9441 <title><structname>pg_prepared_xacts</> Columns</title>
9448 <entry>References</entry>
9449 <entry>Description</entry>
9454 <entry><structfield>transaction</structfield></entry>
9455 <entry><type>xid</type></entry>
9458 Numeric transaction identifier of the prepared transaction
9462 <entry><structfield>gid</structfield></entry>
9463 <entry><type>text</type></entry>
9466 Global transaction identifier that was assigned to the transaction
9470 <entry><structfield>prepared</structfield></entry>
9471 <entry><type>timestamp with time zone</type></entry>
9474 Time at which the transaction was prepared for commit
9478 <entry><structfield>owner</structfield></entry>
9479 <entry><type>name</type></entry>
9480 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9482 Name of the user that executed the transaction
9486 <entry><structfield>database</structfield></entry>
9487 <entry><type>name</type></entry>
9488 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9490 Name of the database in which the transaction was executed
9498 When the <structname>pg_prepared_xacts</structname> view is accessed, the
9499 internal transaction manager data structures are momentarily locked, and
9500 a copy is made for the view to display. This ensures that the
9501 view produces a consistent set of results, while not blocking
9502 normal operations longer than necessary. Nonetheless
9503 there could be some impact on database performance if this view is
9504 frequently accessed.
9509 <sect1 id="view-pg-publication-tables">
9510 <title><structname>pg_publication_tables</structname></title>
9512 <indexterm zone="view-pg-publication-tables">
9513 <primary>pg_publication_tables</primary>
9517 The view <structname>pg_publication_tables</structname> provides
9518 information about the mapping between publications and the tables they
9519 contain. Unlike the underlying
9520 catalog <structname>pg_publication_rel</structname>, this view expands
9521 publications defined as <literal>FOR ALL TABLES</literal>, so for such
9522 publications there will be a row for each eligible table.
9526 <title><structname>pg_publication_tables</structname> Columns</title>
9533 <entry>References</entry>
9534 <entry>Description</entry>
9540 <entry><structfield>pubname</structfield></entry>
9541 <entry><type>name</type></entry>
9542 <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
9543 <entry>Name of publication</entry>
9547 <entry><structfield>schemaname</structfield></entry>
9548 <entry><type>name</type></entry>
9549 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9550 <entry>Name of schema containing table</entry>
9554 <entry><structfield>tablename</structfield></entry>
9555 <entry><type>name</type></entry>
9556 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9557 <entry>Name of table</entry>
9564 <sect1 id="view-pg-replication-origin-status">
9565 <title><structname>pg_replication_origin_status</structname></title>
9567 <indexterm zone="view-pg-replication-origin-status">
9568 <primary>pg_replication_origin_status</primary>
9572 The <structname>pg_replication_origin_status</structname> view
9573 contains information about how far replay for a certain origin has
9574 progressed. For more on replication origins
9575 see <xref linkend="replication-origins">.
9580 <title><structname>pg_replication_origin_status</structname> Columns</title>
9587 <entry>References</entry>
9588 <entry>Description</entry>
9594 <entry><structfield>local_id</structfield></entry>
9595 <entry><type>Oid</type></entry>
9596 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
9597 <entry>internal node identifier</entry>
9601 <entry><structfield>external_id</structfield></entry>
9602 <entry><type>text</type></entry>
9603 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
9604 <entry>external node identifier</entry>
9608 <entry><structfield>remote_lsn</structfield></entry>
9609 <entry><type>pg_lsn</type></entry>
9611 <entry>The origin node's LSN up to which data has been replicated.</entry>
9615 <entry><structfield>local_lsn</structfield></entry>
9616 <entry><type>pg_lsn</type></entry>
9619 This node's LSN at which <literal>remote_lsn</literal> has
9620 been replicated. Used to flush commit records before persisting
9621 data to disk when using asynchronous commits.
9629 <sect1 id="view-pg-replication-slots">
9630 <title><structname>pg_replication_slots</structname></title>
9632 <indexterm zone="view-pg-replication-slots">
9633 <primary>pg_replication_slots</primary>
9637 The <structname>pg_replication_slots</structname> view provides a listing
9638 of all replication slots that currently exist on the database cluster,
9639 along with their current state.
9643 For more on replication slots,
9644 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
9649 <title><structname>pg_replication_slots</structname> Columns</title>
9656 <entry>References</entry>
9657 <entry>Description</entry>
9663 <entry><structfield>slot_name</structfield></entry>
9664 <entry><type>name</type></entry>
9666 <entry>A unique, cluster-wide identifier for the replication slot</entry>
9670 <entry><structfield>plugin</structfield></entry>
9671 <entry><type>name</type></entry>
9673 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
9677 <entry><structfield>slot_type</structfield></entry>
9678 <entry><type>text</type></entry>
9680 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
9684 <entry><structfield>datoid</structfield></entry>
9685 <entry><type>oid</type></entry>
9686 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9687 <entry>The OID of the database this slot is associated with, or
9688 null. Only logical slots have an associated database.</entry>
9692 <entry><structfield>database</structfield></entry>
9693 <entry><type>text</type></entry>
9694 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9695 <entry>The name of the database this slot is associated with, or
9696 null. Only logical slots have an associated database.</entry>
9700 <entry><structfield>temporary</structfield></entry>
9701 <entry><type>boolean</type></entry>
9703 <entry>True if this is a temporary replication slot. Temporary slots are
9704 not saved to disk and are automatically dropped on error or when
9705 the session has finished.</entry>
9709 <entry><structfield>active</structfield></entry>
9710 <entry><type>boolean</type></entry>
9712 <entry>True if this slot is currently actively being used</entry>
9716 <entry><structfield>active_pid</structfield></entry>
9717 <entry><type>integer</type></entry>
9719 <entry>The process ID of the session using this slot if the slot
9720 is currently actively being used. <literal>NULL</literal> if
9726 <entry><structfield>xmin</structfield></entry>
9727 <entry><type>xid</type></entry>
9729 <entry>The oldest transaction that this slot needs the database to
9730 retain. <literal>VACUUM</literal> cannot remove tuples deleted
9731 by any later transaction.
9736 <entry><structfield>catalog_xmin</structfield></entry>
9737 <entry><type>xid</type></entry>
9739 <entry>The oldest transaction affecting the system catalogs that this
9740 slot needs the database to retain. <literal>VACUUM</literal> cannot
9741 remove catalog tuples deleted by any later transaction.
9746 <entry><structfield>restart_lsn</structfield></entry>
9747 <entry><type>pg_lsn</type></entry>
9749 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
9750 might be required by the consumer of this slot and thus won't be
9751 automatically removed during checkpoints.
9756 <entry><structfield>confirmed_flush_lsn</structfield></entry>
9757 <entry><type>pg_lsn</type></entry>
9759 <entry>The address (<literal>LSN</literal>) up to which the logical
9760 slot's consumer has confirmed receiving data. Data older than this is
9761 not available anymore. <literal>NULL</> for physical slots.
9770 <sect1 id="view-pg-roles">
9771 <title><structname>pg_roles</structname></title>
9773 <indexterm zone="view-pg-roles">
9774 <primary>pg_roles</primary>
9778 The view <structname>pg_roles</structname> provides access to
9779 information about database roles. This is simply a publicly
9781 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9782 that blanks out the password field.
9786 This view explicitly exposes the OID column of the underlying table,
9787 since that is needed to do joins to other catalogs.
9791 <title><structname>pg_roles</> Columns</title>
9798 <entry>References</entry>
9799 <entry>Description</entry>
9805 <entry><structfield>rolname</structfield></entry>
9806 <entry><type>name</type></entry>
9808 <entry>Role name</entry>
9812 <entry><structfield>rolsuper</structfield></entry>
9813 <entry><type>bool</type></entry>
9815 <entry>Role has superuser privileges</entry>
9819 <entry><structfield>rolinherit</structfield></entry>
9820 <entry><type>bool</type></entry>
9822 <entry>Role automatically inherits privileges of roles it is a
9827 <entry><structfield>rolcreaterole</structfield></entry>
9828 <entry><type>bool</type></entry>
9830 <entry>Role can create more roles</entry>
9834 <entry><structfield>rolcreatedb</structfield></entry>
9835 <entry><type>bool</type></entry>
9837 <entry>Role can create databases</entry>
9841 <entry><structfield>rolcanlogin</structfield></entry>
9842 <entry><type>bool</type></entry>
9845 Role can log in. That is, this role can be given as the initial
9846 session authorization identifier
9851 <entry><structfield>rolreplication</structfield></entry>
9852 <entry><type>bool</type></entry>
9855 Role is a replication role. That is, this role can initiate streaming
9856 replication (see <xref linkend="streaming-replication">) and set/unset
9857 the system backup mode using <function>pg_start_backup</> and
9858 <function>pg_stop_backup</>
9863 <entry><structfield>rolconnlimit</structfield></entry>
9864 <entry><type>int4</type></entry>
9867 For roles that can log in, this sets maximum number of concurrent
9868 connections this role can make. -1 means no limit.
9873 <entry><structfield>rolpassword</structfield></entry>
9874 <entry><type>text</type></entry>
9876 <entry>Not the password (always reads as <literal>********</>)</entry>
9880 <entry><structfield>rolvaliduntil</structfield></entry>
9881 <entry><type>timestamptz</type></entry>
9883 <entry>Password expiry time (only used for password authentication);
9884 null if no expiration</entry>
9888 <entry><structfield>rolbypassrls</structfield></entry>
9889 <entry><type>bool</type></entry>
9892 Role bypasses every row level security policy, see
9893 <xref linkend="ddl-rowsecurity"> for more information.
9898 <entry><structfield>rolconfig</structfield></entry>
9899 <entry><type>text[]</type></entry>
9901 <entry>Role-specific defaults for run-time configuration variables</entry>
9905 <entry><structfield>oid</structfield></entry>
9906 <entry><type>oid</type></entry>
9907 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9908 <entry>ID of role</entry>
9916 <sect1 id="view-pg-rules">
9917 <title><structname>pg_rules</structname></title>
9919 <indexterm zone="view-pg-rules">
9920 <primary>pg_rules</primary>
9924 The view <structname>pg_rules</structname> provides access to
9925 useful information about query rewrite rules.
9929 <title><structname>pg_rules</> Columns</title>
9936 <entry>References</entry>
9937 <entry>Description</entry>
9942 <entry><structfield>schemaname</structfield></entry>
9943 <entry><type>name</type></entry>
9944 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9945 <entry>Name of schema containing table</entry>
9948 <entry><structfield>tablename</structfield></entry>
9949 <entry><type>name</type></entry>
9950 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9951 <entry>Name of table the rule is for</entry>
9954 <entry><structfield>rulename</structfield></entry>
9955 <entry><type>name</type></entry>
9956 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
9957 <entry>Name of rule</entry>
9960 <entry><structfield>definition</structfield></entry>
9961 <entry><type>text</type></entry>
9963 <entry>Rule definition (a reconstructed creation command)</entry>
9970 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
9971 of views and materialized views; those can be seen in
9972 <structname>pg_views</> and <structname>pg_matviews</>.
9977 <sect1 id="view-pg-seclabels">
9978 <title><structname>pg_seclabels</structname></title>
9980 <indexterm zone="view-pg-seclabels">
9981 <primary>pg_seclabels</primary>
9985 The view <structname>pg_seclabels</structname> provides information about
9986 security labels. It as an easier-to-query version of the
9987 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9991 <title><structname>pg_seclabels</> Columns</title>
9998 <entry>References</entry>
9999 <entry>Description</entry>
10004 <entry><structfield>objoid</structfield></entry>
10005 <entry><type>oid</type></entry>
10006 <entry>any OID column</entry>
10007 <entry>The OID of the object this security label pertains to</entry>
10010 <entry><structfield>classoid</structfield></entry>
10011 <entry><type>oid</type></entry>
10012 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
10013 <entry>The OID of the system catalog this object appears in</entry>
10016 <entry><structfield>objsubid</structfield></entry>
10017 <entry><type>int4</type></entry>
10020 For a security label on a table column, this is the column number (the
10021 <structfield>objoid</> and <structfield>classoid</> refer to
10022 the table itself). For all other object types, this column is
10027 <entry><structfield>objtype</structfield></entry>
10028 <entry><type>text</type></entry>
10031 The type of object to which this label applies, as text.
10035 <entry><structfield>objnamespace</structfield></entry>
10036 <entry><type>oid</type></entry>
10037 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
10039 The OID of the namespace for this object, if applicable;
10044 <entry><structfield>objname</structfield></entry>
10045 <entry><type>text</type></entry>
10048 The name of the object to which this label applies, as text.
10052 <entry><structfield>provider</structfield></entry>
10053 <entry><type>text</type></entry>
10054 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
10055 <entry>The label provider associated with this label.</entry>
10058 <entry><structfield>label</structfield></entry>
10059 <entry><type>text</type></entry>
10060 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
10061 <entry>The security label applied to this object.</entry>
10068 <sect1 id="view-pg-sequences">
10069 <title><structname>pg_sequences</structname></title>
10071 <indexterm zone="view-pg-sequences">
10072 <primary>pg_sequences</primary>
10076 The view <structname>pg_sequences</structname> provides access to
10077 useful information about each sequence in the database.
10081 <title><structname>pg_sequences</> Columns</title>
10086 <entry>Name</entry>
10087 <entry>Type</entry>
10088 <entry>References</entry>
10089 <entry>Description</entry>
10094 <entry><structfield>schemaname</structfield></entry>
10095 <entry><type>name</type></entry>
10096 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10097 <entry>Name of schema containing sequence</entry>
10100 <entry><structfield>sequencename</structfield></entry>
10101 <entry><type>name</type></entry>
10102 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10103 <entry>Name of sequence</entry>
10106 <entry><structfield>sequenceowner</structfield></entry>
10107 <entry><type>name</type></entry>
10108 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10109 <entry>Name of sequence's owner</entry>
10112 <entry><structfield>data_type</structfield></entry>
10113 <entry><type>regtype</type></entry>
10114 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_type</structname></link>.oid</literal></entry>
10115 <entry>Data type of the sequence</entry>
10118 <entry><structfield>start_value</structfield></entry>
10119 <entry><type>bigint</type></entry>
10121 <entry>Start value of the sequence</entry>
10124 <entry><structfield>min_value</structfield></entry>
10125 <entry><type>bigint</type></entry>
10127 <entry>Minimum value of the sequence</entry>
10130 <entry><structfield>max_value</structfield></entry>
10131 <entry><type>bigint</type></entry>
10133 <entry>Maximum value of the sequence</entry>
10136 <entry><structfield>increment_by</structfield></entry>
10137 <entry><type>bigint</type></entry>
10139 <entry>Increment value of the sequence</entry>
10142 <entry><structfield>cycle</structfield></entry>
10143 <entry><type>boolean</type></entry>
10145 <entry>Whether the sequence cycles</entry>
10148 <entry><structfield>cache_size</structfield></entry>
10149 <entry><type>bigint</type></entry>
10151 <entry>Cache size of the sequence</entry>
10154 <entry><structfield>last_value</structfield></entry>
10155 <entry><type>bigint</type></entry>
10157 <entry>The last sequence value written to disk. If caching is used,
10158 this value can be greater than the last value handed out from the
10159 sequence. Null if the sequence has not been read from yet. Also, if
10160 the current user does not have <literal>USAGE</literal>
10161 or <literal>SELECT</literal> privilege on the sequence, the value is
10169 <sect1 id="view-pg-settings">
10170 <title><structname>pg_settings</structname></title>
10172 <indexterm zone="view-pg-settings">
10173 <primary>pg_settings</primary>
10177 The view <structname>pg_settings</structname> provides access to
10178 run-time parameters of the server. It is essentially an alternative
10179 interface to the <xref linkend="sql-show">
10180 and <xref linkend="sql-set"> commands.
10181 It also provides access to some facts about each parameter that are
10182 not directly available from <command>SHOW</>, such as minimum and
10187 <title><structname>pg_settings</> Columns</title>
10192 <entry>Name</entry>
10193 <entry>Type</entry>
10194 <entry>Description</entry>
10199 <entry><structfield>name</structfield></entry>
10200 <entry><type>text</type></entry>
10201 <entry>Run-time configuration parameter name</entry>
10204 <entry><structfield>setting</structfield></entry>
10205 <entry><type>text</type></entry>
10206 <entry>Current value of the parameter</entry>
10209 <entry><structfield>unit</structfield></entry>
10210 <entry><type>text</type></entry>
10211 <entry>Implicit unit of the parameter</entry>
10214 <entry><structfield>category</structfield></entry>
10215 <entry><type>text</type></entry>
10216 <entry>Logical group of the parameter</entry>
10219 <entry><structfield>short_desc</structfield></entry>
10220 <entry><type>text</type></entry>
10221 <entry>A brief description of the parameter</entry>
10224 <entry><structfield>extra_desc</structfield></entry>
10225 <entry><type>text</type></entry>
10226 <entry>Additional, more detailed, description of the parameter</entry>
10229 <entry><structfield>context</structfield></entry>
10230 <entry><type>text</type></entry>
10231 <entry>Context required to set the parameter's value (see below)</entry>
10234 <entry><structfield>vartype</structfield></entry>
10235 <entry><type>text</type></entry>
10236 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
10237 <literal>integer</>, <literal>real</>, or <literal>string</>)
10241 <entry><structfield>source</structfield></entry>
10242 <entry><type>text</type></entry>
10243 <entry>Source of the current parameter value</entry>
10246 <entry><structfield>min_val</structfield></entry>
10247 <entry><type>text</type></entry>
10248 <entry>Minimum allowed value of the parameter (null for non-numeric
10252 <entry><structfield>max_val</structfield></entry>
10253 <entry><type>text</type></entry>
10254 <entry>Maximum allowed value of the parameter (null for non-numeric
10258 <entry><structfield>enumvals</structfield></entry>
10259 <entry><type>text[]</type></entry>
10260 <entry>Allowed values of an enum parameter (null for non-enum
10264 <entry><structfield>boot_val</structfield></entry>
10265 <entry><type>text</type></entry>
10266 <entry>Parameter value assumed at server startup if the parameter is
10267 not otherwise set</entry>
10270 <entry><structfield>reset_val</structfield></entry>
10271 <entry><type>text</type></entry>
10272 <entry>Value that <command>RESET</command> would reset the parameter to
10273 in the current session</entry>
10276 <entry><structfield>sourcefile</structfield></entry>
10277 <entry><type>text</type></entry>
10278 <entry>Configuration file the current value was set in (null for
10279 values set from sources other than configuration files, or when
10280 examined by a user who is neither a superuser or a member of
10281 <literal>pg_read_all_settings</literal>); helpful when using
10282 <literal>include</> directives in configuration files</entry>
10285 <entry><structfield>sourceline</structfield></entry>
10286 <entry><type>integer</type></entry>
10287 <entry>Line number within the configuration file the current value was
10288 set at (null for values set from sources other than configuration files,
10289 or when examined by a user who is neither a superuser or a member of
10290 <literal>pg_read_all_settings</literal>).
10294 <entry><structfield>pending_restart</structfield></entry>
10295 <entry><type>boolean</type></entry>
10296 <entry><literal>true</literal> if the value has been changed in the
10297 configuration file but needs a restart; or <literal>false</literal>
10306 There are several possible values of <structfield>context</structfield>.
10307 In order of decreasing difficulty of changing the setting, they are:
10312 <!-- PGC_INTERNAL -->
10313 <term><literal>internal</literal></term>
10316 These settings cannot be changed directly; they reflect internally
10317 determined values. Some of them may be adjustable by rebuilding the
10318 server with different configuration options, or by changing options
10319 supplied to <command>initdb</command>.
10324 <!-- PGC_POSTMASTER -->
10325 <term><literal>postmaster</literal></term>
10328 These settings can only be applied when the server starts, so any change
10329 requires restarting the server. Values for these settings are typically
10330 stored in the <filename>postgresql.conf</filename> file, or passed on
10331 the command line when starting the server. Of course, settings with any
10332 of the lower <structfield>context</structfield> types can also be
10333 set at server start time.
10338 <!-- PGC_SIGHUP -->
10339 <term><literal>sighup</literal></term>
10342 Changes to these settings can be made in
10343 <filename>postgresql.conf</filename> without restarting the server.
10344 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
10345 cause it to re-read <filename>postgresql.conf</filename> and apply
10346 the changes. The postmaster will also forward the
10347 <systemitem>SIGHUP</systemitem> signal to its child processes so that
10348 they all pick up the new value.
10353 <!-- PGC_SU_BACKEND -->
10354 <term><literal>superuser-backend</literal></term>
10357 Changes to these settings can be made in
10358 <filename>postgresql.conf</filename> without restarting the server.
10359 They can also be set for a particular session in the connection request
10360 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10361 environment variable), but only if the connecting user is a superuser.
10362 However, these settings never change in a session after it is started.
10363 If you change them in <filename>postgresql.conf</filename>, send a
10364 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10365 re-read <filename>postgresql.conf</filename>. The new values will only
10366 affect subsequently-launched sessions.
10371 <!-- PGC_BACKEND -->
10372 <term><literal>backend</literal></term>
10375 Changes to these settings can be made in
10376 <filename>postgresql.conf</filename> without restarting the server.
10377 They can also be set for a particular session in the connection request
10378 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10379 environment variable); any user can make such a change for their session.
10380 However, these settings never change in a session after it is started.
10381 If you change them in <filename>postgresql.conf</filename>, send a
10382 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10383 re-read <filename>postgresql.conf</filename>. The new values will only
10384 affect subsequently-launched sessions.
10390 <term><literal>superuser</literal></term>
10393 These settings can be set from <filename>postgresql.conf</filename>,
10394 or within a session via the <command>SET</> command; but only superusers
10395 can change them via <command>SET</>. Changes in
10396 <filename>postgresql.conf</filename> will affect existing sessions
10397 only if no session-local value has been established with <command>SET</>.
10402 <!-- PGC_USERSET -->
10403 <term><literal>user</literal></term>
10406 These settings can be set from <filename>postgresql.conf</filename>,
10407 or within a session via the <command>SET</> command. Any user is
10408 allowed to change their session-local value. Changes in
10409 <filename>postgresql.conf</filename> will affect existing sessions
10410 only if no session-local value has been established with <command>SET</>.
10417 See <xref linkend="config-setting"> for more information about the various
10418 ways to change these parameters.
10422 The <structname>pg_settings</structname> view cannot be inserted into or
10423 deleted from, but it can be updated. An <command>UPDATE</command> applied
10424 to a row of <structname>pg_settings</structname> is equivalent to executing
10425 the <xref linkend="sql-set"> command on that named
10426 parameter. The change only affects the value used by the current
10427 session. If an <command>UPDATE</command> is issued within a transaction
10428 that is later aborted, the effects of the <command>UPDATE</command> command
10429 disappear when the transaction is rolled back. Once the surrounding
10430 transaction is committed, the effects will persist until the end of the
10431 session, unless overridden by another <command>UPDATE</command> or
10432 <command>SET</command>.
10437 <sect1 id="view-pg-shadow">
10438 <title><structname>pg_shadow</structname></title>
10440 <indexterm zone="view-pg-shadow">
10441 <primary>pg_shadow</primary>
10445 The view <structname>pg_shadow</structname> exists for backwards
10446 compatibility: it emulates a catalog that existed in
10447 <productname>PostgreSQL</productname> before version 8.1.
10448 It shows properties of all roles that are marked as
10449 <structfield>rolcanlogin</> in
10450 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
10454 The name stems from the fact that this table
10455 should not be readable by the public since it contains passwords.
10456 <link linkend="view-pg-user"><structname>pg_user</structname></link>
10457 is a publicly readable view on
10458 <structname>pg_shadow</structname> that blanks out the password field.
10462 <title><structname>pg_shadow</> Columns</title>
10467 <entry>Name</entry>
10468 <entry>Type</entry>
10469 <entry>References</entry>
10470 <entry>Description</entry>
10476 <entry><structfield>usename</structfield></entry>
10477 <entry><type>name</type></entry>
10478 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10479 <entry>User name</entry>
10483 <entry><structfield>usesysid</structfield></entry>
10484 <entry><type>oid</type></entry>
10485 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10486 <entry>ID of this user</entry>
10490 <entry><structfield>usecreatedb</structfield></entry>
10491 <entry><type>bool</type></entry>
10493 <entry>User can create databases</entry>
10497 <entry><structfield>usesuper</structfield></entry>
10498 <entry><type>bool</type></entry>
10500 <entry>User is a superuser</entry>
10504 <entry><structfield>userepl</structfield></entry>
10505 <entry><type>bool</type></entry>
10508 User can initiate streaming replication and put the system in and
10509 out of backup mode.
10514 <entry><structfield>usebypassrls</structfield></entry>
10515 <entry><type>bool</type></entry>
10518 User bypasses every row level security policy, see
10519 <xref linkend="ddl-rowsecurity"> for more information.
10524 <entry><structfield>passwd</structfield></entry>
10525 <entry><type>text</type></entry>
10527 <entry>Password (possibly encrypted); null if none. See
10528 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
10529 for details of how encrypted passwords are stored.</entry>
10533 <entry><structfield>valuntil</structfield></entry>
10534 <entry><type>abstime</type></entry>
10536 <entry>Password expiry time (only used for password authentication)</entry>
10540 <entry><structfield>useconfig</structfield></entry>
10541 <entry><type>text[]</type></entry>
10543 <entry>Session defaults for run-time configuration variables</entry>
10551 <sect1 id="view-pg-stats">
10552 <title><structname>pg_stats</structname></title>
10554 <indexterm zone="view-pg-stats">
10555 <primary>pg_stats</primary>
10559 The view <structname>pg_stats</structname> provides access to
10560 the information stored in the <link
10561 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
10562 catalog. This view allows access only to rows of
10563 <structname>pg_statistic</structname> that correspond to tables the
10564 user has permission to read, and therefore it is safe to allow public
10565 read access to this view.
10569 <structname>pg_stats</structname> is also designed to present the
10570 information in a more readable format than the underlying catalog
10571 — at the cost that its schema must be extended whenever new slot types
10572 are defined for <structname>pg_statistic</structname>.
10576 <title><structname>pg_stats</> Columns</title>
10581 <entry>Name</entry>
10582 <entry>Type</entry>
10583 <entry>References</entry>
10584 <entry>Description</entry>
10589 <entry><structfield>schemaname</structfield></entry>
10590 <entry><type>name</type></entry>
10591 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10592 <entry>Name of schema containing table</entry>
10596 <entry><structfield>tablename</structfield></entry>
10597 <entry><type>name</type></entry>
10598 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10599 <entry>Name of table</entry>
10603 <entry><structfield>attname</structfield></entry>
10604 <entry><type>name</type></entry>
10605 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
10606 <entry>Name of the column described by this row</entry>
10610 <entry><structfield>inherited</structfield></entry>
10611 <entry><type>bool</type></entry>
10613 <entry>If true, this row includes inheritance child columns, not just the
10614 values in the specified table</entry>
10618 <entry><structfield>null_frac</structfield></entry>
10619 <entry><type>real</type></entry>
10621 <entry>Fraction of column entries that are null</entry>
10625 <entry><structfield>avg_width</structfield></entry>
10626 <entry><type>integer</type></entry>
10628 <entry>Average width in bytes of column's entries</entry>
10632 <entry><structfield>n_distinct</structfield></entry>
10633 <entry><type>real</type></entry>
10636 If greater than zero, the estimated number of distinct values in the
10637 column. If less than zero, the negative of the number of distinct
10638 values divided by the number of rows. (The negated form is used when
10639 <command>ANALYZE</> believes that the number of distinct values is
10640 likely to increase as the table grows; the positive form is used when
10641 the column seems to have a fixed number of possible values.) For
10642 example, -1 indicates a unique column in which the number of distinct
10643 values is the same as the number of rows.
10648 <entry><structfield>most_common_vals</structfield></entry>
10649 <entry><type>anyarray</type></entry>
10652 A list of the most common values in the column. (Null if
10653 no values seem to be more common than any others.)
10658 <entry><structfield>most_common_freqs</structfield></entry>
10659 <entry><type>real[]</type></entry>
10662 A list of the frequencies of the most common values,
10663 i.e., number of occurrences of each divided by total number of rows.
10664 (Null when <structfield>most_common_vals</structfield> is.)
10669 <entry><structfield>histogram_bounds</structfield></entry>
10670 <entry><type>anyarray</type></entry>
10673 A list of values that divide the column's values into groups of
10674 approximately equal population. The values in
10675 <structfield>most_common_vals</>, if present, are omitted from this
10676 histogram calculation. (This column is null if the column data type
10677 does not have a <literal><</> operator or if the
10678 <structfield>most_common_vals</> list accounts for the entire
10684 <entry><structfield>correlation</structfield></entry>
10685 <entry><type>real</type></entry>
10688 Statistical correlation between physical row ordering and
10689 logical ordering of the column values. This ranges from -1 to +1.
10690 When the value is near -1 or +1, an index scan on the column will
10691 be estimated to be cheaper than when it is near zero, due to reduction
10692 of random access to the disk. (This column is null if the column data
10693 type does not have a <literal><</> operator.)
10698 <entry><structfield>most_common_elems</structfield></entry>
10699 <entry><type>anyarray</type></entry>
10702 A list of non-null element values most often appearing within values of
10703 the column. (Null for scalar types.)
10708 <entry><structfield>most_common_elem_freqs</structfield></entry>
10709 <entry><type>real[]</type></entry>
10712 A list of the frequencies of the most common element values, i.e., the
10713 fraction of rows containing at least one instance of the given value.
10714 Two or three additional values follow the per-element frequencies;
10715 these are the minimum and maximum of the preceding per-element
10716 frequencies, and optionally the frequency of null elements.
10717 (Null when <structfield>most_common_elems</structfield> is.)
10722 <entry><structfield>elem_count_histogram</structfield></entry>
10723 <entry><type>real[]</type></entry>
10726 A histogram of the counts of distinct non-null element values within the
10727 values of the column, followed by the average number of distinct
10728 non-null elements. (Null for scalar types.)
10736 The maximum number of entries in the array fields can be controlled on a
10737 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
10738 command, or globally by setting the
10739 <xref linkend="guc-default-statistics-target"> run-time parameter.
10744 <sect1 id="view-pg-tables">
10745 <title><structname>pg_tables</structname></title>
10747 <indexterm zone="view-pg-tables">
10748 <primary>pg_tables</primary>
10752 The view <structname>pg_tables</structname> provides access to
10753 useful information about each table in the database.
10757 <title><structname>pg_tables</> Columns</title>
10762 <entry>Name</entry>
10763 <entry>Type</entry>
10764 <entry>References</entry>
10765 <entry>Description</entry>
10770 <entry><structfield>schemaname</structfield></entry>
10771 <entry><type>name</type></entry>
10772 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10773 <entry>Name of schema containing table</entry>
10776 <entry><structfield>tablename</structfield></entry>
10777 <entry><type>name</type></entry>
10778 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10779 <entry>Name of table</entry>
10782 <entry><structfield>tableowner</structfield></entry>
10783 <entry><type>name</type></entry>
10784 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10785 <entry>Name of table's owner</entry>
10788 <entry><structfield>tablespace</structfield></entry>
10789 <entry><type>name</type></entry>
10790 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
10791 <entry>Name of tablespace containing table (null if default for database)</entry>
10794 <entry><structfield>hasindexes</structfield></entry>
10795 <entry><type>boolean</type></entry>
10796 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
10797 <entry>True if table has (or recently had) any indexes</entry>
10800 <entry><structfield>hasrules</structfield></entry>
10801 <entry><type>boolean</type></entry>
10802 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
10803 <entry>True if table has (or once had) rules</entry>
10806 <entry><structfield>hastriggers</structfield></entry>
10807 <entry><type>boolean</type></entry>
10808 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
10809 <entry>True if table has (or once had) triggers</entry>
10812 <entry><structfield>rowsecurity</structfield></entry>
10813 <entry><type>boolean</type></entry>
10814 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
10815 <entry>True if row security is enabled on the table</entry>
10823 <sect1 id="view-pg-timezone-abbrevs">
10824 <title><structname>pg_timezone_abbrevs</structname></title>
10826 <indexterm zone="view-pg-timezone-abbrevs">
10827 <primary>pg_timezone_abbrevs</primary>
10831 The view <structname>pg_timezone_abbrevs</structname> provides a list
10832 of time zone abbreviations that are currently recognized by the datetime
10833 input routines. The contents of this view change when the
10834 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
10838 <title><structname>pg_timezone_abbrevs</> Columns</title>
10843 <entry>Name</entry>
10844 <entry>Type</entry>
10845 <entry>Description</entry>
10850 <entry><structfield>abbrev</structfield></entry>
10851 <entry><type>text</type></entry>
10852 <entry>Time zone abbreviation</entry>
10855 <entry><structfield>utc_offset</structfield></entry>
10856 <entry><type>interval</type></entry>
10857 <entry>Offset from UTC (positive means east of Greenwich)</entry>
10860 <entry><structfield>is_dst</structfield></entry>
10861 <entry><type>boolean</type></entry>
10862 <entry>True if this is a daylight-savings abbreviation</entry>
10869 While most timezone abbreviations represent fixed offsets from UTC,
10870 there are some that have historically varied in value
10871 (see <xref linkend="datetime-config-files"> for more information).
10872 In such cases this view presents their current meaning.
10877 <sect1 id="view-pg-timezone-names">
10878 <title><structname>pg_timezone_names</structname></title>
10880 <indexterm zone="view-pg-timezone-names">
10881 <primary>pg_timezone_names</primary>
10885 The view <structname>pg_timezone_names</structname> provides a list
10886 of time zone names that are recognized by <command>SET TIMEZONE</>,
10887 along with their associated abbreviations, UTC offsets,
10888 and daylight-savings status. (Technically,
10889 <productname>PostgreSQL</productname> does not use UTC because leap
10890 seconds are not handled.)
10891 Unlike the abbreviations shown in <link
10892 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
10893 date rules. Therefore, the associated information changes across local DST
10894 boundaries. The displayed information is computed based on the current
10895 value of <function>CURRENT_TIMESTAMP</>.
10899 <title><structname>pg_timezone_names</> Columns</title>
10904 <entry>Name</entry>
10905 <entry>Type</entry>
10906 <entry>Description</entry>
10911 <entry><structfield>name</structfield></entry>
10912 <entry><type>text</type></entry>
10913 <entry>Time zone name</entry>
10916 <entry><structfield>abbrev</structfield></entry>
10917 <entry><type>text</type></entry>
10918 <entry>Time zone abbreviation</entry>
10921 <entry><structfield>utc_offset</structfield></entry>
10922 <entry><type>interval</type></entry>
10923 <entry>Offset from UTC (positive means east of Greenwich)</entry>
10926 <entry><structfield>is_dst</structfield></entry>
10927 <entry><type>boolean</type></entry>
10928 <entry>True if currently observing daylight savings</entry>
10936 <sect1 id="view-pg-user">
10937 <title><structname>pg_user</structname></title>
10939 <indexterm zone="view-pg-user">
10940 <primary>pg_user</primary>
10944 The view <structname>pg_user</structname> provides access to
10945 information about database users. This is simply a publicly
10947 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
10948 that blanks out the password field.
10952 <title><structname>pg_user</> Columns</title>
10957 <entry>Name</entry>
10958 <entry>Type</entry>
10959 <entry>Description</entry>
10964 <entry><structfield>usename</structfield></entry>
10965 <entry><type>name</type></entry>
10966 <entry>User name</entry>
10970 <entry><structfield>usesysid</structfield></entry>
10971 <entry><type>oid</type></entry>
10972 <entry>ID of this user</entry>
10976 <entry><structfield>usecreatedb</structfield></entry>
10977 <entry><type>bool</type></entry>
10978 <entry>User can create databases</entry>
10982 <entry><structfield>usesuper</structfield></entry>
10983 <entry><type>bool</type></entry>
10984 <entry>User is a superuser</entry>
10988 <entry><structfield>userepl</structfield></entry>
10989 <entry><type>bool</type></entry>
10991 User can initiate streaming replication and put the system in and
10992 out of backup mode.
10997 <entry><structfield>usebypassrls</structfield></entry>
10998 <entry><type>bool</type></entry>
11000 User bypasses every row level security policy, see
11001 <xref linkend="ddl-rowsecurity"> for more information.
11006 <entry><structfield>passwd</structfield></entry>
11007 <entry><type>text</type></entry>
11008 <entry>Not the password (always reads as <literal>********</>)</entry>
11012 <entry><structfield>valuntil</structfield></entry>
11013 <entry><type>abstime</type></entry>
11014 <entry>Password expiry time (only used for password authentication)</entry>
11018 <entry><structfield>useconfig</structfield></entry>
11019 <entry><type>text[]</type></entry>
11020 <entry>Session defaults for run-time configuration variables</entry>
11028 <sect1 id="view-pg-user-mappings">
11029 <title><structname>pg_user_mappings</structname></title>
11031 <indexterm zone="view-pg-user-mappings">
11032 <primary>pg_user_mappings</primary>
11036 The view <structname>pg_user_mappings</structname> provides access
11037 to information about user mappings. This is essentially a publicly
11039 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
11040 that leaves out the options field if the user has no rights to use
11045 <title><structname>pg_user_mappings</> Columns</title>
11050 <entry>Name</entry>
11051 <entry>Type</entry>
11052 <entry>References</entry>
11053 <entry>Description</entry>
11059 <entry><structfield>umid</structfield></entry>
11060 <entry><type>oid</type></entry>
11061 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
11062 <entry>OID of the user mapping</entry>
11066 <entry><structfield>srvid</structfield></entry>
11067 <entry><type>oid</type></entry>
11068 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
11070 The OID of the foreign server that contains this mapping
11075 <entry><structfield>srvname</structfield></entry>
11076 <entry><type>name</type></entry>
11077 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
11079 Name of the foreign server
11084 <entry><structfield>umuser</structfield></entry>
11085 <entry><type>oid</type></entry>
11086 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
11087 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
11091 <entry><structfield>usename</structfield></entry>
11092 <entry><type>name</type></entry>
11094 <entry>Name of the local user to be mapped</entry>
11098 <entry><structfield>umoptions</structfield></entry>
11099 <entry><type>text[]</type></entry>
11102 User mapping specific options, as <quote>keyword=value</>
11103 strings. This column will show as null unless the current user
11104 is the user being mapped, or the mapping is for
11105 <literal>PUBLIC</literal> and the current user is the server
11106 owner, or the current user is a superuser. The intent is
11107 to protect password information stored as user mapping option.
11116 <sect1 id="view-pg-views">
11117 <title><structname>pg_views</structname></title>
11119 <indexterm zone="view-pg-views">
11120 <primary>pg_views</primary>
11124 The view <structname>pg_views</structname> provides access to
11125 useful information about each view in the database.
11129 <title><structname>pg_views</> Columns</title>
11134 <entry>Name</entry>
11135 <entry>Type</entry>
11136 <entry>References</entry>
11137 <entry>Description</entry>
11142 <entry><structfield>schemaname</structfield></entry>
11143 <entry><type>name</type></entry>
11144 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
11145 <entry>Name of schema containing view</entry>
11148 <entry><structfield>viewname</structfield></entry>
11149 <entry><type>name</type></entry>
11150 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
11151 <entry>Name of view</entry>
11154 <entry><structfield>viewowner</structfield></entry>
11155 <entry><type>name</type></entry>
11156 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
11157 <entry>Name of view's owner</entry>
11160 <entry><structfield>definition</structfield></entry>
11161 <entry><type>text</type></entry>
11163 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>