1 <!-- doc/src/sgml/catalogs.sgml -->
3 Documentation of the system catalogs, directed toward PostgreSQL developers
6 <chapter id="catalogs">
7 <title>System Catalogs</title>
10 The system catalogs are the place where a relational database
11 management system stores schema metadata, such as information about
12 tables and columns, and internal bookkeeping information.
13 <productname>PostgreSQL</productname>'s system catalogs are regular
14 tables. You can drop and recreate the tables, add columns, insert
15 and update values, and severely mess up your system that way.
16 Normally, one should not change the system catalogs by hand, there
17 are normally SQL commands to do that. (For example, <command>CREATE
18 DATABASE</command> inserts a row into the
19 <structname>pg_database</structname> catalog — and actually
20 creates the database on disk.) There are some exceptions for
21 particularly esoteric operations, but many of those have been made
22 available as SQL commands over time, and so the need for direct manipulation
23 of the system catalogs is ever decreasing.
26 <sect1 id="catalogs-overview">
27 <title>Overview</title>
30 <xref linkend="catalog-table"> lists the system catalogs.
31 More detailed documentation of each catalog follows below.
35 Most system catalogs are copied from the template database during
36 database creation and are thereafter database-specific. A few
37 catalogs are physically shared across all databases in a cluster;
38 these are noted in the descriptions of the individual catalogs.
41 <table id="catalog-table">
42 <title>System Catalogs</title>
47 <entry>Catalog Name</entry>
48 <entry>Purpose</entry>
54 <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
55 <entry>aggregate functions</entry>
59 <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
60 <entry>index access methods</entry>
64 <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
65 <entry>access method operators</entry>
69 <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
70 <entry>access method support procedures</entry>
74 <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
75 <entry>column default values</entry>
79 <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
80 <entry>table columns (<quote>attributes</quote>)</entry>
84 <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
85 <entry>authorization identifiers (roles)</entry>
89 <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
90 <entry>authorization identifier membership relationships</entry>
94 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
95 <entry>casts (data type conversions)</entry>
99 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
100 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
104 <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
105 <entry>collations (locale information)</entry>
109 <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
110 <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
114 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
115 <entry>encoding conversion information</entry>
119 <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
120 <entry>databases within this database cluster</entry>
124 <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
125 <entry>per-role and per-database settings</entry>
129 <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
130 <entry>default privileges for object types</entry>
134 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
135 <entry>dependencies between database objects</entry>
139 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
140 <entry>descriptions or comments on database objects</entry>
144 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
145 <entry>enum label and value definitions</entry>
149 <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
150 <entry>event triggers</entry>
154 <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
155 <entry>installed extensions</entry>
159 <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
160 <entry>foreign-data wrapper definitions</entry>
164 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
165 <entry>foreign server definitions</entry>
169 <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
170 <entry>additional foreign table information</entry>
174 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
175 <entry>additional index information</entry>
179 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
180 <entry>table inheritance hierarchy</entry>
184 <entry><link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link></entry>
185 <entry>object initial privileges</entry>
189 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
190 <entry>languages for writing functions</entry>
194 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
195 <entry>data pages for large objects</entry>
199 <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
200 <entry>metadata for large objects</entry>
204 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
205 <entry>schemas</entry>
209 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
210 <entry>access method operator classes</entry>
214 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
215 <entry>operators</entry>
219 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
220 <entry>access method operator families</entry>
224 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
225 <entry>template data for procedural languages</entry>
229 <entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
230 <entry>information about partition key of tables</entry>
234 <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
235 <entry>row-security policies</entry>
239 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
240 <entry>functions and procedures</entry>
244 <entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
245 <entry>publications for logical replication</entry>
249 <entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
250 <entry>relation to publication mapping</entry>
254 <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
255 <entry>information about range types</entry>
259 <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
260 <entry>registered replication origins</entry>
264 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
265 <entry>query rewrite rules</entry>
269 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
270 <entry>security labels on database objects</entry>
274 <entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
275 <entry>information about sequences</entry>
279 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
280 <entry>dependencies on shared objects</entry>
284 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
285 <entry>comments on shared objects</entry>
289 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
290 <entry>security labels on shared database objects</entry>
294 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
295 <entry>planner statistics</entry>
299 <entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
300 <entry>logical replication subscriptions</entry>
304 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
305 <entry>tablespaces within this database cluster</entry>
309 <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
310 <entry>transforms (data type to procedural language conversions)</entry>
314 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
315 <entry>triggers</entry>
319 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
320 <entry>text search configurations</entry>
324 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
325 <entry>text search configurations' token mappings</entry>
329 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
330 <entry>text search dictionaries</entry>
334 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
335 <entry>text search parsers</entry>
339 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
340 <entry>text search templates</entry>
344 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
345 <entry>data types</entry>
349 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
350 <entry>mappings of users to foreign servers</entry>
358 <sect1 id="catalog-pg-aggregate">
359 <title><structname>pg_aggregate</structname></title>
361 <indexterm zone="catalog-pg-aggregate">
362 <primary>pg_aggregate</primary>
366 The catalog <structname>pg_aggregate</structname> stores information about
367 aggregate functions. An aggregate function is a function that
368 operates on a set of values (typically one column from each row
369 that matches a query condition) and returns a single value computed
370 from all these values. Typical aggregate functions are
371 <function>sum</function>, <function>count</function>, and
372 <function>max</function>. Each entry in
373 <structname>pg_aggregate</structname> is an extension of an entry
374 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
375 entry carries the aggregate's name, input and output data types, and
376 other information that is similar to ordinary functions.
380 <title><structname>pg_aggregate</> Columns</title>
387 <entry>References</entry>
388 <entry>Description</entry>
393 <entry><structfield>aggfnoid</structfield></entry>
394 <entry><type>regproc</type></entry>
395 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
396 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
399 <entry><structfield>aggkind</structfield></entry>
400 <entry><type>char</type></entry>
402 <entry>Aggregate kind:
403 <literal>n</literal> for <quote>normal</> aggregates,
404 <literal>o</literal> for <quote>ordered-set</> aggregates, or
405 <literal>h</literal> for <quote>hypothetical-set</> aggregates
409 <entry><structfield>aggnumdirectargs</structfield></entry>
410 <entry><type>int2</type></entry>
412 <entry>Number of direct (non-aggregated) arguments of an ordered-set or
413 hypothetical-set aggregate, counting a variadic array as one argument.
414 If equal to <structfield>pronargs</>, the aggregate must be variadic
415 and the variadic array describes the aggregated arguments as well as
416 the final direct arguments.
417 Always zero for normal aggregates.</entry>
420 <entry><structfield>aggtransfn</structfield></entry>
421 <entry><type>regproc</type></entry>
422 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
423 <entry>Transition function</entry>
426 <entry><structfield>aggfinalfn</structfield></entry>
427 <entry><type>regproc</type></entry>
428 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
429 <entry>Final function (zero if none)</entry>
432 <entry><structfield>aggcombinefn</structfield></entry>
433 <entry><type>regproc</type></entry>
434 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
435 <entry>Combine function (zero if none)</entry>
438 <entry><structfield>aggserialfn</structfield></entry>
439 <entry><type>regproc</type></entry>
440 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
441 <entry>Serialization function (zero if none)</entry>
444 <entry><structfield>aggdeserialfn</structfield></entry>
445 <entry><type>regproc</type></entry>
446 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
447 <entry>Deserialization function (zero if none)</entry>
450 <entry><structfield>aggmtransfn</structfield></entry>
451 <entry><type>regproc</type></entry>
452 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
453 <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
456 <entry><structfield>aggminvtransfn</structfield></entry>
457 <entry><type>regproc</type></entry>
458 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
459 <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
462 <entry><structfield>aggmfinalfn</structfield></entry>
463 <entry><type>regproc</type></entry>
464 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
465 <entry>Final function for moving-aggregate mode (zero if none)</entry>
468 <entry><structfield>aggfinalextra</structfield></entry>
469 <entry><type>bool</type></entry>
471 <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
474 <entry><structfield>aggmfinalextra</structfield></entry>
475 <entry><type>bool</type></entry>
477 <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
480 <entry><structfield>aggsortop</structfield></entry>
481 <entry><type>oid</type></entry>
482 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
483 <entry>Associated sort operator (zero if none)</entry>
486 <entry><structfield>aggtranstype</structfield></entry>
487 <entry><type>oid</type></entry>
488 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
489 <entry>Data type of the aggregate function's internal transition (state) data</entry>
492 <entry><structfield>aggtransspace</structfield></entry>
493 <entry><type>int4</type></entry>
495 <entry>Approximate average size (in bytes) of the transition state
496 data, or zero to use a default estimate</entry>
499 <entry><structfield>aggmtranstype</structfield></entry>
500 <entry><type>oid</type></entry>
501 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
502 <entry>Data type of the aggregate function's internal transition (state)
503 data for moving-aggregate mode (zero if none)</entry>
506 <entry><structfield>aggmtransspace</structfield></entry>
507 <entry><type>int4</type></entry>
509 <entry>Approximate average size (in bytes) of the transition state data
510 for moving-aggregate mode, or zero to use a default estimate</entry>
513 <entry><structfield>agginitval</structfield></entry>
514 <entry><type>text</type></entry>
517 The initial value of the transition state. This is a text
518 field containing the initial value in its external string
519 representation. If this field is null, the transition state
520 value starts out null.
524 <entry><structfield>aggminitval</structfield></entry>
525 <entry><type>text</type></entry>
528 The initial value of the transition state for moving-aggregate mode.
529 This is a text field containing the initial value in its external
530 string representation. If this field is null, the transition state
531 value starts out null.
539 New aggregate functions are registered with the <xref
540 linkend="sql-createaggregate">
541 command. See <xref linkend="xaggr"> for more information about
542 writing aggregate functions and the meaning of the transition
549 <sect1 id="catalog-pg-am">
550 <title><structname>pg_am</structname></title>
552 <indexterm zone="catalog-pg-am">
553 <primary>pg_am</primary>
557 The catalog <structname>pg_am</structname> stores information about
558 relation access methods. There is one row for each access method supported
560 Currently, only indexes have access methods. The requirements for index
561 access methods are discussed in detail in <xref linkend="indexam">.
565 <title><structname>pg_am</> Columns</title>
572 <entry>References</entry>
573 <entry>Description</entry>
579 <entry><structfield>oid</structfield></entry>
580 <entry><type>oid</type></entry>
582 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
586 <entry><structfield>amname</structfield></entry>
587 <entry><type>name</type></entry>
589 <entry>Name of the access method</entry>
593 <entry><structfield>amhandler</structfield></entry>
594 <entry><type>regproc</type></entry>
595 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
597 OID of a handler function that is responsible for supplying information
598 about the access method
603 <entry><structfield>amtype</structfield></entry>
604 <entry><type>char</type></entry>
607 Currently always <literal>i</literal> to indicate an index access
608 method; other values may be allowed in future
617 Before <productname>PostgreSQL</> 9.6, <structname>pg_am</structname>
618 contained many additional columns representing properties of index access
619 methods. That data is now only directly visible at the C code level.
620 However, <function>pg_index_column_has_property()</function> and related
621 functions have been added to allow SQL queries to inspect index access
622 method properties; see <xref linkend="functions-info-catalog-table">.
629 <sect1 id="catalog-pg-amop">
630 <title><structname>pg_amop</structname></title>
632 <indexterm zone="catalog-pg-amop">
633 <primary>pg_amop</primary>
637 The catalog <structname>pg_amop</structname> stores information about
638 operators associated with access method operator families. There is one
639 row for each operator that is a member of an operator family. A family
640 member can be either a <firstterm>search</> operator or an
641 <firstterm>ordering</> operator. An operator
642 can appear in more than one family, but cannot appear in more than one
643 search position nor more than one ordering position within a family.
644 (It is allowed, though unlikely, for an operator to be used for both
645 search and ordering purposes.)
649 <title><structname>pg_amop</> Columns</title>
656 <entry>References</entry>
657 <entry>Description</entry>
663 <entry><structfield>oid</structfield></entry>
664 <entry><type>oid</type></entry>
666 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
670 <entry><structfield>amopfamily</structfield></entry>
671 <entry><type>oid</type></entry>
672 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
673 <entry>The operator family this entry is for</entry>
677 <entry><structfield>amoplefttype</structfield></entry>
678 <entry><type>oid</type></entry>
679 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
680 <entry>Left-hand input data type of operator</entry>
684 <entry><structfield>amoprighttype</structfield></entry>
685 <entry><type>oid</type></entry>
686 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
687 <entry>Right-hand input data type of operator</entry>
691 <entry><structfield>amopstrategy</structfield></entry>
692 <entry><type>int2</type></entry>
694 <entry>Operator strategy number</entry>
698 <entry><structfield>amoppurpose</structfield></entry>
699 <entry><type>char</type></entry>
701 <entry>Operator purpose, either <literal>s</> for search or
702 <literal>o</> for ordering</entry>
706 <entry><structfield>amopopr</structfield></entry>
707 <entry><type>oid</type></entry>
708 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
709 <entry>OID of the operator</entry>
713 <entry><structfield>amopmethod</structfield></entry>
714 <entry><type>oid</type></entry>
715 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
716 <entry>Index access method operator family is for</entry>
720 <entry><structfield>amopsortfamily</structfield></entry>
721 <entry><type>oid</type></entry>
722 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
723 <entry>The B-tree operator family this entry sorts according to, if an
724 ordering operator; zero if a search operator</entry>
732 A <quote>search</> operator entry indicates that an index of this operator
733 family can be searched to find all rows satisfying
735 <replaceable>indexed_column</>
736 <replaceable>operator</>
737 <replaceable>constant</>.
738 Obviously, such an operator must return <type>boolean</type>, and its left-hand input
739 type must match the index's column data type.
743 An <quote>ordering</> operator entry indicates that an index of this
744 operator family can be scanned to return rows in the order represented by
746 <replaceable>indexed_column</>
747 <replaceable>operator</>
748 <replaceable>constant</>.
749 Such an operator could return any sortable data type, though again
750 its left-hand input type must match the index's column data type.
751 The exact semantics of the <literal>ORDER BY</> are specified by the
752 <structfield>amopsortfamily</structfield> column, which must reference
753 a B-tree operator family for the operator's result type.
758 At present, it's assumed that the sort order for an ordering operator
759 is the default for the referenced operator family, i.e., <literal>ASC NULLS
760 LAST</>. This might someday be relaxed by adding additional columns
761 to specify sort options explicitly.
766 An entry's <structfield>amopmethod</> must match the
767 <structname>opfmethod</> of its containing operator family (including
768 <structfield>amopmethod</> here is an intentional denormalization of the
769 catalog structure for performance reasons). Also,
770 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
771 the <structfield>oprleft</> and <structfield>oprright</> fields of the
772 referenced <structname>pg_operator</> entry.
778 <sect1 id="catalog-pg-amproc">
779 <title><structname>pg_amproc</structname></title>
781 <indexterm zone="catalog-pg-amproc">
782 <primary>pg_amproc</primary>
786 The catalog <structname>pg_amproc</structname> stores information about
787 support procedures associated with access method operator families. There
788 is one row for each support procedure belonging to an operator family.
792 <title><structname>pg_amproc</structname> Columns</title>
799 <entry>References</entry>
800 <entry>Description</entry>
806 <entry><structfield>oid</structfield></entry>
807 <entry><type>oid</type></entry>
809 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
813 <entry><structfield>amprocfamily</structfield></entry>
814 <entry><type>oid</type></entry>
815 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
816 <entry>The operator family this entry is for</entry>
820 <entry><structfield>amproclefttype</structfield></entry>
821 <entry><type>oid</type></entry>
822 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
823 <entry>Left-hand input data type of associated operator</entry>
827 <entry><structfield>amprocrighttype</structfield></entry>
828 <entry><type>oid</type></entry>
829 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
830 <entry>Right-hand input data type of associated operator</entry>
834 <entry><structfield>amprocnum</structfield></entry>
835 <entry><type>int2</type></entry>
837 <entry>Support procedure number</entry>
841 <entry><structfield>amproc</structfield></entry>
842 <entry><type>regproc</type></entry>
843 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
844 <entry>OID of the procedure</entry>
852 The usual interpretation of the
853 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
854 is that they identify the left and right input types of the operator(s)
855 that a particular support procedure supports. For some access methods
856 these match the input data type(s) of the support procedure itself, for
857 others not. There is a notion of <quote>default</> support procedures for
858 an index, which are those with <structfield>amproclefttype</> and
859 <structfield>amprocrighttype</> both equal to the index operator class's
860 <structfield>opcintype</>.
866 <sect1 id="catalog-pg-attrdef">
867 <title><structname>pg_attrdef</structname></title>
869 <indexterm zone="catalog-pg-attrdef">
870 <primary>pg_attrdef</primary>
874 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
875 about columns is stored in <structname>pg_attribute</structname>
876 (see below). Only columns that explicitly specify a default value
877 (when the table is created or the column is added) will have an
882 <title><structname>pg_attrdef</> Columns</title>
889 <entry>References</entry>
890 <entry>Description</entry>
896 <entry><structfield>oid</structfield></entry>
897 <entry><type>oid</type></entry>
899 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
903 <entry><structfield>adrelid</structfield></entry>
904 <entry><type>oid</type></entry>
905 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
906 <entry>The table this column belongs to</entry>
910 <entry><structfield>adnum</structfield></entry>
911 <entry><type>int2</type></entry>
912 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
913 <entry>The number of the column</entry>
917 <entry><structfield>adbin</structfield></entry>
918 <entry><type>pg_node_tree</type></entry>
920 <entry>The internal representation of the column default value</entry>
924 <entry><structfield>adsrc</structfield></entry>
925 <entry><type>text</type></entry>
927 <entry>A human-readable representation of the default value</entry>
934 The <structfield>adsrc</structfield> field is historical, and is best
935 not used, because it does not track outside changes that might affect
936 the representation of the default value. Reverse-compiling the
937 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
938 example) is a better way to display the default value.
944 <sect1 id="catalog-pg-attribute">
945 <title><structname>pg_attribute</structname></title>
947 <indexterm zone="catalog-pg-attribute">
948 <primary>pg_attribute</primary>
952 The catalog <structname>pg_attribute</structname> stores information about
953 table columns. There will be exactly one
954 <structname>pg_attribute</structname> row for every column in every
955 table in the database. (There will also be attribute entries for
956 indexes, and indeed all objects that have <structname>pg_class</structname>
961 The term attribute is equivalent to column and is used for
966 <title><structname>pg_attribute</> Columns</title>
973 <entry>References</entry>
974 <entry>Description</entry>
980 <entry><structfield>attrelid</structfield></entry>
981 <entry><type>oid</type></entry>
982 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
983 <entry>The table this column belongs to</entry>
987 <entry><structfield>attname</structfield></entry>
988 <entry><type>name</type></entry>
990 <entry>The column name</entry>
994 <entry><structfield>atttypid</structfield></entry>
995 <entry><type>oid</type></entry>
996 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
997 <entry>The data type of this column</entry>
1001 <entry><structfield>attstattarget</structfield></entry>
1002 <entry><type>int4</type></entry>
1005 <structfield>attstattarget</structfield> controls the level of detail
1006 of statistics accumulated for this column by
1007 <xref linkend="sql-analyze">.
1008 A zero value indicates that no statistics should be collected.
1009 A negative value says to use the system default statistics target.
1010 The exact meaning of positive values is data type-dependent.
1011 For scalar data types, <structfield>attstattarget</structfield>
1012 is both the target number of <quote>most common values</quote>
1013 to collect, and the target number of histogram bins to create.
1018 <entry><structfield>attlen</structfield></entry>
1019 <entry><type>int2</type></entry>
1022 A copy of <literal>pg_type.typlen</literal> of this column's
1028 <entry><structfield>attnum</structfield></entry>
1029 <entry><type>int2</type></entry>
1032 The number of the column. Ordinary columns are numbered from 1
1033 up. System columns, such as <structfield>oid</structfield>,
1034 have (arbitrary) negative numbers.
1039 <entry><structfield>attndims</structfield></entry>
1040 <entry><type>int4</type></entry>
1043 Number of dimensions, if the column is an array type; otherwise 0.
1044 (Presently, the number of dimensions of an array is not enforced,
1045 so any nonzero value effectively means <quote>it's an array</>.)
1050 <entry><structfield>attcacheoff</structfield></entry>
1051 <entry><type>int4</type></entry>
1054 Always -1 in storage, but when loaded into a row descriptor
1055 in memory this might be updated to cache the offset of the attribute
1061 <entry><structfield>atttypmod</structfield></entry>
1062 <entry><type>int4</type></entry>
1065 <structfield>atttypmod</structfield> records type-specific data
1066 supplied at table creation time (for example, the maximum
1067 length of a <type>varchar</type> column). It is passed to
1068 type-specific input functions and length coercion functions.
1069 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1074 <entry><structfield>attbyval</structfield></entry>
1075 <entry><type>bool</type></entry>
1078 A copy of <literal>pg_type.typbyval</> of this column's type
1083 <entry><structfield>attstorage</structfield></entry>
1084 <entry><type>char</type></entry>
1087 Normally a copy of <literal>pg_type.typstorage</> of this
1088 column's type. For TOAST-able data types, this can be altered
1089 after column creation to control storage policy.
1094 <entry><structfield>attalign</structfield></entry>
1095 <entry><type>char</type></entry>
1098 A copy of <literal>pg_type.typalign</> of this column's type
1103 <entry><structfield>attnotnull</structfield></entry>
1104 <entry><type>bool</type></entry>
1107 This represents a not-null constraint.
1112 <entry><structfield>atthasdef</structfield></entry>
1113 <entry><type>bool</type></entry>
1116 This column has a default value, in which case there will be a
1117 corresponding entry in the <structname>pg_attrdef</structname>
1118 catalog that actually defines the value.
1123 <entry><structfield>attisdropped</structfield></entry>
1124 <entry><type>bool</type></entry>
1127 This column has been dropped and is no longer valid. A dropped
1128 column is still physically present in the table, but is
1129 ignored by the parser and so cannot be accessed via SQL.
1134 <entry><structfield>attislocal</structfield></entry>
1135 <entry><type>bool</type></entry>
1138 This column is defined locally in the relation. Note that a column can
1139 be locally defined and inherited simultaneously.
1144 <entry><structfield>attinhcount</structfield></entry>
1145 <entry><type>int4</type></entry>
1148 The number of direct ancestors this column has. A column with a
1149 nonzero number of ancestors cannot be dropped nor renamed.
1154 <entry><structfield>attcollation</structfield></entry>
1155 <entry><type>oid</type></entry>
1156 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1158 The defined collation of the column, or zero if the column is
1159 not of a collatable data type.
1164 <entry><structfield>attacl</structfield></entry>
1165 <entry><type>aclitem[]</type></entry>
1168 Column-level access privileges, if any have been granted specifically
1174 <entry><structfield>attoptions</structfield></entry>
1175 <entry><type>text[]</type></entry>
1178 Attribute-level options, as <quote>keyword=value</> strings
1183 <entry><structfield>attfdwoptions</structfield></entry>
1184 <entry><type>text[]</type></entry>
1187 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1196 In a dropped column's <structname>pg_attribute</structname> entry,
1197 <structfield>atttypid</structfield> is reset to zero, but
1198 <structfield>attlen</structfield> and the other fields copied from
1199 <structname>pg_type</> are still valid. This arrangement is needed
1200 to cope with the situation where the dropped column's data type was
1201 later dropped, and so there is no <structname>pg_type</> row anymore.
1202 <structfield>attlen</structfield> and the other fields can be used
1203 to interpret the contents of a row of the table.
1208 <sect1 id="catalog-pg-authid">
1209 <title><structname>pg_authid</structname></title>
1211 <indexterm zone="catalog-pg-authid">
1212 <primary>pg_authid</primary>
1216 The catalog <structname>pg_authid</structname> contains information about
1217 database authorization identifiers (roles). A role subsumes the concepts
1218 of <quote>users</> and <quote>groups</>. A user is essentially just a
1219 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1220 without <structfield>rolcanlogin</>) can have other roles as members; see
1221 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1225 Since this catalog contains passwords, it must not be publicly readable.
1226 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1227 is a publicly readable view on
1228 <structname>pg_authid</structname> that blanks out the password field.
1232 <xref linkend="user-manag"> contains detailed information about user and
1233 privilege management.
1237 Because user identities are cluster-wide,
1238 <structname>pg_authid</structname>
1239 is shared across all databases of a cluster: there is only one
1240 copy of <structname>pg_authid</structname> per cluster, not
1245 <title><structname>pg_authid</> Columns</title>
1252 <entry>Description</entry>
1259 <entry><structfield>oid</structfield></entry>
1260 <entry><type>oid</type></entry>
1261 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1265 <entry><structfield>rolname</structfield></entry>
1266 <entry><type>name</type></entry>
1267 <entry>Role name</entry>
1271 <entry><structfield>rolsuper</structfield></entry>
1272 <entry><type>bool</type></entry>
1273 <entry>Role has superuser privileges</entry>
1277 <entry><structfield>rolinherit</structfield></entry>
1278 <entry><type>bool</type></entry>
1279 <entry>Role automatically inherits privileges of roles it is a
1284 <entry><structfield>rolcreaterole</structfield></entry>
1285 <entry><type>bool</type></entry>
1286 <entry>Role can create more roles</entry>
1290 <entry><structfield>rolcreatedb</structfield></entry>
1291 <entry><type>bool</type></entry>
1292 <entry>Role can create databases</entry>
1296 <entry><structfield>rolcanlogin</structfield></entry>
1297 <entry><type>bool</type></entry>
1299 Role can log in. That is, this role can be given as the initial
1300 session authorization identifier
1305 <entry><structfield>rolreplication</structfield></entry>
1306 <entry><type>bool</type></entry>
1308 Role is a replication role. That is, this role can initiate streaming
1309 replication (see <xref linkend="streaming-replication">) and set/unset
1310 the system backup mode using <function>pg_start_backup</> and
1311 <function>pg_stop_backup</>
1316 <entry><structfield>rolbypassrls</structfield></entry>
1317 <entry><type>bool</type></entry>
1319 Role bypasses every row level security policy, see
1320 <xref linkend="ddl-rowsecurity"> for more information.
1325 <entry><structfield>rolconnlimit</structfield></entry>
1326 <entry><type>int4</type></entry>
1328 For roles that can log in, this sets maximum number of concurrent
1329 connections this role can make. -1 means no limit.
1334 <entry><structfield>rolpassword</structfield></entry>
1335 <entry><type>text</type></entry>
1337 Password (possibly encrypted); null if none. If the password
1338 is encrypted, this column will begin with the string <literal>md5</>
1339 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1340 will be of the user's password concatenated to their user name.
1341 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1342 <productname>PostgreSQL</> will store the md5 hash of
1343 <literal>xyzzyjoe</>. A password that does not follow that
1344 format is assumed to be unencrypted.
1349 <entry><structfield>rolvaliduntil</structfield></entry>
1350 <entry><type>timestamptz</type></entry>
1351 <entry>Password expiry time (only used for password authentication);
1352 null if no expiration</entry>
1361 <sect1 id="catalog-pg-auth-members">
1362 <title><structname>pg_auth_members</structname></title>
1364 <indexterm zone="catalog-pg-auth-members">
1365 <primary>pg_auth_members</primary>
1369 The catalog <structname>pg_auth_members</structname> shows the membership
1370 relations between roles. Any non-circular set of relationships is allowed.
1374 Because user identities are cluster-wide,
1375 <structname>pg_auth_members</structname>
1376 is shared across all databases of a cluster: there is only one
1377 copy of <structname>pg_auth_members</structname> per cluster, not
1382 <title><structname>pg_auth_members</> Columns</title>
1389 <entry>References</entry>
1390 <entry>Description</entry>
1396 <entry><structfield>roleid</structfield></entry>
1397 <entry><type>oid</type></entry>
1398 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1399 <entry>ID of a role that has a member</entry>
1403 <entry><structfield>member</structfield></entry>
1404 <entry><type>oid</type></entry>
1405 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1406 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1410 <entry><structfield>grantor</structfield></entry>
1411 <entry><type>oid</type></entry>
1412 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1413 <entry>ID of the role that granted this membership</entry>
1417 <entry><structfield>admin_option</structfield></entry>
1418 <entry><type>bool</type></entry>
1420 <entry>True if <structfield>member</> can grant membership in
1421 <structfield>roleid</> to others</entry>
1430 <sect1 id="catalog-pg-cast">
1431 <title><structname>pg_cast</structname></title>
1433 <indexterm zone="catalog-pg-cast">
1434 <primary>pg_cast</primary>
1438 The catalog <structname>pg_cast</structname> stores data type conversion
1439 paths, both built-in and user-defined.
1443 It should be noted that <structname>pg_cast</structname> does not represent
1444 every type conversion that the system knows how to perform; only those that
1445 cannot be deduced from some generic rule. For example, casting between a
1446 domain and its base type is not explicitly represented in
1447 <structname>pg_cast</structname>. Another important exception is that
1448 <quote>automatic I/O conversion casts</>, those performed using a data
1449 type's own I/O functions to convert to or from <type>text</> or other
1450 string types, are not explicitly represented in
1451 <structname>pg_cast</structname>.
1455 <title><structname>pg_cast</> Columns</title>
1462 <entry>References</entry>
1463 <entry>Description</entry>
1469 <entry><structfield>oid</structfield></entry>
1470 <entry><type>oid</type></entry>
1472 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1476 <entry><structfield>castsource</structfield></entry>
1477 <entry><type>oid</type></entry>
1478 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1479 <entry>OID of the source data type</entry>
1483 <entry><structfield>casttarget</structfield></entry>
1484 <entry><type>oid</type></entry>
1485 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1486 <entry>OID of the target data type</entry>
1490 <entry><structfield>castfunc</structfield></entry>
1491 <entry><type>oid</type></entry>
1492 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1494 The OID of the function to use to perform this cast. Zero is
1495 stored if the cast method doesn't require a function.
1500 <entry><structfield>castcontext</structfield></entry>
1501 <entry><type>char</type></entry>
1504 Indicates what contexts the cast can be invoked in.
1505 <literal>e</> means only as an explicit cast (using
1506 <literal>CAST</> or <literal>::</> syntax).
1507 <literal>a</> means implicitly in assignment
1508 to a target column, as well as explicitly.
1509 <literal>i</> means implicitly in expressions, as well as the
1514 <entry><structfield>castmethod</structfield></entry>
1515 <entry><type>char</type></entry>
1518 Indicates how the cast is performed.
1519 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1520 <literal>i</> means that the input/output functions are used.
1521 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1529 The cast functions listed in <structname>pg_cast</structname> must
1530 always take the cast source type as their first argument type, and
1531 return the cast destination type as their result type. A cast
1532 function can have up to three arguments. The second argument,
1533 if present, must be type <type>integer</>; it receives the type
1534 modifier associated with the destination type, or -1
1535 if there is none. The third argument,
1536 if present, must be type <type>boolean</>; it receives <literal>true</>
1537 if the cast is an explicit cast, <literal>false</> otherwise.
1541 It is legitimate to create a <structname>pg_cast</structname> entry
1542 in which the source and target types are the same, if the associated
1543 function takes more than one argument. Such entries represent
1544 <quote>length coercion functions</> that coerce values of the type
1545 to be legal for a particular type modifier value.
1549 When a <structname>pg_cast</structname> entry has different source and
1550 target types and a function that takes more than one argument, it
1551 represents converting from one type to another and applying a length
1552 coercion in a single step. When no such entry is available, coercion
1553 to a type that uses a type modifier involves two steps, one to
1554 convert between data types and a second to apply the modifier.
1558 <sect1 id="catalog-pg-class">
1559 <title><structname>pg_class</structname></title>
1561 <indexterm zone="catalog-pg-class">
1562 <primary>pg_class</primary>
1566 The catalog <structname>pg_class</structname> catalogs tables and most
1567 everything else that has columns or is otherwise similar to a
1568 table. This includes indexes (but see also
1569 <structname>pg_index</structname>), sequences (but see also
1570 <structname>pg_sequence</structname>), views, materialized
1571 views, composite types, and TOAST tables; see <structfield>relkind</>.
1572 Below, when we mean all of these
1573 kinds of objects we speak of <quote>relations</quote>. Not all
1574 columns are meaningful for all relation types.
1578 <title><structname>pg_class</> Columns</title>
1585 <entry>References</entry>
1586 <entry>Description</entry>
1592 <entry><structfield>oid</structfield></entry>
1593 <entry><type>oid</type></entry>
1595 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1599 <entry><structfield>relname</structfield></entry>
1600 <entry><type>name</type></entry>
1602 <entry>Name of the table, index, view, etc.</entry>
1606 <entry><structfield>relnamespace</structfield></entry>
1607 <entry><type>oid</type></entry>
1608 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1610 The OID of the namespace that contains this relation
1615 <entry><structfield>reltype</structfield></entry>
1616 <entry><type>oid</type></entry>
1617 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1619 The OID of the data type that corresponds to this table's row type,
1620 if any (zero for indexes, which have no <structname>pg_type</> entry)
1625 <entry><structfield>reloftype</structfield></entry>
1626 <entry><type>oid</type></entry>
1627 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1629 For typed tables, the OID of the underlying composite type,
1630 zero for all other relations
1635 <entry><structfield>relowner</structfield></entry>
1636 <entry><type>oid</type></entry>
1637 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1638 <entry>Owner of the relation</entry>
1642 <entry><structfield>relam</structfield></entry>
1643 <entry><type>oid</type></entry>
1644 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1645 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1649 <entry><structfield>relfilenode</structfield></entry>
1650 <entry><type>oid</type></entry>
1652 <entry>Name of the on-disk file of this relation; zero means this
1653 is a <quote>mapped</> relation whose disk file name is determined
1654 by low-level state</entry>
1658 <entry><structfield>reltablespace</structfield></entry>
1659 <entry><type>oid</type></entry>
1660 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1662 The tablespace in which this relation is stored. If zero,
1663 the database's default tablespace is implied. (Not meaningful
1664 if the relation has no on-disk file.)
1669 <entry><structfield>relpages</structfield></entry>
1670 <entry><type>int4</type></entry>
1673 Size of the on-disk representation of this table in pages (of size
1674 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1675 planner. It is updated by <command>VACUUM</command>,
1676 <command>ANALYZE</command>, and a few DDL commands such as
1677 <command>CREATE INDEX</command>.
1682 <entry><structfield>reltuples</structfield></entry>
1683 <entry><type>float4</type></entry>
1686 Number of rows in the table. This is only an estimate used by the
1687 planner. It is updated by <command>VACUUM</command>,
1688 <command>ANALYZE</command>, and a few DDL commands such as
1689 <command>CREATE INDEX</command>.
1694 <entry><structfield>relallvisible</structfield></entry>
1695 <entry><type>int4</type></entry>
1698 Number of pages that are marked all-visible in the table's
1699 visibility map. This is only an estimate used by the
1700 planner. It is updated by <command>VACUUM</command>,
1701 <command>ANALYZE</command>, and a few DDL commands such as
1702 <command>CREATE INDEX</command>.
1707 <entry><structfield>reltoastrelid</structfield></entry>
1708 <entry><type>oid</type></entry>
1709 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1711 OID of the TOAST table associated with this table, 0 if none. The
1712 TOAST table stores large attributes <quote>out of line</quote> in a
1718 <entry><structfield>relhasindex</structfield></entry>
1719 <entry><type>bool</type></entry>
1722 True if this is a table and it has (or recently had) any indexes
1727 <entry><structfield>relisshared</structfield></entry>
1728 <entry><type>bool</type></entry>
1731 True if this table is shared across all databases in the cluster. Only
1732 certain system catalogs (such as <structname>pg_database</structname>)
1738 <entry><structfield>relpersistence</structfield></entry>
1739 <entry><type>char</type></entry>
1742 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1743 <literal>t</> = temporary table
1748 <entry><structfield>relkind</structfield></entry>
1749 <entry><type>char</type></entry>
1752 <literal>r</> = ordinary table, <literal>P</> = partitioned table,
1753 <literal>i</> = index
1754 <literal>S</> = sequence, <literal>v</> = view,
1755 <literal>m</> = materialized view,
1756 <literal>c</> = composite type, <literal>t</> = TOAST table,
1757 <literal>f</> = foreign table
1762 <entry><structfield>relnatts</structfield></entry>
1763 <entry><type>int2</type></entry>
1766 Number of user columns in the relation (system columns not
1767 counted). There must be this many corresponding entries in
1768 <structname>pg_attribute</structname>. See also
1769 <literal>pg_attribute.attnum</literal>.
1774 <entry><structfield>relchecks</structfield></entry>
1775 <entry><type>int2</type></entry>
1778 Number of <literal>CHECK</> constraints on the table; see
1779 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1784 <entry><structfield>relhasoids</structfield></entry>
1785 <entry><type>bool</type></entry>
1788 True if we generate an OID for each row of the relation
1793 <entry><structfield>relhaspkey</structfield></entry>
1794 <entry><type>bool</type></entry>
1797 True if the table has (or once had) a primary key
1802 <entry><structfield>relhasrules</structfield></entry>
1803 <entry><type>bool</type></entry>
1806 True if table has (or once had) rules; see
1807 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1812 <entry><structfield>relhastriggers</structfield></entry>
1813 <entry><type>bool</type></entry>
1816 True if table has (or once had) triggers; see
1817 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1822 <entry><structfield>relhassubclass</structfield></entry>
1823 <entry><type>bool</type></entry>
1825 <entry>True if table has (or once had) any inheritance children</entry>
1829 <entry><structfield>relrowsecurity</structfield></entry>
1830 <entry><type>bool</type></entry>
1833 True if table has row level security enabled; see
1834 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1839 <entry><structfield>relforcerowsecurity</structfield></entry>
1840 <entry><type>bool</type></entry>
1843 True if row level security (when enabled) will also apply to table owner; see
1844 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1849 <entry><structfield>relispopulated</structfield></entry>
1850 <entry><type>bool</type></entry>
1852 <entry>True if relation is populated (this is true for all
1853 relations other than some materialized views)</entry>
1857 <entry><structfield>relreplident</structfield></entry>
1858 <entry><type>char</type></entry>
1861 Columns used to form <quote>replica identity</> for rows:
1862 <literal>d</> = default (primary key, if any),
1863 <literal>n</> = nothing,
1864 <literal>f</> = all columns
1865 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1870 <entry><structfield>relispartition</structfield></entry>
1871 <entry><type>bool</type></entry>
1873 <entry>True if table is a partition</entry>
1877 <entry><structfield>relfrozenxid</structfield></entry>
1878 <entry><type>xid</type></entry>
1881 All transaction IDs before this one have been replaced with a permanent
1882 (<quote>frozen</>) transaction ID in this table. This is used to track
1883 whether the table needs to be vacuumed in order to prevent transaction
1884 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1885 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1890 <entry><structfield>relminmxid</structfield></entry>
1891 <entry><type>xid</type></entry>
1894 All multixact IDs before this one have been replaced by a
1895 transaction ID in this table. This is used to track
1896 whether the table needs to be vacuumed in order to prevent multixact ID
1897 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
1898 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1903 <entry><structfield>relacl</structfield></entry>
1904 <entry><type>aclitem[]</type></entry>
1907 Access privileges; see
1908 <xref linkend="sql-grant"> and
1909 <xref linkend="sql-revoke">
1915 <entry><structfield>reloptions</structfield></entry>
1916 <entry><type>text[]</type></entry>
1919 Access-method-specific options, as <quote>keyword=value</> strings
1924 <entry><structfield>relpartbound</structfield></entry>
1925 <entry><type>pg_node_tree</type></entry>
1928 If table is a partition (see <structfield>relispartition</structfield>),
1929 internal representation of the partition bound
1937 Several of the Boolean flags in <structname>pg_class</> are maintained
1938 lazily: they are guaranteed to be true if that's the correct state, but
1939 may not be reset to false immediately when the condition is no longer
1940 true. For example, <structfield>relhasindex</> is set by
1941 <command>CREATE INDEX</command>, but it is never cleared by
1942 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1943 <structfield>relhasindex</> if it finds the table has no indexes. This
1944 arrangement avoids race conditions and improves concurrency.
1948 <sect1 id="catalog-pg-collation">
1949 <title><structname>pg_collation</structname></title>
1951 <indexterm zone="catalog-pg-collation">
1952 <primary>pg_collation</primary>
1956 The catalog <structname>pg_collation</structname> describes the
1957 available collations, which are essentially mappings from an SQL
1958 name to operating system locale categories.
1959 See <xref linkend="collation"> for more information.
1963 <title><structname>pg_collation</> Columns</title>
1970 <entry>References</entry>
1971 <entry>Description</entry>
1977 <entry><structfield>oid</structfield></entry>
1978 <entry><type>oid</type></entry>
1980 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1984 <entry><structfield>collname</structfield></entry>
1985 <entry><type>name</type></entry>
1987 <entry>Collation name (unique per namespace and encoding)</entry>
1991 <entry><structfield>collnamespace</structfield></entry>
1992 <entry><type>oid</type></entry>
1993 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1995 The OID of the namespace that contains this collation
2000 <entry><structfield>collowner</structfield></entry>
2001 <entry><type>oid</type></entry>
2002 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2003 <entry>Owner of the collation</entry>
2007 <entry><structfield>collencoding</structfield></entry>
2008 <entry><type>int4</type></entry>
2010 <entry>Encoding in which the collation is applicable, or -1 if it
2011 works for any encoding</entry>
2015 <entry><structfield>collcollate</structfield></entry>
2016 <entry><type>name</type></entry>
2018 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2022 <entry><structfield>collctype</structfield></entry>
2023 <entry><type>name</type></entry>
2025 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2032 Note that the unique key on this catalog is (<structfield>collname</>,
2033 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2034 (<structfield>collname</>, <structfield>collnamespace</>).
2035 <productname>PostgreSQL</productname> generally ignores all
2036 collations that do not have <structfield>collencoding</> equal to
2037 either the current database's encoding or -1, and creation of new entries
2038 with the same name as an entry with <structfield>collencoding</> = -1
2039 is forbidden. Therefore it is sufficient to use a qualified SQL name
2040 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2041 even though this is not unique according to the catalog definition.
2042 The reason for defining the catalog this way is that
2043 <application>initdb</> fills it in at cluster initialization time with
2044 entries for all locales available on the system, so it must be able to
2045 hold entries for all encodings that might ever be used in the cluster.
2049 In the <literal>template0</> database, it could be useful to create
2050 collations whose encoding does not match the database encoding,
2051 since they could match the encodings of databases later cloned from
2052 <literal>template0</>. This would currently have to be done manually.
2056 <sect1 id="catalog-pg-constraint">
2057 <title><structname>pg_constraint</structname></title>
2059 <indexterm zone="catalog-pg-constraint">
2060 <primary>pg_constraint</primary>
2064 The catalog <structname>pg_constraint</structname> stores check, primary
2065 key, unique, foreign key, and exclusion constraints on tables.
2066 (Column constraints are not treated specially. Every column constraint is
2067 equivalent to some table constraint.)
2068 Not-null constraints are represented in the <structname>pg_attribute</>
2073 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2074 TRIGGER</>) also give rise to an entry in this table.
2078 Check constraints on domains are stored here, too.
2082 <title><structname>pg_constraint</> Columns</title>
2089 <entry>References</entry>
2090 <entry>Description</entry>
2096 <entry><structfield>oid</structfield></entry>
2097 <entry><type>oid</type></entry>
2099 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2103 <entry><structfield>conname</structfield></entry>
2104 <entry><type>name</type></entry>
2106 <entry>Constraint name (not necessarily unique!)</entry>
2110 <entry><structfield>connamespace</structfield></entry>
2111 <entry><type>oid</type></entry>
2112 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2114 The OID of the namespace that contains this constraint
2119 <entry><structfield>contype</structfield></entry>
2120 <entry><type>char</type></entry>
2123 <literal>c</> = check constraint,
2124 <literal>f</> = foreign key constraint,
2125 <literal>p</> = primary key constraint,
2126 <literal>u</> = unique constraint,
2127 <literal>t</> = constraint trigger,
2128 <literal>x</> = exclusion constraint
2133 <entry><structfield>condeferrable</structfield></entry>
2134 <entry><type>bool</type></entry>
2136 <entry>Is the constraint deferrable?</entry>
2140 <entry><structfield>condeferred</structfield></entry>
2141 <entry><type>bool</type></entry>
2143 <entry>Is the constraint deferred by default?</entry>
2147 <entry><structfield>convalidated</structfield></entry>
2148 <entry><type>bool</type></entry>
2150 <entry>Has the constraint been validated?
2151 Currently, can only be false for foreign keys and CHECK constraints</entry>
2155 <entry><structfield>conrelid</structfield></entry>
2156 <entry><type>oid</type></entry>
2157 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2158 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2162 <entry><structfield>contypid</structfield></entry>
2163 <entry><type>oid</type></entry>
2164 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2165 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2169 <entry><structfield>conindid</structfield></entry>
2170 <entry><type>oid</type></entry>
2171 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2172 <entry>The index supporting this constraint, if it's a unique, primary
2173 key, foreign key, or exclusion constraint; else 0</entry>
2177 <entry><structfield>confrelid</structfield></entry>
2178 <entry><type>oid</type></entry>
2179 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2180 <entry>If a foreign key, the referenced table; else 0</entry>
2184 <entry><structfield>confupdtype</structfield></entry>
2185 <entry><type>char</type></entry>
2187 <entry>Foreign key update action code:
2188 <literal>a</> = no action,
2189 <literal>r</> = restrict,
2190 <literal>c</> = cascade,
2191 <literal>n</> = set null,
2192 <literal>d</> = set default
2197 <entry><structfield>confdeltype</structfield></entry>
2198 <entry><type>char</type></entry>
2200 <entry>Foreign key deletion action code:
2201 <literal>a</> = no action,
2202 <literal>r</> = restrict,
2203 <literal>c</> = cascade,
2204 <literal>n</> = set null,
2205 <literal>d</> = set default
2210 <entry><structfield>confmatchtype</structfield></entry>
2211 <entry><type>char</type></entry>
2213 <entry>Foreign key match type:
2214 <literal>f</> = full,
2215 <literal>p</> = partial,
2216 <literal>s</> = simple
2221 <entry><structfield>conislocal</structfield></entry>
2222 <entry><type>bool</type></entry>
2225 This constraint is defined locally for the relation. Note that a
2226 constraint can be locally defined and inherited simultaneously.
2231 <entry><structfield>coninhcount</structfield></entry>
2232 <entry><type>int4</type></entry>
2235 The number of direct inheritance ancestors this constraint has.
2237 a nonzero number of ancestors cannot be dropped nor renamed.
2242 <entry><structfield>connoinherit</structfield></entry>
2243 <entry><type>bool</type></entry>
2246 This constraint is defined locally for the relation. It is a
2247 non-inheritable constraint.
2252 <entry><structfield>conkey</structfield></entry>
2253 <entry><type>int2[]</type></entry>
2254 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2255 <entry>If a table constraint (including foreign keys, but not constraint
2256 triggers), list of the constrained columns</entry>
2260 <entry><structfield>confkey</structfield></entry>
2261 <entry><type>int2[]</type></entry>
2262 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2263 <entry>If a foreign key, list of the referenced columns</entry>
2267 <entry><structfield>conpfeqop</structfield></entry>
2268 <entry><type>oid[]</type></entry>
2269 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2270 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2274 <entry><structfield>conppeqop</structfield></entry>
2275 <entry><type>oid[]</type></entry>
2276 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2277 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2281 <entry><structfield>conffeqop</structfield></entry>
2282 <entry><type>oid[]</type></entry>
2283 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2284 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2288 <entry><structfield>conexclop</structfield></entry>
2289 <entry><type>oid[]</type></entry>
2290 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2291 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2295 <entry><structfield>conbin</structfield></entry>
2296 <entry><type>pg_node_tree</type></entry>
2298 <entry>If a check constraint, an internal representation of the expression</entry>
2302 <entry><structfield>consrc</structfield></entry>
2303 <entry><type>text</type></entry>
2305 <entry>If a check constraint, a human-readable representation of the expression</entry>
2312 In the case of an exclusion constraint, <structfield>conkey</structfield>
2313 is only useful for constraint elements that are simple column references.
2314 For other cases, a zero appears in <structfield>conkey</structfield>
2315 and the associated index must be consulted to discover the expression
2316 that is constrained. (<structfield>conkey</structfield> thus has the
2317 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2323 <structfield>consrc</structfield> is not updated when referenced objects
2324 change; for example, it won't track renaming of columns. Rather than
2325 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2326 to extract the definition of a check constraint.
2332 <literal>pg_class.relchecks</literal> needs to agree with the
2333 number of check-constraint entries found in this table for each
2340 <sect1 id="catalog-pg-conversion">
2341 <title><structname>pg_conversion</structname></title>
2343 <indexterm zone="catalog-pg-conversion">
2344 <primary>pg_conversion</primary>
2348 The catalog <structname>pg_conversion</structname> describes
2349 encoding conversion procedures. See <xref linkend="sql-createconversion">
2350 for more information.
2354 <title><structname>pg_conversion</> Columns</title>
2361 <entry>References</entry>
2362 <entry>Description</entry>
2368 <entry><structfield>oid</structfield></entry>
2369 <entry><type>oid</type></entry>
2371 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2375 <entry><structfield>conname</structfield></entry>
2376 <entry><type>name</type></entry>
2378 <entry>Conversion name (unique within a namespace)</entry>
2382 <entry><structfield>connamespace</structfield></entry>
2383 <entry><type>oid</type></entry>
2384 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2386 The OID of the namespace that contains this conversion
2391 <entry><structfield>conowner</structfield></entry>
2392 <entry><type>oid</type></entry>
2393 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2394 <entry>Owner of the conversion</entry>
2398 <entry><structfield>conforencoding</structfield></entry>
2399 <entry><type>int4</type></entry>
2401 <entry>Source encoding ID</entry>
2405 <entry><structfield>contoencoding</structfield></entry>
2406 <entry><type>int4</type></entry>
2408 <entry>Destination encoding ID</entry>
2412 <entry><structfield>conproc</structfield></entry>
2413 <entry><type>regproc</type></entry>
2414 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2415 <entry>Conversion procedure</entry>
2419 <entry><structfield>condefault</structfield></entry>
2420 <entry><type>bool</type></entry>
2422 <entry>True if this is the default conversion</entry>
2431 <sect1 id="catalog-pg-database">
2432 <title><structname>pg_database</structname></title>
2434 <indexterm zone="catalog-pg-database">
2435 <primary>pg_database</primary>
2439 The catalog <structname>pg_database</structname> stores information about
2440 the available databases. Databases are created with the <xref
2441 linkend="sql-createdatabase"> command.
2442 Consult <xref linkend="managing-databases"> for details about the meaning
2443 of some of the parameters.
2447 Unlike most system catalogs, <structname>pg_database</structname>
2448 is shared across all databases of a cluster: there is only one
2449 copy of <structname>pg_database</structname> per cluster, not
2454 <title><structname>pg_database</> Columns</title>
2461 <entry>References</entry>
2462 <entry>Description</entry>
2468 <entry><structfield>oid</structfield></entry>
2469 <entry><type>oid</type></entry>
2471 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2475 <entry><structfield>datname</structfield></entry>
2476 <entry><type>name</type></entry>
2478 <entry>Database name</entry>
2482 <entry><structfield>datdba</structfield></entry>
2483 <entry><type>oid</type></entry>
2484 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2485 <entry>Owner of the database, usually the user who created it</entry>
2489 <entry><structfield>encoding</structfield></entry>
2490 <entry><type>int4</type></entry>
2492 <entry>Character encoding for this database
2493 (<function>pg_encoding_to_char()</function> can translate
2494 this number to the encoding name)</entry>
2498 <entry><structfield>datcollate</structfield></entry>
2499 <entry><type>name</type></entry>
2501 <entry>LC_COLLATE for this database</entry>
2505 <entry><structfield>datctype</structfield></entry>
2506 <entry><type>name</type></entry>
2508 <entry>LC_CTYPE for this database</entry>
2512 <entry><structfield>datistemplate</structfield></entry>
2513 <entry><type>bool</type></entry>
2516 If true, then this database can be cloned by
2517 any user with <literal>CREATEDB</> privileges;
2518 if false, then only superusers or the owner of
2519 the database can clone it.
2524 <entry><structfield>datallowconn</structfield></entry>
2525 <entry><type>bool</type></entry>
2528 If false then no one can connect to this database. This is
2529 used to protect the <literal>template0</> database from being altered.
2534 <entry><structfield>datconnlimit</structfield></entry>
2535 <entry><type>int4</type></entry>
2538 Sets maximum number of concurrent connections that can be made
2539 to this database. -1 means no limit.
2544 <entry><structfield>datlastsysoid</structfield></entry>
2545 <entry><type>oid</type></entry>
2548 Last system OID in the database; useful
2549 particularly to <application>pg_dump</application>
2554 <entry><structfield>datfrozenxid</structfield></entry>
2555 <entry><type>xid</type></entry>
2558 All transaction IDs before this one have been replaced with a permanent
2559 (<quote>frozen</>) transaction ID in this database. This is used to
2560 track whether the database needs to be vacuumed in order to prevent
2561 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2562 It is the minimum of the per-table
2563 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2568 <entry><structfield>datminmxid</structfield></entry>
2569 <entry><type>xid</type></entry>
2572 All multixact IDs before this one have been replaced with a
2573 transaction ID in this database. This is used to
2574 track whether the database needs to be vacuumed in order to prevent
2575 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2576 It is the minimum of the per-table
2577 <structname>pg_class</>.<structfield>relminmxid</> values.
2582 <entry><structfield>dattablespace</structfield></entry>
2583 <entry><type>oid</type></entry>
2584 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2586 The default tablespace for the database.
2587 Within this database, all tables for which
2588 <structname>pg_class</>.<structfield>reltablespace</> is zero
2589 will be stored in this tablespace; in particular, all the non-shared
2590 system catalogs will be there.
2595 <entry><structfield>datacl</structfield></entry>
2596 <entry><type>aclitem[]</type></entry>
2599 Access privileges; see
2600 <xref linkend="sql-grant"> and
2601 <xref linkend="sql-revoke">
2611 <sect1 id="catalog-pg-db-role-setting">
2612 <title><structname>pg_db_role_setting</structname></title>
2614 <indexterm zone="catalog-pg-db-role-setting">
2615 <primary>pg_db_role_setting</primary>
2619 The catalog <structname>pg_db_role_setting</structname> records the default
2620 values that have been set for run-time configuration variables,
2621 for each role and database combination.
2625 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2626 is shared across all databases of a cluster: there is only one
2627 copy of <structname>pg_db_role_setting</structname> per cluster, not
2632 <title><structname>pg_db_role_setting</> Columns</title>
2639 <entry>References</entry>
2640 <entry>Description</entry>
2646 <entry><structfield>setdatabase</structfield></entry>
2647 <entry><type>oid</type></entry>
2648 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2649 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2653 <entry><structfield>setrole</structfield></entry>
2654 <entry><type>oid</type></entry>
2655 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2656 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2660 <entry><structfield>setconfig</structfield></entry>
2661 <entry><type>text[]</type></entry>
2663 <entry>Defaults for run-time configuration variables</entry>
2671 <sect1 id="catalog-pg-default-acl">
2672 <title><structname>pg_default_acl</structname></title>
2674 <indexterm zone="catalog-pg-default-acl">
2675 <primary>pg_default_acl</primary>
2679 The catalog <structname>pg_default_acl</> stores initial
2680 privileges to be assigned to newly created objects.
2684 <title><structname>pg_default_acl</> Columns</title>
2691 <entry>References</entry>
2692 <entry>Description</entry>
2698 <entry><structfield>oid</structfield></entry>
2699 <entry><type>oid</type></entry>
2701 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2705 <entry><structfield>defaclrole</structfield></entry>
2706 <entry><type>oid</type></entry>
2707 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2708 <entry>The OID of the role associated with this entry</entry>
2712 <entry><structfield>defaclnamespace</structfield></entry>
2713 <entry><type>oid</type></entry>
2714 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2715 <entry>The OID of the namespace associated with this entry,
2716 or 0 if none</entry>
2720 <entry><structfield>defaclobjtype</structfield></entry>
2721 <entry><type>char</type></entry>
2724 Type of object this entry is for:
2725 <literal>r</> = relation (table, view),
2726 <literal>S</> = sequence,
2727 <literal>f</> = function,
2728 <literal>T</> = type
2733 <entry><structfield>defaclacl</structfield></entry>
2734 <entry><type>aclitem[]</type></entry>
2737 Access privileges that this type of object should have on creation
2745 A <structname>pg_default_acl</> entry shows the initial privileges to
2746 be assigned to an object belonging to the indicated user. There are
2747 currently two types of entry: <quote>global</> entries with
2748 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2749 that reference a particular schema. If a global entry is present then
2750 it <emphasis>overrides</> the normal hard-wired default privileges
2751 for the object type. A per-schema entry, if present, represents privileges
2752 to be <emphasis>added to</> the global or hard-wired default privileges.
2756 Note that when an ACL entry in another catalog is null, it is taken
2757 to represent the hard-wired default privileges for its object,
2758 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2759 at the moment. <structname>pg_default_acl</> is only consulted during
2766 <sect1 id="catalog-pg-depend">
2767 <title><structname>pg_depend</structname></title>
2769 <indexterm zone="catalog-pg-depend">
2770 <primary>pg_depend</primary>
2774 The catalog <structname>pg_depend</structname> records the dependency
2775 relationships between database objects. This information allows
2776 <command>DROP</> commands to find which other objects must be dropped
2777 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2782 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2783 which performs a similar function for dependencies involving objects
2784 that are shared across a database cluster.
2788 <title><structname>pg_depend</> Columns</title>
2795 <entry>References</entry>
2796 <entry>Description</entry>
2802 <entry><structfield>classid</structfield></entry>
2803 <entry><type>oid</type></entry>
2804 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2805 <entry>The OID of the system catalog the dependent object is in</entry>
2809 <entry><structfield>objid</structfield></entry>
2810 <entry><type>oid</type></entry>
2811 <entry>any OID column</entry>
2812 <entry>The OID of the specific dependent object</entry>
2816 <entry><structfield>objsubid</structfield></entry>
2817 <entry><type>int4</type></entry>
2820 For a table column, this is the column number (the
2821 <structfield>objid</> and <structfield>classid</> refer to the
2822 table itself). For all other object types, this column is
2828 <entry><structfield>refclassid</structfield></entry>
2829 <entry><type>oid</type></entry>
2830 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2831 <entry>The OID of the system catalog the referenced object is in</entry>
2835 <entry><structfield>refobjid</structfield></entry>
2836 <entry><type>oid</type></entry>
2837 <entry>any OID column</entry>
2838 <entry>The OID of the specific referenced object</entry>
2842 <entry><structfield>refobjsubid</structfield></entry>
2843 <entry><type>int4</type></entry>
2846 For a table column, this is the column number (the
2847 <structfield>refobjid</> and <structfield>refclassid</> refer
2848 to the table itself). For all other object types, this column
2854 <entry><structfield>deptype</structfield></entry>
2855 <entry><type>char</type></entry>
2858 A code defining the specific semantics of this dependency relationship; see text
2867 In all cases, a <structname>pg_depend</structname> entry indicates that the
2868 referenced object cannot be dropped without also dropping the dependent
2869 object. However, there are several subflavors identified by
2870 <structfield>deptype</>:
2874 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2877 A normal relationship between separately-created objects. The
2878 dependent object can be dropped without affecting the
2879 referenced object. The referenced object can only be dropped
2880 by specifying <literal>CASCADE</>, in which case the dependent
2881 object is dropped, too. Example: a table column has a normal
2882 dependency on its data type.
2888 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2891 The dependent object can be dropped separately from the
2892 referenced object, and should be automatically dropped
2893 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2894 mode) if the referenced object is dropped. Example: a named
2895 constraint on a table is made autodependent on the table, so
2896 that it will go away if the table is dropped.
2902 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2905 The dependent object was created as part of creation of the
2906 referenced object, and is really just a part of its internal
2907 implementation. A <command>DROP</> of the dependent object
2908 will be disallowed outright (we'll tell the user to issue a
2909 <command>DROP</> against the referenced object, instead). A
2910 <command>DROP</> of the referenced object will be propagated
2911 through to drop the dependent object whether
2912 <command>CASCADE</> is specified or not. Example: a trigger
2913 that's created to enforce a foreign-key constraint is made
2914 internally dependent on the constraint's
2915 <structname>pg_constraint</> entry.
2921 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2924 The dependent object is a member of the <firstterm>extension</> that is
2925 the referenced object (see
2926 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2927 The dependent object can be dropped only via
2928 <command>DROP EXTENSION</> on the referenced object. Functionally
2929 this dependency type acts the same as an internal dependency, but
2930 it's kept separate for clarity and to simplify <application>pg_dump</>.
2936 <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2939 The dependent object is not a member of the extension that is the
2940 referenced object (and so should not be ignored by pg_dump), but
2941 cannot function without it and should be dropped when the
2942 extension itself is. The dependent object may be dropped on its
2949 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2952 There is no dependent object; this type of entry is a signal
2953 that the system itself depends on the referenced object, and so
2954 that object must never be deleted. Entries of this type are
2955 created only by <command>initdb</command>. The columns for the
2956 dependent object contain zeroes.
2962 Other dependency flavors might be needed in future.
2968 <sect1 id="catalog-pg-description">
2969 <title><structname>pg_description</structname></title>
2971 <indexterm zone="catalog-pg-description">
2972 <primary>pg_description</primary>
2976 The catalog <structname>pg_description</> stores optional descriptions
2977 (comments) for each database object. Descriptions can be manipulated
2978 with the <xref linkend="sql-comment"> command and viewed with
2979 <application>psql</application>'s <literal>\d</literal> commands.
2980 Descriptions of many built-in system objects are provided in the initial
2981 contents of <structname>pg_description</structname>.
2985 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2986 which performs a similar function for descriptions involving objects that
2987 are shared across a database cluster.
2991 <title><structname>pg_description</> Columns</title>
2998 <entry>References</entry>
2999 <entry>Description</entry>
3005 <entry><structfield>objoid</structfield></entry>
3006 <entry><type>oid</type></entry>
3007 <entry>any OID column</entry>
3008 <entry>The OID of the object this description pertains to</entry>
3012 <entry><structfield>classoid</structfield></entry>
3013 <entry><type>oid</type></entry>
3014 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3015 <entry>The OID of the system catalog this object appears in</entry>
3019 <entry><structfield>objsubid</structfield></entry>
3020 <entry><type>int4</type></entry>
3023 For a comment on a table column, this is the column number (the
3024 <structfield>objoid</> and <structfield>classoid</> refer to
3025 the table itself). For all other object types, this column is
3031 <entry><structfield>description</structfield></entry>
3032 <entry><type>text</type></entry>
3034 <entry>Arbitrary text that serves as the description of this object</entry>
3043 <sect1 id="catalog-pg-enum">
3044 <title><structname>pg_enum</structname></title>
3046 <indexterm zone="catalog-pg-enum">
3047 <primary>pg_enum</primary>
3051 The <structname>pg_enum</structname> catalog contains entries
3052 showing the values and labels for each enum type. The
3053 internal representation of a given enum value is actually the OID
3054 of its associated row in <structname>pg_enum</structname>.
3058 <title><structname>pg_enum</> Columns</title>
3065 <entry>References</entry>
3066 <entry>Description</entry>
3072 <entry><structfield>oid</structfield></entry>
3073 <entry><type>oid</type></entry>
3075 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3079 <entry><structfield>enumtypid</structfield></entry>
3080 <entry><type>oid</type></entry>
3081 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3082 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3086 <entry><structfield>enumsortorder</structfield></entry>
3087 <entry><type>float4</type></entry>
3089 <entry>The sort position of this enum value within its enum type</entry>
3093 <entry><structfield>enumlabel</structfield></entry>
3094 <entry><type>name</type></entry>
3096 <entry>The textual label for this enum value</entry>
3103 The OIDs for <structname>pg_enum</structname> rows follow a special
3104 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3105 as the sort ordering of their enum type. That is, if two even OIDs
3106 belong to the same enum type, the smaller OID must have the smaller
3107 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3108 need bear no relationship to the sort order. This rule allows the
3109 enum comparison routines to avoid catalog lookups in many common cases.
3110 The routines that create and alter enum types attempt to assign even
3111 OIDs to enum values whenever possible.
3115 When an enum type is created, its members are assigned sort-order
3116 positions 1..<replaceable>n</>. But members added later might be given
3117 negative or fractional values of <structfield>enumsortorder</structfield>.
3118 The only requirement on these values is that they be correctly
3119 ordered and unique within each enum type.
3124 <sect1 id="catalog-pg-event-trigger">
3125 <title><structname>pg_event_trigger</structname></title>
3127 <indexterm zone="catalog-pg-event-trigger">
3128 <primary>pg_event_trigger</primary>
3132 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3133 See <xref linkend="event-triggers"> for more information.
3137 <title><structname>pg_event_trigger</> Columns</title>
3144 <entry>References</entry>
3145 <entry>Description</entry>
3151 <entry><structfield>evtname</structfield></entry>
3152 <entry><type>name</type></entry>
3154 <entry>Trigger name (must be unique)</entry>
3158 <entry><structfield>evtevent</structfield></entry>
3159 <entry><type>name</type></entry>
3161 <entry>Identifies the event for which this trigger fires</entry>
3165 <entry><structfield>evtowner</structfield></entry>
3166 <entry><type>oid</type></entry>
3167 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3168 <entry>Owner of the event trigger</entry>
3172 <entry><structfield>evtfoid</structfield></entry>
3173 <entry><type>oid</type></entry>
3174 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3175 <entry>The function to be called</entry>
3179 <entry><structfield>evtenabled</structfield></entry>
3180 <entry><type>char</type></entry>
3183 Controls in which <xref linkend="guc-session-replication-role"> modes
3184 the event trigger fires.
3185 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3186 <literal>D</> = trigger is disabled,
3187 <literal>R</> = trigger fires in <quote>replica</> mode,
3188 <literal>A</> = trigger fires always.
3193 <entry><structfield>evttags</structfield></entry>
3194 <entry><type>text[]</type></entry>
3197 Command tags for which this trigger will fire. If NULL, the firing
3198 of this trigger is not restricted on the basis of the command tag.
3207 <sect1 id="catalog-pg-extension">
3208 <title><structname>pg_extension</structname></title>
3210 <indexterm zone="catalog-pg-extension">
3211 <primary>pg_extension</primary>
3215 The catalog <structname>pg_extension</structname> stores information
3216 about the installed extensions. See <xref linkend="extend-extensions">
3217 for details about extensions.
3221 <title><structname>pg_extension</> Columns</title>
3228 <entry>References</entry>
3229 <entry>Description</entry>
3235 <entry><structfield>oid</structfield></entry>
3236 <entry><type>oid</type></entry>
3238 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3242 <entry><structfield>extname</structfield></entry>
3243 <entry><type>name</type></entry>
3245 <entry>Name of the extension</entry>
3249 <entry><structfield>extowner</structfield></entry>
3250 <entry><type>oid</type></entry>
3251 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3252 <entry>Owner of the extension</entry>
3256 <entry><structfield>extnamespace</structfield></entry>
3257 <entry><type>oid</type></entry>
3258 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3259 <entry>Schema containing the extension's exported objects</entry>
3263 <entry><structfield>extrelocatable</structfield></entry>
3264 <entry><type>bool</type></entry>
3266 <entry>True if extension can be relocated to another schema</entry>
3270 <entry><structfield>extversion</structfield></entry>
3271 <entry><type>text</type></entry>
3273 <entry>Version name for the extension</entry>
3277 <entry><structfield>extconfig</structfield></entry>
3278 <entry><type>oid[]</type></entry>
3279 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3280 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3281 table(s), or <literal>NULL</> if none</entry>
3285 <entry><structfield>extcondition</structfield></entry>
3286 <entry><type>text[]</type></entry>
3288 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3289 extension's configuration table(s), or <literal>NULL</> if none</entry>
3297 Note that unlike most catalogs with a <quote>namespace</> column,
3298 <structfield>extnamespace</structfield> is not meant to imply
3299 that the extension belongs to that schema. Extension names are never
3300 schema-qualified. Rather, <structfield>extnamespace</structfield>
3301 indicates the schema that contains most or all of the extension's
3302 objects. If <structfield>extrelocatable</structfield> is true, then
3303 this schema must in fact contain all schema-qualifiable objects
3304 belonging to the extension.
3309 <sect1 id="catalog-pg-foreign-data-wrapper">
3310 <title><structname>pg_foreign_data_wrapper</structname></title>
3312 <indexterm zone="catalog-pg-foreign-data-wrapper">
3313 <primary>pg_foreign_data_wrapper</primary>
3317 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3318 foreign-data wrapper definitions. A foreign-data wrapper is the
3319 mechanism by which external data, residing on foreign servers, is
3324 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3331 <entry>References</entry>
3332 <entry>Description</entry>
3338 <entry><structfield>oid</structfield></entry>
3339 <entry><type>oid</type></entry>
3341 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3345 <entry><structfield>fdwname</structfield></entry>
3346 <entry><type>name</type></entry>
3348 <entry>Name of the foreign-data wrapper</entry>
3352 <entry><structfield>fdwowner</structfield></entry>
3353 <entry><type>oid</type></entry>
3354 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3355 <entry>Owner of the foreign-data wrapper</entry>
3359 <entry><structfield>fdwhandler</structfield></entry>
3360 <entry><type>oid</type></entry>
3361 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3363 References a handler function that is responsible for
3364 supplying execution routines for the foreign-data wrapper.
3365 Zero if no handler is provided
3370 <entry><structfield>fdwvalidator</structfield></entry>
3371 <entry><type>oid</type></entry>
3372 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3374 References a validator function that is responsible for
3375 checking the validity of the options given to the
3376 foreign-data wrapper, as well as options for foreign servers and user
3377 mappings using the foreign-data wrapper. Zero if no validator
3383 <entry><structfield>fdwacl</structfield></entry>
3384 <entry><type>aclitem[]</type></entry>
3387 Access privileges; see
3388 <xref linkend="sql-grant"> and
3389 <xref linkend="sql-revoke">
3395 <entry><structfield>fdwoptions</structfield></entry>
3396 <entry><type>text[]</type></entry>
3399 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3408 <sect1 id="catalog-pg-foreign-server">
3409 <title><structname>pg_foreign_server</structname></title>
3411 <indexterm zone="catalog-pg-foreign-server">
3412 <primary>pg_foreign_server</primary>
3416 The catalog <structname>pg_foreign_server</structname> stores
3417 foreign server definitions. A foreign server describes a source
3418 of external data, such as a remote server. Foreign
3419 servers are accessed via foreign-data wrappers.
3423 <title><structname>pg_foreign_server</> Columns</title>
3430 <entry>References</entry>
3431 <entry>Description</entry>
3437 <entry><structfield>oid</structfield></entry>
3438 <entry><type>oid</type></entry>
3440 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3444 <entry><structfield>srvname</structfield></entry>
3445 <entry><type>name</type></entry>
3447 <entry>Name of the foreign server</entry>
3451 <entry><structfield>srvowner</structfield></entry>
3452 <entry><type>oid</type></entry>
3453 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3454 <entry>Owner of the foreign server</entry>
3458 <entry><structfield>srvfdw</structfield></entry>
3459 <entry><type>oid</type></entry>
3460 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3461 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3465 <entry><structfield>srvtype</structfield></entry>
3466 <entry><type>text</type></entry>
3468 <entry>Type of the server (optional)</entry>
3472 <entry><structfield>srvversion</structfield></entry>
3473 <entry><type>text</type></entry>
3475 <entry>Version of the server (optional)</entry>
3479 <entry><structfield>srvacl</structfield></entry>
3480 <entry><type>aclitem[]</type></entry>
3483 Access privileges; see
3484 <xref linkend="sql-grant"> and
3485 <xref linkend="sql-revoke">
3491 <entry><structfield>srvoptions</structfield></entry>
3492 <entry><type>text[]</type></entry>
3495 Foreign server specific options, as <quote>keyword=value</> strings
3504 <sect1 id="catalog-pg-foreign-table">
3505 <title><structname>pg_foreign_table</structname></title>
3507 <indexterm zone="catalog-pg-foreign-table">
3508 <primary>pg_foreign_table</primary>
3512 The catalog <structname>pg_foreign_table</structname> contains
3513 auxiliary information about foreign tables. A foreign table is
3514 primarily represented by a <structname>pg_class</structname> entry,
3515 just like a regular table. Its <structname>pg_foreign_table</structname>
3516 entry contains the information that is pertinent only to foreign tables
3517 and not any other kind of relation.
3521 <title><structname>pg_foreign_table</> Columns</title>
3528 <entry>References</entry>
3529 <entry>Description</entry>
3535 <entry><structfield>ftrelid</structfield></entry>
3536 <entry><type>oid</type></entry>
3537 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3538 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3542 <entry><structfield>ftserver</structfield></entry>
3543 <entry><type>oid</type></entry>
3544 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3545 <entry>OID of the foreign server for this foreign table</entry>
3549 <entry><structfield>ftoptions</structfield></entry>
3550 <entry><type>text[]</type></entry>
3553 Foreign table options, as <quote>keyword=value</> strings
3562 <sect1 id="catalog-pg-index">
3563 <title><structname>pg_index</structname></title>
3565 <indexterm zone="catalog-pg-index">
3566 <primary>pg_index</primary>
3570 The catalog <structname>pg_index</structname> contains part of the information
3571 about indexes. The rest is mostly in
3572 <structname>pg_class</structname>.
3576 <title><structname>pg_index</> Columns</title>
3583 <entry>References</entry>
3584 <entry>Description</entry>
3590 <entry><structfield>indexrelid</structfield></entry>
3591 <entry><type>oid</type></entry>
3592 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3593 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3597 <entry><structfield>indrelid</structfield></entry>
3598 <entry><type>oid</type></entry>
3599 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3600 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3604 <entry><structfield>indnatts</structfield></entry>
3605 <entry><type>int2</type></entry>
3607 <entry>The number of columns in the index (duplicates
3608 <literal>pg_class.relnatts</literal>)</entry>
3612 <entry><structfield>indisunique</structfield></entry>
3613 <entry><type>bool</type></entry>
3615 <entry>If true, this is a unique index</entry>
3619 <entry><structfield>indisprimary</structfield></entry>
3620 <entry><type>bool</type></entry>
3622 <entry>If true, this index represents the primary key of the table
3623 (<structfield>indisunique</> should always be true when this is true)</entry>
3627 <entry><structfield>indisexclusion</structfield></entry>
3628 <entry><type>bool</type></entry>
3630 <entry>If true, this index supports an exclusion constraint</entry>
3634 <entry><structfield>indimmediate</structfield></entry>
3635 <entry><type>bool</type></entry>
3637 <entry>If true, the uniqueness check is enforced immediately on
3639 (irrelevant if <structfield>indisunique</> is not true)</entry>
3643 <entry><structfield>indisclustered</structfield></entry>
3644 <entry><type>bool</type></entry>
3646 <entry>If true, the table was last clustered on this index</entry>
3650 <entry><structfield>indisvalid</structfield></entry>
3651 <entry><type>bool</type></entry>
3654 If true, the index is currently valid for queries. False means the
3655 index is possibly incomplete: it must still be modified by
3656 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3657 be used for queries. If it is unique, the uniqueness property is not
3658 guaranteed true either.
3663 <entry><structfield>indcheckxmin</structfield></entry>
3664 <entry><type>bool</type></entry>
3667 If true, queries must not use the index until the <structfield>xmin</>
3668 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3669 event horizon, because the table may contain broken HOT chains with
3670 incompatible rows that they can see
3675 <entry><structfield>indisready</structfield></entry>
3676 <entry><type>bool</type></entry>
3679 If true, the index is currently ready for inserts. False means the
3680 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3686 <entry><structfield>indislive</structfield></entry>
3687 <entry><type>bool</type></entry>
3690 If false, the index is in process of being dropped, and should be
3691 ignored for all purposes (including HOT-safety decisions)
3696 <entry><structfield>indisreplident</structfield></entry>
3697 <entry><type>bool</type></entry>
3700 If true this index has been chosen as <quote>replica identity</>
3701 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3707 <entry><structfield>indkey</structfield></entry>
3708 <entry><type>int2vector</type></entry>
3709 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3711 This is an array of <structfield>indnatts</structfield> values that
3712 indicate which table columns this index indexes. For example a value
3713 of <literal>1 3</literal> would mean that the first and the third table
3714 columns make up the index key. A zero in this array indicates that the
3715 corresponding index attribute is an expression over the table columns,
3716 rather than a simple column reference.
3721 <entry><structfield>indcollation</structfield></entry>
3722 <entry><type>oidvector</type></entry>
3723 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3725 For each column in the index key, this contains the OID of the
3726 collation to use for the index.
3731 <entry><structfield>indclass</structfield></entry>
3732 <entry><type>oidvector</type></entry>
3733 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3735 For each column in the index key, this contains the OID of
3736 the operator class to use. See
3737 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3742 <entry><structfield>indoption</structfield></entry>
3743 <entry><type>int2vector</type></entry>
3746 This is an array of <structfield>indnatts</structfield> values that
3747 store per-column flag bits. The meaning of the bits is defined by
3748 the index's access method.
3753 <entry><structfield>indexprs</structfield></entry>
3754 <entry><type>pg_node_tree</type></entry>
3757 Expression trees (in <function>nodeToString()</function>
3758 representation) for index attributes that are not simple column
3759 references. This is a list with one element for each zero
3760 entry in <structfield>indkey</>. Null if all index attributes
3761 are simple references.
3766 <entry><structfield>indpred</structfield></entry>
3767 <entry><type>pg_node_tree</type></entry>
3770 Expression tree (in <function>nodeToString()</function>
3771 representation) for partial index predicate. Null if not a
3782 <sect1 id="catalog-pg-inherits">
3783 <title><structname>pg_inherits</structname></title>
3785 <indexterm zone="catalog-pg-inherits">
3786 <primary>pg_inherits</primary>
3790 The catalog <structname>pg_inherits</> records information about
3791 table inheritance hierarchies. There is one entry for each direct
3792 child table in the database. (Indirect inheritance can be determined
3793 by following chains of entries.)
3797 <title><structname>pg_inherits</> Columns</title>
3804 <entry>References</entry>
3805 <entry>Description</entry>
3811 <entry><structfield>inhrelid</structfield></entry>
3812 <entry><type>oid</type></entry>
3813 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3815 The OID of the child table
3820 <entry><structfield>inhparent</structfield></entry>
3821 <entry><type>oid</type></entry>
3822 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3824 The OID of the parent table
3829 <entry><structfield>inhseqno</structfield></entry>
3830 <entry><type>int4</type></entry>
3833 If there is more than one direct parent for a child table (multiple
3834 inheritance), this number tells the order in which the
3835 inherited columns are to be arranged. The count starts at 1.
3844 <sect1 id="catalog-pg-init-privs">
3845 <title><structname>pg_init_privs</structname></title>
3847 <indexterm zone="catalog-pg-init-privs">
3848 <primary>pg_init_privs</primary>
3852 The catalog <structname>pg_init_privs</> records information about
3853 the initial privileges of objects in the system. There is one entry
3854 for each object in the database which has a non-default (non-NULL)
3855 initial set of privileges.
3859 Objects can have initial privileges either by having those privileges set
3860 when the system is initialized (by <application>initdb</>) or when the
3861 object is created during a <command>CREATE EXTENSION</command> and the
3862 extension script sets initial privileges using the <command>GRANT</command>
3863 system. Note that the system will automatically handle recording of the
3864 privileges during the extension script and that extension authors need
3865 only use the <command>GRANT</command> and <command>REVOKE</command>
3866 statements in their script to have the privileges recorded. The
3867 <literal>privtype</literal> column indicates if the initial privilege was
3868 set by <application>initdb</> or during a
3869 <command>CREATE EXTENSION</command> command.
3873 Objects which have initial privileges set by <application>initdb</> will
3874 have entries where <literal>privtype</literal> is
3875 <literal>'i'</literal>, while objects which have initial privileges set
3876 by <command>CREATE EXTENSION</command> will have entries where
3877 <literal>privtype</literal> is <literal>'e'</literal>.
3881 <title><structname>pg_init_privs</> Columns</title>
3888 <entry>References</entry>
3889 <entry>Description</entry>
3895 <entry><structfield>objoid</structfield></entry>
3896 <entry><type>oid</type></entry>
3897 <entry>any OID column</entry>
3898 <entry>The OID of the specific object</entry>
3902 <entry><structfield>classoid</structfield></entry>
3903 <entry><type>oid</type></entry>
3904 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3905 <entry>The OID of the system catalog the object is in</entry>
3909 <entry><structfield>objsubid</structfield></entry>
3910 <entry><type>int4</type></entry>
3913 For a table column, this is the column number (the
3914 <structfield>objoid</> and <structfield>classoid</> refer to the
3915 table itself). For all other object types, this column is
3921 <entry><structfield>privtype</structfield></entry>
3922 <entry><type>char</type></entry>
3925 A code defining the type of initial privilege of this object; see text
3930 <entry><structfield>initprivs</structfield></entry>
3931 <entry><type>aclitem[]</type></entry>
3934 The initial access privileges; see
3935 <xref linkend="sql-grant"> and
3936 <xref linkend="sql-revoke">
3948 <sect1 id="catalog-pg-language">
3949 <title><structname>pg_language</structname></title>
3951 <indexterm zone="catalog-pg-language">
3952 <primary>pg_language</primary>
3956 The catalog <structname>pg_language</structname> registers
3957 languages in which you can write functions or stored procedures.
3958 See <xref linkend="sql-createlanguage">
3959 and <xref linkend="xplang"> for more information about language handlers.
3963 <title><structname>pg_language</> Columns</title>
3970 <entry>References</entry>
3971 <entry>Description</entry>
3977 <entry><structfield>oid</structfield></entry>
3978 <entry><type>oid</type></entry>
3980 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3984 <entry><structfield>lanname</structfield></entry>
3985 <entry><type>name</type></entry>
3987 <entry>Name of the language</entry>
3991 <entry><structfield>lanowner</structfield></entry>
3992 <entry><type>oid</type></entry>
3993 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3994 <entry>Owner of the language</entry>
3998 <entry><structfield>lanispl</structfield></entry>
3999 <entry><type>bool</type></entry>
4002 This is false for internal languages (such as
4003 <acronym>SQL</acronym>) and true for user-defined languages.
4004 Currently, <application>pg_dump</application> still uses this
4005 to determine which languages need to be dumped, but this might be
4006 replaced by a different mechanism in the future.
4011 <entry><structfield>lanpltrusted</structfield></entry>
4012 <entry><type>bool</type></entry>
4015 True if this is a trusted language, which means that it is believed
4016 not to grant access to anything outside the normal SQL execution
4017 environment. Only superusers can create functions in untrusted
4023 <entry><structfield>lanplcallfoid</structfield></entry>
4024 <entry><type>oid</type></entry>
4025 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4027 For noninternal languages this references the language
4028 handler, which is a special function that is responsible for
4029 executing all functions that are written in the particular
4035 <entry><structfield>laninline</structfield></entry>
4036 <entry><type>oid</type></entry>
4037 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4039 This references a function that is responsible for executing
4040 <quote>inline</> anonymous code blocks
4041 (<xref linkend="sql-do"> blocks).
4042 Zero if inline blocks are not supported.
4047 <entry><structfield>lanvalidator</structfield></entry>
4048 <entry><type>oid</type></entry>
4049 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4051 This references a language validator function that is responsible
4052 for checking the syntax and validity of new functions when they
4053 are created. Zero if no validator is provided.
4058 <entry><structfield>lanacl</structfield></entry>
4059 <entry><type>aclitem[]</type></entry>
4062 Access privileges; see
4063 <xref linkend="sql-grant"> and
4064 <xref linkend="sql-revoke">
4075 <sect1 id="catalog-pg-largeobject">
4076 <title><structname>pg_largeobject</structname></title>
4078 <indexterm zone="catalog-pg-largeobject">
4079 <primary>pg_largeobject</primary>
4083 The catalog <structname>pg_largeobject</structname> holds the data making up
4084 <quote>large objects</quote>. A large object is identified by an OID
4085 assigned when it is created. Each large object is broken into
4086 segments or <quote>pages</> small enough to be conveniently stored as rows
4087 in <structname>pg_largeobject</structname>.
4088 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4089 <literal>BLCKSZ/4</>, or typically 2 kB).
4093 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4094 associated with large objects. As a result,
4095 <structname>pg_largeobject</structname> was publicly readable and could be
4096 used to obtain the OIDs (and contents) of all large objects in the system.
4097 This is no longer the case; use
4098 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4099 to obtain a list of large object OIDs.
4103 <title><structname>pg_largeobject</> Columns</title>
4110 <entry>References</entry>
4111 <entry>Description</entry>
4117 <entry><structfield>loid</structfield></entry>
4118 <entry><type>oid</type></entry>
4119 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4120 <entry>Identifier of the large object that includes this page</entry>
4124 <entry><structfield>pageno</structfield></entry>
4125 <entry><type>int4</type></entry>
4127 <entry>Page number of this page within its large object
4128 (counting from zero)</entry>
4132 <entry><structfield>data</structfield></entry>
4133 <entry><type>bytea</type></entry>
4136 Actual data stored in the large object.
4137 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4145 Each row of <structname>pg_largeobject</structname> holds data
4146 for one page of a large object, beginning at
4147 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4148 allows sparse storage: pages might be missing, and might be shorter than
4149 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4150 Missing regions within a large object read as zeroes.
4155 <sect1 id="catalog-pg-largeobject-metadata">
4156 <title><structname>pg_largeobject_metadata</structname></title>
4158 <indexterm zone="catalog-pg-largeobject-metadata">
4159 <primary>pg_largeobject_metadata</primary>
4163 The catalog <structname>pg_largeobject_metadata</structname>
4164 holds metadata associated with large objects. The actual large object
4166 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4170 <title><structname>pg_largeobject_metadata</> Columns</title>
4177 <entry>References</entry>
4178 <entry>Description</entry>
4184 <entry><structfield>oid</structfield></entry>
4185 <entry><type>oid</type></entry>
4187 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4191 <entry><structfield>lomowner</structfield></entry>
4192 <entry><type>oid</type></entry>
4193 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4194 <entry>Owner of the large object</entry>
4198 <entry><structfield>lomacl</structfield></entry>
4199 <entry><type>aclitem[]</type></entry>
4202 Access privileges; see
4203 <xref linkend="sql-grant"> and
4204 <xref linkend="sql-revoke">
4214 <sect1 id="catalog-pg-namespace">
4215 <title><structname>pg_namespace</structname></title>
4217 <indexterm zone="catalog-pg-namespace">
4218 <primary>pg_namespace</primary>
4222 The catalog <structname>pg_namespace</> stores namespaces.
4223 A namespace is the structure underlying SQL schemas: each namespace
4224 can have a separate collection of relations, types, etc. without name
4229 <title><structname>pg_namespace</> Columns</title>
4236 <entry>References</entry>
4237 <entry>Description</entry>
4243 <entry><structfield>oid</structfield></entry>
4244 <entry><type>oid</type></entry>
4246 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4250 <entry><structfield>nspname</structfield></entry>
4251 <entry><type>name</type></entry>
4253 <entry>Name of the namespace</entry>
4257 <entry><structfield>nspowner</structfield></entry>
4258 <entry><type>oid</type></entry>
4259 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4260 <entry>Owner of the namespace</entry>
4264 <entry><structfield>nspacl</structfield></entry>
4265 <entry><type>aclitem[]</type></entry>
4268 Access privileges; see
4269 <xref linkend="sql-grant"> and
4270 <xref linkend="sql-revoke">
4281 <sect1 id="catalog-pg-opclass">
4282 <title><structname>pg_opclass</structname></title>
4284 <indexterm zone="catalog-pg-opclass">
4285 <primary>pg_opclass</primary>
4289 The catalog <structname>pg_opclass</structname> defines
4290 index access method operator classes. Each operator class defines
4291 semantics for index columns of a particular data type and a particular
4292 index access method. An operator class essentially specifies that a
4293 particular operator family is applicable to a particular indexable column
4294 data type. The set of operators from the family that are actually usable
4295 with the indexed column are whichever ones accept the column's data type
4296 as their left-hand input.
4300 Operator classes are described at length in <xref linkend="xindex">.
4304 <title><structname>pg_opclass</> Columns</title>
4311 <entry>References</entry>
4312 <entry>Description</entry>
4318 <entry><structfield>oid</structfield></entry>
4319 <entry><type>oid</type></entry>
4321 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4325 <entry><structfield>opcmethod</structfield></entry>
4326 <entry><type>oid</type></entry>
4327 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4328 <entry>Index access method operator class is for</entry>
4332 <entry><structfield>opcname</structfield></entry>
4333 <entry><type>name</type></entry>
4335 <entry>Name of this operator class</entry>
4339 <entry><structfield>opcnamespace</structfield></entry>
4340 <entry><type>oid</type></entry>
4341 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4342 <entry>Namespace of this operator class</entry>
4346 <entry><structfield>opcowner</structfield></entry>
4347 <entry><type>oid</type></entry>
4348 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4349 <entry>Owner of the operator class</entry>
4353 <entry><structfield>opcfamily</structfield></entry>
4354 <entry><type>oid</type></entry>
4355 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4356 <entry>Operator family containing the operator class</entry>
4360 <entry><structfield>opcintype</structfield></entry>
4361 <entry><type>oid</type></entry>
4362 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4363 <entry>Data type that the operator class indexes</entry>
4367 <entry><structfield>opcdefault</structfield></entry>
4368 <entry><type>bool</type></entry>
4370 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4374 <entry><structfield>opckeytype</structfield></entry>
4375 <entry><type>oid</type></entry>
4376 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4377 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4385 An operator class's <structfield>opcmethod</> must match the
4386 <structname>opfmethod</> of its containing operator family.
4387 Also, there must be no more than one <structname>pg_opclass</structname>
4388 row having <structname>opcdefault</> true for any given combination of
4389 <structname>opcmethod</> and <structname>opcintype</>.
4395 <sect1 id="catalog-pg-operator">
4396 <title><structname>pg_operator</structname></title>
4398 <indexterm zone="catalog-pg-operator">
4399 <primary>pg_operator</primary>
4403 The catalog <structname>pg_operator</> stores information about operators.
4404 See <xref linkend="sql-createoperator">
4405 and <xref linkend="xoper"> for more information.
4409 <title><structname>pg_operator</> Columns</title>
4416 <entry>References</entry>
4417 <entry>Description</entry>
4423 <entry><structfield>oid</structfield></entry>
4424 <entry><type>oid</type></entry>
4426 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4430 <entry><structfield>oprname</structfield></entry>
4431 <entry><type>name</type></entry>
4433 <entry>Name of the operator</entry>
4437 <entry><structfield>oprnamespace</structfield></entry>
4438 <entry><type>oid</type></entry>
4439 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4441 The OID of the namespace that contains this operator
4446 <entry><structfield>oprowner</structfield></entry>
4447 <entry><type>oid</type></entry>
4448 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4449 <entry>Owner of the operator</entry>
4453 <entry><structfield>oprkind</structfield></entry>
4454 <entry><type>char</type></entry>
4457 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4458 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4463 <entry><structfield>oprcanmerge</structfield></entry>
4464 <entry><type>bool</type></entry>
4466 <entry>This operator supports merge joins</entry>
4470 <entry><structfield>oprcanhash</structfield></entry>
4471 <entry><type>bool</type></entry>
4473 <entry>This operator supports hash joins</entry>
4477 <entry><structfield>oprleft</structfield></entry>
4478 <entry><type>oid</type></entry>
4479 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4480 <entry>Type of the left operand</entry>
4484 <entry><structfield>oprright</structfield></entry>
4485 <entry><type>oid</type></entry>
4486 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4487 <entry>Type of the right operand</entry>
4491 <entry><structfield>oprresult</structfield></entry>
4492 <entry><type>oid</type></entry>
4493 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4494 <entry>Type of the result</entry>
4498 <entry><structfield>oprcom</structfield></entry>
4499 <entry><type>oid</type></entry>
4500 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4501 <entry>Commutator of this operator, if any</entry>
4505 <entry><structfield>oprnegate</structfield></entry>
4506 <entry><type>oid</type></entry>
4507 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4508 <entry>Negator of this operator, if any</entry>
4512 <entry><structfield>oprcode</structfield></entry>
4513 <entry><type>regproc</type></entry>
4514 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4515 <entry>Function that implements this operator</entry>
4519 <entry><structfield>oprrest</structfield></entry>
4520 <entry><type>regproc</type></entry>
4521 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4522 <entry>Restriction selectivity estimation function for this operator</entry>
4526 <entry><structfield>oprjoin</structfield></entry>
4527 <entry><type>regproc</type></entry>
4528 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4529 <entry>Join selectivity estimation function for this operator</entry>
4536 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4537 is zero for a prefix operator.
4543 <sect1 id="catalog-pg-opfamily">
4544 <title><structname>pg_opfamily</structname></title>
4546 <indexterm zone="catalog-pg-opfamily">
4547 <primary>pg_opfamily</primary>
4551 The catalog <structname>pg_opfamily</structname> defines operator families.
4552 Each operator family is a collection of operators and associated
4553 support routines that implement the semantics specified for a particular
4554 index access method. Furthermore, the operators in a family are all
4555 <quote>compatible</>, in a way that is specified by the access method.
4556 The operator family concept allows cross-data-type operators to be used
4557 with indexes and to be reasoned about using knowledge of access method
4562 Operator families are described at length in <xref linkend="xindex">.
4566 <title><structname>pg_opfamily</> Columns</title>
4573 <entry>References</entry>
4574 <entry>Description</entry>
4580 <entry><structfield>oid</structfield></entry>
4581 <entry><type>oid</type></entry>
4583 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4587 <entry><structfield>opfmethod</structfield></entry>
4588 <entry><type>oid</type></entry>
4589 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4590 <entry>Index access method operator family is for</entry>
4594 <entry><structfield>opfname</structfield></entry>
4595 <entry><type>name</type></entry>
4597 <entry>Name of this operator family</entry>
4601 <entry><structfield>opfnamespace</structfield></entry>
4602 <entry><type>oid</type></entry>
4603 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4604 <entry>Namespace of this operator family</entry>
4608 <entry><structfield>opfowner</structfield></entry>
4609 <entry><type>oid</type></entry>
4610 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4611 <entry>Owner of the operator family</entry>
4619 The majority of the information defining an operator family is not in its
4620 <structname>pg_opfamily</structname> row, but in the associated rows in
4621 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4622 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4624 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4630 <sect1 id="catalog-pg-pltemplate">
4631 <title><structname>pg_pltemplate</structname></title>
4633 <indexterm zone="catalog-pg-pltemplate">
4634 <primary>pg_pltemplate</primary>
4638 The catalog <structname>pg_pltemplate</structname> stores
4639 <quote>template</> information for procedural languages.
4640 A template for a language allows the language to be created in a
4641 particular database by a simple <command>CREATE LANGUAGE</> command,
4642 with no need to specify implementation details.
4646 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4647 is shared across all databases of a cluster: there is only one
4648 copy of <structname>pg_pltemplate</structname> per cluster, not
4649 one per database. This allows the information to be accessible in
4650 each database as it is needed.
4654 <title><structname>pg_pltemplate</> Columns</title>
4661 <entry>Description</entry>
4667 <entry><structfield>tmplname</structfield></entry>
4668 <entry><type>name</type></entry>
4669 <entry>Name of the language this template is for</entry>
4673 <entry><structfield>tmpltrusted</structfield></entry>
4674 <entry><type>boolean</type></entry>
4675 <entry>True if language is considered trusted</entry>
4679 <entry><structfield>tmpldbacreate</structfield></entry>
4680 <entry><type>boolean</type></entry>
4681 <entry>True if language may be created by a database owner</entry>
4685 <entry><structfield>tmplhandler</structfield></entry>
4686 <entry><type>text</type></entry>
4687 <entry>Name of call handler function</entry>
4691 <entry><structfield>tmplinline</structfield></entry>
4692 <entry><type>text</type></entry>
4693 <entry>Name of anonymous-block handler function, or null if none</entry>
4697 <entry><structfield>tmplvalidator</structfield></entry>
4698 <entry><type>text</type></entry>
4699 <entry>Name of validator function, or null if none</entry>
4703 <entry><structfield>tmpllibrary</structfield></entry>
4704 <entry><type>text</type></entry>
4705 <entry>Path of shared library that implements language</entry>
4709 <entry><structfield>tmplacl</structfield></entry>
4710 <entry><type>aclitem[]</type></entry>
4711 <entry>Access privileges for template (not actually used)</entry>
4719 There are not currently any commands that manipulate procedural language
4720 templates; to change the built-in information, a superuser must modify
4721 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4722 or <command>UPDATE</command> commands.
4727 It is likely that <structname>pg_pltemplate</> will be removed in some
4728 future release of <productname>PostgreSQL</productname>, in favor of
4729 keeping this knowledge about procedural languages in their respective
4730 extension installation scripts.
4736 <sect1 id="catalog-pg-partitioned-table">
4737 <title><structname>pg_partitioned_table</structname></title>
4739 <indexterm zone="catalog-pg-partitioned-table">
4740 <primary>pg_partitioned_table</primary>
4744 The catalog <structname>pg_partitioned_table</structname> stores
4745 information about how tables are partitioned.
4749 <title><structname>pg_partitioned_table</> Columns</title>
4756 <entry>References</entry>
4757 <entry>Description</entry>
4764 <entry><structfield>partrelid</structfield></entry>
4765 <entry><type>oid</type></entry>
4766 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4767 <entry>The OID of the <structname>pg_class</> entry for this partitioned table</entry>
4771 <entry><structfield>partstrat</structfield></entry>
4772 <entry><type>char</type></entry>
4775 Partitioning strategy; <literal>l</> = list partitioned table,
4776 <literal>r</> = range partitioned table
4781 <entry><structfield>partnatts</structfield></entry>
4782 <entry><type>int2</type></entry>
4784 <entry>The number of columns in partition key</entry>
4788 <entry><structfield>partattrs</structfield></entry>
4789 <entry><type>int2vector</type></entry>
4790 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4792 This is an array of <structfield>partnatts</structfield> values that
4793 indicate which table columns are part of the partition key. For
4794 example, a value of <literal>1 3</literal> would mean that the first
4795 and the third table columns make up the partition key. A zero in this
4796 array indicates that the corresponding partition key column is an
4797 expression, rather than a simple column reference.
4802 <entry><structfield>partclass</structfield></entry>
4803 <entry><type>oidvector</type></entry>
4804 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4806 For each column in the partition key, this contains the OID of the
4807 operator class to use. See
4808 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4813 <entry><structfield>partcollation</structfield></entry>
4814 <entry><type>oidvector</type></entry>
4815 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4817 For each column in the partition key, this contains the OID of the
4818 the collation to use for partitioning.
4823 <entry><structfield>partexprs</structfield></entry>
4824 <entry><type>pg_node_tree</type></entry>
4827 Expression trees (in <function>nodeToString()</function>
4828 representation) for partition key columns that are not simple column
4829 references. This is a list with one element for each zero
4830 entry in <structfield>partattrs</>. Null if all partition key columns
4831 are simple references.
4840 <sect1 id="catalog-pg-policy">
4841 <title><structname>pg_policy</structname></title>
4843 <indexterm zone="catalog-pg-policy">
4844 <primary>pg_policy</primary>
4848 The catalog <structname>pg_policy</structname> stores row level
4849 security policies for tables. A policy includes the kind of
4850 command that it applies to (possibly all commands), the roles that it
4851 applies to, the expression to be added as a security-barrier
4852 qualification to queries that include the table, and the expression
4853 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4854 add new records to the table.
4859 <title><structname>pg_policy</structname> Columns</title>
4866 <entry>References</entry>
4867 <entry>Description</entry>
4873 <entry><structfield>polname</structfield></entry>
4874 <entry><type>name</type></entry>
4876 <entry>The name of the policy</entry>
4880 <entry><structfield>polrelid</structfield></entry>
4881 <entry><type>oid</type></entry>
4882 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4883 <entry>The table to which the policy applies</entry>
4887 <entry><structfield>polcmd</structfield></entry>
4888 <entry><type>char</type></entry>
4890 <entry>The command type to which the policy is applied:
4891 <literal>r</> for <command>SELECT</>,
4892 <literal>a</> for <command>INSERT</>,
4893 <literal>w</> for <command>UPDATE</>,
4894 <literal>d</> for <command>DELETE</>,
4895 or <literal>*</> for all</entry>
4899 <entry><structfield>polpermissive</structfield></entry>
4900 <entry><type>boolean</type></entry>
4902 <entry>Is the policy permissive or restrictive?</entry>
4906 <entry><structfield>polroles</structfield></entry>
4907 <entry><type>oid[]</type></entry>
4908 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4909 <entry>The roles to which the policy is applied</entry>
4913 <entry><structfield>polqual</structfield></entry>
4914 <entry><type>pg_node_tree</type></entry>
4916 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4920 <entry><structfield>polwithcheck</structfield></entry>
4921 <entry><type>pg_node_tree</type></entry>
4923 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4932 Policies stored in <structname>pg_policy</> are applied only when
4933 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4940 <sect1 id="catalog-pg-proc">
4941 <title><structname>pg_proc</structname></title>
4943 <indexterm zone="catalog-pg-proc">
4944 <primary>pg_proc</primary>
4948 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4949 See <xref linkend="sql-createfunction">
4950 and <xref linkend="xfunc"> for more information.
4954 The table contains data for aggregate functions as well as plain functions.
4955 If <structfield>proisagg</structfield> is true, there should be a matching
4956 row in <structfield>pg_aggregate</structfield>.
4960 <title><structname>pg_proc</> Columns</title>
4967 <entry>References</entry>
4968 <entry>Description</entry>
4974 <entry><structfield>oid</structfield></entry>
4975 <entry><type>oid</type></entry>
4977 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4981 <entry><structfield>proname</structfield></entry>
4982 <entry><type>name</type></entry>
4984 <entry>Name of the function</entry>
4988 <entry><structfield>pronamespace</structfield></entry>
4989 <entry><type>oid</type></entry>
4990 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4992 The OID of the namespace that contains this function
4997 <entry><structfield>proowner</structfield></entry>
4998 <entry><type>oid</type></entry>
4999 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5000 <entry>Owner of the function</entry>
5004 <entry><structfield>prolang</structfield></entry>
5005 <entry><type>oid</type></entry>
5006 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
5007 <entry>Implementation language or call interface of this function</entry>
5011 <entry><structfield>procost</structfield></entry>
5012 <entry><type>float4</type></entry>
5014 <entry>Estimated execution cost (in units of
5015 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
5016 this is cost per row returned</entry>
5020 <entry><structfield>prorows</structfield></entry>
5021 <entry><type>float4</type></entry>
5023 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
5027 <entry><structfield>provariadic</structfield></entry>
5028 <entry><type>oid</type></entry>
5029 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5030 <entry>Data type of the variadic array parameter's elements,
5031 or zero if the function does not have a variadic parameter</entry>
5035 <entry><structfield>protransform</structfield></entry>
5036 <entry><type>regproc</type></entry>
5037 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5038 <entry>Calls to this function can be simplified by this other function
5039 (see <xref linkend="xfunc-transform-functions">)</entry>
5043 <entry><structfield>proisagg</structfield></entry>
5044 <entry><type>bool</type></entry>
5046 <entry>Function is an aggregate function</entry>
5050 <entry><structfield>proiswindow</structfield></entry>
5051 <entry><type>bool</type></entry>
5053 <entry>Function is a window function</entry>
5057 <entry><structfield>prosecdef</structfield></entry>
5058 <entry><type>bool</type></entry>
5060 <entry>Function is a security definer (i.e., a <quote>setuid</>
5065 <entry><structfield>proleakproof</structfield></entry>
5066 <entry><type>bool</type></entry>
5069 The function has no side effects. No information about the
5070 arguments is conveyed except via the return value. Any function
5071 that might throw an error depending on the values of its arguments
5077 <entry><structfield>proisstrict</structfield></entry>
5078 <entry><type>bool</type></entry>
5081 Function returns null if any call argument is null. In that
5082 case the function won't actually be called at all. Functions
5083 that are not <quote>strict</quote> must be prepared to handle
5089 <entry><structfield>proretset</structfield></entry>
5090 <entry><type>bool</type></entry>
5092 <entry>Function returns a set (i.e., multiple values of the specified
5097 <entry><structfield>provolatile</structfield></entry>
5098 <entry><type>char</type></entry>
5101 <structfield>provolatile</structfield> tells whether the function's
5102 result depends only on its input arguments, or is affected by outside
5104 It is <literal>i</literal> for <quote>immutable</> functions,
5105 which always deliver the same result for the same inputs.
5106 It is <literal>s</literal> for <quote>stable</> functions,
5107 whose results (for fixed inputs) do not change within a scan.
5108 It is <literal>v</literal> for <quote>volatile</> functions,
5109 whose results might change at any time. (Use <literal>v</literal> also
5110 for functions with side-effects, so that calls to them cannot get
5116 <entry><structfield>proparallel</structfield></entry>
5117 <entry><type>char</type></entry>
5120 <structfield>proparallel</structfield> tells whether the function
5121 can be safely run in parallel mode.
5122 It is <literal>s</literal> for functions which are safe to run in
5123 parallel mode without restriction.
5124 It is <literal>r</literal> for functions which can be run in parallel
5125 mode, but their execution is restricted to the parallel group leader;
5126 parallel worker processes cannot invoke these functions.
5127 It is <literal>u</literal> for functions which are unsafe in parallel
5128 mode; the presence of such a function forces a serial execution plan.
5133 <entry><structfield>pronargs</structfield></entry>
5134 <entry><type>int2</type></entry>
5136 <entry>Number of input arguments</entry>
5140 <entry><structfield>pronargdefaults</structfield></entry>
5141 <entry><type>int2</type></entry>
5143 <entry>Number of arguments that have defaults</entry>
5147 <entry><structfield>prorettype</structfield></entry>
5148 <entry><type>oid</type></entry>
5149 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5150 <entry>Data type of the return value</entry>
5154 <entry><structfield>proargtypes</structfield></entry>
5155 <entry><type>oidvector</type></entry>
5156 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5158 An array with the data types of the function arguments. This includes
5159 only input arguments (including <literal>INOUT</literal> and
5160 <literal>VARIADIC</> arguments), and thus represents
5161 the call signature of the function.
5166 <entry><structfield>proallargtypes</structfield></entry>
5167 <entry><type>oid[]</type></entry>
5168 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5170 An array with the data types of the function arguments. This includes
5171 all arguments (including <literal>OUT</literal> and
5172 <literal>INOUT</literal> arguments); however, if all the
5173 arguments are <literal>IN</literal> arguments, this field will be null.
5174 Note that subscripting is 1-based, whereas for historical reasons
5175 <structfield>proargtypes</> is subscripted from 0.
5180 <entry><structfield>proargmodes</structfield></entry>
5181 <entry><type>char[]</type></entry>
5184 An array with the modes of the function arguments, encoded as
5185 <literal>i</literal> for <literal>IN</> arguments,
5186 <literal>o</literal> for <literal>OUT</> arguments,
5187 <literal>b</literal> for <literal>INOUT</> arguments,
5188 <literal>v</literal> for <literal>VARIADIC</> arguments,
5189 <literal>t</literal> for <literal>TABLE</> arguments.
5190 If all the arguments are <literal>IN</literal> arguments,
5191 this field will be null.
5192 Note that subscripts correspond to positions of
5193 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5198 <entry><structfield>proargnames</structfield></entry>
5199 <entry><type>text[]</type></entry>
5202 An array with the names of the function arguments.
5203 Arguments without a name are set to empty strings in the array.
5204 If none of the arguments have a name, this field will be null.
5205 Note that subscripts correspond to positions of
5206 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5211 <entry><structfield>proargdefaults</structfield></entry>
5212 <entry><type>pg_node_tree</type></entry>
5215 Expression trees (in <function>nodeToString()</function> representation)
5216 for default values. This is a list with
5217 <structfield>pronargdefaults</> elements, corresponding to the last
5218 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5219 <replaceable>N</> <structfield>proargtypes</> positions).
5220 If none of the arguments have defaults, this field will be null.
5225 <entry><structfield>protrftypes</structfield></entry>
5226 <entry><type>oid[]</type></entry>
5229 Data type OIDs for which to apply transforms.
5234 <entry><structfield>prosrc</structfield></entry>
5235 <entry><type>text</type></entry>
5238 This tells the function handler how to invoke the function. It
5239 might be the actual source code of the function for interpreted
5240 languages, a link symbol, a file name, or just about anything
5241 else, depending on the implementation language/call convention.
5246 <entry><structfield>probin</structfield></entry>
5247 <entry><type>text</type></entry>
5250 Additional information about how to invoke the function.
5251 Again, the interpretation is language-specific.
5256 <entry><structfield>proconfig</structfield></entry>
5257 <entry><type>text[]</type></entry>
5259 <entry>Function's local settings for run-time configuration variables</entry>
5263 <entry><structfield>proacl</structfield></entry>
5264 <entry><type>aclitem[]</type></entry>
5267 Access privileges; see
5268 <xref linkend="sql-grant"> and
5269 <xref linkend="sql-revoke">
5278 For compiled functions, both built-in and dynamically loaded,
5279 <structfield>prosrc</structfield> contains the function's C-language
5280 name (link symbol). For all other currently-known language types,
5281 <structfield>prosrc</structfield> contains the function's source
5282 text. <structfield>probin</structfield> is unused except for
5283 dynamically-loaded C functions, for which it gives the name of the
5284 shared library file containing the function.
5289 <sect1 id="catalog-pg-publication">
5290 <title><structname>pg_publication</structname></title>
5292 <indexterm zone="catalog-pg-publication">
5293 <primary>pg_publication</primary>
5297 The catalog <structname>pg_publication</structname> contains all
5298 publications created in the database. For more on publications see
5299 <xref linkend="logical-replication-publication">.
5303 <title><structname>pg_publication</structname> Columns</title>
5310 <entry>References</entry>
5311 <entry>Description</entry>
5317 <entry><structfield>oid</structfield></entry>
5318 <entry><type>oid</type></entry>
5320 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5324 <entry><structfield>pubname</structfield></entry>
5325 <entry><type>Name</type></entry>
5327 <entry>Name of the publication</entry>
5331 <entry><structfield>pubowner</structfield></entry>
5332 <entry><type>oid</type></entry>
5333 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5334 <entry>Owner of the publication</entry>
5338 <entry><structfield>puballtables</structfield></entry>
5339 <entry><type>bool</type></entry>
5341 <entry>If true, this publication automatically includes all tables
5342 in the database, including any that will be created in the future.
5347 <entry><structfield>pubinsert</structfield></entry>
5348 <entry><type>bool</type></entry>
5350 <entry>If true, <command>INSERT</command> operations are replicated for
5351 tables in the publication.</entry>
5355 <entry><structfield>pubupdate</structfield></entry>
5356 <entry><type>bool</type></entry>
5358 <entry>If true, <command>UPDATE</command> operations are replicated for
5359 tables in the publication.</entry>
5363 <entry><structfield>pubdelete</structfield></entry>
5364 <entry><type>bool</type></entry>
5366 <entry>If true, <command>DELETE</command> operations are replicated for
5367 tables in the publication.</entry>
5374 <sect1 id="catalog-pg-publication-rel">
5375 <title><structname>pg_publication_rel</structname></title>
5377 <indexterm zone="catalog-pg-publication-rel">
5378 <primary>pg_publication_rel</primary>
5382 The catalog <structname>pg_publication_rel</structname> contains the
5383 mapping between relations and publications in the database. This is a
5384 many-to-many mapping. See also <xref linkend="view-pg-publication-tables">
5385 for a more user-friendly view of this information.
5389 <title><structname>pg_publication_rel</structname> Columns</title>
5396 <entry>References</entry>
5397 <entry>Description</entry>
5403 <entry><structfield>prpubid</structfield></entry>
5404 <entry><type>oid</type></entry>
5405 <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
5406 <entry>Reference to publication</entry>
5410 <entry><structfield>prrelid</structfield></entry>
5411 <entry><type>oid</type></entry>
5412 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5413 <entry>Reference to relation</entry>
5420 <sect1 id="catalog-pg-range">
5421 <title><structname>pg_range</structname></title>
5423 <indexterm zone="catalog-pg-range">
5424 <primary>pg_range</primary>
5428 The catalog <structname>pg_range</structname> stores information about
5429 range types. This is in addition to the types' entries in
5430 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5434 <title><structname>pg_range</> Columns</title>
5441 <entry>References</entry>
5442 <entry>Description</entry>
5448 <entry><structfield>rngtypid</structfield></entry>
5449 <entry><type>oid</type></entry>
5450 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5451 <entry>OID of the range type</entry>
5455 <entry><structfield>rngsubtype</structfield></entry>
5456 <entry><type>oid</type></entry>
5457 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5458 <entry>OID of the element type (subtype) of this range type</entry>
5462 <entry><structfield>rngcollation</structfield></entry>
5463 <entry><type>oid</type></entry>
5464 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5465 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5469 <entry><structfield>rngsubopc</structfield></entry>
5470 <entry><type>oid</type></entry>
5471 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5472 <entry>OID of the subtype's operator class used for range comparisons</entry>
5476 <entry><structfield>rngcanonical</structfield></entry>
5477 <entry><type>regproc</type></entry>
5478 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5479 <entry>OID of the function to convert a range value into canonical form,
5480 or 0 if none</entry>
5484 <entry><structfield>rngsubdiff</structfield></entry>
5485 <entry><type>regproc</type></entry>
5486 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5487 <entry>OID of the function to return the difference between two element
5488 values as <type>double precision</type>, or 0 if none</entry>
5495 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5496 element type is collatable) determines the sort ordering used by the range
5497 type. <structfield>rngcanonical</> is used when the element type is
5498 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5499 improve performance of GiST indexes on the range type.
5504 <sect1 id="catalog-pg-replication-origin">
5505 <title><structname>pg_replication_origin</structname></title>
5507 <indexterm zone="catalog-pg-replication-origin">
5508 <primary>pg_replication_origin</primary>
5512 The <structname>pg_replication_origin</structname> catalog contains
5513 all replication origins created. For more on replication origins
5514 see <xref linkend="replication-origins">.
5519 <title><structname>pg_replication_origin</structname> Columns</title>
5526 <entry>References</entry>
5527 <entry>Description</entry>
5533 <entry><structfield>roident</structfield></entry>
5534 <entry><type>Oid</type></entry>
5536 <entry>A unique, cluster-wide identifier for the replication
5537 origin. Should never leave the system.</entry>
5541 <entry><structfield>roname</structfield></entry>
5542 <entry><type>text</type></entry>
5544 <entry>The external, user defined, name of a replication
5552 <sect1 id="catalog-pg-rewrite">
5553 <title><structname>pg_rewrite</structname></title>
5555 <indexterm zone="catalog-pg-rewrite">
5556 <primary>pg_rewrite</primary>
5560 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5564 <title><structname>pg_rewrite</> Columns</title>
5571 <entry>References</entry>
5572 <entry>Description</entry>
5578 <entry><structfield>oid</structfield></entry>
5579 <entry><type>oid</type></entry>
5581 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5585 <entry><structfield>rulename</structfield></entry>
5586 <entry><type>name</type></entry>
5588 <entry>Rule name</entry>
5592 <entry><structfield>ev_class</structfield></entry>
5593 <entry><type>oid</type></entry>
5594 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5595 <entry>The table this rule is for</entry>
5599 <entry><structfield>ev_type</structfield></entry>
5600 <entry><type>char</type></entry>
5603 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5604 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5610 <entry><structfield>ev_enabled</structfield></entry>
5611 <entry><type>char</type></entry>
5614 Controls in which <xref linkend="guc-session-replication-role"> modes
5616 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5617 <literal>D</> = rule is disabled,
5618 <literal>R</> = rule fires in <quote>replica</> mode,
5619 <literal>A</> = rule fires always.
5624 <entry><structfield>is_instead</structfield></entry>
5625 <entry><type>bool</type></entry>
5627 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5631 <entry><structfield>ev_qual</structfield></entry>
5632 <entry><type>pg_node_tree</type></entry>
5635 Expression tree (in the form of a
5636 <function>nodeToString()</function> representation) for the
5637 rule's qualifying condition
5642 <entry><structfield>ev_action</structfield></entry>
5643 <entry><type>pg_node_tree</type></entry>
5646 Query tree (in the form of a
5647 <function>nodeToString()</function> representation) for the
5657 <literal>pg_class.relhasrules</literal>
5658 must be true if a table has any rules in this catalog.
5664 <sect1 id="catalog-pg-seclabel">
5665 <title><structname>pg_seclabel</structname></title>
5667 <indexterm zone="catalog-pg-seclabel">
5668 <primary>pg_seclabel</primary>
5672 The catalog <structname>pg_seclabel</structname> stores security
5673 labels on database objects. Security labels can be manipulated
5674 with the <xref linkend="sql-security-label"> command. For an easier
5675 way to view security labels, see <xref linkend="view-pg-seclabels">.
5679 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5680 which performs a similar function for security labels of database objects
5681 that are shared across a database cluster.
5685 <title><structname>pg_seclabel</structname> Columns</title>
5692 <entry>References</entry>
5693 <entry>Description</entry>
5699 <entry><structfield>objoid</structfield></entry>
5700 <entry><type>oid</type></entry>
5701 <entry>any OID column</entry>
5702 <entry>The OID of the object this security label pertains to</entry>
5706 <entry><structfield>classoid</structfield></entry>
5707 <entry><type>oid</type></entry>
5708 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5709 <entry>The OID of the system catalog this object appears in</entry>
5713 <entry><structfield>objsubid</structfield></entry>
5714 <entry><type>int4</type></entry>
5717 For a security label on a table column, this is the column number (the
5718 <structfield>objoid</> and <structfield>classoid</> refer to
5719 the table itself). For all other object types, this column is
5725 <entry><structfield>provider</structfield></entry>
5726 <entry><type>text</type></entry>
5728 <entry>The label provider associated with this label.</entry>
5732 <entry><structfield>label</structfield></entry>
5733 <entry><type>text</type></entry>
5735 <entry>The security label applied to this object.</entry>
5742 <sect1 id="catalog-pg-sequence">
5743 <title><structname>pg_sequence</structname></title>
5745 <indexterm zone="catalog-pg-sequence">
5746 <primary>pg_sequence</primary>
5750 The catalog <structname>pg_sequence</structname> contains information about
5751 sequences. Some of the information about sequences, such as the name and
5752 the schema, is in <structname>pg_class</structname>.
5756 <title><structname>pg_sequence</> Columns</title>
5763 <entry>References</entry>
5764 <entry>Description</entry>
5770 <entry><structfield>seqrelid</structfield></entry>
5771 <entry><type>oid</type></entry>
5772 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5773 <entry>The OID of the <structname>pg_class</> entry for this sequence</entry>
5777 <entry><structfield>seqtypid</structfield></entry>
5778 <entry><type>oid</type></entry>
5779 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5780 <entry>Data type of the sequence</entry>
5784 <entry><structfield>seqstart</structfield></entry>
5785 <entry><type>int8</type></entry>
5787 <entry>Start value of the sequence</entry>
5791 <entry><structfield>seqincrement</structfield></entry>
5792 <entry><type>int8</type></entry>
5794 <entry>Increment value of the sequence</entry>
5798 <entry><structfield>seqmax</structfield></entry>
5799 <entry><type>int8</type></entry>
5801 <entry>Maximum value of the sequence</entry>
5805 <entry><structfield>seqmin</structfield></entry>
5806 <entry><type>int8</type></entry>
5808 <entry>Minimum value of the sequence</entry>
5812 <entry><structfield>seqcache</structfield></entry>
5813 <entry><type>int8</type></entry>
5815 <entry>Cache size of the sequence</entry>
5819 <entry><structfield>seqcycle</structfield></entry>
5820 <entry><type>bool</type></entry>
5822 <entry>Whether the sequence cycles</entry>
5829 <sect1 id="catalog-pg-shdepend">
5830 <title><structname>pg_shdepend</structname></title>
5832 <indexterm zone="catalog-pg-shdepend">
5833 <primary>pg_shdepend</primary>
5837 The catalog <structname>pg_shdepend</structname> records the
5838 dependency relationships between database objects and shared objects,
5839 such as roles. This information allows
5840 <productname>PostgreSQL</productname> to ensure that those objects are
5841 unreferenced before attempting to delete them.
5845 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5846 which performs a similar function for dependencies involving objects
5847 within a single database.
5851 Unlike most system catalogs, <structname>pg_shdepend</structname>
5852 is shared across all databases of a cluster: there is only one
5853 copy of <structname>pg_shdepend</structname> per cluster, not
5858 <title><structname>pg_shdepend</> Columns</title>
5865 <entry>References</entry>
5866 <entry>Description</entry>
5872 <entry><structfield>dbid</structfield></entry>
5873 <entry><type>oid</type></entry>
5874 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5875 <entry>The OID of the database the dependent object is in,
5876 or zero for a shared object</entry>
5880 <entry><structfield>classid</structfield></entry>
5881 <entry><type>oid</type></entry>
5882 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5883 <entry>The OID of the system catalog the dependent object is in</entry>
5887 <entry><structfield>objid</structfield></entry>
5888 <entry><type>oid</type></entry>
5889 <entry>any OID column</entry>
5890 <entry>The OID of the specific dependent object</entry>
5894 <entry><structfield>objsubid</structfield></entry>
5895 <entry><type>int4</type></entry>
5898 For a table column, this is the column number (the
5899 <structfield>objid</> and <structfield>classid</> refer to the
5900 table itself). For all other object types, this column is zero.
5905 <entry><structfield>refclassid</structfield></entry>
5906 <entry><type>oid</type></entry>
5907 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5908 <entry>The OID of the system catalog the referenced object is in
5909 (must be a shared catalog)</entry>
5913 <entry><structfield>refobjid</structfield></entry>
5914 <entry><type>oid</type></entry>
5915 <entry>any OID column</entry>
5916 <entry>The OID of the specific referenced object</entry>
5920 <entry><structfield>deptype</structfield></entry>
5921 <entry><type>char</type></entry>
5924 A code defining the specific semantics of this dependency relationship; see text
5933 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5934 the referenced object cannot be dropped without also dropping the dependent
5935 object. However, there are several subflavors identified by
5936 <structfield>deptype</>:
5940 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5943 The referenced object (which must be a role) is the owner of the
5950 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5953 The referenced object (which must be a role) is mentioned in the
5954 ACL (access control list, i.e., privileges list) of the
5955 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5956 not made for the owner of the object, since the owner will have
5957 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5963 <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
5966 The referenced object (which must be a role) is mentioned as the
5967 target of a dependent policy object.
5973 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5976 There is no dependent object; this type of entry is a signal
5977 that the system itself depends on the referenced object, and so
5978 that object must never be deleted. Entries of this type are
5979 created only by <command>initdb</command>. The columns for the
5980 dependent object contain zeroes.
5986 Other dependency flavors might be needed in future. Note in particular
5987 that the current definition only supports roles as referenced objects.
5992 <sect1 id="catalog-pg-shdescription">
5993 <title><structname>pg_shdescription</structname></title>
5995 <indexterm zone="catalog-pg-shdescription">
5996 <primary>pg_shdescription</primary>
6000 The catalog <structname>pg_shdescription</structname> stores optional
6001 descriptions (comments) for shared database objects. Descriptions can be
6002 manipulated with the <xref linkend="sql-comment"> command and viewed with
6003 <application>psql</application>'s <literal>\d</literal> commands.
6007 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6008 which performs a similar function for descriptions involving objects
6009 within a single database.
6013 Unlike most system catalogs, <structname>pg_shdescription</structname>
6014 is shared across all databases of a cluster: there is only one
6015 copy of <structname>pg_shdescription</structname> per cluster, not
6020 <title><structname>pg_shdescription</> Columns</title>
6027 <entry>References</entry>
6028 <entry>Description</entry>
6034 <entry><structfield>objoid</structfield></entry>
6035 <entry><type>oid</type></entry>
6036 <entry>any OID column</entry>
6037 <entry>The OID of the object this description pertains to</entry>
6041 <entry><structfield>classoid</structfield></entry>
6042 <entry><type>oid</type></entry>
6043 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6044 <entry>The OID of the system catalog this object appears in</entry>
6048 <entry><structfield>description</structfield></entry>
6049 <entry><type>text</type></entry>
6051 <entry>Arbitrary text that serves as the description of this object</entry>
6059 <sect1 id="catalog-pg-shseclabel">
6060 <title><structname>pg_shseclabel</structname></title>
6062 <indexterm zone="catalog-pg-shseclabel">
6063 <primary>pg_shseclabel</primary>
6067 The catalog <structname>pg_shseclabel</structname> stores security
6068 labels on shared database objects. Security labels can be manipulated
6069 with the <xref linkend="sql-security-label"> command. For an easier
6070 way to view security labels, see <xref linkend="view-pg-seclabels">.
6074 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6075 which performs a similar function for security labels involving objects
6076 within a single database.
6080 Unlike most system catalogs, <structname>pg_shseclabel</structname>
6081 is shared across all databases of a cluster: there is only one
6082 copy of <structname>pg_shseclabel</structname> per cluster, not
6087 <title><structname>pg_shseclabel</structname> Columns</title>
6093 <entry>References</entry>
6094 <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 security label pertains to</entry>
6105 <entry><structfield>classoid</structfield></entry>
6106 <entry><type>oid</type></entry>
6107 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6108 <entry>The OID of the system catalog this object appears in</entry>
6111 <entry><structfield>provider</structfield></entry>
6112 <entry><type>text</type></entry>
6114 <entry>The label provider associated with this label.</entry>
6117 <entry><structfield>label</structfield></entry>
6118 <entry><type>text</type></entry>
6120 <entry>The security label applied to this object.</entry>
6127 <sect1 id="catalog-pg-statistic">
6128 <title><structname>pg_statistic</structname></title>
6130 <indexterm zone="catalog-pg-statistic">
6131 <primary>pg_statistic</primary>
6135 The catalog <structname>pg_statistic</structname> stores
6136 statistical data about the contents of the database. Entries are
6137 created by <xref linkend="sql-analyze">
6138 and subsequently used by the query planner. Note that all the
6139 statistical data is inherently approximate, even assuming that it
6144 Normally there is one entry, with <structfield>stainherit</> =
6145 <literal>false</>, for each table column that has been analyzed.
6146 If the table has inheritance children, a second entry with
6147 <structfield>stainherit</> = <literal>true</> is also created. This row
6148 represents the column's statistics over the inheritance tree, i.e.,
6149 statistics for the data you'd see with
6150 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
6151 whereas the <structfield>stainherit</> = <literal>false</> row represents
6153 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
6157 <structname>pg_statistic</structname> also stores statistical data about
6158 the values of index expressions. These are described as if they were
6159 actual data columns; in particular, <structfield>starelid</structfield>
6160 references the index. No entry is made for an ordinary non-expression
6161 index column, however, since it would be redundant with the entry
6162 for the underlying table column. Currently, entries for index expressions
6163 always have <structfield>stainherit</> = <literal>false</>.
6167 Since different kinds of statistics might be appropriate for different
6168 kinds of data, <structname>pg_statistic</structname> is designed not
6169 to assume very much about what sort of statistics it stores. Only
6170 extremely general statistics (such as nullness) are given dedicated
6171 columns in <structname>pg_statistic</structname>. Everything else
6172 is stored in <quote>slots</quote>, which are groups of associated columns
6173 whose content is identified by a code number in one of the slot's columns.
6174 For more information see
6175 <filename>src/include/catalog/pg_statistic.h</filename>.
6179 <structname>pg_statistic</structname> should not be readable by the
6180 public, since even statistical information about a table's contents
6181 might be considered sensitive. (Example: minimum and maximum values
6182 of a salary column might be quite interesting.)
6183 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6184 is a publicly readable view on
6185 <structname>pg_statistic</structname> that only exposes information
6186 about those tables that are readable by the current user.
6190 <title><structname>pg_statistic</> Columns</title>
6197 <entry>References</entry>
6198 <entry>Description</entry>
6204 <entry><structfield>starelid</structfield></entry>
6205 <entry><type>oid</type></entry>
6206 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6207 <entry>The table or index that the described column belongs to</entry>
6211 <entry><structfield>staattnum</structfield></entry>
6212 <entry><type>int2</type></entry>
6213 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6214 <entry>The number of the described column</entry>
6218 <entry><structfield>stainherit</structfield></entry>
6219 <entry><type>bool</type></entry>
6221 <entry>If true, the stats include inheritance child columns, not just the
6222 values in the specified relation</entry>
6226 <entry><structfield>stanullfrac</structfield></entry>
6227 <entry><type>float4</type></entry>
6229 <entry>The fraction of the column's entries that are null</entry>
6233 <entry><structfield>stawidth</structfield></entry>
6234 <entry><type>int4</type></entry>
6236 <entry>The average stored width, in bytes, of nonnull entries</entry>
6240 <entry><structfield>stadistinct</structfield></entry>
6241 <entry><type>float4</type></entry>
6243 <entry>The number of distinct nonnull data values in the column.
6244 A value greater than zero is the actual number of distinct values.
6245 A value less than zero is the negative of a multiplier for the number
6246 of rows in the table; for example, a column in which about 80% of the
6247 values are nonnull and each nonnull value appears about twice on
6248 average could be represented by <structfield>stadistinct</> = -0.4.
6249 A zero value means the number of distinct values is unknown.
6254 <entry><structfield>stakind<replaceable>N</></structfield></entry>
6255 <entry><type>int2</type></entry>
6258 A code number indicating the kind of statistics stored in the
6259 <replaceable>N</>th <quote>slot</quote> of the
6260 <structname>pg_statistic</structname> row.
6265 <entry><structfield>staop<replaceable>N</></structfield></entry>
6266 <entry><type>oid</type></entry>
6267 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6269 An operator used to derive the statistics stored in the
6270 <replaceable>N</>th <quote>slot</quote>. For example, a
6271 histogram slot would show the <literal><</literal> operator
6272 that defines the sort order of the data.
6277 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6278 <entry><type>float4[]</type></entry>
6281 Numerical statistics of the appropriate kind for the
6282 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6283 kind does not involve numerical values
6288 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6289 <entry><type>anyarray</type></entry>
6292 Column data values of the appropriate kind for the
6293 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6294 kind does not store any data values. Each array's element
6295 values are actually of the specific column's data type, or a related
6296 type such as an array's element type, so there is no way to define
6297 these columns' type more specifically than <type>anyarray</>.
6306 <sect1 id="catalog-pg-subscription">
6307 <title><structname>pg_subscription</structname></title>
6309 <indexterm zone="catalog-pg-subscription">
6310 <primary>pg_subscription</primary>
6314 The catalog <structname>pg_subscription</structname> contains all existing
6315 logical replication subscriptions. For more information about logical
6316 replication see <xref linkend="logical-replication">.
6320 Unlike most system catalogs, <structname>pg_subscription</structname> is
6321 shared across all databases of a cluster: There is only one copy
6322 of <structname>pg_subscription</structname> per cluster, not one per
6327 Access to the column <structfield>subconninfo</structfield> is revoked from
6328 normal users, because it could contain plain-text passwords.
6332 <title><structname>pg_subscription</structname> Columns</title>
6339 <entry>References</entry>
6340 <entry>Description</entry>
6346 <entry><structfield>oid</structfield></entry>
6347 <entry><type>oid</type></entry>
6349 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6353 <entry><structfield>subdbid</structfield></entry>
6354 <entry><type>oid</type></entry>
6355 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6356 <entry>OID of the database which the subscription resides in</entry>
6360 <entry><structfield>subname</structfield></entry>
6361 <entry><type>name</type></entry>
6363 <entry>Name of the subscription</entry>
6367 <entry><structfield>subowner</structfield></entry>
6368 <entry><type>oid</type></entry>
6369 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6370 <entry>Owner of the subscription</entry>
6374 <entry><structfield>subenabled</structfield></entry>
6375 <entry><type>bool</type></entry>
6377 <entry>If true, the subscription is enabled and should be replicating.</entry>
6381 <entry><structfield>subconninfo</structfield></entry>
6382 <entry><type>text</type></entry>
6384 <entry>Connection string to the upstream database</entry>
6388 <entry><structfield>subslotname</structfield></entry>
6389 <entry><type>name</type></entry>
6391 <entry>Name of the replication slot in the upstream database. Also used
6392 for local replication origin name.</entry>
6396 <entry><structfield>subpublications</structfield></entry>
6397 <entry><type>text[]</type></entry>
6399 <entry>Array of subscribed publication names. These reference the
6400 publications on the publisher server. For more on publications
6401 see <xref linkend="logical-replication-publication">.
6409 <sect1 id="catalog-pg-tablespace">
6410 <title><structname>pg_tablespace</structname></title>
6412 <indexterm zone="catalog-pg-tablespace">
6413 <primary>pg_tablespace</primary>
6417 The catalog <structname>pg_tablespace</structname> stores information
6418 about the available tablespaces. Tables can be placed in particular
6419 tablespaces to aid administration of disk layout.
6423 Unlike most system catalogs, <structname>pg_tablespace</structname>
6424 is shared across all databases of a cluster: there is only one
6425 copy of <structname>pg_tablespace</structname> per cluster, not
6430 <title><structname>pg_tablespace</> Columns</title>
6437 <entry>References</entry>
6438 <entry>Description</entry>
6444 <entry><structfield>oid</structfield></entry>
6445 <entry><type>oid</type></entry>
6447 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6451 <entry><structfield>spcname</structfield></entry>
6452 <entry><type>name</type></entry>
6454 <entry>Tablespace name</entry>
6458 <entry><structfield>spcowner</structfield></entry>
6459 <entry><type>oid</type></entry>
6460 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6461 <entry>Owner of the tablespace, usually the user who created it</entry>
6465 <entry><structfield>spcacl</structfield></entry>
6466 <entry><type>aclitem[]</type></entry>
6469 Access privileges; see
6470 <xref linkend="sql-grant"> and
6471 <xref linkend="sql-revoke">
6477 <entry><structfield>spcoptions</structfield></entry>
6478 <entry><type>text[]</type></entry>
6481 Tablespace-level options, as <quote>keyword=value</> strings
6490 <sect1 id="catalog-pg-transform">
6491 <title><structname>pg_transform</structname></title>
6493 <indexterm zone="catalog-pg-transform">
6494 <primary>pg_transform</primary>
6498 The catalog <structname>pg_transform</structname> stores information about
6499 transforms, which are a mechanism to adapt data types to procedural
6500 languages. See <xref linkend="sql-createtransform"> for more information.
6504 <title><structname>pg_transform</> Columns</title>
6511 <entry>References</entry>
6512 <entry>Description</entry>
6518 <entry><structfield>trftype</structfield></entry>
6519 <entry><type>oid</type></entry>
6520 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6521 <entry>OID of the data type this transform is for</entry>
6525 <entry><structfield>trflang</structfield></entry>
6526 <entry><type>oid</type></entry>
6527 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6528 <entry>OID of the language this transform is for</entry>
6532 <entry><structfield>trffromsql</structfield></entry>
6533 <entry><type>regproc</type></entry>
6534 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6536 The OID of the function to use when converting the data type for input
6537 to the procedural language (e.g., function parameters). Zero is stored
6538 if this operation is not supported.
6543 <entry><structfield>trftosql</structfield></entry>
6544 <entry><type>regproc</type></entry>
6545 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6547 The OID of the function to use when converting output from the
6548 procedural language (e.g., return values) to the data type. Zero is
6549 stored if this operation is not supported.
6558 <sect1 id="catalog-pg-trigger">
6559 <title><structname>pg_trigger</structname></title>
6561 <indexterm zone="catalog-pg-trigger">
6562 <primary>pg_trigger</primary>
6566 The catalog <structname>pg_trigger</structname> stores triggers on tables
6568 See <xref linkend="sql-createtrigger">
6569 for more information.
6573 <title><structname>pg_trigger</> Columns</title>
6580 <entry>References</entry>
6581 <entry>Description</entry>
6587 <entry><structfield>oid</structfield></entry>
6588 <entry><type>oid</type></entry>
6590 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6594 <entry><structfield>tgrelid</structfield></entry>
6595 <entry><type>oid</type></entry>
6596 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6597 <entry>The table this trigger is on</entry>
6601 <entry><structfield>tgname</structfield></entry>
6602 <entry><type>name</type></entry>
6604 <entry>Trigger name (must be unique among triggers of same table)</entry>
6608 <entry><structfield>tgfoid</structfield></entry>
6609 <entry><type>oid</type></entry>
6610 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6611 <entry>The function to be called</entry>
6615 <entry><structfield>tgtype</structfield></entry>
6616 <entry><type>int2</type></entry>
6618 <entry>Bit mask identifying trigger firing conditions</entry>
6622 <entry><structfield>tgenabled</structfield></entry>
6623 <entry><type>char</type></entry>
6626 Controls in which <xref linkend="guc-session-replication-role"> modes
6628 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6629 <literal>D</> = trigger is disabled,
6630 <literal>R</> = trigger fires in <quote>replica</> mode,
6631 <literal>A</> = trigger fires always.
6636 <entry><structfield>tgisinternal</structfield></entry>
6637 <entry><type>bool</type></entry>
6639 <entry>True if trigger is internally generated (usually, to enforce
6640 the constraint identified by <structfield>tgconstraint</>)</entry>
6644 <entry><structfield>tgconstrrelid</structfield></entry>
6645 <entry><type>oid</type></entry>
6646 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6647 <entry>The table referenced by a referential integrity constraint</entry>
6651 <entry><structfield>tgconstrindid</structfield></entry>
6652 <entry><type>oid</type></entry>
6653 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6654 <entry>The index supporting a unique, primary key, referential integrity,
6655 or exclusion constraint</entry>
6659 <entry><structfield>tgconstraint</structfield></entry>
6660 <entry><type>oid</type></entry>
6661 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6662 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6666 <entry><structfield>tgdeferrable</structfield></entry>
6667 <entry><type>bool</type></entry>
6669 <entry>True if constraint trigger is deferrable</entry>
6673 <entry><structfield>tginitdeferred</structfield></entry>
6674 <entry><type>bool</type></entry>
6676 <entry>True if constraint trigger is initially deferred</entry>
6680 <entry><structfield>tgnargs</structfield></entry>
6681 <entry><type>int2</type></entry>
6683 <entry>Number of argument strings passed to trigger function</entry>
6687 <entry><structfield>tgattr</structfield></entry>
6688 <entry><type>int2vector</type></entry>
6689 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6690 <entry>Column numbers, if trigger is column-specific; otherwise an
6695 <entry><structfield>tgargs</structfield></entry>
6696 <entry><type>bytea</type></entry>
6698 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6702 <entry><structfield>tgqual</structfield></entry>
6703 <entry><type>pg_node_tree</type></entry>
6705 <entry>Expression tree (in <function>nodeToString()</function>
6706 representation) for the trigger's <literal>WHEN</> condition, or null
6711 <entry><structfield>tgoldtable</structfield></entry>
6712 <entry><type>name</type></entry>
6714 <entry><literal>REFERENCING</> clause name for <literal>OLD TABLE</>,
6715 or null if none</entry>
6719 <entry><structfield>tgnewtable</structfield></entry>
6720 <entry><type>name</type></entry>
6722 <entry><literal>REFERENCING</> clause name for <literal>NEW TABLE</>,
6723 or null if none</entry>
6730 Currently, column-specific triggering is supported only for
6731 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6732 only for that event type. <structfield>tgtype</structfield> might
6733 contain bits for other event types as well, but those are presumed
6734 to be table-wide regardless of what is in <structfield>tgattr</>.
6739 When <structfield>tgconstraint</> is nonzero,
6740 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6741 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6742 largely redundant with the referenced <structname>pg_constraint</> entry.
6743 However, it is possible for a non-deferrable trigger to be associated
6744 with a deferrable constraint: foreign key constraints can have some
6745 deferrable and some non-deferrable triggers.
6751 <literal>pg_class.relhastriggers</literal>
6752 must be true if a relation has any triggers in this catalog.
6759 <sect1 id="catalog-pg-ts-config">
6760 <title><structname>pg_ts_config</structname></title>
6762 <indexterm zone="catalog-pg-ts-config">
6763 <primary>pg_ts_config</primary>
6767 The <structname>pg_ts_config</structname> catalog contains entries
6768 representing text search configurations. A configuration specifies
6769 a particular text search parser and a list of dictionaries to use
6770 for each of the parser's output token types. The parser is shown
6771 in the <structname>pg_ts_config</structname> entry, but the
6772 token-to-dictionary mapping is defined by subsidiary entries in <link
6773 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6777 <productname>PostgreSQL</productname>'s text search features are
6778 described at length in <xref linkend="textsearch">.
6782 <title><structname>pg_ts_config</> Columns</title>
6789 <entry>References</entry>
6790 <entry>Description</entry>
6796 <entry><structfield>oid</structfield></entry>
6797 <entry><type>oid</type></entry>
6799 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6803 <entry><structfield>cfgname</structfield></entry>
6804 <entry><type>name</type></entry>
6806 <entry>Text search configuration name</entry>
6810 <entry><structfield>cfgnamespace</structfield></entry>
6811 <entry><type>oid</type></entry>
6812 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6814 The OID of the namespace that contains this configuration
6819 <entry><structfield>cfgowner</structfield></entry>
6820 <entry><type>oid</type></entry>
6821 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6822 <entry>Owner of the configuration</entry>
6826 <entry><structfield>cfgparser</structfield></entry>
6827 <entry><type>oid</type></entry>
6828 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6829 <entry>The OID of the text search parser for this configuration</entry>
6837 <sect1 id="catalog-pg-ts-config-map">
6838 <title><structname>pg_ts_config_map</structname></title>
6840 <indexterm zone="catalog-pg-ts-config-map">
6841 <primary>pg_ts_config_map</primary>
6845 The <structname>pg_ts_config_map</structname> catalog contains entries
6846 showing which text search dictionaries should be consulted, and in
6847 what order, for each output token type of each text search configuration's
6852 <productname>PostgreSQL</productname>'s text search features are
6853 described at length in <xref linkend="textsearch">.
6857 <title><structname>pg_ts_config_map</> Columns</title>
6864 <entry>References</entry>
6865 <entry>Description</entry>
6871 <entry><structfield>mapcfg</structfield></entry>
6872 <entry><type>oid</type></entry>
6873 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6874 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6878 <entry><structfield>maptokentype</structfield></entry>
6879 <entry><type>integer</type></entry>
6881 <entry>A token type emitted by the configuration's parser</entry>
6885 <entry><structfield>mapseqno</structfield></entry>
6886 <entry><type>integer</type></entry>
6888 <entry>Order in which to consult this entry (lower
6889 <structfield>mapseqno</>s first)</entry>
6893 <entry><structfield>mapdict</structfield></entry>
6894 <entry><type>oid</type></entry>
6895 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6896 <entry>The OID of the text search dictionary to consult</entry>
6904 <sect1 id="catalog-pg-ts-dict">
6905 <title><structname>pg_ts_dict</structname></title>
6907 <indexterm zone="catalog-pg-ts-dict">
6908 <primary>pg_ts_dict</primary>
6912 The <structname>pg_ts_dict</structname> catalog contains entries
6913 defining text search dictionaries. A dictionary depends on a text
6914 search template, which specifies all the implementation functions
6915 needed; the dictionary itself provides values for the user-settable
6916 parameters supported by the template. This division of labor allows
6917 dictionaries to be created by unprivileged users. The parameters
6918 are specified by a text string <structfield>dictinitoption</>,
6919 whose format and meaning vary depending on the template.
6923 <productname>PostgreSQL</productname>'s text search features are
6924 described at length in <xref linkend="textsearch">.
6928 <title><structname>pg_ts_dict</> Columns</title>
6935 <entry>References</entry>
6936 <entry>Description</entry>
6942 <entry><structfield>oid</structfield></entry>
6943 <entry><type>oid</type></entry>
6945 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6949 <entry><structfield>dictname</structfield></entry>
6950 <entry><type>name</type></entry>
6952 <entry>Text search dictionary name</entry>
6956 <entry><structfield>dictnamespace</structfield></entry>
6957 <entry><type>oid</type></entry>
6958 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6960 The OID of the namespace that contains this dictionary
6965 <entry><structfield>dictowner</structfield></entry>
6966 <entry><type>oid</type></entry>
6967 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6968 <entry>Owner of the dictionary</entry>
6972 <entry><structfield>dicttemplate</structfield></entry>
6973 <entry><type>oid</type></entry>
6974 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6975 <entry>The OID of the text search template for this dictionary</entry>
6979 <entry><structfield>dictinitoption</structfield></entry>
6980 <entry><type>text</type></entry>
6982 <entry>Initialization option string for the template</entry>
6990 <sect1 id="catalog-pg-ts-parser">
6991 <title><structname>pg_ts_parser</structname></title>
6993 <indexterm zone="catalog-pg-ts-parser">
6994 <primary>pg_ts_parser</primary>
6998 The <structname>pg_ts_parser</structname> catalog contains entries
6999 defining text search parsers. A parser is responsible for splitting
7000 input text into lexemes and assigning a token type to each lexeme.
7001 Since a parser must be implemented by C-language-level functions,
7002 creation of new parsers is restricted to database superusers.
7006 <productname>PostgreSQL</productname>'s text search features are
7007 described at length in <xref linkend="textsearch">.
7011 <title><structname>pg_ts_parser</> Columns</title>
7018 <entry>References</entry>
7019 <entry>Description</entry>
7025 <entry><structfield>oid</structfield></entry>
7026 <entry><type>oid</type></entry>
7028 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7032 <entry><structfield>prsname</structfield></entry>
7033 <entry><type>name</type></entry>
7035 <entry>Text search parser name</entry>
7039 <entry><structfield>prsnamespace</structfield></entry>
7040 <entry><type>oid</type></entry>
7041 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7043 The OID of the namespace that contains this parser
7048 <entry><structfield>prsstart</structfield></entry>
7049 <entry><type>regproc</type></entry>
7050 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7051 <entry>OID of the parser's startup function</entry>
7055 <entry><structfield>prstoken</structfield></entry>
7056 <entry><type>regproc</type></entry>
7057 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7058 <entry>OID of the parser's next-token function</entry>
7062 <entry><structfield>prsend</structfield></entry>
7063 <entry><type>regproc</type></entry>
7064 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7065 <entry>OID of the parser's shutdown function</entry>
7069 <entry><structfield>prsheadline</structfield></entry>
7070 <entry><type>regproc</type></entry>
7071 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7072 <entry>OID of the parser's headline function</entry>
7076 <entry><structfield>prslextype</structfield></entry>
7077 <entry><type>regproc</type></entry>
7078 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7079 <entry>OID of the parser's lextype function</entry>
7087 <sect1 id="catalog-pg-ts-template">
7088 <title><structname>pg_ts_template</structname></title>
7090 <indexterm zone="catalog-pg-ts-template">
7091 <primary>pg_ts_template</primary>
7095 The <structname>pg_ts_template</structname> catalog contains entries
7096 defining text search templates. A template is the implementation
7097 skeleton for a class of text search dictionaries.
7098 Since a template must be implemented by C-language-level functions,
7099 creation of new templates is restricted to database superusers.
7103 <productname>PostgreSQL</productname>'s text search features are
7104 described at length in <xref linkend="textsearch">.
7108 <title><structname>pg_ts_template</> Columns</title>
7115 <entry>References</entry>
7116 <entry>Description</entry>
7122 <entry><structfield>oid</structfield></entry>
7123 <entry><type>oid</type></entry>
7125 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7129 <entry><structfield>tmplname</structfield></entry>
7130 <entry><type>name</type></entry>
7132 <entry>Text search template name</entry>
7136 <entry><structfield>tmplnamespace</structfield></entry>
7137 <entry><type>oid</type></entry>
7138 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7140 The OID of the namespace that contains this template
7145 <entry><structfield>tmplinit</structfield></entry>
7146 <entry><type>regproc</type></entry>
7147 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7148 <entry>OID of the template's initialization function</entry>
7152 <entry><structfield>tmpllexize</structfield></entry>
7153 <entry><type>regproc</type></entry>
7154 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7155 <entry>OID of the template's lexize function</entry>
7163 <sect1 id="catalog-pg-type">
7164 <title><structname>pg_type</structname></title>
7166 <indexterm zone="catalog-pg-type">
7167 <primary>pg_type</primary>
7171 The catalog <structname>pg_type</structname> stores information about data
7172 types. Base types and enum types (scalar types) are created with
7173 <xref linkend="sql-createtype">, and
7175 <xref linkend="sql-createdomain">.
7176 A composite type is automatically created for each table in the database, to
7177 represent the row structure of the table. It is also possible to create
7178 composite types with <command>CREATE TYPE AS</command>.
7182 <title><structname>pg_type</> Columns</title>
7189 <entry>References</entry>
7190 <entry>Description</entry>
7196 <entry><structfield>oid</structfield></entry>
7197 <entry><type>oid</type></entry>
7199 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7203 <entry><structfield>typname</structfield></entry>
7204 <entry><type>name</type></entry>
7206 <entry>Data type name</entry>
7210 <entry><structfield>typnamespace</structfield></entry>
7211 <entry><type>oid</type></entry>
7212 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7214 The OID of the namespace that contains this type
7219 <entry><structfield>typowner</structfield></entry>
7220 <entry><type>oid</type></entry>
7221 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7222 <entry>Owner of the type</entry>
7226 <entry><structfield>typlen</structfield></entry>
7227 <entry><type>int2</type></entry>
7230 For a fixed-size type, <structfield>typlen</structfield> is the number
7231 of bytes in the internal representation of the type. But for a
7232 variable-length type, <structfield>typlen</structfield> is negative.
7233 -1 indicates a <quote>varlena</> type (one that has a length word),
7234 -2 indicates a null-terminated C string.
7239 <entry><structfield>typbyval</structfield></entry>
7240 <entry><type>bool</type></entry>
7243 <structfield>typbyval</structfield> determines whether internal
7244 routines pass a value of this type by value or by reference.
7245 <structfield>typbyval</structfield> had better be false if
7246 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7247 where Datum is 8 bytes).
7248 Variable-length types are always passed by reference. Note that
7249 <structfield>typbyval</structfield> can be false even if the
7250 length would allow pass-by-value.
7255 <entry><structfield>typtype</structfield></entry>
7256 <entry><type>char</type></entry>
7259 <structfield>typtype</structfield> is
7260 <literal>b</literal> for a base type,
7261 <literal>c</literal> for a composite type (e.g., a table's row type),
7262 <literal>d</literal> for a domain,
7263 <literal>e</literal> for an enum type,
7264 <literal>p</literal> for a pseudo-type, or
7265 <literal>r</literal> for a range type.
7266 See also <structfield>typrelid</structfield> and
7267 <structfield>typbasetype</structfield>.
7272 <entry><structfield>typcategory</structfield></entry>
7273 <entry><type>char</type></entry>
7276 <structfield>typcategory</structfield> is an arbitrary classification
7277 of data types that is used by the parser to determine which implicit
7278 casts should be <quote>preferred</>.
7279 See <xref linkend="catalog-typcategory-table">.
7284 <entry><structfield>typispreferred</structfield></entry>
7285 <entry><type>bool</type></entry>
7288 True if the type is a preferred cast target within its
7289 <structfield>typcategory</structfield>
7294 <entry><structfield>typisdefined</structfield></entry>
7295 <entry><type>bool</type></entry>
7298 True if the type is defined, false if this is a placeholder
7299 entry for a not-yet-defined type. When
7300 <structfield>typisdefined</structfield> is false, nothing
7301 except the type name, namespace, and OID can be relied on.
7306 <entry><structfield>typdelim</structfield></entry>
7307 <entry><type>char</type></entry>
7310 Character that separates two values of this type when parsing
7311 array input. Note that the delimiter is associated with the array
7312 element data type, not the array data type.
7317 <entry><structfield>typrelid</structfield></entry>
7318 <entry><type>oid</type></entry>
7319 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7321 If this is a composite type (see
7322 <structfield>typtype</structfield>), then this column points to
7323 the <structname>pg_class</structname> entry that defines the
7324 corresponding table. (For a free-standing composite type, the
7325 <structname>pg_class</structname> entry doesn't really represent
7326 a table, but it is needed anyway for the type's
7327 <structname>pg_attribute</structname> entries to link to.)
7328 Zero for non-composite types.
7333 <entry><structfield>typelem</structfield></entry>
7334 <entry><type>oid</type></entry>
7335 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7337 If <structfield>typelem</structfield> is not 0 then it
7338 identifies another row in <structname>pg_type</structname>.
7339 The current type can then be subscripted like an array yielding
7340 values of type <structfield>typelem</structfield>. A
7341 <quote>true</quote> array type is variable length
7342 (<structfield>typlen</structfield> = -1),
7343 but some fixed-length (<structfield>typlen</structfield> > 0) types
7344 also have nonzero <structfield>typelem</structfield>, for example
7345 <type>name</type> and <type>point</type>.
7346 If a fixed-length type has a <structfield>typelem</structfield> then
7347 its internal representation must be some number of values of the
7348 <structfield>typelem</structfield> data type with no other data.
7349 Variable-length array types have a header defined by the array
7355 <entry><structfield>typarray</structfield></entry>
7356 <entry><type>oid</type></entry>
7357 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7359 If <structfield>typarray</structfield> is not 0 then it
7360 identifies another row in <structname>pg_type</structname>, which
7361 is the <quote>true</quote> array type having this type as element
7366 <entry><structfield>typinput</structfield></entry>
7367 <entry><type>regproc</type></entry>
7368 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7369 <entry>Input conversion function (text format)</entry>
7373 <entry><structfield>typoutput</structfield></entry>
7374 <entry><type>regproc</type></entry>
7375 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7376 <entry>Output conversion function (text format)</entry>
7380 <entry><structfield>typreceive</structfield></entry>
7381 <entry><type>regproc</type></entry>
7382 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7383 <entry>Input conversion function (binary format), or 0 if none</entry>
7387 <entry><structfield>typsend</structfield></entry>
7388 <entry><type>regproc</type></entry>
7389 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7390 <entry>Output conversion function (binary format), or 0 if none</entry>
7394 <entry><structfield>typmodin</structfield></entry>
7395 <entry><type>regproc</type></entry>
7396 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7397 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7401 <entry><structfield>typmodout</structfield></entry>
7402 <entry><type>regproc</type></entry>
7403 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7404 <entry>Type modifier output function, or 0 to use the standard format</entry>
7408 <entry><structfield>typanalyze</structfield></entry>
7409 <entry><type>regproc</type></entry>
7410 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7411 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7415 <entry><structfield>typalign</structfield></entry>
7416 <entry><type>char</type></entry>
7420 <structfield>typalign</structfield> is the alignment required
7421 when storing a value of this type. It applies to storage on
7422 disk as well as most representations of the value inside
7423 <productname>PostgreSQL</>.
7424 When multiple values are stored consecutively, such
7425 as in the representation of a complete row on disk, padding is
7426 inserted before a datum of this type so that it begins on the
7427 specified boundary. The alignment reference is the beginning
7428 of the first datum in the sequence.
7432 Possible values are:
7435 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7438 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7441 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7444 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7449 For types used in system tables, it is critical that the size
7450 and alignment defined in <structname>pg_type</structname>
7451 agree with the way that the compiler will lay out the column in
7452 a structure representing a table row.
7458 <entry><structfield>typstorage</structfield></entry>
7459 <entry><type>char</type></entry>
7462 <structfield>typstorage</structfield> tells for varlena
7463 types (those with <structfield>typlen</structfield> = -1) if
7464 the type is prepared for toasting and what the default strategy
7465 for attributes of this type should be.
7469 <para><literal>p</>: Value must always be stored plain.</para>
7473 <literal>e</>: Value can be stored in a <quote>secondary</quote>
7474 relation (if relation has one, see
7475 <literal>pg_class.reltoastrelid</literal>).
7479 <para><literal>m</>: Value can be stored compressed inline.</para>
7482 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7485 Note that <literal>m</> columns can also be moved out to secondary
7486 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7492 <entry><structfield>typnotnull</structfield></entry>
7493 <entry><type>bool</type></entry>
7496 <structfield>typnotnull</structfield> represents a not-null
7497 constraint on a type. Used for domains only.
7502 <entry><structfield>typbasetype</structfield></entry>
7503 <entry><type>oid</type></entry>
7504 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7506 If this is a domain (see <structfield>typtype</structfield>), then
7507 <structfield>typbasetype</structfield> identifies the type that this
7508 one is based on. Zero if this type is not a domain.
7513 <entry><structfield>typtypmod</structfield></entry>
7514 <entry><type>int4</type></entry>
7517 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7518 to be applied to their base type (-1 if base type does not use a
7519 <literal>typmod</>). -1 if this type is not a domain.
7524 <entry><structfield>typndims</structfield></entry>
7525 <entry><type>int4</type></entry>
7528 <structfield>typndims</structfield> is the number of array dimensions
7529 for a domain over an array (that is, <structfield>typbasetype</> is
7531 Zero for types other than domains over array types.
7536 <entry><structfield>typcollation</structfield></entry>
7537 <entry><type>oid</type></entry>
7538 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7540 <structfield>typcollation</structfield> specifies the collation
7541 of the type. If the type does not support collations, this will
7542 be zero. A base type that supports collations will have
7543 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7544 collatable type can have some other collation OID, if one was
7545 specified for the domain.
7550 <entry><structfield>typdefaultbin</structfield></entry>
7551 <entry><type>pg_node_tree</type></entry>
7554 If <structfield>typdefaultbin</> is not null, it is the
7555 <function>nodeToString()</function>
7556 representation of a default expression for the type. This is
7557 only used for domains.
7562 <entry><structfield>typdefault</structfield></entry>
7563 <entry><type>text</type></entry>
7566 <structfield>typdefault</> is null if the type has no associated
7567 default value. If <structfield>typdefaultbin</> is not null,
7568 <structfield>typdefault</> must contain a human-readable version of the
7569 default expression represented by <structfield>typdefaultbin</>. If
7570 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7571 not, then <structfield>typdefault</> is the external representation of
7572 the type's default value, which can be fed to the type's input
7573 converter to produce a constant.
7578 <entry><structfield>typacl</structfield></entry>
7579 <entry><type>aclitem[]</type></entry>
7582 Access privileges; see
7583 <xref linkend="sql-grant"> and
7584 <xref linkend="sql-revoke">
7593 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7594 of <structfield>typcategory</>. Any future additions to this list will
7595 also be upper-case ASCII letters. All other ASCII characters are reserved
7596 for user-defined categories.
7599 <table id="catalog-typcategory-table">
7600 <title><structfield>typcategory</> Codes</title>
7606 <entry>Category</entry>
7612 <entry><literal>A</literal></entry>
7613 <entry>Array types</entry>
7616 <entry><literal>B</literal></entry>
7617 <entry>Boolean types</entry>
7620 <entry><literal>C</literal></entry>
7621 <entry>Composite types</entry>
7624 <entry><literal>D</literal></entry>
7625 <entry>Date/time types</entry>
7628 <entry><literal>E</literal></entry>
7629 <entry>Enum types</entry>
7632 <entry><literal>G</literal></entry>
7633 <entry>Geometric types</entry>
7636 <entry><literal>I</literal></entry>
7637 <entry>Network address types</entry>
7640 <entry><literal>N</literal></entry>
7641 <entry>Numeric types</entry>
7644 <entry><literal>P</literal></entry>
7645 <entry>Pseudo-types</entry>
7648 <entry><literal>R</literal></entry>
7649 <entry>Range types</entry>
7652 <entry><literal>S</literal></entry>
7653 <entry>String types</entry>
7656 <entry><literal>T</literal></entry>
7657 <entry>Timespan types</entry>
7660 <entry><literal>U</literal></entry>
7661 <entry>User-defined types</entry>
7664 <entry><literal>V</literal></entry>
7665 <entry>Bit-string types</entry>
7668 <entry><literal>X</literal></entry>
7669 <entry><type>unknown</> type</entry>
7678 <sect1 id="catalog-pg-user-mapping">
7679 <title><structname>pg_user_mapping</structname></title>
7681 <indexterm zone="catalog-pg-user-mapping">
7682 <primary>pg_user_mapping</primary>
7686 The catalog <structname>pg_user_mapping</structname> stores
7687 the mappings from local user to remote. Access to this catalog is
7688 restricted from normal users, use the view
7689 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7694 <title><structname>pg_user_mapping</> Columns</title>
7701 <entry>References</entry>
7702 <entry>Description</entry>
7708 <entry><structfield>oid</structfield></entry>
7709 <entry><type>oid</type></entry>
7711 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7715 <entry><structfield>umuser</structfield></entry>
7716 <entry><type>oid</type></entry>
7717 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7718 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7722 <entry><structfield>umserver</structfield></entry>
7723 <entry><type>oid</type></entry>
7724 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7726 The OID of the foreign server that contains this mapping
7731 <entry><structfield>umoptions</structfield></entry>
7732 <entry><type>text[]</type></entry>
7735 User mapping specific options, as <quote>keyword=value</> strings
7744 <sect1 id="views-overview">
7745 <title>System Views</title>
7748 In addition to the system catalogs, <productname>PostgreSQL</productname>
7749 provides a number of built-in views. Some system views provide convenient
7750 access to some commonly used queries on the system catalogs. Other views
7751 provide access to internal server state.
7755 The information schema (<xref linkend="information-schema">) provides
7756 an alternative set of views which overlap the functionality of the system
7757 views. Since the information schema is SQL-standard whereas the views
7758 described here are <productname>PostgreSQL</productname>-specific,
7759 it's usually better to use the information schema if it provides all
7760 the information you need.
7764 <xref linkend="view-table"> lists the system views described here.
7765 More detailed documentation of each view follows below.
7766 There are some additional views that provide access to the results of
7767 the statistics collector; they are described in <xref
7768 linkend="monitoring-stats-views-table">.
7772 Except where noted, all the views described here are read-only.
7775 <table id="view-table">
7776 <title>System Views</title>
7781 <entry>View Name</entry>
7782 <entry>Purpose</entry>
7788 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7789 <entry>available extensions</entry>
7793 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7794 <entry>available versions of extensions</entry>
7798 <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
7799 <entry>compile-time configuration parameters</entry>
7803 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7804 <entry>open cursors</entry>
7808 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
7809 <entry>summary of configuration file contents</entry>
7813 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7814 <entry>groups of database users</entry>
7818 <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
7819 <entry>summary of client authentication configuration file contents</entry>
7823 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7824 <entry>indexes</entry>
7828 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7829 <entry>locks currently held or awaited</entry>
7833 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7834 <entry>materialized views</entry>
7838 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7839 <entry>policies</entry>
7843 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7844 <entry>prepared statements</entry>
7848 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7849 <entry>prepared transactions</entry>
7853 <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
7854 <entry>publications and their associated tables</entry>
7858 <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
7859 <entry>information about replication origins, including replication progress</entry>
7863 <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
7864 <entry>replication slot information</entry>
7868 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7869 <entry>database roles</entry>
7873 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7874 <entry>rules</entry>
7878 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7879 <entry>security labels</entry>
7883 <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
7884 <entry>sequences</entry>
7888 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7889 <entry>parameter settings</entry>
7893 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7894 <entry>database users</entry>
7898 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7899 <entry>planner statistics</entry>
7903 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7904 <entry>tables</entry>
7908 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7909 <entry>time zone abbreviations</entry>
7913 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7914 <entry>time zone names</entry>
7918 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7919 <entry>database users</entry>
7923 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7924 <entry>user mappings</entry>
7928 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7929 <entry>views</entry>
7937 <sect1 id="view-pg-available-extensions">
7938 <title><structname>pg_available_extensions</structname></title>
7940 <indexterm zone="view-pg-available-extensions">
7941 <primary>pg_available_extensions</primary>
7945 The <structname>pg_available_extensions</structname> view lists the
7946 extensions that are available for installation.
7948 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7949 catalog, which shows the extensions currently installed.
7953 <title><structname>pg_available_extensions</> Columns</title>
7960 <entry>Description</entry>
7966 <entry><structfield>name</structfield></entry>
7967 <entry><type>name</type></entry>
7968 <entry>Extension name</entry>
7972 <entry><structfield>default_version</structfield></entry>
7973 <entry><type>text</type></entry>
7974 <entry>Name of default version, or <literal>NULL</literal> if none is
7979 <entry><structfield>installed_version</structfield></entry>
7980 <entry><type>text</type></entry>
7981 <entry>Currently installed version of the extension,
7982 or <literal>NULL</literal> if not installed</entry>
7986 <entry><structfield>comment</structfield></entry>
7987 <entry><type>text</type></entry>
7988 <entry>Comment string from the extension's control file</entry>
7995 The <structname>pg_available_extensions</structname> view is read only.
7999 <sect1 id="view-pg-available-extension-versions">
8000 <title><structname>pg_available_extension_versions</structname></title>
8002 <indexterm zone="view-pg-available-extension-versions">
8003 <primary>pg_available_extension_versions</primary>
8007 The <structname>pg_available_extension_versions</structname> view lists the
8008 specific extension versions that are available for installation.
8010 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8011 catalog, which shows the extensions currently installed.
8015 <title><structname>pg_available_extension_versions</> Columns</title>
8022 <entry>Description</entry>
8028 <entry><structfield>name</structfield></entry>
8029 <entry><type>name</type></entry>
8030 <entry>Extension name</entry>
8034 <entry><structfield>version</structfield></entry>
8035 <entry><type>text</type></entry>
8036 <entry>Version name</entry>
8040 <entry><structfield>installed</structfield></entry>
8041 <entry><type>bool</type></entry>
8042 <entry>True if this version of this extension is currently
8047 <entry><structfield>superuser</structfield></entry>
8048 <entry><type>bool</type></entry>
8049 <entry>True if only superusers are allowed to install this extension</entry>
8053 <entry><structfield>relocatable</structfield></entry>
8054 <entry><type>bool</type></entry>
8055 <entry>True if extension can be relocated to another schema</entry>
8059 <entry><structfield>schema</structfield></entry>
8060 <entry><type>name</type></entry>
8061 <entry>Name of the schema that the extension must be installed into,
8062 or <literal>NULL</literal> if partially or fully relocatable</entry>
8066 <entry><structfield>requires</structfield></entry>
8067 <entry><type>name[]</type></entry>
8068 <entry>Names of prerequisite extensions,
8069 or <literal>NULL</literal> if none</entry>
8073 <entry><structfield>comment</structfield></entry>
8074 <entry><type>text</type></entry>
8075 <entry>Comment string from the extension's control file</entry>
8082 The <structname>pg_available_extension_versions</structname> view is read
8087 <sect1 id="view-pg-config">
8088 <title><structname>pg_config</structname></title>
8090 <indexterm zone="view-pg-config">
8091 <primary>pg_config</primary>
8095 The view <structname>pg_config</structname> describes the
8096 compile-time configuration parameters of the currently installed
8097 version of <productname>PostgreSQL</>. It is intended, for example, to
8098 be used by software packages that want to interface to
8099 <productname>PostgreSQL</> to facilitate finding the required header
8100 files and libraries. It provides the same basic information as the
8101 <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
8106 By default, the <structname>pg_config</structname> view can be read
8111 <title><structname>pg_config</> Columns</title>
8117 <entry>Description</entry>
8123 <entry><structfield>name</structfield></entry>
8124 <entry><type>text</type></entry>
8125 <entry>The parameter name</entry>
8129 <entry><structfield>setting</structfield></entry>
8130 <entry><type>text</type></entry>
8131 <entry>The parameter value</entry>
8139 <sect1 id="view-pg-cursors">
8140 <title><structname>pg_cursors</structname></title>
8142 <indexterm zone="view-pg-cursors">
8143 <primary>pg_cursors</primary>
8147 The <structname>pg_cursors</structname> view lists the cursors that
8148 are currently available. Cursors can be defined in several ways:
8152 via the <xref linkend="sql-declare">
8159 via the Bind message in the frontend/backend protocol, as
8160 described in <xref linkend="protocol-flow-ext-query">
8166 via the Server Programming Interface (SPI), as described in
8167 <xref linkend="spi-interface">
8172 The <structname>pg_cursors</structname> view displays cursors
8173 created by any of these means. Cursors only exist for the duration
8174 of the transaction that defines them, unless they have been
8175 declared <literal>WITH HOLD</literal>. Therefore non-holdable
8176 cursors are only present in the view until the end of their
8177 creating transaction.
8181 Cursors are used internally to implement some of the components
8182 of <productname>PostgreSQL</>, such as procedural languages.
8183 Therefore, the <structname>pg_cursors</> view might include cursors
8184 that have not been explicitly created by the user.
8190 <title><structname>pg_cursors</> Columns</title>
8197 <entry>Description</entry>
8203 <entry><structfield>name</structfield></entry>
8204 <entry><type>text</type></entry>
8205 <entry>The name of the cursor</entry>
8209 <entry><structfield>statement</structfield></entry>
8210 <entry><type>text</type></entry>
8211 <entry>The verbatim query string submitted to declare this cursor</entry>
8215 <entry><structfield>is_holdable</structfield></entry>
8216 <entry><type>boolean</type></entry>
8218 <literal>true</literal> if the cursor is holdable (that is, it
8219 can be accessed after the transaction that declared the cursor
8220 has committed); <literal>false</literal> otherwise
8225 <entry><structfield>is_binary</structfield></entry>
8226 <entry><type>boolean</type></entry>
8228 <literal>true</literal> if the cursor was declared
8229 <literal>BINARY</literal>; <literal>false</literal>
8235 <entry><structfield>is_scrollable</structfield></entry>
8236 <entry><type>boolean</type></entry>
8238 <literal>true</> if the cursor is scrollable (that is, it
8239 allows rows to be retrieved in a nonsequential manner);
8240 <literal>false</literal> otherwise
8245 <entry><structfield>creation_time</structfield></entry>
8246 <entry><type>timestamptz</type></entry>
8247 <entry>The time at which the cursor was declared</entry>
8254 The <structname>pg_cursors</structname> view is read only.
8259 <sect1 id="view-pg-file-settings">
8260 <title><structname>pg_file_settings</structname></title>
8262 <indexterm zone="view-pg-file-settings">
8263 <primary>pg_file_settings</primary>
8267 The view <structname>pg_file_settings</structname> provides a summary of
8268 the contents of the server's configuration file(s). A row appears in
8269 this view for each <quote>name = value</> entry appearing in the files,
8270 with annotations indicating whether the value could be applied
8271 successfully. Additional row(s) may appear for problems not linked to
8272 a <quote>name = value</> entry, such as syntax errors in the files.
8276 This view is helpful for checking whether planned changes in the
8277 configuration files will work, or for diagnosing a previous failure.
8278 Note that this view reports on the <emphasis>current</> contents of the
8279 files, not on what was last applied by the server. (The
8280 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
8281 view is usually sufficient to determine that.)
8285 By default, the <structname>pg_file_settings</structname> view can be read
8290 <title><structname>pg_file_settings</> Columns</title>
8297 <entry>Description</entry>
8302 <entry><structfield>sourcefile</structfield></entry>
8303 <entry><structfield>text</structfield></entry>
8304 <entry>Full path name of the configuration file</entry>
8307 <entry><structfield>sourceline</structfield></entry>
8308 <entry><structfield>integer</structfield></entry>
8310 Line number within the configuration file where the entry appears
8314 <entry><structfield>seqno</structfield></entry>
8315 <entry><structfield>integer</structfield></entry>
8316 <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
8319 <entry><structfield>name</structfield></entry>
8320 <entry><structfield>text</structfield></entry>
8321 <entry>Configuration parameter name</entry>
8324 <entry><structfield>setting</structfield></entry>
8325 <entry><structfield>text</structfield></entry>
8326 <entry>Value to be assigned to the parameter</entry>
8329 <entry><structfield>applied</structfield></entry>
8330 <entry><structfield>boolean</structfield></entry>
8331 <entry>True if the value can be applied successfully</entry>
8334 <entry><structfield>error</structfield></entry>
8335 <entry><structfield>text</structfield></entry>
8336 <entry>If not null, an error message indicating why this entry could
8337 not be applied</entry>
8344 If the configuration file contains syntax errors or invalid parameter
8345 names, the server will not attempt to apply any settings from it, and
8346 therefore all the <structfield>applied</> fields will read as false.
8347 In such a case there will be one or more rows with
8348 non-null <structfield>error</structfield> fields indicating the
8349 problem(s). Otherwise, individual settings will be applied if possible.
8350 If an individual setting cannot be applied (e.g., invalid value, or the
8351 setting cannot be changed after server start) it will have an appropriate
8352 message in the <structfield>error</structfield> field. Another way that
8353 an entry might have <structfield>applied</> = false is that it is
8354 overridden by a later entry for the same parameter name; this case is not
8355 considered an error so nothing appears in
8356 the <structfield>error</structfield> field.
8360 See <xref linkend="config-setting"> for more information about the various
8361 ways to change run-time parameters.
8366 <sect1 id="view-pg-group">
8367 <title><structname>pg_group</structname></title>
8369 <indexterm zone="view-pg-group">
8370 <primary>pg_group</primary>
8374 The view <structname>pg_group</structname> exists for backwards
8375 compatibility: it emulates a catalog that existed in
8376 <productname>PostgreSQL</productname> before version 8.1.
8377 It shows the names and members of all roles that are marked as not
8378 <structfield>rolcanlogin</>, which is an approximation to the set
8379 of roles that are being used as groups.
8383 <title><structname>pg_group</> Columns</title>
8390 <entry>References</entry>
8391 <entry>Description</entry>
8397 <entry><structfield>groname</structfield></entry>
8398 <entry><type>name</type></entry>
8399 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8400 <entry>Name of the group</entry>
8404 <entry><structfield>grosysid</structfield></entry>
8405 <entry><type>oid</type></entry>
8406 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8407 <entry>ID of this group</entry>
8411 <entry><structfield>grolist</structfield></entry>
8412 <entry><type>oid[]</type></entry>
8413 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8414 <entry>An array containing the IDs of the roles in this group</entry>
8422 <sect1 id="view-pg-hba-file-rules">
8423 <title><structname>pg_hba_file_rules</structname></title>
8425 <indexterm zone="view-pg-hba-file-rules">
8426 <primary>pg_hba_file_rules</primary>
8430 The view <structname>pg_hba_file_rules</structname> provides a summary of
8431 the contents of the client authentication configuration
8432 file, <filename>pg_hba.conf</>. A row appears in this view for each
8433 non-empty, non-comment line in the file, with annotations indicating
8434 whether the rule could be applied successfully.
8438 This view can be helpful for checking whether planned changes in the
8439 authentication configuration file will work, or for diagnosing a previous
8440 failure. Note that this view reports on the <emphasis>current</> contents
8441 of the file, not on what was last loaded by the server.
8445 By default, the <structname>pg_hba_file_rules</structname> view can be read
8450 <title><structname>pg_hba_file_rules</> Columns</title>
8457 <entry>Description</entry>
8462 <entry><structfield>line_number</structfield></entry>
8463 <entry><structfield>integer</structfield></entry>
8465 Line number of this rule in <filename>pg_hba.conf</>
8469 <entry><structfield>type</structfield></entry>
8470 <entry><structfield>text</structfield></entry>
8471 <entry>Type of connection</entry>
8474 <entry><structfield>database</structfield></entry>
8475 <entry><structfield>text[]</structfield></entry>
8476 <entry>List of database name(s) to which this rule applies</entry>
8479 <entry><structfield>user_name</structfield></entry>
8480 <entry><structfield>text[]</structfield></entry>
8481 <entry>List of user and group name(s) to which this rule applies</entry>
8484 <entry><structfield>address</structfield></entry>
8485 <entry><structfield>text</structfield></entry>
8487 Host name or IP address, or one
8488 of <literal>all</literal>, <literal>samehost</literal>,
8489 or <literal>samenet</literal>, or null for local connections
8493 <entry><structfield>netmask</structfield></entry>
8494 <entry><structfield>text</structfield></entry>
8495 <entry>IP address mask, or null if not applicable</entry>
8498 <entry><structfield>auth_method</structfield></entry>
8499 <entry><type>text</type></entry>
8500 <entry>Authentication method</entry>
8503 <entry><structfield>options</structfield></entry>
8504 <entry><type>text[]</type></entry>
8505 <entry>Options specified for authentication method, if any</entry>
8508 <entry><structfield>error</structfield></entry>
8509 <entry><structfield>text</structfield></entry>
8511 If not null, an error message indicating why this
8512 line could not be processed
8520 Usually, a row reflecting an incorrect entry will have values for only
8521 the <structfield>line_number</> and <structfield>error</> fields.
8525 See <xref linkend="client-authentication"> for more information about
8526 client authentication configuration.
8530 <sect1 id="view-pg-indexes">
8531 <title><structname>pg_indexes</structname></title>
8533 <indexterm zone="view-pg-indexes">
8534 <primary>pg_indexes</primary>
8538 The view <structname>pg_indexes</structname> provides access to
8539 useful information about each index in the database.
8543 <title><structname>pg_indexes</> Columns</title>
8550 <entry>References</entry>
8551 <entry>Description</entry>
8556 <entry><structfield>schemaname</structfield></entry>
8557 <entry><type>name</type></entry>
8558 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8559 <entry>Name of schema containing table and index</entry>
8562 <entry><structfield>tablename</structfield></entry>
8563 <entry><type>name</type></entry>
8564 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8565 <entry>Name of table the index is for</entry>
8568 <entry><structfield>indexname</structfield></entry>
8569 <entry><type>name</type></entry>
8570 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8571 <entry>Name of index</entry>
8574 <entry><structfield>tablespace</structfield></entry>
8575 <entry><type>name</type></entry>
8576 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8577 <entry>Name of tablespace containing index (null if default for database)</entry>
8580 <entry><structfield>indexdef</structfield></entry>
8581 <entry><type>text</type></entry>
8583 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8592 <sect1 id="view-pg-locks">
8593 <title><structname>pg_locks</structname></title>
8595 <indexterm zone="view-pg-locks">
8596 <primary>pg_locks</primary>
8600 The view <structname>pg_locks</structname> provides access to
8601 information about the locks held by active processes within the
8602 database server. See <xref linkend="mvcc"> for more discussion
8607 <structname>pg_locks</structname> contains one row per active lockable
8608 object, requested lock mode, and relevant process. Thus, the same
8609 lockable object might
8610 appear many times, if multiple processes are holding or waiting
8611 for locks on it. However, an object that currently has no locks on it
8612 will not appear at all.
8616 There are several distinct types of lockable objects:
8617 whole relations (e.g., tables), individual pages of relations,
8618 individual tuples of relations,
8619 transaction IDs (both virtual and permanent IDs),
8620 and general database objects (identified by class OID and object OID,
8621 in the same way as in <structname>pg_description</structname> or
8622 <structname>pg_depend</structname>). Also, the right to extend a
8623 relation is represented as a separate lockable object.
8624 Also, <quote>advisory</> locks can be taken on numbers that have
8625 user-defined meanings.
8629 <title><structname>pg_locks</> Columns</title>
8636 <entry>References</entry>
8637 <entry>Description</entry>
8642 <entry><structfield>locktype</structfield></entry>
8643 <entry><type>text</type></entry>
8646 Type of the lockable object:
8647 <literal>relation</>,
8651 <literal>transactionid</>,
8652 <literal>virtualxid</>,
8654 <literal>userlock</>, or
8655 <literal>advisory</>
8659 <entry><structfield>database</structfield></entry>
8660 <entry><type>oid</type></entry>
8661 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8663 OID of the database in which the lock target exists, or
8664 zero if the target is a shared object, or
8665 null if the target is a transaction ID
8669 <entry><structfield>relation</structfield></entry>
8670 <entry><type>oid</type></entry>
8671 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8673 OID of the relation targeted by the lock, or null if the target is not
8674 a relation or part of a relation
8678 <entry><structfield>page</structfield></entry>
8679 <entry><type>integer</type></entry>
8682 Page number targeted by the lock within the relation,
8683 or null if the target is not a relation page or tuple
8687 <entry><structfield>tuple</structfield></entry>
8688 <entry><type>smallint</type></entry>
8691 Tuple number targeted by the lock within the page,
8692 or null if the target is not a tuple
8696 <entry><structfield>virtualxid</structfield></entry>
8697 <entry><type>text</type></entry>
8700 Virtual ID of the transaction targeted by the lock,
8701 or null if the target is not a virtual transaction ID
8705 <entry><structfield>transactionid</structfield></entry>
8706 <entry><type>xid</type></entry>
8709 ID of the transaction targeted by the lock,
8710 or null if the target is not a transaction ID
8714 <entry><structfield>classid</structfield></entry>
8715 <entry><type>oid</type></entry>
8716 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8718 OID of the system catalog containing the lock target, or null if the
8719 target is not a general database object
8723 <entry><structfield>objid</structfield></entry>
8724 <entry><type>oid</type></entry>
8725 <entry>any OID column</entry>
8727 OID of the lock target within its system catalog, or null if the
8728 target is not a general database object
8732 <entry><structfield>objsubid</structfield></entry>
8733 <entry><type>smallint</type></entry>
8736 Column number targeted by the lock (the
8737 <structfield>classid</> and <structfield>objid</> refer to the
8739 or zero if the target is some other general database object,
8740 or null if the target is not a general database object
8744 <entry><structfield>virtualtransaction</structfield></entry>
8745 <entry><type>text</type></entry>
8748 Virtual ID of the transaction that is holding or awaiting this lock
8752 <entry><structfield>pid</structfield></entry>
8753 <entry><type>integer</type></entry>
8756 Process ID of the server process holding or awaiting this
8757 lock, or null if the lock is held by a prepared transaction
8761 <entry><structfield>mode</structfield></entry>
8762 <entry><type>text</type></entry>
8764 <entry>Name of the lock mode held or desired by this process (see <xref
8765 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8768 <entry><structfield>granted</structfield></entry>
8769 <entry><type>boolean</type></entry>
8771 <entry>True if lock is held, false if lock is awaited</entry>
8774 <entry><structfield>fastpath</structfield></entry>
8775 <entry><type>boolean</type></entry>
8777 <entry>True if lock was taken via fast path, false if taken via main
8785 <structfield>granted</structfield> is true in a row representing a lock
8786 held by the indicated process. False indicates that this process is
8787 currently waiting to acquire this lock, which implies that at least one
8788 other process is holding or waiting for a conflicting lock mode on the same
8789 lockable object. The waiting process will sleep until the other lock is
8790 released (or a deadlock situation is detected). A single process can be
8791 waiting to acquire at most one lock at a time.
8795 Throughout running a transaction, a server process holds an exclusive lock
8796 on the transaction's virtual transaction ID. If a permanent ID is assigned
8797 to the transaction (which normally happens only if the transaction changes
8798 the state of the database), it also holds an exclusive lock on the
8799 transaction's permanent transaction ID until it ends. When a process finds
8800 it necessary to wait specifically for another transaction to end, it does
8801 so by attempting to acquire share lock on the other transaction's ID
8802 (either virtual or permanent ID depending on the situation). That will
8803 succeed only when the other transaction terminates and releases its locks.
8807 Although tuples are a lockable type of object,
8808 information about row-level locks is stored on disk, not in memory,
8809 and therefore row-level locks normally do not appear in this view.
8810 If a process is waiting for a
8811 row-level lock, it will usually appear in the view as waiting for the
8812 permanent transaction ID of the current holder of that row lock.
8816 Advisory locks can be acquired on keys consisting of either a single
8817 <type>bigint</type> value or two integer values.
8818 A <type>bigint</type> key is displayed with its
8819 high-order half in the <structfield>classid</> column, its low-order half
8820 in the <structfield>objid</> column, and <structfield>objsubid</> equal
8821 to 1. The original <type>bigint</type> value can be reassembled with the
8822 expression <literal>(classid::bigint << 32) |
8823 objid::bigint</literal>. Integer keys are displayed with the
8825 <structfield>classid</> column, the second key in the <structfield>objid</>
8826 column, and <structfield>objsubid</> equal to 2. The actual meaning of
8827 the keys is up to the user. Advisory locks are local to each database,
8828 so the <structfield>database</> column is meaningful for an advisory lock.
8832 <structname>pg_locks</structname> provides a global view of all locks
8833 in the database cluster, not only those relevant to the current database.
8834 Although its <structfield>relation</structfield> column can be joined
8835 against <structname>pg_class</>.<structfield>oid</> to identify locked
8836 relations, this will only work correctly for relations in the current
8837 database (those for which the <structfield>database</structfield> column
8838 is either the current database's OID or zero).
8842 The <structfield>pid</structfield> column can be joined to the
8843 <structfield>pid</structfield> column of the <link
8844 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8846 information on the session holding or awaiting each lock,
8849 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8850 ON pl.pid = psa.pid;
8852 Also, if you are using prepared transactions, the
8853 <structfield>virtualtransaction</> column can be joined to the
8854 <structfield>transaction</structfield> column of the <link
8855 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8856 view to get more information on prepared transactions that hold locks.
8857 (A prepared transaction can never be waiting for a lock,
8858 but it continues to hold the locks it acquired while running.)
8861 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8862 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8867 While it is possible to obtain information about which processes block
8868 which other processes by joining <structname>pg_locks</structname> against
8869 itself, this is very difficult to get right in detail. Such a query would
8870 have to encode knowledge about which lock modes conflict with which
8871 others. Worse, the <structname>pg_locks</structname> view does not expose
8872 information about which processes are ahead of which others in lock wait
8873 queues, nor information about which processes are parallel workers running
8874 on behalf of which other client sessions. It is better to use
8875 the <function>pg_blocking_pids()</> function
8876 (see <xref linkend="functions-info-session-table">) to identify which
8877 process(es) a waiting process is blocked behind.
8881 The <structname>pg_locks</structname> view displays data from both the
8882 regular lock manager and the predicate lock manager, which are
8883 separate systems; in addition, the regular lock manager subdivides its
8884 locks into regular and <firstterm>fast-path</> locks.
8885 This data is not guaranteed to be entirely consistent.
8886 When the view is queried,
8887 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8888 is gathered from each backend one at a time, without freezing the state of
8889 the entire lock manager, so it is possible for locks to be taken or
8890 released while information is gathered. Note, however, that these locks are
8891 known not to conflict with any other lock currently in place. After
8892 all backends have been queried for fast-path locks, the remainder of the
8893 regular lock manager is locked as a unit, and a consistent snapshot of all
8894 remaining locks is collected as an atomic action. After unlocking the
8895 regular lock manager, the predicate lock manager is similarly locked and all
8896 predicate locks are collected as an atomic action. Thus, with the exception
8897 of fast-path locks, each lock manager will deliver a consistent set of
8898 results, but as we do not lock both lock managers simultaneously, it is
8899 possible for locks to be taken or released after we interrogate the regular
8900 lock manager and before we interrogate the predicate lock manager.
8904 Locking the regular and/or predicate lock manager could have some
8905 impact on database performance if this view is very frequently accessed.
8906 The locks are held only for the minimum amount of time necessary to
8907 obtain data from the lock managers, but this does not completely eliminate
8908 the possibility of a performance impact.
8913 <sect1 id="view-pg-matviews">
8914 <title><structname>pg_matviews</structname></title>
8916 <indexterm zone="view-pg-matviews">
8917 <primary>pg_matviews</primary>
8920 <indexterm zone="view-pg-matviews">
8921 <primary>materialized views</primary>
8925 The view <structname>pg_matviews</structname> provides access to
8926 useful information about each materialized view in the database.
8930 <title><structname>pg_matviews</> Columns</title>
8937 <entry>References</entry>
8938 <entry>Description</entry>
8943 <entry><structfield>schemaname</structfield></entry>
8944 <entry><type>name</type></entry>
8945 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8946 <entry>Name of schema containing materialized view</entry>
8949 <entry><structfield>matviewname</structfield></entry>
8950 <entry><type>name</type></entry>
8951 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8952 <entry>Name of materialized view</entry>
8955 <entry><structfield>matviewowner</structfield></entry>
8956 <entry><type>name</type></entry>
8957 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8958 <entry>Name of materialized view's owner</entry>
8961 <entry><structfield>tablespace</structfield></entry>
8962 <entry><type>name</type></entry>
8963 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8964 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8967 <entry><structfield>hasindexes</structfield></entry>
8968 <entry><type>boolean</type></entry>
8970 <entry>True if materialized view has (or recently had) any indexes</entry>
8973 <entry><structfield>ispopulated</structfield></entry>
8974 <entry><type>boolean</type></entry>
8976 <entry>True if materialized view is currently populated</entry>
8979 <entry><structfield>definition</structfield></entry>
8980 <entry><type>text</type></entry>
8982 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8990 <sect1 id="view-pg-policies">
8991 <title><structname>pg_policies</structname></title>
8993 <indexterm zone="view-pg-policies">
8994 <primary>pg_policies</primary>
8998 The view <structname>pg_policies</structname> provides access to
8999 useful information about each row-level security policy in the database.
9003 <title><structname>pg_policies</> Columns</title>
9010 <entry>References</entry>
9011 <entry>Description</entry>
9016 <entry><structfield>schemaname</structfield></entry>
9017 <entry><type>name</type></entry>
9018 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9019 <entry>Name of schema containing table policy is on</entry>
9022 <entry><structfield>tablename</structfield></entry>
9023 <entry><type>name</type></entry>
9024 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9025 <entry>Name of table policy is on</entry>
9028 <entry><structfield>policyname</structfield></entry>
9029 <entry><type>name</type></entry>
9030 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
9031 <entry>Name of policy</entry>
9034 <entry><structfield>polpermissive</structfield></entry>
9035 <entry><type>text</type></entry>
9037 <entry>Is the policy permissive or restrictive?</entry>
9040 <entry><structfield>roles</structfield></entry>
9041 <entry><type>name[]</type></entry>
9043 <entry>The roles to which this policy applies</entry>
9046 <entry><structfield>cmd</structfield></entry>
9047 <entry><type>text</type></entry>
9049 <entry>The command type to which the policy is applied</entry>
9052 <entry><structfield>qual</structfield></entry>
9053 <entry><type>text</type></entry>
9055 <entry>The expression added to the security barrier qualifications for
9056 queries that this policy applies to</entry>
9059 <entry><structfield>with_check</structfield></entry>
9060 <entry><type>text</type></entry>
9062 <entry>The expression added to the WITH CHECK qualifications for
9063 queries that attempt to add rows to this table</entry>
9071 <sect1 id="view-pg-prepared-statements">
9072 <title><structname>pg_prepared_statements</structname></title>
9074 <indexterm zone="view-pg-prepared-statements">
9075 <primary>pg_prepared_statements</primary>
9079 The <structname>pg_prepared_statements</structname> view displays
9080 all the prepared statements that are available in the current
9081 session. See <xref linkend="sql-prepare"> for more information about prepared
9086 <structname>pg_prepared_statements</structname> contains one row
9087 for each prepared statement. Rows are added to the view when a new
9088 prepared statement is created and removed when a prepared statement
9089 is released (for example, via the <xref linkend="sql-deallocate"> command).
9093 <title><structname>pg_prepared_statements</> Columns</title>
9100 <entry>Description</entry>
9105 <entry><structfield>name</structfield></entry>
9106 <entry><type>text</type></entry>
9108 The identifier of the prepared statement
9112 <entry><structfield>statement</structfield></entry>
9113 <entry><type>text</type></entry>
9115 The query string submitted by the client to create this
9116 prepared statement. For prepared statements created via SQL,
9117 this is the <command>PREPARE</command> statement submitted by
9118 the client. For prepared statements created via the
9119 frontend/backend protocol, this is the text of the prepared
9124 <entry><structfield>prepare_time</structfield></entry>
9125 <entry><type>timestamptz</type></entry>
9127 The time at which the prepared statement was created
9131 <entry><structfield>parameter_types</structfield></entry>
9132 <entry><type>regtype[]</type></entry>
9134 The expected parameter types for the prepared statement in the
9135 form of an array of <type>regtype</type>. The OID corresponding
9136 to an element of this array can be obtained by casting the
9137 <type>regtype</type> value to <type>oid</type>.
9141 <entry><structfield>from_sql</structfield></entry>
9142 <entry><type>boolean</type></entry>
9144 <literal>true</literal> if the prepared statement was created
9145 via the <command>PREPARE</command> SQL command;
9146 <literal>false</literal> if the statement was prepared via the
9147 frontend/backend protocol
9155 The <structname>pg_prepared_statements</structname> view is read only.
9159 <sect1 id="view-pg-prepared-xacts">
9160 <title><structname>pg_prepared_xacts</structname></title>
9162 <indexterm zone="view-pg-prepared-xacts">
9163 <primary>pg_prepared_xacts</primary>
9167 The view <structname>pg_prepared_xacts</structname> displays
9168 information about transactions that are currently prepared for two-phase
9169 commit (see <xref linkend="sql-prepare-transaction"> for details).
9173 <structname>pg_prepared_xacts</structname> contains one row per prepared
9174 transaction. An entry is removed when the transaction is committed or
9179 <title><structname>pg_prepared_xacts</> Columns</title>
9186 <entry>References</entry>
9187 <entry>Description</entry>
9192 <entry><structfield>transaction</structfield></entry>
9193 <entry><type>xid</type></entry>
9196 Numeric transaction identifier of the prepared transaction
9200 <entry><structfield>gid</structfield></entry>
9201 <entry><type>text</type></entry>
9204 Global transaction identifier that was assigned to the transaction
9208 <entry><structfield>prepared</structfield></entry>
9209 <entry><type>timestamp with time zone</type></entry>
9212 Time at which the transaction was prepared for commit
9216 <entry><structfield>owner</structfield></entry>
9217 <entry><type>name</type></entry>
9218 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9220 Name of the user that executed the transaction
9224 <entry><structfield>database</structfield></entry>
9225 <entry><type>name</type></entry>
9226 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9228 Name of the database in which the transaction was executed
9236 When the <structname>pg_prepared_xacts</structname> view is accessed, the
9237 internal transaction manager data structures are momentarily locked, and
9238 a copy is made for the view to display. This ensures that the
9239 view produces a consistent set of results, while not blocking
9240 normal operations longer than necessary. Nonetheless
9241 there could be some impact on database performance if this view is
9242 frequently accessed.
9247 <sect1 id="view-pg-publication-tables">
9248 <title><structname>pg_publication_tables</structname></title>
9250 <indexterm zone="view-pg-publication-tables">
9251 <primary>pg_publication_tables</primary>
9255 The view <structname>pg_publication_tables</structname> provides
9256 information about the mapping between publications and the tables they
9257 contain. Unlike the underlying
9258 catalog <structname>pg_publication_rel</structname>, this view expands
9259 publications defined as <literal>FOR ALL TABLES</literal>, so for such
9260 publications there will be a row for each eligible table.
9264 <title><structname>pg_publication_tables</structname> Columns</title>
9271 <entry>References</entry>
9272 <entry>Description</entry>
9278 <entry><structfield>pubname</structfield></entry>
9279 <entry><type>name</type></entry>
9280 <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
9281 <entry>Name of publication</entry>
9285 <entry><structfield>schemaname</structfield></entry>
9286 <entry><type>name</type></entry>
9287 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9288 <entry>Name of schema containing table</entry>
9292 <entry><structfield>tablename</structfield></entry>
9293 <entry><type>name</type></entry>
9294 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9295 <entry>Name of table</entry>
9302 <sect1 id="view-pg-replication-origin-status">
9303 <title><structname>pg_replication_origin_status</structname></title>
9305 <indexterm zone="view-pg-replication-origin-status">
9306 <primary>pg_replication_origin_status</primary>
9310 The <structname>pg_replication_origin_status</structname> view
9311 contains information about how far replay for a certain origin has
9312 progressed. For more on replication origins
9313 see <xref linkend="replication-origins">.
9318 <title><structname>pg_replication_origin_status</structname> Columns</title>
9325 <entry>References</entry>
9326 <entry>Description</entry>
9332 <entry><structfield>local_id</structfield></entry>
9333 <entry><type>Oid</type></entry>
9334 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
9335 <entry>internal node identifier</entry>
9339 <entry><structfield>external_id</structfield></entry>
9340 <entry><type>text</type></entry>
9341 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
9342 <entry>external node identifier</entry>
9346 <entry><structfield>remote_lsn</structfield></entry>
9347 <entry><type>pg_lsn</type></entry>
9349 <entry>The origin node's LSN up to which data has been replicated.</entry>
9353 <entry><structfield>local_lsn</structfield></entry>
9354 <entry><type>pg_lsn</type></entry>
9357 This node's LSN at which <literal>remote_lsn</literal> has
9358 been replicated. Used to flush commit records before persisting
9359 data to disk when using asynchronous commits.
9367 <sect1 id="view-pg-replication-slots">
9368 <title><structname>pg_replication_slots</structname></title>
9370 <indexterm zone="view-pg-replication-slots">
9371 <primary>pg_replication_slots</primary>
9375 The <structname>pg_replication_slots</structname> view provides a listing
9376 of all replication slots that currently exist on the database cluster,
9377 along with their current state.
9381 For more on replication slots,
9382 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
9387 <title><structname>pg_replication_slots</structname> Columns</title>
9394 <entry>References</entry>
9395 <entry>Description</entry>
9401 <entry><structfield>slot_name</structfield></entry>
9402 <entry><type>name</type></entry>
9404 <entry>A unique, cluster-wide identifier for the replication slot</entry>
9408 <entry><structfield>plugin</structfield></entry>
9409 <entry><type>name</type></entry>
9411 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
9415 <entry><structfield>slot_type</structfield></entry>
9416 <entry><type>text</type></entry>
9418 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
9422 <entry><structfield>datoid</structfield></entry>
9423 <entry><type>oid</type></entry>
9424 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9425 <entry>The OID of the database this slot is associated with, or
9426 null. Only logical slots have an associated database.</entry>
9430 <entry><structfield>database</structfield></entry>
9431 <entry><type>text</type></entry>
9432 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9433 <entry>The name of the database this slot is associated with, or
9434 null. Only logical slots have an associated database.</entry>
9438 <entry><structfield>temporary</structfield></entry>
9439 <entry><type>boolean</type></entry>
9441 <entry>True if this is a temporary replication slot. Temporary slots are
9442 not saved to disk and are automatically dropped on error or when
9443 the session has finished.</entry>
9447 <entry><structfield>active</structfield></entry>
9448 <entry><type>boolean</type></entry>
9450 <entry>True if this slot is currently actively being used</entry>
9454 <entry><structfield>active_pid</structfield></entry>
9455 <entry><type>integer</type></entry>
9457 <entry>The process ID of the session using this slot if the slot
9458 is currently actively being used. <literal>NULL</literal> if
9464 <entry><structfield>xmin</structfield></entry>
9465 <entry><type>xid</type></entry>
9467 <entry>The oldest transaction that this slot needs the database to
9468 retain. <literal>VACUUM</literal> cannot remove tuples deleted
9469 by any later transaction.
9474 <entry><structfield>catalog_xmin</structfield></entry>
9475 <entry><type>xid</type></entry>
9477 <entry>The oldest transaction affecting the system catalogs that this
9478 slot needs the database to retain. <literal>VACUUM</literal> cannot
9479 remove catalog tuples deleted by any later transaction.
9484 <entry><structfield>restart_lsn</structfield></entry>
9485 <entry><type>pg_lsn</type></entry>
9487 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
9488 might be required by the consumer of this slot and thus won't be
9489 automatically removed during checkpoints.
9494 <entry><structfield>confirmed_flush_lsn</structfield></entry>
9495 <entry><type>pg_lsn</type></entry>
9497 <entry>The address (<literal>LSN</literal>) up to which the logical
9498 slot's consumer has confirmed receiving data. Data older than this is
9499 not available anymore. <literal>NULL</> for physical slots.
9508 <sect1 id="view-pg-roles">
9509 <title><structname>pg_roles</structname></title>
9511 <indexterm zone="view-pg-roles">
9512 <primary>pg_roles</primary>
9516 The view <structname>pg_roles</structname> provides access to
9517 information about database roles. This is simply a publicly
9519 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9520 that blanks out the password field.
9524 This view explicitly exposes the OID column of the underlying table,
9525 since that is needed to do joins to other catalogs.
9529 <title><structname>pg_roles</> Columns</title>
9536 <entry>References</entry>
9537 <entry>Description</entry>
9543 <entry><structfield>rolname</structfield></entry>
9544 <entry><type>name</type></entry>
9546 <entry>Role name</entry>
9550 <entry><structfield>rolsuper</structfield></entry>
9551 <entry><type>bool</type></entry>
9553 <entry>Role has superuser privileges</entry>
9557 <entry><structfield>rolinherit</structfield></entry>
9558 <entry><type>bool</type></entry>
9560 <entry>Role automatically inherits privileges of roles it is a
9565 <entry><structfield>rolcreaterole</structfield></entry>
9566 <entry><type>bool</type></entry>
9568 <entry>Role can create more roles</entry>
9572 <entry><structfield>rolcreatedb</structfield></entry>
9573 <entry><type>bool</type></entry>
9575 <entry>Role can create databases</entry>
9579 <entry><structfield>rolcanlogin</structfield></entry>
9580 <entry><type>bool</type></entry>
9583 Role can log in. That is, this role can be given as the initial
9584 session authorization identifier
9589 <entry><structfield>rolreplication</structfield></entry>
9590 <entry><type>bool</type></entry>
9593 Role is a replication role. That is, this role can initiate streaming
9594 replication (see <xref linkend="streaming-replication">) and set/unset
9595 the system backup mode using <function>pg_start_backup</> and
9596 <function>pg_stop_backup</>
9601 <entry><structfield>rolconnlimit</structfield></entry>
9602 <entry><type>int4</type></entry>
9605 For roles that can log in, this sets maximum number of concurrent
9606 connections this role can make. -1 means no limit.
9611 <entry><structfield>rolpassword</structfield></entry>
9612 <entry><type>text</type></entry>
9614 <entry>Not the password (always reads as <literal>********</>)</entry>
9618 <entry><structfield>rolvaliduntil</structfield></entry>
9619 <entry><type>timestamptz</type></entry>
9621 <entry>Password expiry time (only used for password authentication);
9622 null if no expiration</entry>
9626 <entry><structfield>rolbypassrls</structfield></entry>
9627 <entry><type>bool</type></entry>
9630 Role bypasses every row level security policy, see
9631 <xref linkend="ddl-rowsecurity"> for more information.
9636 <entry><structfield>rolconfig</structfield></entry>
9637 <entry><type>text[]</type></entry>
9639 <entry>Role-specific defaults for run-time configuration variables</entry>
9643 <entry><structfield>oid</structfield></entry>
9644 <entry><type>oid</type></entry>
9645 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9646 <entry>ID of role</entry>
9654 <sect1 id="view-pg-rules">
9655 <title><structname>pg_rules</structname></title>
9657 <indexterm zone="view-pg-rules">
9658 <primary>pg_rules</primary>
9662 The view <structname>pg_rules</structname> provides access to
9663 useful information about query rewrite rules.
9667 <title><structname>pg_rules</> Columns</title>
9674 <entry>References</entry>
9675 <entry>Description</entry>
9680 <entry><structfield>schemaname</structfield></entry>
9681 <entry><type>name</type></entry>
9682 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9683 <entry>Name of schema containing table</entry>
9686 <entry><structfield>tablename</structfield></entry>
9687 <entry><type>name</type></entry>
9688 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9689 <entry>Name of table the rule is for</entry>
9692 <entry><structfield>rulename</structfield></entry>
9693 <entry><type>name</type></entry>
9694 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
9695 <entry>Name of rule</entry>
9698 <entry><structfield>definition</structfield></entry>
9699 <entry><type>text</type></entry>
9701 <entry>Rule definition (a reconstructed creation command)</entry>
9708 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
9709 of views and materialized views; those can be seen in
9710 <structname>pg_views</> and <structname>pg_matviews</>.
9715 <sect1 id="view-pg-seclabels">
9716 <title><structname>pg_seclabels</structname></title>
9718 <indexterm zone="view-pg-seclabels">
9719 <primary>pg_seclabels</primary>
9723 The view <structname>pg_seclabels</structname> provides information about
9724 security labels. It as an easier-to-query version of the
9725 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9729 <title><structname>pg_seclabels</> Columns</title>
9736 <entry>References</entry>
9737 <entry>Description</entry>
9742 <entry><structfield>objoid</structfield></entry>
9743 <entry><type>oid</type></entry>
9744 <entry>any OID column</entry>
9745 <entry>The OID of the object this security label pertains to</entry>
9748 <entry><structfield>classoid</structfield></entry>
9749 <entry><type>oid</type></entry>
9750 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9751 <entry>The OID of the system catalog this object appears in</entry>
9754 <entry><structfield>objsubid</structfield></entry>
9755 <entry><type>int4</type></entry>
9758 For a security label on a table column, this is the column number (the
9759 <structfield>objoid</> and <structfield>classoid</> refer to
9760 the table itself). For all other object types, this column is
9765 <entry><structfield>objtype</structfield></entry>
9766 <entry><type>text</type></entry>
9769 The type of object to which this label applies, as text.
9773 <entry><structfield>objnamespace</structfield></entry>
9774 <entry><type>oid</type></entry>
9775 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9777 The OID of the namespace for this object, if applicable;
9782 <entry><structfield>objname</structfield></entry>
9783 <entry><type>text</type></entry>
9786 The name of the object to which this label applies, as text.
9790 <entry><structfield>provider</structfield></entry>
9791 <entry><type>text</type></entry>
9792 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9793 <entry>The label provider associated with this label.</entry>
9796 <entry><structfield>label</structfield></entry>
9797 <entry><type>text</type></entry>
9798 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
9799 <entry>The security label applied to this object.</entry>
9806 <sect1 id="view-pg-sequences">
9807 <title><structname>pg_sequences</structname></title>
9809 <indexterm zone="view-pg-sequences">
9810 <primary>pg_sequences</primary>
9814 The view <structname>pg_sequences</structname> provides access to
9815 useful information about each sequence in the database.
9819 <title><structname>pg_sequences</> Columns</title>
9826 <entry>References</entry>
9827 <entry>Description</entry>
9832 <entry><structfield>schemaname</structfield></entry>
9833 <entry><type>name</type></entry>
9834 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9835 <entry>Name of schema containing sequence</entry>
9838 <entry><structfield>sequencename</structfield></entry>
9839 <entry><type>name</type></entry>
9840 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9841 <entry>Name of sequence</entry>
9844 <entry><structfield>sequenceowner</structfield></entry>
9845 <entry><type>name</type></entry>
9846 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9847 <entry>Name of sequence's owner</entry>
9850 <entry><structfield>data_type</structfield></entry>
9851 <entry><type>regtype</type></entry>
9852 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_type</structname></link>.oid</literal></entry>
9853 <entry>Data type of the sequence</entry>
9856 <entry><structfield>start_value</structfield></entry>
9857 <entry><type>bigint</type></entry>
9859 <entry>Start value of the sequence</entry>
9862 <entry><structfield>min_value</structfield></entry>
9863 <entry><type>bigint</type></entry>
9865 <entry>Minimum value of the sequence</entry>
9868 <entry><structfield>max_value</structfield></entry>
9869 <entry><type>bigint</type></entry>
9871 <entry>Maximum value of the sequence</entry>
9874 <entry><structfield>increment_by</structfield></entry>
9875 <entry><type>bigint</type></entry>
9877 <entry>Increment value of the sequence</entry>
9880 <entry><structfield>cycle</structfield></entry>
9881 <entry><type>boolean</type></entry>
9883 <entry>Whether the sequence cycles</entry>
9886 <entry><structfield>cache_size</structfield></entry>
9887 <entry><type>bigint</type></entry>
9889 <entry>Cache size of the sequence</entry>
9892 <entry><structfield>last_value</structfield></entry>
9893 <entry><type>bigint</type></entry>
9895 <entry>The last sequence value written to disk. If caching is used,
9896 this value can be greater than the last value handed out from the
9897 sequence. Null if the sequence has not been read from yet. Also, if
9898 the current user does not have <literal>USAGE</literal>
9899 or <literal>SELECT</literal> privilege on the sequence, the value is
9907 <sect1 id="view-pg-settings">
9908 <title><structname>pg_settings</structname></title>
9910 <indexterm zone="view-pg-settings">
9911 <primary>pg_settings</primary>
9915 The view <structname>pg_settings</structname> provides access to
9916 run-time parameters of the server. It is essentially an alternative
9917 interface to the <xref linkend="sql-show">
9918 and <xref linkend="sql-set"> commands.
9919 It also provides access to some facts about each parameter that are
9920 not directly available from <command>SHOW</>, such as minimum and
9925 <title><structname>pg_settings</> Columns</title>
9932 <entry>Description</entry>
9937 <entry><structfield>name</structfield></entry>
9938 <entry><type>text</type></entry>
9939 <entry>Run-time configuration parameter name</entry>
9942 <entry><structfield>setting</structfield></entry>
9943 <entry><type>text</type></entry>
9944 <entry>Current value of the parameter</entry>
9947 <entry><structfield>unit</structfield></entry>
9948 <entry><type>text</type></entry>
9949 <entry>Implicit unit of the parameter</entry>
9952 <entry><structfield>category</structfield></entry>
9953 <entry><type>text</type></entry>
9954 <entry>Logical group of the parameter</entry>
9957 <entry><structfield>short_desc</structfield></entry>
9958 <entry><type>text</type></entry>
9959 <entry>A brief description of the parameter</entry>
9962 <entry><structfield>extra_desc</structfield></entry>
9963 <entry><type>text</type></entry>
9964 <entry>Additional, more detailed, description of the parameter</entry>
9967 <entry><structfield>context</structfield></entry>
9968 <entry><type>text</type></entry>
9969 <entry>Context required to set the parameter's value (see below)</entry>
9972 <entry><structfield>vartype</structfield></entry>
9973 <entry><type>text</type></entry>
9974 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
9975 <literal>integer</>, <literal>real</>, or <literal>string</>)
9979 <entry><structfield>source</structfield></entry>
9980 <entry><type>text</type></entry>
9981 <entry>Source of the current parameter value</entry>
9984 <entry><structfield>min_val</structfield></entry>
9985 <entry><type>text</type></entry>
9986 <entry>Minimum allowed value of the parameter (null for non-numeric
9990 <entry><structfield>max_val</structfield></entry>
9991 <entry><type>text</type></entry>
9992 <entry>Maximum allowed value of the parameter (null for non-numeric
9996 <entry><structfield>enumvals</structfield></entry>
9997 <entry><type>text[]</type></entry>
9998 <entry>Allowed values of an enum parameter (null for non-enum
10002 <entry><structfield>boot_val</structfield></entry>
10003 <entry><type>text</type></entry>
10004 <entry>Parameter value assumed at server startup if the parameter is
10005 not otherwise set</entry>
10008 <entry><structfield>reset_val</structfield></entry>
10009 <entry><type>text</type></entry>
10010 <entry>Value that <command>RESET</command> would reset the parameter to
10011 in the current session</entry>
10014 <entry><structfield>sourcefile</structfield></entry>
10015 <entry><type>text</type></entry>
10016 <entry>Configuration file the current value was set in (null for
10017 values set from sources other than configuration files, or when
10018 examined by a non-superuser);
10019 helpful when using <literal>include</> directives in configuration files</entry>
10022 <entry><structfield>sourceline</structfield></entry>
10023 <entry><type>integer</type></entry>
10024 <entry>Line number within the configuration file the current value was
10025 set at (null for values set from sources other than configuration files,
10026 or when examined by a non-superuser)
10030 <entry><structfield>pending_restart</structfield></entry>
10031 <entry><type>boolean</type></entry>
10032 <entry><literal>true</literal> if the value has been changed in the
10033 configuration file but needs a restart; or <literal>false</literal>
10042 There are several possible values of <structfield>context</structfield>.
10043 In order of decreasing difficulty of changing the setting, they are:
10048 <!-- PGC_INTERNAL -->
10049 <term><literal>internal</literal></term>
10052 These settings cannot be changed directly; they reflect internally
10053 determined values. Some of them may be adjustable by rebuilding the
10054 server with different configuration options, or by changing options
10055 supplied to <command>initdb</command>.
10060 <!-- PGC_POSTMASTER -->
10061 <term><literal>postmaster</literal></term>
10064 These settings can only be applied when the server starts, so any change
10065 requires restarting the server. Values for these settings are typically
10066 stored in the <filename>postgresql.conf</filename> file, or passed on
10067 the command line when starting the server. Of course, settings with any
10068 of the lower <structfield>context</structfield> types can also be
10069 set at server start time.
10074 <!-- PGC_SIGHUP -->
10075 <term><literal>sighup</literal></term>
10078 Changes to these settings can be made in
10079 <filename>postgresql.conf</filename> without restarting the server.
10080 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
10081 cause it to re-read <filename>postgresql.conf</filename> and apply
10082 the changes. The postmaster will also forward the
10083 <systemitem>SIGHUP</systemitem> signal to its child processes so that
10084 they all pick up the new value.
10089 <!-- PGC_SU_BACKEND -->
10090 <term><literal>superuser-backend</literal></term>
10093 Changes to these settings can be made in
10094 <filename>postgresql.conf</filename> without restarting the server.
10095 They can also be set for a particular session in the connection request
10096 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10097 environment variable), but only if the connecting user is a superuser.
10098 However, these settings never change in a session after it is started.
10099 If you change them in <filename>postgresql.conf</filename>, send a
10100 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10101 re-read <filename>postgresql.conf</filename>. The new values will only
10102 affect subsequently-launched sessions.
10107 <!-- PGC_BACKEND -->
10108 <term><literal>backend</literal></term>
10111 Changes to these settings can be made in
10112 <filename>postgresql.conf</filename> without restarting the server.
10113 They can also be set for a particular session in the connection request
10114 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10115 environment variable); any user can make such a change for their session.
10116 However, these settings never change in a session after it is started.
10117 If you change them in <filename>postgresql.conf</filename>, send a
10118 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10119 re-read <filename>postgresql.conf</filename>. The new values will only
10120 affect subsequently-launched sessions.
10126 <term><literal>superuser</literal></term>
10129 These settings can be set from <filename>postgresql.conf</filename>,
10130 or within a session via the <command>SET</> command; but only superusers
10131 can change them via <command>SET</>. Changes in
10132 <filename>postgresql.conf</filename> will affect existing sessions
10133 only if no session-local value has been established with <command>SET</>.
10138 <!-- PGC_USERSET -->
10139 <term><literal>user</literal></term>
10142 These settings can be set from <filename>postgresql.conf</filename>,
10143 or within a session via the <command>SET</> command. Any user is
10144 allowed to change their session-local value. Changes in
10145 <filename>postgresql.conf</filename> will affect existing sessions
10146 only if no session-local value has been established with <command>SET</>.
10153 See <xref linkend="config-setting"> for more information about the various
10154 ways to change these parameters.
10158 The <structname>pg_settings</structname> view cannot be inserted into or
10159 deleted from, but it can be updated. An <command>UPDATE</command> applied
10160 to a row of <structname>pg_settings</structname> is equivalent to executing
10161 the <xref linkend="sql-set"> command on that named
10162 parameter. The change only affects the value used by the current
10163 session. If an <command>UPDATE</command> is issued within a transaction
10164 that is later aborted, the effects of the <command>UPDATE</command> command
10165 disappear when the transaction is rolled back. Once the surrounding
10166 transaction is committed, the effects will persist until the end of the
10167 session, unless overridden by another <command>UPDATE</command> or
10168 <command>SET</command>.
10173 <sect1 id="view-pg-shadow">
10174 <title><structname>pg_shadow</structname></title>
10176 <indexterm zone="view-pg-shadow">
10177 <primary>pg_shadow</primary>
10181 The view <structname>pg_shadow</structname> exists for backwards
10182 compatibility: it emulates a catalog that existed in
10183 <productname>PostgreSQL</productname> before version 8.1.
10184 It shows properties of all roles that are marked as
10185 <structfield>rolcanlogin</> in
10186 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
10190 The name stems from the fact that this table
10191 should not be readable by the public since it contains passwords.
10192 <link linkend="view-pg-user"><structname>pg_user</structname></link>
10193 is a publicly readable view on
10194 <structname>pg_shadow</structname> that blanks out the password field.
10198 <title><structname>pg_shadow</> Columns</title>
10203 <entry>Name</entry>
10204 <entry>Type</entry>
10205 <entry>References</entry>
10206 <entry>Description</entry>
10212 <entry><structfield>usename</structfield></entry>
10213 <entry><type>name</type></entry>
10214 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10215 <entry>User name</entry>
10219 <entry><structfield>usesysid</structfield></entry>
10220 <entry><type>oid</type></entry>
10221 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10222 <entry>ID of this user</entry>
10226 <entry><structfield>usecreatedb</structfield></entry>
10227 <entry><type>bool</type></entry>
10229 <entry>User can create databases</entry>
10233 <entry><structfield>usesuper</structfield></entry>
10234 <entry><type>bool</type></entry>
10236 <entry>User is a superuser</entry>
10240 <entry><structfield>userepl</structfield></entry>
10241 <entry><type>bool</type></entry>
10244 User can initiate streaming replication and put the system in and
10245 out of backup mode.
10250 <entry><structfield>usebypassrls</structfield></entry>
10251 <entry><type>bool</type></entry>
10254 User bypasses every row level security policy, see
10255 <xref linkend="ddl-rowsecurity"> for more information.
10260 <entry><structfield>passwd</structfield></entry>
10261 <entry><type>text</type></entry>
10263 <entry>Password (possibly encrypted); null if none. See
10264 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
10265 for details of how encrypted passwords are stored.</entry>
10269 <entry><structfield>valuntil</structfield></entry>
10270 <entry><type>abstime</type></entry>
10272 <entry>Password expiry time (only used for password authentication)</entry>
10276 <entry><structfield>useconfig</structfield></entry>
10277 <entry><type>text[]</type></entry>
10279 <entry>Session defaults for run-time configuration variables</entry>
10287 <sect1 id="view-pg-stats">
10288 <title><structname>pg_stats</structname></title>
10290 <indexterm zone="view-pg-stats">
10291 <primary>pg_stats</primary>
10295 The view <structname>pg_stats</structname> provides access to
10296 the information stored in the <link
10297 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
10298 catalog. This view allows access only to rows of
10299 <structname>pg_statistic</structname> that correspond to tables the
10300 user has permission to read, and therefore it is safe to allow public
10301 read access to this view.
10305 <structname>pg_stats</structname> is also designed to present the
10306 information in a more readable format than the underlying catalog
10307 — at the cost that its schema must be extended whenever new slot types
10308 are defined for <structname>pg_statistic</structname>.
10312 <title><structname>pg_stats</> Columns</title>
10317 <entry>Name</entry>
10318 <entry>Type</entry>
10319 <entry>References</entry>
10320 <entry>Description</entry>
10325 <entry><structfield>schemaname</structfield></entry>
10326 <entry><type>name</type></entry>
10327 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10328 <entry>Name of schema containing table</entry>
10332 <entry><structfield>tablename</structfield></entry>
10333 <entry><type>name</type></entry>
10334 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10335 <entry>Name of table</entry>
10339 <entry><structfield>attname</structfield></entry>
10340 <entry><type>name</type></entry>
10341 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
10342 <entry>Name of the column described by this row</entry>
10346 <entry><structfield>inherited</structfield></entry>
10347 <entry><type>bool</type></entry>
10349 <entry>If true, this row includes inheritance child columns, not just the
10350 values in the specified table</entry>
10354 <entry><structfield>null_frac</structfield></entry>
10355 <entry><type>real</type></entry>
10357 <entry>Fraction of column entries that are null</entry>
10361 <entry><structfield>avg_width</structfield></entry>
10362 <entry><type>integer</type></entry>
10364 <entry>Average width in bytes of column's entries</entry>
10368 <entry><structfield>n_distinct</structfield></entry>
10369 <entry><type>real</type></entry>
10372 If greater than zero, the estimated number of distinct values in the
10373 column. If less than zero, the negative of the number of distinct
10374 values divided by the number of rows. (The negated form is used when
10375 <command>ANALYZE</> believes that the number of distinct values is
10376 likely to increase as the table grows; the positive form is used when
10377 the column seems to have a fixed number of possible values.) For
10378 example, -1 indicates a unique column in which the number of distinct
10379 values is the same as the number of rows.
10384 <entry><structfield>most_common_vals</structfield></entry>
10385 <entry><type>anyarray</type></entry>
10388 A list of the most common values in the column. (Null if
10389 no values seem to be more common than any others.)
10394 <entry><structfield>most_common_freqs</structfield></entry>
10395 <entry><type>real[]</type></entry>
10398 A list of the frequencies of the most common values,
10399 i.e., number of occurrences of each divided by total number of rows.
10400 (Null when <structfield>most_common_vals</structfield> is.)
10405 <entry><structfield>histogram_bounds</structfield></entry>
10406 <entry><type>anyarray</type></entry>
10409 A list of values that divide the column's values into groups of
10410 approximately equal population. The values in
10411 <structfield>most_common_vals</>, if present, are omitted from this
10412 histogram calculation. (This column is null if the column data type
10413 does not have a <literal><</> operator or if the
10414 <structfield>most_common_vals</> list accounts for the entire
10420 <entry><structfield>correlation</structfield></entry>
10421 <entry><type>real</type></entry>
10424 Statistical correlation between physical row ordering and
10425 logical ordering of the column values. This ranges from -1 to +1.
10426 When the value is near -1 or +1, an index scan on the column will
10427 be estimated to be cheaper than when it is near zero, due to reduction
10428 of random access to the disk. (This column is null if the column data
10429 type does not have a <literal><</> operator.)
10434 <entry><structfield>most_common_elems</structfield></entry>
10435 <entry><type>anyarray</type></entry>
10438 A list of non-null element values most often appearing within values of
10439 the column. (Null for scalar types.)
10444 <entry><structfield>most_common_elem_freqs</structfield></entry>
10445 <entry><type>real[]</type></entry>
10448 A list of the frequencies of the most common element values, i.e., the
10449 fraction of rows containing at least one instance of the given value.
10450 Two or three additional values follow the per-element frequencies;
10451 these are the minimum and maximum of the preceding per-element
10452 frequencies, and optionally the frequency of null elements.
10453 (Null when <structfield>most_common_elems</structfield> is.)
10458 <entry><structfield>elem_count_histogram</structfield></entry>
10459 <entry><type>real[]</type></entry>
10462 A histogram of the counts of distinct non-null element values within the
10463 values of the column, followed by the average number of distinct
10464 non-null elements. (Null for scalar types.)
10472 The maximum number of entries in the array fields can be controlled on a
10473 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
10474 command, or globally by setting the
10475 <xref linkend="guc-default-statistics-target"> run-time parameter.
10480 <sect1 id="view-pg-tables">
10481 <title><structname>pg_tables</structname></title>
10483 <indexterm zone="view-pg-tables">
10484 <primary>pg_tables</primary>
10488 The view <structname>pg_tables</structname> provides access to
10489 useful information about each table in the database.
10493 <title><structname>pg_tables</> Columns</title>
10498 <entry>Name</entry>
10499 <entry>Type</entry>
10500 <entry>References</entry>
10501 <entry>Description</entry>
10506 <entry><structfield>schemaname</structfield></entry>
10507 <entry><type>name</type></entry>
10508 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10509 <entry>Name of schema containing table</entry>
10512 <entry><structfield>tablename</structfield></entry>
10513 <entry><type>name</type></entry>
10514 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10515 <entry>Name of table</entry>
10518 <entry><structfield>tableowner</structfield></entry>
10519 <entry><type>name</type></entry>
10520 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10521 <entry>Name of table's owner</entry>
10524 <entry><structfield>tablespace</structfield></entry>
10525 <entry><type>name</type></entry>
10526 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
10527 <entry>Name of tablespace containing table (null if default for database)</entry>
10530 <entry><structfield>hasindexes</structfield></entry>
10531 <entry><type>boolean</type></entry>
10532 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
10533 <entry>True if table has (or recently had) any indexes</entry>
10536 <entry><structfield>hasrules</structfield></entry>
10537 <entry><type>boolean</type></entry>
10538 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
10539 <entry>True if table has (or once had) rules</entry>
10542 <entry><structfield>hastriggers</structfield></entry>
10543 <entry><type>boolean</type></entry>
10544 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
10545 <entry>True if table has (or once had) triggers</entry>
10548 <entry><structfield>rowsecurity</structfield></entry>
10549 <entry><type>boolean</type></entry>
10550 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
10551 <entry>True if row security is enabled on the table</entry>
10559 <sect1 id="view-pg-timezone-abbrevs">
10560 <title><structname>pg_timezone_abbrevs</structname></title>
10562 <indexterm zone="view-pg-timezone-abbrevs">
10563 <primary>pg_timezone_abbrevs</primary>
10567 The view <structname>pg_timezone_abbrevs</structname> provides a list
10568 of time zone abbreviations that are currently recognized by the datetime
10569 input routines. The contents of this view change when the
10570 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
10574 <title><structname>pg_timezone_abbrevs</> Columns</title>
10579 <entry>Name</entry>
10580 <entry>Type</entry>
10581 <entry>Description</entry>
10586 <entry><structfield>abbrev</structfield></entry>
10587 <entry><type>text</type></entry>
10588 <entry>Time zone abbreviation</entry>
10591 <entry><structfield>utc_offset</structfield></entry>
10592 <entry><type>interval</type></entry>
10593 <entry>Offset from UTC (positive means east of Greenwich)</entry>
10596 <entry><structfield>is_dst</structfield></entry>
10597 <entry><type>boolean</type></entry>
10598 <entry>True if this is a daylight-savings abbreviation</entry>
10605 While most timezone abbreviations represent fixed offsets from UTC,
10606 there are some that have historically varied in value
10607 (see <xref linkend="datetime-config-files"> for more information).
10608 In such cases this view presents their current meaning.
10613 <sect1 id="view-pg-timezone-names">
10614 <title><structname>pg_timezone_names</structname></title>
10616 <indexterm zone="view-pg-timezone-names">
10617 <primary>pg_timezone_names</primary>
10621 The view <structname>pg_timezone_names</structname> provides a list
10622 of time zone names that are recognized by <command>SET TIMEZONE</>,
10623 along with their associated abbreviations, UTC offsets,
10624 and daylight-savings status. (Technically,
10625 <productname>PostgreSQL</productname> does not use UTC because leap
10626 seconds are not handled.)
10627 Unlike the abbreviations shown in <link
10628 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
10629 date rules. Therefore, the associated information changes across local DST
10630 boundaries. The displayed information is computed based on the current
10631 value of <function>CURRENT_TIMESTAMP</>.
10635 <title><structname>pg_timezone_names</> Columns</title>
10640 <entry>Name</entry>
10641 <entry>Type</entry>
10642 <entry>Description</entry>
10647 <entry><structfield>name</structfield></entry>
10648 <entry><type>text</type></entry>
10649 <entry>Time zone name</entry>
10652 <entry><structfield>abbrev</structfield></entry>
10653 <entry><type>text</type></entry>
10654 <entry>Time zone abbreviation</entry>
10657 <entry><structfield>utc_offset</structfield></entry>
10658 <entry><type>interval</type></entry>
10659 <entry>Offset from UTC (positive means east of Greenwich)</entry>
10662 <entry><structfield>is_dst</structfield></entry>
10663 <entry><type>boolean</type></entry>
10664 <entry>True if currently observing daylight savings</entry>
10672 <sect1 id="view-pg-user">
10673 <title><structname>pg_user</structname></title>
10675 <indexterm zone="view-pg-user">
10676 <primary>pg_user</primary>
10680 The view <structname>pg_user</structname> provides access to
10681 information about database users. This is simply a publicly
10683 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
10684 that blanks out the password field.
10688 <title><structname>pg_user</> Columns</title>
10693 <entry>Name</entry>
10694 <entry>Type</entry>
10695 <entry>Description</entry>
10700 <entry><structfield>usename</structfield></entry>
10701 <entry><type>name</type></entry>
10702 <entry>User name</entry>
10706 <entry><structfield>usesysid</structfield></entry>
10707 <entry><type>oid</type></entry>
10708 <entry>ID of this user</entry>
10712 <entry><structfield>usecreatedb</structfield></entry>
10713 <entry><type>bool</type></entry>
10714 <entry>User can create databases</entry>
10718 <entry><structfield>usesuper</structfield></entry>
10719 <entry><type>bool</type></entry>
10720 <entry>User is a superuser</entry>
10724 <entry><structfield>userepl</structfield></entry>
10725 <entry><type>bool</type></entry>
10727 User can initiate streaming replication and put the system in and
10728 out of backup mode.
10733 <entry><structfield>usebypassrls</structfield></entry>
10734 <entry><type>bool</type></entry>
10736 User bypasses every row level security policy, see
10737 <xref linkend="ddl-rowsecurity"> for more information.
10742 <entry><structfield>passwd</structfield></entry>
10743 <entry><type>text</type></entry>
10744 <entry>Not the password (always reads as <literal>********</>)</entry>
10748 <entry><structfield>valuntil</structfield></entry>
10749 <entry><type>abstime</type></entry>
10750 <entry>Password expiry time (only used for password authentication)</entry>
10754 <entry><structfield>useconfig</structfield></entry>
10755 <entry><type>text[]</type></entry>
10756 <entry>Session defaults for run-time configuration variables</entry>
10764 <sect1 id="view-pg-user-mappings">
10765 <title><structname>pg_user_mappings</structname></title>
10767 <indexterm zone="view-pg-user-mappings">
10768 <primary>pg_user_mappings</primary>
10772 The view <structname>pg_user_mappings</structname> provides access
10773 to information about user mappings. This is essentially a publicly
10775 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
10776 that leaves out the options field if the user has no rights to use
10781 <title><structname>pg_user_mappings</> Columns</title>
10786 <entry>Name</entry>
10787 <entry>Type</entry>
10788 <entry>References</entry>
10789 <entry>Description</entry>
10795 <entry><structfield>umid</structfield></entry>
10796 <entry><type>oid</type></entry>
10797 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
10798 <entry>OID of the user mapping</entry>
10802 <entry><structfield>srvid</structfield></entry>
10803 <entry><type>oid</type></entry>
10804 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
10806 The OID of the foreign server that contains this mapping
10811 <entry><structfield>srvname</structfield></entry>
10812 <entry><type>name</type></entry>
10813 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
10815 Name of the foreign server
10820 <entry><structfield>umuser</structfield></entry>
10821 <entry><type>oid</type></entry>
10822 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10823 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
10827 <entry><structfield>usename</structfield></entry>
10828 <entry><type>name</type></entry>
10830 <entry>Name of the local user to be mapped</entry>
10834 <entry><structfield>umoptions</structfield></entry>
10835 <entry><type>text[]</type></entry>
10838 User mapping specific options, as <quote>keyword=value</>
10839 strings, if the current user is the owner of the foreign
10849 <sect1 id="view-pg-views">
10850 <title><structname>pg_views</structname></title>
10852 <indexterm zone="view-pg-views">
10853 <primary>pg_views</primary>
10857 The view <structname>pg_views</structname> provides access to
10858 useful information about each view in the database.
10862 <title><structname>pg_views</> Columns</title>
10867 <entry>Name</entry>
10868 <entry>Type</entry>
10869 <entry>References</entry>
10870 <entry>Description</entry>
10875 <entry><structfield>schemaname</structfield></entry>
10876 <entry><type>name</type></entry>
10877 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10878 <entry>Name of schema containing view</entry>
10881 <entry><structfield>viewname</structfield></entry>
10882 <entry><type>name</type></entry>
10883 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10884 <entry>Name of view</entry>
10887 <entry><structfield>viewowner</structfield></entry>
10888 <entry><type>name</type></entry>
10889 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10890 <entry>Name of view's owner</entry>
10893 <entry><structfield>definition</structfield></entry>
10894 <entry><type>text</type></entry>
10896 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>