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-policy"><structname>pg_policy</structname></link></entry>
230 <entry>row-security policies</entry>
234 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
235 <entry>functions and procedures</entry>
239 <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
240 <entry>information about range types</entry>
244 <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
245 <entry>registered replication origins</entry>
249 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
250 <entry>query rewrite rules</entry>
254 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
255 <entry>security labels on database objects</entry>
259 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
260 <entry>dependencies on shared objects</entry>
264 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
265 <entry>comments on shared objects</entry>
269 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
270 <entry>security labels on shared database objects</entry>
274 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
275 <entry>planner statistics</entry>
279 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
280 <entry>tablespaces within this database cluster</entry>
284 <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
285 <entry>transforms (data type to procedural language conversions)</entry>
289 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
290 <entry>triggers</entry>
294 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
295 <entry>text search configurations</entry>
299 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
300 <entry>text search configurations' token mappings</entry>
304 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
305 <entry>text search dictionaries</entry>
309 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
310 <entry>text search parsers</entry>
314 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
315 <entry>text search templates</entry>
319 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
320 <entry>data types</entry>
324 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
325 <entry>mappings of users to foreign servers</entry>
333 <sect1 id="catalog-pg-aggregate">
334 <title><structname>pg_aggregate</structname></title>
336 <indexterm zone="catalog-pg-aggregate">
337 <primary>pg_aggregate</primary>
341 The catalog <structname>pg_aggregate</structname> stores information about
342 aggregate functions. An aggregate function is a function that
343 operates on a set of values (typically one column from each row
344 that matches a query condition) and returns a single value computed
345 from all these values. Typical aggregate functions are
346 <function>sum</function>, <function>count</function>, and
347 <function>max</function>. Each entry in
348 <structname>pg_aggregate</structname> is an extension of an entry
349 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
350 entry carries the aggregate's name, input and output data types, and
351 other information that is similar to ordinary functions.
355 <title><structname>pg_aggregate</> Columns</title>
362 <entry>References</entry>
363 <entry>Description</entry>
368 <entry><structfield>aggfnoid</structfield></entry>
369 <entry><type>regproc</type></entry>
370 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
371 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
374 <entry><structfield>aggkind</structfield></entry>
375 <entry><type>char</type></entry>
377 <entry>Aggregate kind:
378 <literal>n</literal> for <quote>normal</> aggregates,
379 <literal>o</literal> for <quote>ordered-set</> aggregates, or
380 <literal>h</literal> for <quote>hypothetical-set</> aggregates
384 <entry><structfield>aggnumdirectargs</structfield></entry>
385 <entry><type>int2</type></entry>
387 <entry>Number of direct (non-aggregated) arguments of an ordered-set or
388 hypothetical-set aggregate, counting a variadic array as one argument.
389 If equal to <structfield>pronargs</>, the aggregate must be variadic
390 and the variadic array describes the aggregated arguments as well as
391 the final direct arguments.
392 Always zero for normal aggregates.</entry>
395 <entry><structfield>aggtransfn</structfield></entry>
396 <entry><type>regproc</type></entry>
397 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
398 <entry>Transition function</entry>
401 <entry><structfield>aggfinalfn</structfield></entry>
402 <entry><type>regproc</type></entry>
403 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
404 <entry>Final function (zero if none)</entry>
407 <entry><structfield>aggcombinefn</structfield></entry>
408 <entry><type>regproc</type></entry>
409 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
410 <entry>Combine function (zero if none)</entry>
413 <entry><structfield>aggserialfn</structfield></entry>
414 <entry><type>regproc</type></entry>
415 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
416 <entry>Serialization function (zero if none)</entry>
419 <entry><structfield>aggdeserialfn</structfield></entry>
420 <entry><type>regproc</type></entry>
421 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
422 <entry>Deserialization function (zero if none)</entry>
425 <entry><structfield>aggmtransfn</structfield></entry>
426 <entry><type>regproc</type></entry>
427 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
428 <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
431 <entry><structfield>aggminvtransfn</structfield></entry>
432 <entry><type>regproc</type></entry>
433 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
434 <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
437 <entry><structfield>aggmfinalfn</structfield></entry>
438 <entry><type>regproc</type></entry>
439 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
440 <entry>Final function for moving-aggregate mode (zero if none)</entry>
443 <entry><structfield>aggfinalextra</structfield></entry>
444 <entry><type>bool</type></entry>
446 <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
449 <entry><structfield>aggmfinalextra</structfield></entry>
450 <entry><type>bool</type></entry>
452 <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
455 <entry><structfield>aggsortop</structfield></entry>
456 <entry><type>oid</type></entry>
457 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
458 <entry>Associated sort operator (zero if none)</entry>
461 <entry><structfield>aggtranstype</structfield></entry>
462 <entry><type>oid</type></entry>
463 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
464 <entry>Data type of the aggregate function's internal transition (state) data</entry>
467 <entry><structfield>aggtransspace</structfield></entry>
468 <entry><type>int4</type></entry>
470 <entry>Approximate average size (in bytes) of the transition state
471 data, or zero to use a default estimate</entry>
474 <entry><structfield>aggmtranstype</structfield></entry>
475 <entry><type>oid</type></entry>
476 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
477 <entry>Data type of the aggregate function's internal transition (state)
478 data for moving-aggregate mode (zero if none)</entry>
481 <entry><structfield>aggmtransspace</structfield></entry>
482 <entry><type>int4</type></entry>
484 <entry>Approximate average size (in bytes) of the transition state data
485 for moving-aggregate mode, or zero to use a default estimate</entry>
488 <entry><structfield>agginitval</structfield></entry>
489 <entry><type>text</type></entry>
492 The initial value of the transition state. This is a text
493 field containing the initial value in its external string
494 representation. If this field is null, the transition state
495 value starts out null.
499 <entry><structfield>aggminitval</structfield></entry>
500 <entry><type>text</type></entry>
503 The initial value of the transition state for moving-aggregate mode.
504 This is a text field containing the initial value in its external
505 string representation. If this field is null, the transition state
506 value starts out null.
514 New aggregate functions are registered with the <xref
515 linkend="sql-createaggregate">
516 command. See <xref linkend="xaggr"> for more information about
517 writing aggregate functions and the meaning of the transition
524 <sect1 id="catalog-pg-am">
525 <title><structname>pg_am</structname></title>
527 <indexterm zone="catalog-pg-am">
528 <primary>pg_am</primary>
532 The catalog <structname>pg_am</structname> stores information about
533 relation access methods. There is one row for each access method supported
535 Currently, only indexes have access methods. The requirements for index
536 access methods are discussed in detail in <xref linkend="indexam">.
540 <title><structname>pg_am</> Columns</title>
547 <entry>References</entry>
548 <entry>Description</entry>
554 <entry><structfield>oid</structfield></entry>
555 <entry><type>oid</type></entry>
557 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
561 <entry><structfield>amname</structfield></entry>
562 <entry><type>name</type></entry>
564 <entry>Name of the access method</entry>
568 <entry><structfield>amhandler</structfield></entry>
569 <entry><type>oid</type></entry>
570 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
572 OID of a handler function that is responsible for supplying information
573 about the access method
578 <entry><structfield>amtype</structfield></entry>
579 <entry><type>char</type></entry>
582 Currently always <literal>i</literal> to indicate an index access
583 method; other values may be allowed in future
592 Before <productname>PostgreSQL</> 9.6, <structname>pg_am</structname>
593 contained many additional columns representing properties of index access
594 methods. That data is now only directly visible at the C code level.
595 However, <function>pg_index_column_has_property()</function> and related
596 functions have been added to allow SQL queries to inspect index access
597 method properties; see <xref linkend="functions-info-catalog-table">.
604 <sect1 id="catalog-pg-amop">
605 <title><structname>pg_amop</structname></title>
607 <indexterm zone="catalog-pg-amop">
608 <primary>pg_amop</primary>
612 The catalog <structname>pg_amop</structname> stores information about
613 operators associated with access method operator families. There is one
614 row for each operator that is a member of an operator family. A family
615 member can be either a <firstterm>search</> operator or an
616 <firstterm>ordering</> operator. An operator
617 can appear in more than one family, but cannot appear in more than one
618 search position nor more than one ordering position within a family.
619 (It is allowed, though unlikely, for an operator to be used for both
620 search and ordering purposes.)
624 <title><structname>pg_amop</> Columns</title>
631 <entry>References</entry>
632 <entry>Description</entry>
638 <entry><structfield>oid</structfield></entry>
639 <entry><type>oid</type></entry>
641 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
645 <entry><structfield>amopfamily</structfield></entry>
646 <entry><type>oid</type></entry>
647 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
648 <entry>The operator family this entry is for</entry>
652 <entry><structfield>amoplefttype</structfield></entry>
653 <entry><type>oid</type></entry>
654 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
655 <entry>Left-hand input data type of operator</entry>
659 <entry><structfield>amoprighttype</structfield></entry>
660 <entry><type>oid</type></entry>
661 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
662 <entry>Right-hand input data type of operator</entry>
666 <entry><structfield>amopstrategy</structfield></entry>
667 <entry><type>int2</type></entry>
669 <entry>Operator strategy number</entry>
673 <entry><structfield>amoppurpose</structfield></entry>
674 <entry><type>char</type></entry>
676 <entry>Operator purpose, either <literal>s</> for search or
677 <literal>o</> for ordering</entry>
681 <entry><structfield>amopopr</structfield></entry>
682 <entry><type>oid</type></entry>
683 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
684 <entry>OID of the operator</entry>
688 <entry><structfield>amopmethod</structfield></entry>
689 <entry><type>oid</type></entry>
690 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
691 <entry>Index access method operator family is for</entry>
695 <entry><structfield>amopsortfamily</structfield></entry>
696 <entry><type>oid</type></entry>
697 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
698 <entry>The B-tree operator family this entry sorts according to, if an
699 ordering operator; zero if a search operator</entry>
707 A <quote>search</> operator entry indicates that an index of this operator
708 family can be searched to find all rows satisfying
710 <replaceable>indexed_column</>
711 <replaceable>operator</>
712 <replaceable>constant</>.
713 Obviously, such an operator must return <type>boolean</type>, and its left-hand input
714 type must match the index's column data type.
718 An <quote>ordering</> operator entry indicates that an index of this
719 operator family can be scanned to return rows in the order represented by
721 <replaceable>indexed_column</>
722 <replaceable>operator</>
723 <replaceable>constant</>.
724 Such an operator could return any sortable data type, though again
725 its left-hand input type must match the index's column data type.
726 The exact semantics of the <literal>ORDER BY</> are specified by the
727 <structfield>amopsortfamily</structfield> column, which must reference
728 a B-tree operator family for the operator's result type.
733 At present, it's assumed that the sort order for an ordering operator
734 is the default for the referenced operator family, i.e., <literal>ASC NULLS
735 LAST</>. This might someday be relaxed by adding additional columns
736 to specify sort options explicitly.
741 An entry's <structfield>amopmethod</> must match the
742 <structname>opfmethod</> of its containing operator family (including
743 <structfield>amopmethod</> here is an intentional denormalization of the
744 catalog structure for performance reasons). Also,
745 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
746 the <structfield>oprleft</> and <structfield>oprright</> fields of the
747 referenced <structname>pg_operator</> entry.
753 <sect1 id="catalog-pg-amproc">
754 <title><structname>pg_amproc</structname></title>
756 <indexterm zone="catalog-pg-amproc">
757 <primary>pg_amproc</primary>
761 The catalog <structname>pg_amproc</structname> stores information about
762 support procedures associated with access method operator families. There
763 is one row for each support procedure belonging to an operator family.
767 <title><structname>pg_amproc</structname> Columns</title>
774 <entry>References</entry>
775 <entry>Description</entry>
781 <entry><structfield>oid</structfield></entry>
782 <entry><type>oid</type></entry>
784 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
788 <entry><structfield>amprocfamily</structfield></entry>
789 <entry><type>oid</type></entry>
790 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
791 <entry>The operator family this entry is for</entry>
795 <entry><structfield>amproclefttype</structfield></entry>
796 <entry><type>oid</type></entry>
797 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
798 <entry>Left-hand input data type of associated operator</entry>
802 <entry><structfield>amprocrighttype</structfield></entry>
803 <entry><type>oid</type></entry>
804 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
805 <entry>Right-hand input data type of associated operator</entry>
809 <entry><structfield>amprocnum</structfield></entry>
810 <entry><type>int2</type></entry>
812 <entry>Support procedure number</entry>
816 <entry><structfield>amproc</structfield></entry>
817 <entry><type>regproc</type></entry>
818 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
819 <entry>OID of the procedure</entry>
827 The usual interpretation of the
828 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
829 is that they identify the left and right input types of the operator(s)
830 that a particular support procedure supports. For some access methods
831 these match the input data type(s) of the support procedure itself, for
832 others not. There is a notion of <quote>default</> support procedures for
833 an index, which are those with <structfield>amproclefttype</> and
834 <structfield>amprocrighttype</> both equal to the index operator class's
835 <structfield>opcintype</>.
841 <sect1 id="catalog-pg-attrdef">
842 <title><structname>pg_attrdef</structname></title>
844 <indexterm zone="catalog-pg-attrdef">
845 <primary>pg_attrdef</primary>
849 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
850 about columns is stored in <structname>pg_attribute</structname>
851 (see below). Only columns that explicitly specify a default value
852 (when the table is created or the column is added) will have an
857 <title><structname>pg_attrdef</> Columns</title>
864 <entry>References</entry>
865 <entry>Description</entry>
871 <entry><structfield>oid</structfield></entry>
872 <entry><type>oid</type></entry>
874 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
878 <entry><structfield>adrelid</structfield></entry>
879 <entry><type>oid</type></entry>
880 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
881 <entry>The table this column belongs to</entry>
885 <entry><structfield>adnum</structfield></entry>
886 <entry><type>int2</type></entry>
887 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
888 <entry>The number of the column</entry>
892 <entry><structfield>adbin</structfield></entry>
893 <entry><type>pg_node_tree</type></entry>
895 <entry>The internal representation of the column default value</entry>
899 <entry><structfield>adsrc</structfield></entry>
900 <entry><type>text</type></entry>
902 <entry>A human-readable representation of the default value</entry>
909 The <structfield>adsrc</structfield> field is historical, and is best
910 not used, because it does not track outside changes that might affect
911 the representation of the default value. Reverse-compiling the
912 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
913 example) is a better way to display the default value.
919 <sect1 id="catalog-pg-attribute">
920 <title><structname>pg_attribute</structname></title>
922 <indexterm zone="catalog-pg-attribute">
923 <primary>pg_attribute</primary>
927 The catalog <structname>pg_attribute</structname> stores information about
928 table columns. There will be exactly one
929 <structname>pg_attribute</structname> row for every column in every
930 table in the database. (There will also be attribute entries for
931 indexes, and indeed all objects that have <structname>pg_class</structname>
936 The term attribute is equivalent to column and is used for
941 <title><structname>pg_attribute</> Columns</title>
948 <entry>References</entry>
949 <entry>Description</entry>
955 <entry><structfield>attrelid</structfield></entry>
956 <entry><type>oid</type></entry>
957 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
958 <entry>The table this column belongs to</entry>
962 <entry><structfield>attname</structfield></entry>
963 <entry><type>name</type></entry>
965 <entry>The column name</entry>
969 <entry><structfield>atttypid</structfield></entry>
970 <entry><type>oid</type></entry>
971 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
972 <entry>The data type of this column</entry>
976 <entry><structfield>attstattarget</structfield></entry>
977 <entry><type>int4</type></entry>
980 <structfield>attstattarget</structfield> controls the level of detail
981 of statistics accumulated for this column by
982 <xref linkend="sql-analyze">.
983 A zero value indicates that no statistics should be collected.
984 A negative value says to use the system default statistics target.
985 The exact meaning of positive values is data type-dependent.
986 For scalar data types, <structfield>attstattarget</structfield>
987 is both the target number of <quote>most common values</quote>
988 to collect, and the target number of histogram bins to create.
993 <entry><structfield>attlen</structfield></entry>
994 <entry><type>int2</type></entry>
997 A copy of <literal>pg_type.typlen</literal> of this column's
1003 <entry><structfield>attnum</structfield></entry>
1004 <entry><type>int2</type></entry>
1007 The number of the column. Ordinary columns are numbered from 1
1008 up. System columns, such as <structfield>oid</structfield>,
1009 have (arbitrary) negative numbers.
1014 <entry><structfield>attndims</structfield></entry>
1015 <entry><type>int4</type></entry>
1018 Number of dimensions, if the column is an array type; otherwise 0.
1019 (Presently, the number of dimensions of an array is not enforced,
1020 so any nonzero value effectively means <quote>it's an array</>.)
1025 <entry><structfield>attcacheoff</structfield></entry>
1026 <entry><type>int4</type></entry>
1029 Always -1 in storage, but when loaded into a row descriptor
1030 in memory this might be updated to cache the offset of the attribute
1036 <entry><structfield>atttypmod</structfield></entry>
1037 <entry><type>int4</type></entry>
1040 <structfield>atttypmod</structfield> records type-specific data
1041 supplied at table creation time (for example, the maximum
1042 length of a <type>varchar</type> column). It is passed to
1043 type-specific input functions and length coercion functions.
1044 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1049 <entry><structfield>attbyval</structfield></entry>
1050 <entry><type>bool</type></entry>
1053 A copy of <literal>pg_type.typbyval</> of this column's type
1058 <entry><structfield>attstorage</structfield></entry>
1059 <entry><type>char</type></entry>
1062 Normally a copy of <literal>pg_type.typstorage</> of this
1063 column's type. For TOAST-able data types, this can be altered
1064 after column creation to control storage policy.
1069 <entry><structfield>attalign</structfield></entry>
1070 <entry><type>char</type></entry>
1073 A copy of <literal>pg_type.typalign</> of this column's type
1078 <entry><structfield>attnotnull</structfield></entry>
1079 <entry><type>bool</type></entry>
1082 This represents a not-null constraint.
1087 <entry><structfield>atthasdef</structfield></entry>
1088 <entry><type>bool</type></entry>
1091 This column has a default value, in which case there will be a
1092 corresponding entry in the <structname>pg_attrdef</structname>
1093 catalog that actually defines the value.
1098 <entry><structfield>attisdropped</structfield></entry>
1099 <entry><type>bool</type></entry>
1102 This column has been dropped and is no longer valid. A dropped
1103 column is still physically present in the table, but is
1104 ignored by the parser and so cannot be accessed via SQL.
1109 <entry><structfield>attislocal</structfield></entry>
1110 <entry><type>bool</type></entry>
1113 This column is defined locally in the relation. Note that a column can
1114 be locally defined and inherited simultaneously.
1119 <entry><structfield>attinhcount</structfield></entry>
1120 <entry><type>int4</type></entry>
1123 The number of direct ancestors this column has. A column with a
1124 nonzero number of ancestors cannot be dropped nor renamed.
1129 <entry><structfield>attcollation</structfield></entry>
1130 <entry><type>oid</type></entry>
1131 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1133 The defined collation of the column, or zero if the column is
1134 not of a collatable data type.
1139 <entry><structfield>attacl</structfield></entry>
1140 <entry><type>aclitem[]</type></entry>
1143 Column-level access privileges, if any have been granted specifically
1149 <entry><structfield>attoptions</structfield></entry>
1150 <entry><type>text[]</type></entry>
1153 Attribute-level options, as <quote>keyword=value</> strings
1158 <entry><structfield>attfdwoptions</structfield></entry>
1159 <entry><type>text[]</type></entry>
1162 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1171 In a dropped column's <structname>pg_attribute</structname> entry,
1172 <structfield>atttypid</structfield> is reset to zero, but
1173 <structfield>attlen</structfield> and the other fields copied from
1174 <structname>pg_type</> are still valid. This arrangement is needed
1175 to cope with the situation where the dropped column's data type was
1176 later dropped, and so there is no <structname>pg_type</> row anymore.
1177 <structfield>attlen</structfield> and the other fields can be used
1178 to interpret the contents of a row of the table.
1183 <sect1 id="catalog-pg-authid">
1184 <title><structname>pg_authid</structname></title>
1186 <indexterm zone="catalog-pg-authid">
1187 <primary>pg_authid</primary>
1191 The catalog <structname>pg_authid</structname> contains information about
1192 database authorization identifiers (roles). A role subsumes the concepts
1193 of <quote>users</> and <quote>groups</>. A user is essentially just a
1194 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1195 without <structfield>rolcanlogin</>) can have other roles as members; see
1196 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1200 Since this catalog contains passwords, it must not be publicly readable.
1201 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1202 is a publicly readable view on
1203 <structname>pg_authid</structname> that blanks out the password field.
1207 <xref linkend="user-manag"> contains detailed information about user and
1208 privilege management.
1212 Because user identities are cluster-wide,
1213 <structname>pg_authid</structname>
1214 is shared across all databases of a cluster: there is only one
1215 copy of <structname>pg_authid</structname> per cluster, not
1220 <title><structname>pg_authid</> Columns</title>
1227 <entry>Description</entry>
1234 <entry><structfield>oid</structfield></entry>
1235 <entry><type>oid</type></entry>
1236 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1240 <entry><structfield>rolname</structfield></entry>
1241 <entry><type>name</type></entry>
1242 <entry>Role name</entry>
1246 <entry><structfield>rolsuper</structfield></entry>
1247 <entry><type>bool</type></entry>
1248 <entry>Role has superuser privileges</entry>
1252 <entry><structfield>rolinherit</structfield></entry>
1253 <entry><type>bool</type></entry>
1254 <entry>Role automatically inherits privileges of roles it is a
1259 <entry><structfield>rolcreaterole</structfield></entry>
1260 <entry><type>bool</type></entry>
1261 <entry>Role can create more roles</entry>
1265 <entry><structfield>rolcreatedb</structfield></entry>
1266 <entry><type>bool</type></entry>
1267 <entry>Role can create databases</entry>
1271 <entry><structfield>rolcanlogin</structfield></entry>
1272 <entry><type>bool</type></entry>
1274 Role can log in. That is, this role can be given as the initial
1275 session authorization identifier
1280 <entry><structfield>rolreplication</structfield></entry>
1281 <entry><type>bool</type></entry>
1283 Role is a replication role. That is, this role can initiate streaming
1284 replication (see <xref linkend="streaming-replication">) and set/unset
1285 the system backup mode using <function>pg_start_backup</> and
1286 <function>pg_stop_backup</>
1291 <entry><structfield>rolbypassrls</structfield></entry>
1292 <entry><type>bool</type></entry>
1294 Role bypasses every row level security policy, see
1295 <xref linkend="ddl-rowsecurity"> for more information.
1300 <entry><structfield>rolconnlimit</structfield></entry>
1301 <entry><type>int4</type></entry>
1303 For roles that can log in, this sets maximum number of concurrent
1304 connections this role can make. -1 means no limit.
1309 <entry><structfield>rolpassword</structfield></entry>
1310 <entry><type>text</type></entry>
1312 Password (possibly encrypted); null if none. If the password
1313 is encrypted, this column will begin with the string <literal>md5</>
1314 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1315 will be of the user's password concatenated to their user name.
1316 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1317 <productname>PostgreSQL</> will store the md5 hash of
1318 <literal>xyzzyjoe</>. A password that does not follow that
1319 format is assumed to be unencrypted.
1324 <entry><structfield>rolvaliduntil</structfield></entry>
1325 <entry><type>timestamptz</type></entry>
1326 <entry>Password expiry time (only used for password authentication);
1327 null if no expiration</entry>
1336 <sect1 id="catalog-pg-auth-members">
1337 <title><structname>pg_auth_members</structname></title>
1339 <indexterm zone="catalog-pg-auth-members">
1340 <primary>pg_auth_members</primary>
1344 The catalog <structname>pg_auth_members</structname> shows the membership
1345 relations between roles. Any non-circular set of relationships is allowed.
1349 Because user identities are cluster-wide,
1350 <structname>pg_auth_members</structname>
1351 is shared across all databases of a cluster: there is only one
1352 copy of <structname>pg_auth_members</structname> per cluster, not
1357 <title><structname>pg_auth_members</> Columns</title>
1364 <entry>References</entry>
1365 <entry>Description</entry>
1371 <entry><structfield>roleid</structfield></entry>
1372 <entry><type>oid</type></entry>
1373 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1374 <entry>ID of a role that has a member</entry>
1378 <entry><structfield>member</structfield></entry>
1379 <entry><type>oid</type></entry>
1380 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1381 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1385 <entry><structfield>grantor</structfield></entry>
1386 <entry><type>oid</type></entry>
1387 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1388 <entry>ID of the role that granted this membership</entry>
1392 <entry><structfield>admin_option</structfield></entry>
1393 <entry><type>bool</type></entry>
1395 <entry>True if <structfield>member</> can grant membership in
1396 <structfield>roleid</> to others</entry>
1405 <sect1 id="catalog-pg-cast">
1406 <title><structname>pg_cast</structname></title>
1408 <indexterm zone="catalog-pg-cast">
1409 <primary>pg_cast</primary>
1413 The catalog <structname>pg_cast</structname> stores data type conversion
1414 paths, both built-in and user-defined.
1418 It should be noted that <structname>pg_cast</structname> does not represent
1419 every type conversion that the system knows how to perform; only those that
1420 cannot be deduced from some generic rule. For example, casting between a
1421 domain and its base type is not explicitly represented in
1422 <structname>pg_cast</structname>. Another important exception is that
1423 <quote>automatic I/O conversion casts</>, those performed using a data
1424 type's own I/O functions to convert to or from <type>text</> or other
1425 string types, are not explicitly represented in
1426 <structname>pg_cast</structname>.
1430 <title><structname>pg_cast</> Columns</title>
1437 <entry>References</entry>
1438 <entry>Description</entry>
1444 <entry><structfield>oid</structfield></entry>
1445 <entry><type>oid</type></entry>
1447 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1451 <entry><structfield>castsource</structfield></entry>
1452 <entry><type>oid</type></entry>
1453 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1454 <entry>OID of the source data type</entry>
1458 <entry><structfield>casttarget</structfield></entry>
1459 <entry><type>oid</type></entry>
1460 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1461 <entry>OID of the target data type</entry>
1465 <entry><structfield>castfunc</structfield></entry>
1466 <entry><type>oid</type></entry>
1467 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1469 The OID of the function to use to perform this cast. Zero is
1470 stored if the cast method doesn't require a function.
1475 <entry><structfield>castcontext</structfield></entry>
1476 <entry><type>char</type></entry>
1479 Indicates what contexts the cast can be invoked in.
1480 <literal>e</> means only as an explicit cast (using
1481 <literal>CAST</> or <literal>::</> syntax).
1482 <literal>a</> means implicitly in assignment
1483 to a target column, as well as explicitly.
1484 <literal>i</> means implicitly in expressions, as well as the
1489 <entry><structfield>castmethod</structfield></entry>
1490 <entry><type>char</type></entry>
1493 Indicates how the cast is performed.
1494 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1495 <literal>i</> means that the input/output functions are used.
1496 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1504 The cast functions listed in <structname>pg_cast</structname> must
1505 always take the cast source type as their first argument type, and
1506 return the cast destination type as their result type. A cast
1507 function can have up to three arguments. The second argument,
1508 if present, must be type <type>integer</>; it receives the type
1509 modifier associated with the destination type, or -1
1510 if there is none. The third argument,
1511 if present, must be type <type>boolean</>; it receives <literal>true</>
1512 if the cast is an explicit cast, <literal>false</> otherwise.
1516 It is legitimate to create a <structname>pg_cast</structname> entry
1517 in which the source and target types are the same, if the associated
1518 function takes more than one argument. Such entries represent
1519 <quote>length coercion functions</> that coerce values of the type
1520 to be legal for a particular type modifier value.
1524 When a <structname>pg_cast</structname> entry has different source and
1525 target types and a function that takes more than one argument, it
1526 represents converting from one type to another and applying a length
1527 coercion in a single step. When no such entry is available, coercion
1528 to a type that uses a type modifier involves two steps, one to
1529 convert between data types and a second to apply the modifier.
1533 <sect1 id="catalog-pg-class">
1534 <title><structname>pg_class</structname></title>
1536 <indexterm zone="catalog-pg-class">
1537 <primary>pg_class</primary>
1541 The catalog <structname>pg_class</structname> catalogs tables and most
1542 everything else that has columns or is otherwise similar to a
1543 table. This includes indexes (but see also
1544 <structname>pg_index</structname>), sequences, views, materialized
1545 views, composite types, and TOAST tables; see <structfield>relkind</>.
1546 Below, when we mean all of these
1547 kinds of objects we speak of <quote>relations</quote>. Not all
1548 columns are meaningful for all relation types.
1552 <title><structname>pg_class</> Columns</title>
1559 <entry>References</entry>
1560 <entry>Description</entry>
1566 <entry><structfield>oid</structfield></entry>
1567 <entry><type>oid</type></entry>
1569 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1573 <entry><structfield>relname</structfield></entry>
1574 <entry><type>name</type></entry>
1576 <entry>Name of the table, index, view, etc.</entry>
1580 <entry><structfield>relnamespace</structfield></entry>
1581 <entry><type>oid</type></entry>
1582 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1584 The OID of the namespace that contains this relation
1589 <entry><structfield>reltype</structfield></entry>
1590 <entry><type>oid</type></entry>
1591 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1593 The OID of the data type that corresponds to this table's row type,
1594 if any (zero for indexes, which have no <structname>pg_type</> entry)
1599 <entry><structfield>reloftype</structfield></entry>
1600 <entry><type>oid</type></entry>
1601 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1603 For typed tables, the OID of the underlying composite type,
1604 zero for all other relations
1609 <entry><structfield>relowner</structfield></entry>
1610 <entry><type>oid</type></entry>
1611 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1612 <entry>Owner of the relation</entry>
1616 <entry><structfield>relam</structfield></entry>
1617 <entry><type>oid</type></entry>
1618 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1619 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1623 <entry><structfield>relfilenode</structfield></entry>
1624 <entry><type>oid</type></entry>
1626 <entry>Name of the on-disk file of this relation; zero means this
1627 is a <quote>mapped</> relation whose disk file name is determined
1628 by low-level state</entry>
1632 <entry><structfield>reltablespace</structfield></entry>
1633 <entry><type>oid</type></entry>
1634 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1636 The tablespace in which this relation is stored. If zero,
1637 the database's default tablespace is implied. (Not meaningful
1638 if the relation has no on-disk file.)
1643 <entry><structfield>relpages</structfield></entry>
1644 <entry><type>int4</type></entry>
1647 Size of the on-disk representation of this table in pages (of size
1648 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1649 planner. It is updated by <command>VACUUM</command>,
1650 <command>ANALYZE</command>, and a few DDL commands such as
1651 <command>CREATE INDEX</command>.
1656 <entry><structfield>reltuples</structfield></entry>
1657 <entry><type>float4</type></entry>
1660 Number of rows in the table. This is only an estimate used by the
1661 planner. It is updated by <command>VACUUM</command>,
1662 <command>ANALYZE</command>, and a few DDL commands such as
1663 <command>CREATE INDEX</command>.
1668 <entry><structfield>relallvisible</structfield></entry>
1669 <entry><type>int4</type></entry>
1672 Number of pages that are marked all-visible in the table's
1673 visibility map. This is only an estimate used by the
1674 planner. It is updated by <command>VACUUM</command>,
1675 <command>ANALYZE</command>, and a few DDL commands such as
1676 <command>CREATE INDEX</command>.
1681 <entry><structfield>reltoastrelid</structfield></entry>
1682 <entry><type>oid</type></entry>
1683 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1685 OID of the TOAST table associated with this table, 0 if none. The
1686 TOAST table stores large attributes <quote>out of line</quote> in a
1692 <entry><structfield>relhasindex</structfield></entry>
1693 <entry><type>bool</type></entry>
1696 True if this is a table and it has (or recently had) any indexes
1701 <entry><structfield>relisshared</structfield></entry>
1702 <entry><type>bool</type></entry>
1705 True if this table is shared across all databases in the cluster. Only
1706 certain system catalogs (such as <structname>pg_database</structname>)
1712 <entry><structfield>relpersistence</structfield></entry>
1713 <entry><type>char</type></entry>
1716 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1717 <literal>t</> = temporary table
1722 <entry><structfield>relkind</structfield></entry>
1723 <entry><type>char</type></entry>
1726 <literal>r</> = ordinary table, <literal>i</> = index,
1727 <literal>S</> = sequence, <literal>v</> = view,
1728 <literal>m</> = materialized view,
1729 <literal>c</> = composite type, <literal>t</> = TOAST table,
1730 <literal>f</> = foreign table
1735 <entry><structfield>relnatts</structfield></entry>
1736 <entry><type>int2</type></entry>
1739 Number of user columns in the relation (system columns not
1740 counted). There must be this many corresponding entries in
1741 <structname>pg_attribute</structname>. See also
1742 <literal>pg_attribute.attnum</literal>.
1747 <entry><structfield>relchecks</structfield></entry>
1748 <entry><type>int2</type></entry>
1751 Number of <literal>CHECK</> constraints on the table; see
1752 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1757 <entry><structfield>relhasoids</structfield></entry>
1758 <entry><type>bool</type></entry>
1761 True if we generate an OID for each row of the relation
1766 <entry><structfield>relhaspkey</structfield></entry>
1767 <entry><type>bool</type></entry>
1770 True if the table has (or once had) a primary key
1775 <entry><structfield>relhasrules</structfield></entry>
1776 <entry><type>bool</type></entry>
1779 True if table has (or once had) rules; see
1780 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1785 <entry><structfield>relhastriggers</structfield></entry>
1786 <entry><type>bool</type></entry>
1789 True if table has (or once had) triggers; see
1790 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1795 <entry><structfield>relhassubclass</structfield></entry>
1796 <entry><type>bool</type></entry>
1798 <entry>True if table has (or once had) any inheritance children</entry>
1802 <entry><structfield>relrowsecurity</structfield></entry>
1803 <entry><type>bool</type></entry>
1806 True if table has row level security enabled; see
1807 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1812 <entry><structfield>relforcerowsecurity</structfield></entry>
1813 <entry><type>bool</type></entry>
1816 True if row level security (when enabled) will also apply to table owner; see
1817 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1822 <entry><structfield>relispopulated</structfield></entry>
1823 <entry><type>bool</type></entry>
1825 <entry>True if relation is populated (this is true for all
1826 relations other than some materialized views)</entry>
1830 <entry><structfield>relreplident</structfield></entry>
1831 <entry><type>char</type></entry>
1834 Columns used to form <quote>replica identity</> for rows:
1835 <literal>d</> = default (primary key, if any),
1836 <literal>n</> = nothing,
1837 <literal>f</> = all columns
1838 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1843 <entry><structfield>relfrozenxid</structfield></entry>
1844 <entry><type>xid</type></entry>
1847 All transaction IDs before this one have been replaced with a permanent
1848 (<quote>frozen</>) transaction ID in this table. This is used to track
1849 whether the table needs to be vacuumed in order to prevent transaction
1850 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1851 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1856 <entry><structfield>relminmxid</structfield></entry>
1857 <entry><type>xid</type></entry>
1860 All multixact IDs before this one have been replaced by a
1861 transaction ID in this table. This is used to track
1862 whether the table needs to be vacuumed in order to prevent multixact ID
1863 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
1864 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1869 <entry><structfield>relacl</structfield></entry>
1870 <entry><type>aclitem[]</type></entry>
1873 Access privileges; see
1874 <xref linkend="sql-grant"> and
1875 <xref linkend="sql-revoke">
1881 <entry><structfield>reloptions</structfield></entry>
1882 <entry><type>text[]</type></entry>
1885 Access-method-specific options, as <quote>keyword=value</> strings
1893 Several of the Boolean flags in <structname>pg_class</> are maintained
1894 lazily: they are guaranteed to be true if that's the correct state, but
1895 may not be reset to false immediately when the condition is no longer
1896 true. For example, <structfield>relhasindex</> is set by
1897 <command>CREATE INDEX</command>, but it is never cleared by
1898 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1899 <structfield>relhasindex</> if it finds the table has no indexes. This
1900 arrangement avoids race conditions and improves concurrency.
1904 <sect1 id="catalog-pg-collation">
1905 <title><structname>pg_collation</structname></title>
1907 <indexterm zone="catalog-pg-collation">
1908 <primary>pg_collation</primary>
1912 The catalog <structname>pg_collation</structname> describes the
1913 available collations, which are essentially mappings from an SQL
1914 name to operating system locale categories.
1915 See <xref linkend="collation"> for more information.
1919 <title><structname>pg_collation</> Columns</title>
1926 <entry>References</entry>
1927 <entry>Description</entry>
1933 <entry><structfield>oid</structfield></entry>
1934 <entry><type>oid</type></entry>
1936 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1940 <entry><structfield>collname</structfield></entry>
1941 <entry><type>name</type></entry>
1943 <entry>Collation name (unique per namespace and encoding)</entry>
1947 <entry><structfield>collnamespace</structfield></entry>
1948 <entry><type>oid</type></entry>
1949 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1951 The OID of the namespace that contains this collation
1956 <entry><structfield>collowner</structfield></entry>
1957 <entry><type>oid</type></entry>
1958 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1959 <entry>Owner of the collation</entry>
1963 <entry><structfield>collencoding</structfield></entry>
1964 <entry><type>int4</type></entry>
1966 <entry>Encoding in which the collation is applicable, or -1 if it
1967 works for any encoding</entry>
1971 <entry><structfield>collcollate</structfield></entry>
1972 <entry><type>name</type></entry>
1974 <entry><symbol>LC_COLLATE</> for this collation object</entry>
1978 <entry><structfield>collctype</structfield></entry>
1979 <entry><type>name</type></entry>
1981 <entry><symbol>LC_CTYPE</> for this collation object</entry>
1988 Note that the unique key on this catalog is (<structfield>collname</>,
1989 <structfield>collencoding</>, <structfield>collnamespace</>) not just
1990 (<structfield>collname</>, <structfield>collnamespace</>).
1991 <productname>PostgreSQL</productname> generally ignores all
1992 collations that do not have <structfield>collencoding</> equal to
1993 either the current database's encoding or -1, and creation of new entries
1994 with the same name as an entry with <structfield>collencoding</> = -1
1995 is forbidden. Therefore it is sufficient to use a qualified SQL name
1996 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
1997 even though this is not unique according to the catalog definition.
1998 The reason for defining the catalog this way is that
1999 <application>initdb</> fills it in at cluster initialization time with
2000 entries for all locales available on the system, so it must be able to
2001 hold entries for all encodings that might ever be used in the cluster.
2005 In the <literal>template0</> database, it could be useful to create
2006 collations whose encoding does not match the database encoding,
2007 since they could match the encodings of databases later cloned from
2008 <literal>template0</>. This would currently have to be done manually.
2012 <sect1 id="catalog-pg-constraint">
2013 <title><structname>pg_constraint</structname></title>
2015 <indexterm zone="catalog-pg-constraint">
2016 <primary>pg_constraint</primary>
2020 The catalog <structname>pg_constraint</structname> stores check, primary
2021 key, unique, foreign key, and exclusion constraints on tables.
2022 (Column constraints are not treated specially. Every column constraint is
2023 equivalent to some table constraint.)
2024 Not-null constraints are represented in the <structname>pg_attribute</>
2029 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2030 TRIGGER</>) also give rise to an entry in this table.
2034 Check constraints on domains are stored here, too.
2038 <title><structname>pg_constraint</> Columns</title>
2045 <entry>References</entry>
2046 <entry>Description</entry>
2052 <entry><structfield>oid</structfield></entry>
2053 <entry><type>oid</type></entry>
2055 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2059 <entry><structfield>conname</structfield></entry>
2060 <entry><type>name</type></entry>
2062 <entry>Constraint name (not necessarily unique!)</entry>
2066 <entry><structfield>connamespace</structfield></entry>
2067 <entry><type>oid</type></entry>
2068 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2070 The OID of the namespace that contains this constraint
2075 <entry><structfield>contype</structfield></entry>
2076 <entry><type>char</type></entry>
2079 <literal>c</> = check constraint,
2080 <literal>f</> = foreign key constraint,
2081 <literal>p</> = primary key constraint,
2082 <literal>u</> = unique constraint,
2083 <literal>t</> = constraint trigger,
2084 <literal>x</> = exclusion constraint
2089 <entry><structfield>condeferrable</structfield></entry>
2090 <entry><type>bool</type></entry>
2092 <entry>Is the constraint deferrable?</entry>
2096 <entry><structfield>condeferred</structfield></entry>
2097 <entry><type>bool</type></entry>
2099 <entry>Is the constraint deferred by default?</entry>
2103 <entry><structfield>convalidated</structfield></entry>
2104 <entry><type>bool</type></entry>
2106 <entry>Has the constraint been validated?
2107 Currently, can only be false for foreign keys and CHECK constraints</entry>
2111 <entry><structfield>conrelid</structfield></entry>
2112 <entry><type>oid</type></entry>
2113 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2114 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2118 <entry><structfield>contypid</structfield></entry>
2119 <entry><type>oid</type></entry>
2120 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2121 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2125 <entry><structfield>conindid</structfield></entry>
2126 <entry><type>oid</type></entry>
2127 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2128 <entry>The index supporting this constraint, if it's a unique, primary
2129 key, foreign key, or exclusion constraint; else 0</entry>
2133 <entry><structfield>confrelid</structfield></entry>
2134 <entry><type>oid</type></entry>
2135 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2136 <entry>If a foreign key, the referenced table; else 0</entry>
2140 <entry><structfield>confupdtype</structfield></entry>
2141 <entry><type>char</type></entry>
2143 <entry>Foreign key update action code:
2144 <literal>a</> = no action,
2145 <literal>r</> = restrict,
2146 <literal>c</> = cascade,
2147 <literal>n</> = set null,
2148 <literal>d</> = set default
2153 <entry><structfield>confdeltype</structfield></entry>
2154 <entry><type>char</type></entry>
2156 <entry>Foreign key deletion action code:
2157 <literal>a</> = no action,
2158 <literal>r</> = restrict,
2159 <literal>c</> = cascade,
2160 <literal>n</> = set null,
2161 <literal>d</> = set default
2166 <entry><structfield>confmatchtype</structfield></entry>
2167 <entry><type>char</type></entry>
2169 <entry>Foreign key match type:
2170 <literal>f</> = full,
2171 <literal>p</> = partial,
2172 <literal>s</> = simple
2177 <entry><structfield>conislocal</structfield></entry>
2178 <entry><type>bool</type></entry>
2181 This constraint is defined locally for the relation. Note that a
2182 constraint can be locally defined and inherited simultaneously.
2187 <entry><structfield>coninhcount</structfield></entry>
2188 <entry><type>int4</type></entry>
2191 The number of direct inheritance ancestors this constraint has.
2193 a nonzero number of ancestors cannot be dropped nor renamed.
2198 <entry><structfield>connoinherit</structfield></entry>
2199 <entry><type>bool</type></entry>
2202 This constraint is defined locally for the relation. It is a
2203 non-inheritable constraint.
2208 <entry><structfield>conkey</structfield></entry>
2209 <entry><type>int2[]</type></entry>
2210 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2211 <entry>If a table constraint (including foreign keys, but not constraint
2212 triggers), list of the constrained columns</entry>
2216 <entry><structfield>confkey</structfield></entry>
2217 <entry><type>int2[]</type></entry>
2218 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2219 <entry>If a foreign key, list of the referenced columns</entry>
2223 <entry><structfield>conpfeqop</structfield></entry>
2224 <entry><type>oid[]</type></entry>
2225 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2226 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2230 <entry><structfield>conppeqop</structfield></entry>
2231 <entry><type>oid[]</type></entry>
2232 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2233 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2237 <entry><structfield>conffeqop</structfield></entry>
2238 <entry><type>oid[]</type></entry>
2239 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2240 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2244 <entry><structfield>conexclop</structfield></entry>
2245 <entry><type>oid[]</type></entry>
2246 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2247 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2251 <entry><structfield>conbin</structfield></entry>
2252 <entry><type>pg_node_tree</type></entry>
2254 <entry>If a check constraint, an internal representation of the expression</entry>
2258 <entry><structfield>consrc</structfield></entry>
2259 <entry><type>text</type></entry>
2261 <entry>If a check constraint, a human-readable representation of the expression</entry>
2268 In the case of an exclusion constraint, <structfield>conkey</structfield>
2269 is only useful for constraint elements that are simple column references.
2270 For other cases, a zero appears in <structfield>conkey</structfield>
2271 and the associated index must be consulted to discover the expression
2272 that is constrained. (<structfield>conkey</structfield> thus has the
2273 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2279 <structfield>consrc</structfield> is not updated when referenced objects
2280 change; for example, it won't track renaming of columns. Rather than
2281 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2282 to extract the definition of a check constraint.
2288 <literal>pg_class.relchecks</literal> needs to agree with the
2289 number of check-constraint entries found in this table for each
2296 <sect1 id="catalog-pg-conversion">
2297 <title><structname>pg_conversion</structname></title>
2299 <indexterm zone="catalog-pg-conversion">
2300 <primary>pg_conversion</primary>
2304 The catalog <structname>pg_conversion</structname> describes
2305 encoding conversion procedures. See <xref linkend="sql-createconversion">
2306 for more information.
2310 <title><structname>pg_conversion</> Columns</title>
2317 <entry>References</entry>
2318 <entry>Description</entry>
2324 <entry><structfield>oid</structfield></entry>
2325 <entry><type>oid</type></entry>
2327 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2331 <entry><structfield>conname</structfield></entry>
2332 <entry><type>name</type></entry>
2334 <entry>Conversion name (unique within a namespace)</entry>
2338 <entry><structfield>connamespace</structfield></entry>
2339 <entry><type>oid</type></entry>
2340 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2342 The OID of the namespace that contains this conversion
2347 <entry><structfield>conowner</structfield></entry>
2348 <entry><type>oid</type></entry>
2349 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2350 <entry>Owner of the conversion</entry>
2354 <entry><structfield>conforencoding</structfield></entry>
2355 <entry><type>int4</type></entry>
2357 <entry>Source encoding ID</entry>
2361 <entry><structfield>contoencoding</structfield></entry>
2362 <entry><type>int4</type></entry>
2364 <entry>Destination encoding ID</entry>
2368 <entry><structfield>conproc</structfield></entry>
2369 <entry><type>regproc</type></entry>
2370 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2371 <entry>Conversion procedure</entry>
2375 <entry><structfield>condefault</structfield></entry>
2376 <entry><type>bool</type></entry>
2378 <entry>True if this is the default conversion</entry>
2387 <sect1 id="catalog-pg-database">
2388 <title><structname>pg_database</structname></title>
2390 <indexterm zone="catalog-pg-database">
2391 <primary>pg_database</primary>
2395 The catalog <structname>pg_database</structname> stores information about
2396 the available databases. Databases are created with the <xref
2397 linkend="sql-createdatabase"> command.
2398 Consult <xref linkend="managing-databases"> for details about the meaning
2399 of some of the parameters.
2403 Unlike most system catalogs, <structname>pg_database</structname>
2404 is shared across all databases of a cluster: there is only one
2405 copy of <structname>pg_database</structname> per cluster, not
2410 <title><structname>pg_database</> Columns</title>
2417 <entry>References</entry>
2418 <entry>Description</entry>
2424 <entry><structfield>oid</structfield></entry>
2425 <entry><type>oid</type></entry>
2427 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2431 <entry><structfield>datname</structfield></entry>
2432 <entry><type>name</type></entry>
2434 <entry>Database name</entry>
2438 <entry><structfield>datdba</structfield></entry>
2439 <entry><type>oid</type></entry>
2440 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2441 <entry>Owner of the database, usually the user who created it</entry>
2445 <entry><structfield>encoding</structfield></entry>
2446 <entry><type>int4</type></entry>
2448 <entry>Character encoding for this database
2449 (<function>pg_encoding_to_char()</function> can translate
2450 this number to the encoding name)</entry>
2454 <entry><structfield>datcollate</structfield></entry>
2455 <entry><type>name</type></entry>
2457 <entry>LC_COLLATE for this database</entry>
2461 <entry><structfield>datctype</structfield></entry>
2462 <entry><type>name</type></entry>
2464 <entry>LC_CTYPE for this database</entry>
2468 <entry><structfield>datistemplate</structfield></entry>
2469 <entry><type>bool</type></entry>
2472 If true, then this database can be cloned by
2473 any user with <literal>CREATEDB</> privileges;
2474 if false, then only superusers or the owner of
2475 the database can clone it.
2480 <entry><structfield>datallowconn</structfield></entry>
2481 <entry><type>bool</type></entry>
2484 If false then no one can connect to this database. This is
2485 used to protect the <literal>template0</> database from being altered.
2490 <entry><structfield>datconnlimit</structfield></entry>
2491 <entry><type>int4</type></entry>
2494 Sets maximum number of concurrent connections that can be made
2495 to this database. -1 means no limit.
2500 <entry><structfield>datlastsysoid</structfield></entry>
2501 <entry><type>oid</type></entry>
2504 Last system OID in the database; useful
2505 particularly to <application>pg_dump</application>
2510 <entry><structfield>datfrozenxid</structfield></entry>
2511 <entry><type>xid</type></entry>
2514 All transaction IDs before this one have been replaced with a permanent
2515 (<quote>frozen</>) transaction ID in this database. This is used to
2516 track whether the database needs to be vacuumed in order to prevent
2517 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2518 It is the minimum of the per-table
2519 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2524 <entry><structfield>datminmxid</structfield></entry>
2525 <entry><type>xid</type></entry>
2528 All multixact IDs before this one have been replaced with a
2529 transaction ID in this database. This is used to
2530 track whether the database needs to be vacuumed in order to prevent
2531 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2532 It is the minimum of the per-table
2533 <structname>pg_class</>.<structfield>relminmxid</> values.
2538 <entry><structfield>dattablespace</structfield></entry>
2539 <entry><type>oid</type></entry>
2540 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2542 The default tablespace for the database.
2543 Within this database, all tables for which
2544 <structname>pg_class</>.<structfield>reltablespace</> is zero
2545 will be stored in this tablespace; in particular, all the non-shared
2546 system catalogs will be there.
2551 <entry><structfield>datacl</structfield></entry>
2552 <entry><type>aclitem[]</type></entry>
2555 Access privileges; see
2556 <xref linkend="sql-grant"> and
2557 <xref linkend="sql-revoke">
2567 <sect1 id="catalog-pg-db-role-setting">
2568 <title><structname>pg_db_role_setting</structname></title>
2570 <indexterm zone="catalog-pg-db-role-setting">
2571 <primary>pg_db_role_setting</primary>
2575 The catalog <structname>pg_db_role_setting</structname> records the default
2576 values that have been set for run-time configuration variables,
2577 for each role and database combination.
2581 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2582 is shared across all databases of a cluster: there is only one
2583 copy of <structname>pg_db_role_setting</structname> per cluster, not
2588 <title><structname>pg_db_role_setting</> Columns</title>
2595 <entry>References</entry>
2596 <entry>Description</entry>
2602 <entry><structfield>setdatabase</structfield></entry>
2603 <entry><type>oid</type></entry>
2604 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2605 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2609 <entry><structfield>setrole</structfield></entry>
2610 <entry><type>oid</type></entry>
2611 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2612 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2616 <entry><structfield>setconfig</structfield></entry>
2617 <entry><type>text[]</type></entry>
2619 <entry>Defaults for run-time configuration variables</entry>
2627 <sect1 id="catalog-pg-default-acl">
2628 <title><structname>pg_default_acl</structname></title>
2630 <indexterm zone="catalog-pg-default-acl">
2631 <primary>pg_default_acl</primary>
2635 The catalog <structname>pg_default_acl</> stores initial
2636 privileges to be assigned to newly created objects.
2640 <title><structname>pg_default_acl</> Columns</title>
2647 <entry>References</entry>
2648 <entry>Description</entry>
2654 <entry><structfield>oid</structfield></entry>
2655 <entry><type>oid</type></entry>
2657 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2661 <entry><structfield>defaclrole</structfield></entry>
2662 <entry><type>oid</type></entry>
2663 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2664 <entry>The OID of the role associated with this entry</entry>
2668 <entry><structfield>defaclnamespace</structfield></entry>
2669 <entry><type>oid</type></entry>
2670 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2671 <entry>The OID of the namespace associated with this entry,
2672 or 0 if none</entry>
2676 <entry><structfield>defaclobjtype</structfield></entry>
2677 <entry><type>char</type></entry>
2680 Type of object this entry is for:
2681 <literal>r</> = relation (table, view),
2682 <literal>S</> = sequence,
2683 <literal>f</> = function,
2684 <literal>T</> = type
2689 <entry><structfield>defaclacl</structfield></entry>
2690 <entry><type>aclitem[]</type></entry>
2693 Access privileges that this type of object should have on creation
2701 A <structname>pg_default_acl</> entry shows the initial privileges to
2702 be assigned to an object belonging to the indicated user. There are
2703 currently two types of entry: <quote>global</> entries with
2704 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2705 that reference a particular schema. If a global entry is present then
2706 it <emphasis>overrides</> the normal hard-wired default privileges
2707 for the object type. A per-schema entry, if present, represents privileges
2708 to be <emphasis>added to</> the global or hard-wired default privileges.
2712 Note that when an ACL entry in another catalog is null, it is taken
2713 to represent the hard-wired default privileges for its object,
2714 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2715 at the moment. <structname>pg_default_acl</> is only consulted during
2722 <sect1 id="catalog-pg-depend">
2723 <title><structname>pg_depend</structname></title>
2725 <indexterm zone="catalog-pg-depend">
2726 <primary>pg_depend</primary>
2730 The catalog <structname>pg_depend</structname> records the dependency
2731 relationships between database objects. This information allows
2732 <command>DROP</> commands to find which other objects must be dropped
2733 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2738 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2739 which performs a similar function for dependencies involving objects
2740 that are shared across a database cluster.
2744 <title><structname>pg_depend</> Columns</title>
2751 <entry>References</entry>
2752 <entry>Description</entry>
2758 <entry><structfield>classid</structfield></entry>
2759 <entry><type>oid</type></entry>
2760 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2761 <entry>The OID of the system catalog the dependent object is in</entry>
2765 <entry><structfield>objid</structfield></entry>
2766 <entry><type>oid</type></entry>
2767 <entry>any OID column</entry>
2768 <entry>The OID of the specific dependent object</entry>
2772 <entry><structfield>objsubid</structfield></entry>
2773 <entry><type>int4</type></entry>
2776 For a table column, this is the column number (the
2777 <structfield>objid</> and <structfield>classid</> refer to the
2778 table itself). For all other object types, this column is
2784 <entry><structfield>refclassid</structfield></entry>
2785 <entry><type>oid</type></entry>
2786 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2787 <entry>The OID of the system catalog the referenced object is in</entry>
2791 <entry><structfield>refobjid</structfield></entry>
2792 <entry><type>oid</type></entry>
2793 <entry>any OID column</entry>
2794 <entry>The OID of the specific referenced object</entry>
2798 <entry><structfield>refobjsubid</structfield></entry>
2799 <entry><type>int4</type></entry>
2802 For a table column, this is the column number (the
2803 <structfield>refobjid</> and <structfield>refclassid</> refer
2804 to the table itself). For all other object types, this column
2810 <entry><structfield>deptype</structfield></entry>
2811 <entry><type>char</type></entry>
2814 A code defining the specific semantics of this dependency relationship; see text
2823 In all cases, a <structname>pg_depend</structname> entry indicates that the
2824 referenced object cannot be dropped without also dropping the dependent
2825 object. However, there are several subflavors identified by
2826 <structfield>deptype</>:
2830 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2833 A normal relationship between separately-created objects. The
2834 dependent object can be dropped without affecting the
2835 referenced object. The referenced object can only be dropped
2836 by specifying <literal>CASCADE</>, in which case the dependent
2837 object is dropped, too. Example: a table column has a normal
2838 dependency on its data type.
2844 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2847 The dependent object can be dropped separately from the
2848 referenced object, and should be automatically dropped
2849 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2850 mode) if the referenced object is dropped. Example: a named
2851 constraint on a table is made autodependent on the table, so
2852 that it will go away if the table is dropped.
2858 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2861 The dependent object was created as part of creation of the
2862 referenced object, and is really just a part of its internal
2863 implementation. A <command>DROP</> of the dependent object
2864 will be disallowed outright (we'll tell the user to issue a
2865 <command>DROP</> against the referenced object, instead). A
2866 <command>DROP</> of the referenced object will be propagated
2867 through to drop the dependent object whether
2868 <command>CASCADE</> is specified or not. Example: a trigger
2869 that's created to enforce a foreign-key constraint is made
2870 internally dependent on the constraint's
2871 <structname>pg_constraint</> entry.
2877 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2880 The dependent object is a member of the <firstterm>extension</> that is
2881 the referenced object (see
2882 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2883 The dependent object can be dropped only via
2884 <command>DROP EXTENSION</> on the referenced object. Functionally
2885 this dependency type acts the same as an internal dependency, but
2886 it's kept separate for clarity and to simplify <application>pg_dump</>.
2892 <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2895 The dependent object is not a member of the extension that is the
2896 referenced object (and so should not be ignored by pg_dump), but
2897 cannot function without it and should be dropped when the
2898 extension itself is. The dependent object may be dropped on its
2905 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2908 There is no dependent object; this type of entry is a signal
2909 that the system itself depends on the referenced object, and so
2910 that object must never be deleted. Entries of this type are
2911 created only by <command>initdb</command>. The columns for the
2912 dependent object contain zeroes.
2918 Other dependency flavors might be needed in future.
2924 <sect1 id="catalog-pg-description">
2925 <title><structname>pg_description</structname></title>
2927 <indexterm zone="catalog-pg-description">
2928 <primary>pg_description</primary>
2932 The catalog <structname>pg_description</> stores optional descriptions
2933 (comments) for each database object. Descriptions can be manipulated
2934 with the <xref linkend="sql-comment"> command and viewed with
2935 <application>psql</application>'s <literal>\d</literal> commands.
2936 Descriptions of many built-in system objects are provided in the initial
2937 contents of <structname>pg_description</structname>.
2941 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2942 which performs a similar function for descriptions involving objects that
2943 are shared across a database cluster.
2947 <title><structname>pg_description</> Columns</title>
2954 <entry>References</entry>
2955 <entry>Description</entry>
2961 <entry><structfield>objoid</structfield></entry>
2962 <entry><type>oid</type></entry>
2963 <entry>any OID column</entry>
2964 <entry>The OID of the object this description pertains to</entry>
2968 <entry><structfield>classoid</structfield></entry>
2969 <entry><type>oid</type></entry>
2970 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2971 <entry>The OID of the system catalog this object appears in</entry>
2975 <entry><structfield>objsubid</structfield></entry>
2976 <entry><type>int4</type></entry>
2979 For a comment on a table column, this is the column number (the
2980 <structfield>objoid</> and <structfield>classoid</> refer to
2981 the table itself). For all other object types, this column is
2987 <entry><structfield>description</structfield></entry>
2988 <entry><type>text</type></entry>
2990 <entry>Arbitrary text that serves as the description of this object</entry>
2999 <sect1 id="catalog-pg-enum">
3000 <title><structname>pg_enum</structname></title>
3002 <indexterm zone="catalog-pg-enum">
3003 <primary>pg_enum</primary>
3007 The <structname>pg_enum</structname> catalog contains entries
3008 showing the values and labels for each enum type. The
3009 internal representation of a given enum value is actually the OID
3010 of its associated row in <structname>pg_enum</structname>.
3014 <title><structname>pg_enum</> Columns</title>
3021 <entry>References</entry>
3022 <entry>Description</entry>
3028 <entry><structfield>oid</structfield></entry>
3029 <entry><type>oid</type></entry>
3031 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3035 <entry><structfield>enumtypid</structfield></entry>
3036 <entry><type>oid</type></entry>
3037 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3038 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3042 <entry><structfield>enumsortorder</structfield></entry>
3043 <entry><type>float4</type></entry>
3045 <entry>The sort position of this enum value within its enum type</entry>
3049 <entry><structfield>enumlabel</structfield></entry>
3050 <entry><type>name</type></entry>
3052 <entry>The textual label for this enum value</entry>
3059 The OIDs for <structname>pg_enum</structname> rows follow a special
3060 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3061 as the sort ordering of their enum type. That is, if two even OIDs
3062 belong to the same enum type, the smaller OID must have the smaller
3063 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3064 need bear no relationship to the sort order. This rule allows the
3065 enum comparison routines to avoid catalog lookups in many common cases.
3066 The routines that create and alter enum types attempt to assign even
3067 OIDs to enum values whenever possible.
3071 When an enum type is created, its members are assigned sort-order
3072 positions 1..<replaceable>n</>. But members added later might be given
3073 negative or fractional values of <structfield>enumsortorder</structfield>.
3074 The only requirement on these values is that they be correctly
3075 ordered and unique within each enum type.
3080 <sect1 id="catalog-pg-event-trigger">
3081 <title><structname>pg_event_trigger</structname></title>
3083 <indexterm zone="catalog-pg-event-trigger">
3084 <primary>pg_event_trigger</primary>
3088 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3089 See <xref linkend="event-triggers"> for more information.
3093 <title><structname>pg_event_trigger</> Columns</title>
3100 <entry>References</entry>
3101 <entry>Description</entry>
3107 <entry><structfield>evtname</structfield></entry>
3108 <entry><type>name</type></entry>
3110 <entry>Trigger name (must be unique)</entry>
3114 <entry><structfield>evtevent</structfield></entry>
3115 <entry><type>name</type></entry>
3117 <entry>Identifies the event for which this trigger fires</entry>
3121 <entry><structfield>evtowner</structfield></entry>
3122 <entry><type>oid</type></entry>
3123 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3124 <entry>Owner of the event trigger</entry>
3128 <entry><structfield>evtfoid</structfield></entry>
3129 <entry><type>oid</type></entry>
3130 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3131 <entry>The function to be called</entry>
3135 <entry><structfield>evtenabled</structfield></entry>
3136 <entry><type>char</type></entry>
3139 Controls in which <xref linkend="guc-session-replication-role"> modes
3140 the event trigger fires.
3141 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3142 <literal>D</> = trigger is disabled,
3143 <literal>R</> = trigger fires in <quote>replica</> mode,
3144 <literal>A</> = trigger fires always.
3149 <entry><structfield>evttags</structfield></entry>
3150 <entry><type>text[]</type></entry>
3153 Command tags for which this trigger will fire. If NULL, the firing
3154 of this trigger is not restricted on the basis of the command tag.
3163 <sect1 id="catalog-pg-extension">
3164 <title><structname>pg_extension</structname></title>
3166 <indexterm zone="catalog-pg-extension">
3167 <primary>pg_extension</primary>
3171 The catalog <structname>pg_extension</structname> stores information
3172 about the installed extensions. See <xref linkend="extend-extensions">
3173 for details about extensions.
3177 <title><structname>pg_extension</> Columns</title>
3184 <entry>References</entry>
3185 <entry>Description</entry>
3191 <entry><structfield>oid</structfield></entry>
3192 <entry><type>oid</type></entry>
3194 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3198 <entry><structfield>extname</structfield></entry>
3199 <entry><type>name</type></entry>
3201 <entry>Name of the extension</entry>
3205 <entry><structfield>extowner</structfield></entry>
3206 <entry><type>oid</type></entry>
3207 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3208 <entry>Owner of the extension</entry>
3212 <entry><structfield>extnamespace</structfield></entry>
3213 <entry><type>oid</type></entry>
3214 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3215 <entry>Schema containing the extension's exported objects</entry>
3219 <entry><structfield>extrelocatable</structfield></entry>
3220 <entry><type>bool</type></entry>
3222 <entry>True if extension can be relocated to another schema</entry>
3226 <entry><structfield>extversion</structfield></entry>
3227 <entry><type>text</type></entry>
3229 <entry>Version name for the extension</entry>
3233 <entry><structfield>extconfig</structfield></entry>
3234 <entry><type>oid[]</type></entry>
3235 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3236 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3237 table(s), or <literal>NULL</> if none</entry>
3241 <entry><structfield>extcondition</structfield></entry>
3242 <entry><type>text[]</type></entry>
3244 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3245 extension's configuration table(s), or <literal>NULL</> if none</entry>
3253 Note that unlike most catalogs with a <quote>namespace</> column,
3254 <structfield>extnamespace</structfield> is not meant to imply
3255 that the extension belongs to that schema. Extension names are never
3256 schema-qualified. Rather, <structfield>extnamespace</structfield>
3257 indicates the schema that contains most or all of the extension's
3258 objects. If <structfield>extrelocatable</structfield> is true, then
3259 this schema must in fact contain all schema-qualifiable objects
3260 belonging to the extension.
3265 <sect1 id="catalog-pg-foreign-data-wrapper">
3266 <title><structname>pg_foreign_data_wrapper</structname></title>
3268 <indexterm zone="catalog-pg-foreign-data-wrapper">
3269 <primary>pg_foreign_data_wrapper</primary>
3273 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3274 foreign-data wrapper definitions. A foreign-data wrapper is the
3275 mechanism by which external data, residing on foreign servers, is
3280 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3287 <entry>References</entry>
3288 <entry>Description</entry>
3294 <entry><structfield>oid</structfield></entry>
3295 <entry><type>oid</type></entry>
3297 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3301 <entry><structfield>fdwname</structfield></entry>
3302 <entry><type>name</type></entry>
3304 <entry>Name of the foreign-data wrapper</entry>
3308 <entry><structfield>fdwowner</structfield></entry>
3309 <entry><type>oid</type></entry>
3310 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3311 <entry>Owner of the foreign-data wrapper</entry>
3315 <entry><structfield>fdwhandler</structfield></entry>
3316 <entry><type>oid</type></entry>
3317 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3319 References a handler function that is responsible for
3320 supplying execution routines for the foreign-data wrapper.
3321 Zero if no handler is provided
3326 <entry><structfield>fdwvalidator</structfield></entry>
3327 <entry><type>oid</type></entry>
3328 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3330 References a validator function that is responsible for
3331 checking the validity of the options given to the
3332 foreign-data wrapper, as well as options for foreign servers and user
3333 mappings using the foreign-data wrapper. Zero if no validator
3339 <entry><structfield>fdwacl</structfield></entry>
3340 <entry><type>aclitem[]</type></entry>
3343 Access privileges; see
3344 <xref linkend="sql-grant"> and
3345 <xref linkend="sql-revoke">
3351 <entry><structfield>fdwoptions</structfield></entry>
3352 <entry><type>text[]</type></entry>
3355 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3364 <sect1 id="catalog-pg-foreign-server">
3365 <title><structname>pg_foreign_server</structname></title>
3367 <indexterm zone="catalog-pg-foreign-server">
3368 <primary>pg_foreign_server</primary>
3372 The catalog <structname>pg_foreign_server</structname> stores
3373 foreign server definitions. A foreign server describes a source
3374 of external data, such as a remote server. Foreign
3375 servers are accessed via foreign-data wrappers.
3379 <title><structname>pg_foreign_server</> Columns</title>
3386 <entry>References</entry>
3387 <entry>Description</entry>
3393 <entry><structfield>oid</structfield></entry>
3394 <entry><type>oid</type></entry>
3396 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3400 <entry><structfield>srvname</structfield></entry>
3401 <entry><type>name</type></entry>
3403 <entry>Name of the foreign server</entry>
3407 <entry><structfield>srvowner</structfield></entry>
3408 <entry><type>oid</type></entry>
3409 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3410 <entry>Owner of the foreign server</entry>
3414 <entry><structfield>srvfdw</structfield></entry>
3415 <entry><type>oid</type></entry>
3416 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3417 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3421 <entry><structfield>srvtype</structfield></entry>
3422 <entry><type>text</type></entry>
3424 <entry>Type of the server (optional)</entry>
3428 <entry><structfield>srvversion</structfield></entry>
3429 <entry><type>text</type></entry>
3431 <entry>Version of the server (optional)</entry>
3435 <entry><structfield>srvacl</structfield></entry>
3436 <entry><type>aclitem[]</type></entry>
3439 Access privileges; see
3440 <xref linkend="sql-grant"> and
3441 <xref linkend="sql-revoke">
3447 <entry><structfield>srvoptions</structfield></entry>
3448 <entry><type>text[]</type></entry>
3451 Foreign server specific options, as <quote>keyword=value</> strings
3460 <sect1 id="catalog-pg-foreign-table">
3461 <title><structname>pg_foreign_table</structname></title>
3463 <indexterm zone="catalog-pg-foreign-table">
3464 <primary>pg_foreign_table</primary>
3468 The catalog <structname>pg_foreign_table</structname> contains
3469 auxiliary information about foreign tables. A foreign table is
3470 primarily represented by a <structname>pg_class</structname> entry,
3471 just like a regular table. Its <structname>pg_foreign_table</structname>
3472 entry contains the information that is pertinent only to foreign tables
3473 and not any other kind of relation.
3477 <title><structname>pg_foreign_table</> Columns</title>
3484 <entry>References</entry>
3485 <entry>Description</entry>
3491 <entry><structfield>ftrelid</structfield></entry>
3492 <entry><type>oid</type></entry>
3493 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3494 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3498 <entry><structfield>ftserver</structfield></entry>
3499 <entry><type>oid</type></entry>
3500 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3501 <entry>OID of the foreign server for this foreign table</entry>
3505 <entry><structfield>ftoptions</structfield></entry>
3506 <entry><type>text[]</type></entry>
3509 Foreign table options, as <quote>keyword=value</> strings
3518 <sect1 id="catalog-pg-index">
3519 <title><structname>pg_index</structname></title>
3521 <indexterm zone="catalog-pg-index">
3522 <primary>pg_index</primary>
3526 The catalog <structname>pg_index</structname> contains part of the information
3527 about indexes. The rest is mostly in
3528 <structname>pg_class</structname>.
3532 <title><structname>pg_index</> Columns</title>
3539 <entry>References</entry>
3540 <entry>Description</entry>
3546 <entry><structfield>indexrelid</structfield></entry>
3547 <entry><type>oid</type></entry>
3548 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3549 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3553 <entry><structfield>indrelid</structfield></entry>
3554 <entry><type>oid</type></entry>
3555 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3556 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3560 <entry><structfield>indnatts</structfield></entry>
3561 <entry><type>int2</type></entry>
3563 <entry>The number of columns in the index (duplicates
3564 <literal>pg_class.relnatts</literal>)</entry>
3568 <entry><structfield>indisunique</structfield></entry>
3569 <entry><type>bool</type></entry>
3571 <entry>If true, this is a unique index</entry>
3575 <entry><structfield>indisprimary</structfield></entry>
3576 <entry><type>bool</type></entry>
3578 <entry>If true, this index represents the primary key of the table
3579 (<structfield>indisunique</> should always be true when this is true)</entry>
3583 <entry><structfield>indisexclusion</structfield></entry>
3584 <entry><type>bool</type></entry>
3586 <entry>If true, this index supports an exclusion constraint</entry>
3590 <entry><structfield>indimmediate</structfield></entry>
3591 <entry><type>bool</type></entry>
3593 <entry>If true, the uniqueness check is enforced immediately on
3595 (irrelevant if <structfield>indisunique</> is not true)</entry>
3599 <entry><structfield>indisclustered</structfield></entry>
3600 <entry><type>bool</type></entry>
3602 <entry>If true, the table was last clustered on this index</entry>
3606 <entry><structfield>indisvalid</structfield></entry>
3607 <entry><type>bool</type></entry>
3610 If true, the index is currently valid for queries. False means the
3611 index is possibly incomplete: it must still be modified by
3612 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3613 be used for queries. If it is unique, the uniqueness property is not
3614 guaranteed true either.
3619 <entry><structfield>indcheckxmin</structfield></entry>
3620 <entry><type>bool</type></entry>
3623 If true, queries must not use the index until the <structfield>xmin</>
3624 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3625 event horizon, because the table may contain broken HOT chains with
3626 incompatible rows that they can see
3631 <entry><structfield>indisready</structfield></entry>
3632 <entry><type>bool</type></entry>
3635 If true, the index is currently ready for inserts. False means the
3636 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3642 <entry><structfield>indislive</structfield></entry>
3643 <entry><type>bool</type></entry>
3646 If false, the index is in process of being dropped, and should be
3647 ignored for all purposes (including HOT-safety decisions)
3652 <entry><structfield>indisreplident</structfield></entry>
3653 <entry><type>bool</type></entry>
3656 If true this index has been chosen as <quote>replica identity</>
3657 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3663 <entry><structfield>indkey</structfield></entry>
3664 <entry><type>int2vector</type></entry>
3665 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3667 This is an array of <structfield>indnatts</structfield> values that
3668 indicate which table columns this index indexes. For example a value
3669 of <literal>1 3</literal> would mean that the first and the third table
3670 columns make up the index key. A zero in this array indicates that the
3671 corresponding index attribute is an expression over the table columns,
3672 rather than a simple column reference.
3677 <entry><structfield>indcollation</structfield></entry>
3678 <entry><type>oidvector</type></entry>
3679 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3681 For each column in the index key, this contains the OID of the
3682 collation to use for the index.
3687 <entry><structfield>indclass</structfield></entry>
3688 <entry><type>oidvector</type></entry>
3689 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3691 For each column in the index key, this contains the OID of
3692 the operator class to use. See
3693 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3698 <entry><structfield>indoption</structfield></entry>
3699 <entry><type>int2vector</type></entry>
3702 This is an array of <structfield>indnatts</structfield> values that
3703 store per-column flag bits. The meaning of the bits is defined by
3704 the index's access method.
3709 <entry><structfield>indexprs</structfield></entry>
3710 <entry><type>pg_node_tree</type></entry>
3713 Expression trees (in <function>nodeToString()</function>
3714 representation) for index attributes that are not simple column
3715 references. This is a list with one element for each zero
3716 entry in <structfield>indkey</>. Null if all index attributes
3717 are simple references.
3722 <entry><structfield>indpred</structfield></entry>
3723 <entry><type>pg_node_tree</type></entry>
3726 Expression tree (in <function>nodeToString()</function>
3727 representation) for partial index predicate. Null if not a
3738 <sect1 id="catalog-pg-inherits">
3739 <title><structname>pg_inherits</structname></title>
3741 <indexterm zone="catalog-pg-inherits">
3742 <primary>pg_inherits</primary>
3746 The catalog <structname>pg_inherits</> records information about
3747 table inheritance hierarchies. There is one entry for each direct
3748 child table in the database. (Indirect inheritance can be determined
3749 by following chains of entries.)
3753 <title><structname>pg_inherits</> Columns</title>
3760 <entry>References</entry>
3761 <entry>Description</entry>
3767 <entry><structfield>inhrelid</structfield></entry>
3768 <entry><type>oid</type></entry>
3769 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3771 The OID of the child table
3776 <entry><structfield>inhparent</structfield></entry>
3777 <entry><type>oid</type></entry>
3778 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3780 The OID of the parent table
3785 <entry><structfield>inhseqno</structfield></entry>
3786 <entry><type>int4</type></entry>
3789 If there is more than one direct parent for a child table (multiple
3790 inheritance), this number tells the order in which the
3791 inherited columns are to be arranged. The count starts at 1.
3800 <sect1 id="catalog-pg-init-privs">
3801 <title><structname>pg_init_privs</structname></title>
3803 <indexterm zone="catalog-pg-init-privs">
3804 <primary>pg_init_privs</primary>
3808 The catalog <structname>pg_init_privs</> records information about
3809 the initial privileges of objects in the system. There is one entry
3810 for each object in the database which has a non-default (non-NULL)
3811 initial set of privileges.
3815 Objects can have initial privileges either by having those privileges set
3816 when the system is initialized (by <application>initdb</>) or when the
3817 object is created during a <command>CREATE EXTENSION</command> and the
3818 extension script sets initial privileges using the <command>GRANT</command>
3819 system. Note that the system will automatically handle recording of the
3820 privileges during the extension script and that extension authors need
3821 only use the <command>GRANT</command> and <command>REVOKE</command>
3822 statements in their script to have the privileges recorded. The
3823 <literal>privtype</literal> column indicates if the initial privilege was
3824 set by <application>initdb</> or during a
3825 <command>CREATE EXTENSION</command> command.
3829 Objects which have initial privileges set by <application>initdb</> will
3830 have entries where <literal>privtype</literal> is
3831 <literal>'i'</literal>, while objects which have initial privileges set
3832 by <command>CREATE EXTENSION</command> will have entries where
3833 <literal>privtype</literal> is <literal>'e'</literal>.
3837 <title><structname>pg_init_privs</> Columns</title>
3844 <entry>References</entry>
3845 <entry>Description</entry>
3851 <entry><structfield>objoid</structfield></entry>
3852 <entry><type>oid</type></entry>
3853 <entry>any OID column</entry>
3854 <entry>The OID of the specific object</entry>
3858 <entry><structfield>classoid</structfield></entry>
3859 <entry><type>oid</type></entry>
3860 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3861 <entry>The OID of the system catalog the object is in</entry>
3865 <entry><structfield>objsubid</structfield></entry>
3866 <entry><type>int4</type></entry>
3869 For a table column, this is the column number (the
3870 <structfield>objoid</> and <structfield>classoid</> refer to the
3871 table itself). For all other object types, this column is
3877 <entry><structfield>privtype</structfield></entry>
3878 <entry><type>char</type></entry>
3881 A code defining the type of initial privilege of this object; see text
3886 <entry><structfield>initprivs</structfield></entry>
3887 <entry><type>aclitem[]</type></entry>
3890 The initial access privileges; see
3891 <xref linkend="sql-grant"> and
3892 <xref linkend="sql-revoke">
3904 <sect1 id="catalog-pg-language">
3905 <title><structname>pg_language</structname></title>
3907 <indexterm zone="catalog-pg-language">
3908 <primary>pg_language</primary>
3912 The catalog <structname>pg_language</structname> registers
3913 languages in which you can write functions or stored procedures.
3914 See <xref linkend="sql-createlanguage">
3915 and <xref linkend="xplang"> for more information about language handlers.
3919 <title><structname>pg_language</> Columns</title>
3926 <entry>References</entry>
3927 <entry>Description</entry>
3933 <entry><structfield>oid</structfield></entry>
3934 <entry><type>oid</type></entry>
3936 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3940 <entry><structfield>lanname</structfield></entry>
3941 <entry><type>name</type></entry>
3943 <entry>Name of the language</entry>
3947 <entry><structfield>lanowner</structfield></entry>
3948 <entry><type>oid</type></entry>
3949 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3950 <entry>Owner of the language</entry>
3954 <entry><structfield>lanispl</structfield></entry>
3955 <entry><type>bool</type></entry>
3958 This is false for internal languages (such as
3959 <acronym>SQL</acronym>) and true for user-defined languages.
3960 Currently, <application>pg_dump</application> still uses this
3961 to determine which languages need to be dumped, but this might be
3962 replaced by a different mechanism in the future.
3967 <entry><structfield>lanpltrusted</structfield></entry>
3968 <entry><type>bool</type></entry>
3971 True if this is a trusted language, which means that it is believed
3972 not to grant access to anything outside the normal SQL execution
3973 environment. Only superusers can create functions in untrusted
3979 <entry><structfield>lanplcallfoid</structfield></entry>
3980 <entry><type>oid</type></entry>
3981 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3983 For noninternal languages this references the language
3984 handler, which is a special function that is responsible for
3985 executing all functions that are written in the particular
3991 <entry><structfield>laninline</structfield></entry>
3992 <entry><type>oid</type></entry>
3993 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3995 This references a function that is responsible for executing
3996 <quote>inline</> anonymous code blocks
3997 (<xref linkend="sql-do"> blocks).
3998 Zero if inline blocks are not supported.
4003 <entry><structfield>lanvalidator</structfield></entry>
4004 <entry><type>oid</type></entry>
4005 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4007 This references a language validator function that is responsible
4008 for checking the syntax and validity of new functions when they
4009 are created. Zero if no validator is provided.
4014 <entry><structfield>lanacl</structfield></entry>
4015 <entry><type>aclitem[]</type></entry>
4018 Access privileges; see
4019 <xref linkend="sql-grant"> and
4020 <xref linkend="sql-revoke">
4031 <sect1 id="catalog-pg-largeobject">
4032 <title><structname>pg_largeobject</structname></title>
4034 <indexterm zone="catalog-pg-largeobject">
4035 <primary>pg_largeobject</primary>
4039 The catalog <structname>pg_largeobject</structname> holds the data making up
4040 <quote>large objects</quote>. A large object is identified by an OID
4041 assigned when it is created. Each large object is broken into
4042 segments or <quote>pages</> small enough to be conveniently stored as rows
4043 in <structname>pg_largeobject</structname>.
4044 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4045 <literal>BLCKSZ/4</>, or typically 2 kB).
4049 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4050 associated with large objects. As a result,
4051 <structname>pg_largeobject</structname> was publicly readable and could be
4052 used to obtain the OIDs (and contents) of all large objects in the system.
4053 This is no longer the case; use
4054 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4055 to obtain a list of large object OIDs.
4059 <title><structname>pg_largeobject</> Columns</title>
4066 <entry>References</entry>
4067 <entry>Description</entry>
4073 <entry><structfield>loid</structfield></entry>
4074 <entry><type>oid</type></entry>
4075 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4076 <entry>Identifier of the large object that includes this page</entry>
4080 <entry><structfield>pageno</structfield></entry>
4081 <entry><type>int4</type></entry>
4083 <entry>Page number of this page within its large object
4084 (counting from zero)</entry>
4088 <entry><structfield>data</structfield></entry>
4089 <entry><type>bytea</type></entry>
4092 Actual data stored in the large object.
4093 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4101 Each row of <structname>pg_largeobject</structname> holds data
4102 for one page of a large object, beginning at
4103 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4104 allows sparse storage: pages might be missing, and might be shorter than
4105 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4106 Missing regions within a large object read as zeroes.
4111 <sect1 id="catalog-pg-largeobject-metadata">
4112 <title><structname>pg_largeobject_metadata</structname></title>
4114 <indexterm zone="catalog-pg-largeobject-metadata">
4115 <primary>pg_largeobject_metadata</primary>
4119 The catalog <structname>pg_largeobject_metadata</structname>
4120 holds metadata associated with large objects. The actual large object
4122 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4126 <title><structname>pg_largeobject_metadata</> Columns</title>
4133 <entry>References</entry>
4134 <entry>Description</entry>
4140 <entry><structfield>oid</structfield></entry>
4141 <entry><type>oid</type></entry>
4143 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4147 <entry><structfield>lomowner</structfield></entry>
4148 <entry><type>oid</type></entry>
4149 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4150 <entry>Owner of the large object</entry>
4154 <entry><structfield>lomacl</structfield></entry>
4155 <entry><type>aclitem[]</type></entry>
4158 Access privileges; see
4159 <xref linkend="sql-grant"> and
4160 <xref linkend="sql-revoke">
4170 <sect1 id="catalog-pg-namespace">
4171 <title><structname>pg_namespace</structname></title>
4173 <indexterm zone="catalog-pg-namespace">
4174 <primary>pg_namespace</primary>
4178 The catalog <structname>pg_namespace</> stores namespaces.
4179 A namespace is the structure underlying SQL schemas: each namespace
4180 can have a separate collection of relations, types, etc. without name
4185 <title><structname>pg_namespace</> Columns</title>
4192 <entry>References</entry>
4193 <entry>Description</entry>
4199 <entry><structfield>oid</structfield></entry>
4200 <entry><type>oid</type></entry>
4202 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4206 <entry><structfield>nspname</structfield></entry>
4207 <entry><type>name</type></entry>
4209 <entry>Name of the namespace</entry>
4213 <entry><structfield>nspowner</structfield></entry>
4214 <entry><type>oid</type></entry>
4215 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4216 <entry>Owner of the namespace</entry>
4220 <entry><structfield>nspacl</structfield></entry>
4221 <entry><type>aclitem[]</type></entry>
4224 Access privileges; see
4225 <xref linkend="sql-grant"> and
4226 <xref linkend="sql-revoke">
4237 <sect1 id="catalog-pg-opclass">
4238 <title><structname>pg_opclass</structname></title>
4240 <indexterm zone="catalog-pg-opclass">
4241 <primary>pg_opclass</primary>
4245 The catalog <structname>pg_opclass</structname> defines
4246 index access method operator classes. Each operator class defines
4247 semantics for index columns of a particular data type and a particular
4248 index access method. An operator class essentially specifies that a
4249 particular operator family is applicable to a particular indexable column
4250 data type. The set of operators from the family that are actually usable
4251 with the indexed column are whichever ones accept the column's data type
4252 as their left-hand input.
4256 Operator classes are described at length in <xref linkend="xindex">.
4260 <title><structname>pg_opclass</> Columns</title>
4267 <entry>References</entry>
4268 <entry>Description</entry>
4274 <entry><structfield>oid</structfield></entry>
4275 <entry><type>oid</type></entry>
4277 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4281 <entry><structfield>opcmethod</structfield></entry>
4282 <entry><type>oid</type></entry>
4283 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4284 <entry>Index access method operator class is for</entry>
4288 <entry><structfield>opcname</structfield></entry>
4289 <entry><type>name</type></entry>
4291 <entry>Name of this operator class</entry>
4295 <entry><structfield>opcnamespace</structfield></entry>
4296 <entry><type>oid</type></entry>
4297 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4298 <entry>Namespace of this operator class</entry>
4302 <entry><structfield>opcowner</structfield></entry>
4303 <entry><type>oid</type></entry>
4304 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4305 <entry>Owner of the operator class</entry>
4309 <entry><structfield>opcfamily</structfield></entry>
4310 <entry><type>oid</type></entry>
4311 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4312 <entry>Operator family containing the operator class</entry>
4316 <entry><structfield>opcintype</structfield></entry>
4317 <entry><type>oid</type></entry>
4318 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4319 <entry>Data type that the operator class indexes</entry>
4323 <entry><structfield>opcdefault</structfield></entry>
4324 <entry><type>bool</type></entry>
4326 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4330 <entry><structfield>opckeytype</structfield></entry>
4331 <entry><type>oid</type></entry>
4332 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4333 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4341 An operator class's <structfield>opcmethod</> must match the
4342 <structname>opfmethod</> of its containing operator family.
4343 Also, there must be no more than one <structname>pg_opclass</structname>
4344 row having <structname>opcdefault</> true for any given combination of
4345 <structname>opcmethod</> and <structname>opcintype</>.
4351 <sect1 id="catalog-pg-operator">
4352 <title><structname>pg_operator</structname></title>
4354 <indexterm zone="catalog-pg-operator">
4355 <primary>pg_operator</primary>
4359 The catalog <structname>pg_operator</> stores information about operators.
4360 See <xref linkend="sql-createoperator">
4361 and <xref linkend="xoper"> for more information.
4365 <title><structname>pg_operator</> Columns</title>
4372 <entry>References</entry>
4373 <entry>Description</entry>
4379 <entry><structfield>oid</structfield></entry>
4380 <entry><type>oid</type></entry>
4382 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4386 <entry><structfield>oprname</structfield></entry>
4387 <entry><type>name</type></entry>
4389 <entry>Name of the operator</entry>
4393 <entry><structfield>oprnamespace</structfield></entry>
4394 <entry><type>oid</type></entry>
4395 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4397 The OID of the namespace that contains this operator
4402 <entry><structfield>oprowner</structfield></entry>
4403 <entry><type>oid</type></entry>
4404 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4405 <entry>Owner of the operator</entry>
4409 <entry><structfield>oprkind</structfield></entry>
4410 <entry><type>char</type></entry>
4413 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4414 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4419 <entry><structfield>oprcanmerge</structfield></entry>
4420 <entry><type>bool</type></entry>
4422 <entry>This operator supports merge joins</entry>
4426 <entry><structfield>oprcanhash</structfield></entry>
4427 <entry><type>bool</type></entry>
4429 <entry>This operator supports hash joins</entry>
4433 <entry><structfield>oprleft</structfield></entry>
4434 <entry><type>oid</type></entry>
4435 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4436 <entry>Type of the left operand</entry>
4440 <entry><structfield>oprright</structfield></entry>
4441 <entry><type>oid</type></entry>
4442 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4443 <entry>Type of the right operand</entry>
4447 <entry><structfield>oprresult</structfield></entry>
4448 <entry><type>oid</type></entry>
4449 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4450 <entry>Type of the result</entry>
4454 <entry><structfield>oprcom</structfield></entry>
4455 <entry><type>oid</type></entry>
4456 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4457 <entry>Commutator of this operator, if any</entry>
4461 <entry><structfield>oprnegate</structfield></entry>
4462 <entry><type>oid</type></entry>
4463 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4464 <entry>Negator of this operator, if any</entry>
4468 <entry><structfield>oprcode</structfield></entry>
4469 <entry><type>regproc</type></entry>
4470 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4471 <entry>Function that implements this operator</entry>
4475 <entry><structfield>oprrest</structfield></entry>
4476 <entry><type>regproc</type></entry>
4477 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4478 <entry>Restriction selectivity estimation function for this operator</entry>
4482 <entry><structfield>oprjoin</structfield></entry>
4483 <entry><type>regproc</type></entry>
4484 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4485 <entry>Join selectivity estimation function for this operator</entry>
4492 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4493 is zero for a prefix operator.
4499 <sect1 id="catalog-pg-opfamily">
4500 <title><structname>pg_opfamily</structname></title>
4502 <indexterm zone="catalog-pg-opfamily">
4503 <primary>pg_opfamily</primary>
4507 The catalog <structname>pg_opfamily</structname> defines operator families.
4508 Each operator family is a collection of operators and associated
4509 support routines that implement the semantics specified for a particular
4510 index access method. Furthermore, the operators in a family are all
4511 <quote>compatible</>, in a way that is specified by the access method.
4512 The operator family concept allows cross-data-type operators to be used
4513 with indexes and to be reasoned about using knowledge of access method
4518 Operator families are described at length in <xref linkend="xindex">.
4522 <title><structname>pg_opfamily</> Columns</title>
4529 <entry>References</entry>
4530 <entry>Description</entry>
4536 <entry><structfield>oid</structfield></entry>
4537 <entry><type>oid</type></entry>
4539 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4543 <entry><structfield>opfmethod</structfield></entry>
4544 <entry><type>oid</type></entry>
4545 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4546 <entry>Index access method operator family is for</entry>
4550 <entry><structfield>opfname</structfield></entry>
4551 <entry><type>name</type></entry>
4553 <entry>Name of this operator family</entry>
4557 <entry><structfield>opfnamespace</structfield></entry>
4558 <entry><type>oid</type></entry>
4559 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4560 <entry>Namespace of this operator family</entry>
4564 <entry><structfield>opfowner</structfield></entry>
4565 <entry><type>oid</type></entry>
4566 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4567 <entry>Owner of the operator family</entry>
4575 The majority of the information defining an operator family is not in its
4576 <structname>pg_opfamily</structname> row, but in the associated rows in
4577 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4578 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4580 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4586 <sect1 id="catalog-pg-pltemplate">
4587 <title><structname>pg_pltemplate</structname></title>
4589 <indexterm zone="catalog-pg-pltemplate">
4590 <primary>pg_pltemplate</primary>
4594 The catalog <structname>pg_pltemplate</structname> stores
4595 <quote>template</> information for procedural languages.
4596 A template for a language allows the language to be created in a
4597 particular database by a simple <command>CREATE LANGUAGE</> command,
4598 with no need to specify implementation details.
4602 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4603 is shared across all databases of a cluster: there is only one
4604 copy of <structname>pg_pltemplate</structname> per cluster, not
4605 one per database. This allows the information to be accessible in
4606 each database as it is needed.
4610 <title><structname>pg_pltemplate</> Columns</title>
4617 <entry>Description</entry>
4623 <entry><structfield>tmplname</structfield></entry>
4624 <entry><type>name</type></entry>
4625 <entry>Name of the language this template is for</entry>
4629 <entry><structfield>tmpltrusted</structfield></entry>
4630 <entry><type>boolean</type></entry>
4631 <entry>True if language is considered trusted</entry>
4635 <entry><structfield>tmpldbacreate</structfield></entry>
4636 <entry><type>boolean</type></entry>
4637 <entry>True if language may be created by a database owner</entry>
4641 <entry><structfield>tmplhandler</structfield></entry>
4642 <entry><type>text</type></entry>
4643 <entry>Name of call handler function</entry>
4647 <entry><structfield>tmplinline</structfield></entry>
4648 <entry><type>text</type></entry>
4649 <entry>Name of anonymous-block handler function, or null if none</entry>
4653 <entry><structfield>tmplvalidator</structfield></entry>
4654 <entry><type>text</type></entry>
4655 <entry>Name of validator function, or null if none</entry>
4659 <entry><structfield>tmpllibrary</structfield></entry>
4660 <entry><type>text</type></entry>
4661 <entry>Path of shared library that implements language</entry>
4665 <entry><structfield>tmplacl</structfield></entry>
4666 <entry><type>aclitem[]</type></entry>
4667 <entry>Access privileges for template (not actually used)</entry>
4675 There are not currently any commands that manipulate procedural language
4676 templates; to change the built-in information, a superuser must modify
4677 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4678 or <command>UPDATE</command> commands.
4683 It is likely that <structname>pg_pltemplate</> will be removed in some
4684 future release of <productname>PostgreSQL</productname>, in favor of
4685 keeping this knowledge about procedural languages in their respective
4686 extension installation scripts.
4692 <sect1 id="catalog-pg-policy">
4693 <title><structname>pg_policy</structname></title>
4695 <indexterm zone="catalog-pg-policy">
4696 <primary>pg_policy</primary>
4700 The catalog <structname>pg_policy</structname> stores row level
4701 security policies for tables. A policy includes the kind of
4702 command that it applies to (possibly all commands), the roles that it
4703 applies to, the expression to be added as a security-barrier
4704 qualification to queries that include the table, and the expression
4705 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4706 add new records to the table.
4711 <title><structname>pg_policy</structname> Columns</title>
4718 <entry>References</entry>
4719 <entry>Description</entry>
4725 <entry><structfield>polname</structfield></entry>
4726 <entry><type>name</type></entry>
4728 <entry>The name of the policy</entry>
4732 <entry><structfield>polrelid</structfield></entry>
4733 <entry><type>oid</type></entry>
4734 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4735 <entry>The table to which the policy applies</entry>
4739 <entry><structfield>polcmd</structfield></entry>
4740 <entry><type>char</type></entry>
4742 <entry>The command type to which the policy is applied:
4743 <literal>r</> for <command>SELECT</>,
4744 <literal>a</> for <command>INSERT</>,
4745 <literal>w</> for <command>UPDATE</>,
4746 <literal>d</> for <command>DELETE</>,
4747 or <literal>*</> for all</entry>
4751 <entry><structfield>polroles</structfield></entry>
4752 <entry><type>oid[]</type></entry>
4753 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4754 <entry>The roles to which the policy is applied</entry>
4758 <entry><structfield>polqual</structfield></entry>
4759 <entry><type>pg_node_tree</type></entry>
4761 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4765 <entry><structfield>polwithcheck</structfield></entry>
4766 <entry><type>pg_node_tree</type></entry>
4768 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4777 Policies stored in <structname>pg_policy</> are applied only when
4778 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4785 <sect1 id="catalog-pg-proc">
4786 <title><structname>pg_proc</structname></title>
4788 <indexterm zone="catalog-pg-proc">
4789 <primary>pg_proc</primary>
4793 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4794 See <xref linkend="sql-createfunction">
4795 and <xref linkend="xfunc"> for more information.
4799 The table contains data for aggregate functions as well as plain functions.
4800 If <structfield>proisagg</structfield> is true, there should be a matching
4801 row in <structfield>pg_aggregate</structfield>.
4805 <title><structname>pg_proc</> Columns</title>
4812 <entry>References</entry>
4813 <entry>Description</entry>
4819 <entry><structfield>oid</structfield></entry>
4820 <entry><type>oid</type></entry>
4822 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4826 <entry><structfield>proname</structfield></entry>
4827 <entry><type>name</type></entry>
4829 <entry>Name of the function</entry>
4833 <entry><structfield>pronamespace</structfield></entry>
4834 <entry><type>oid</type></entry>
4835 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4837 The OID of the namespace that contains this function
4842 <entry><structfield>proowner</structfield></entry>
4843 <entry><type>oid</type></entry>
4844 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4845 <entry>Owner of the function</entry>
4849 <entry><structfield>prolang</structfield></entry>
4850 <entry><type>oid</type></entry>
4851 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4852 <entry>Implementation language or call interface of this function</entry>
4856 <entry><structfield>procost</structfield></entry>
4857 <entry><type>float4</type></entry>
4859 <entry>Estimated execution cost (in units of
4860 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4861 this is cost per row returned</entry>
4865 <entry><structfield>prorows</structfield></entry>
4866 <entry><type>float4</type></entry>
4868 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4872 <entry><structfield>provariadic</structfield></entry>
4873 <entry><type>oid</type></entry>
4874 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4875 <entry>Data type of the variadic array parameter's elements,
4876 or zero if the function does not have a variadic parameter</entry>
4880 <entry><structfield>protransform</structfield></entry>
4881 <entry><type>regproc</type></entry>
4882 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4883 <entry>Calls to this function can be simplified by this other function
4884 (see <xref linkend="xfunc-transform-functions">)</entry>
4888 <entry><structfield>proisagg</structfield></entry>
4889 <entry><type>bool</type></entry>
4891 <entry>Function is an aggregate function</entry>
4895 <entry><structfield>proiswindow</structfield></entry>
4896 <entry><type>bool</type></entry>
4898 <entry>Function is a window function</entry>
4902 <entry><structfield>prosecdef</structfield></entry>
4903 <entry><type>bool</type></entry>
4905 <entry>Function is a security definer (i.e., a <quote>setuid</>
4910 <entry><structfield>proleakproof</structfield></entry>
4911 <entry><type>bool</type></entry>
4914 The function has no side effects. No information about the
4915 arguments is conveyed except via the return value. Any function
4916 that might throw an error depending on the values of its arguments
4922 <entry><structfield>proisstrict</structfield></entry>
4923 <entry><type>bool</type></entry>
4926 Function returns null if any call argument is null. In that
4927 case the function won't actually be called at all. Functions
4928 that are not <quote>strict</quote> must be prepared to handle
4934 <entry><structfield>proretset</structfield></entry>
4935 <entry><type>bool</type></entry>
4937 <entry>Function returns a set (i.e., multiple values of the specified
4942 <entry><structfield>provolatile</structfield></entry>
4943 <entry><type>char</type></entry>
4946 <structfield>provolatile</structfield> tells whether the function's
4947 result depends only on its input arguments, or is affected by outside
4949 It is <literal>i</literal> for <quote>immutable</> functions,
4950 which always deliver the same result for the same inputs.
4951 It is <literal>s</literal> for <quote>stable</> functions,
4952 whose results (for fixed inputs) do not change within a scan.
4953 It is <literal>v</literal> for <quote>volatile</> functions,
4954 whose results might change at any time. (Use <literal>v</literal> also
4955 for functions with side-effects, so that calls to them cannot get
4961 <entry><structfield>proparallel</structfield></entry>
4962 <entry><type>char</type></entry>
4965 <structfield>proparallel</structfield> tells whether the function
4966 can be safely run in parallel mode.
4967 It is <literal>s</literal> for functions which are safe to run in
4968 parallel mode without restriction.
4969 It is <literal>r</literal> for functions which can be run in parallel
4970 mode, but their execution is restricted to the parallel group leader;
4971 parallel worker processes cannot invoke these functions.
4972 It is <literal>u</literal> for functions which are unsafe in parallel
4973 mode; the presence of such a function forces a serial execution plan.
4978 <entry><structfield>pronargs</structfield></entry>
4979 <entry><type>int2</type></entry>
4981 <entry>Number of input arguments</entry>
4985 <entry><structfield>pronargdefaults</structfield></entry>
4986 <entry><type>int2</type></entry>
4988 <entry>Number of arguments that have defaults</entry>
4992 <entry><structfield>prorettype</structfield></entry>
4993 <entry><type>oid</type></entry>
4994 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4995 <entry>Data type of the return value</entry>
4999 <entry><structfield>proargtypes</structfield></entry>
5000 <entry><type>oidvector</type></entry>
5001 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5003 An array with the data types of the function arguments. This includes
5004 only input arguments (including <literal>INOUT</literal> and
5005 <literal>VARIADIC</> arguments), and thus represents
5006 the call signature of the function.
5011 <entry><structfield>proallargtypes</structfield></entry>
5012 <entry><type>oid[]</type></entry>
5013 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5015 An array with the data types of the function arguments. This includes
5016 all arguments (including <literal>OUT</literal> and
5017 <literal>INOUT</literal> arguments); however, if all the
5018 arguments are <literal>IN</literal> arguments, this field will be null.
5019 Note that subscripting is 1-based, whereas for historical reasons
5020 <structfield>proargtypes</> is subscripted from 0.
5025 <entry><structfield>proargmodes</structfield></entry>
5026 <entry><type>char[]</type></entry>
5029 An array with the modes of the function arguments, encoded as
5030 <literal>i</literal> for <literal>IN</> arguments,
5031 <literal>o</literal> for <literal>OUT</> arguments,
5032 <literal>b</literal> for <literal>INOUT</> arguments,
5033 <literal>v</literal> for <literal>VARIADIC</> arguments,
5034 <literal>t</literal> for <literal>TABLE</> arguments.
5035 If all the arguments are <literal>IN</literal> arguments,
5036 this field will be null.
5037 Note that subscripts correspond to positions of
5038 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5043 <entry><structfield>proargnames</structfield></entry>
5044 <entry><type>text[]</type></entry>
5047 An array with the names of the function arguments.
5048 Arguments without a name are set to empty strings in the array.
5049 If none of the arguments have a name, this field will be null.
5050 Note that subscripts correspond to positions of
5051 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5056 <entry><structfield>proargdefaults</structfield></entry>
5057 <entry><type>pg_node_tree</type></entry>
5060 Expression trees (in <function>nodeToString()</function> representation)
5061 for default values. This is a list with
5062 <structfield>pronargdefaults</> elements, corresponding to the last
5063 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5064 <replaceable>N</> <structfield>proargtypes</> positions).
5065 If none of the arguments have defaults, this field will be null.
5070 <entry><structfield>protrftypes</structfield></entry>
5071 <entry><type>oid[]</type></entry>
5074 Data type OIDs for which to apply transforms.
5079 <entry><structfield>prosrc</structfield></entry>
5080 <entry><type>text</type></entry>
5083 This tells the function handler how to invoke the function. It
5084 might be the actual source code of the function for interpreted
5085 languages, a link symbol, a file name, or just about anything
5086 else, depending on the implementation language/call convention.
5091 <entry><structfield>probin</structfield></entry>
5092 <entry><type>text</type></entry>
5095 Additional information about how to invoke the function.
5096 Again, the interpretation is language-specific.
5101 <entry><structfield>proconfig</structfield></entry>
5102 <entry><type>text[]</type></entry>
5104 <entry>Function's local settings for run-time configuration variables</entry>
5108 <entry><structfield>proacl</structfield></entry>
5109 <entry><type>aclitem[]</type></entry>
5112 Access privileges; see
5113 <xref linkend="sql-grant"> and
5114 <xref linkend="sql-revoke">
5123 For compiled functions, both built-in and dynamically loaded,
5124 <structfield>prosrc</structfield> contains the function's C-language
5125 name (link symbol). For all other currently-known language types,
5126 <structfield>prosrc</structfield> contains the function's source
5127 text. <structfield>probin</structfield> is unused except for
5128 dynamically-loaded C functions, for which it gives the name of the
5129 shared library file containing the function.
5134 <sect1 id="catalog-pg-range">
5135 <title><structname>pg_range</structname></title>
5137 <indexterm zone="catalog-pg-range">
5138 <primary>pg_range</primary>
5142 The catalog <structname>pg_range</structname> stores information about
5143 range types. This is in addition to the types' entries in
5144 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5148 <title><structname>pg_range</> Columns</title>
5155 <entry>References</entry>
5156 <entry>Description</entry>
5162 <entry><structfield>rngtypid</structfield></entry>
5163 <entry><type>oid</type></entry>
5164 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5165 <entry>OID of the range type</entry>
5169 <entry><structfield>rngsubtype</structfield></entry>
5170 <entry><type>oid</type></entry>
5171 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5172 <entry>OID of the element type (subtype) of this range type</entry>
5176 <entry><structfield>rngcollation</structfield></entry>
5177 <entry><type>oid</type></entry>
5178 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5179 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5183 <entry><structfield>rngsubopc</structfield></entry>
5184 <entry><type>oid</type></entry>
5185 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5186 <entry>OID of the subtype's operator class used for range comparisons</entry>
5190 <entry><structfield>rngcanonical</structfield></entry>
5191 <entry><type>regproc</type></entry>
5192 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5193 <entry>OID of the function to convert a range value into canonical form,
5194 or 0 if none</entry>
5198 <entry><structfield>rngsubdiff</structfield></entry>
5199 <entry><type>regproc</type></entry>
5200 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5201 <entry>OID of the function to return the difference between two element
5202 values as <type>double precision</type>, or 0 if none</entry>
5209 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5210 element type is collatable) determines the sort ordering used by the range
5211 type. <structfield>rngcanonical</> is used when the element type is
5212 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5213 improve performance of GiST indexes on the range type.
5218 <sect1 id="catalog-pg-replication-origin">
5219 <title><structname>pg_replication_origin</structname></title>
5221 <indexterm zone="catalog-pg-replication-origin">
5222 <primary>pg_replication_origin</primary>
5226 The <structname>pg_replication_origin</structname> catalog contains
5227 all replication origins created. For more on replication origins
5228 see <xref linkend="replication-origins">.
5233 <title><structname>pg_replication_origin</structname> Columns</title>
5240 <entry>References</entry>
5241 <entry>Description</entry>
5247 <entry><structfield>roident</structfield></entry>
5248 <entry><type>Oid</type></entry>
5250 <entry>A unique, cluster-wide identifier for the replication
5251 origin. Should never leave the system.</entry>
5255 <entry><structfield>roname</structfield></entry>
5256 <entry><type>text</type></entry>
5258 <entry>The external, user defined, name of a replication
5266 <sect1 id="catalog-pg-rewrite">
5267 <title><structname>pg_rewrite</structname></title>
5269 <indexterm zone="catalog-pg-rewrite">
5270 <primary>pg_rewrite</primary>
5274 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5278 <title><structname>pg_rewrite</> Columns</title>
5285 <entry>References</entry>
5286 <entry>Description</entry>
5292 <entry><structfield>oid</structfield></entry>
5293 <entry><type>oid</type></entry>
5295 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5299 <entry><structfield>rulename</structfield></entry>
5300 <entry><type>name</type></entry>
5302 <entry>Rule name</entry>
5306 <entry><structfield>ev_class</structfield></entry>
5307 <entry><type>oid</type></entry>
5308 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5309 <entry>The table this rule is for</entry>
5313 <entry><structfield>ev_type</structfield></entry>
5314 <entry><type>char</type></entry>
5317 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5318 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5324 <entry><structfield>ev_enabled</structfield></entry>
5325 <entry><type>char</type></entry>
5328 Controls in which <xref linkend="guc-session-replication-role"> modes
5330 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5331 <literal>D</> = rule is disabled,
5332 <literal>R</> = rule fires in <quote>replica</> mode,
5333 <literal>A</> = rule fires always.
5338 <entry><structfield>is_instead</structfield></entry>
5339 <entry><type>bool</type></entry>
5341 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5345 <entry><structfield>ev_qual</structfield></entry>
5346 <entry><type>pg_node_tree</type></entry>
5349 Expression tree (in the form of a
5350 <function>nodeToString()</function> representation) for the
5351 rule's qualifying condition
5356 <entry><structfield>ev_action</structfield></entry>
5357 <entry><type>pg_node_tree</type></entry>
5360 Query tree (in the form of a
5361 <function>nodeToString()</function> representation) for the
5371 <literal>pg_class.relhasrules</literal>
5372 must be true if a table has any rules in this catalog.
5378 <sect1 id="catalog-pg-seclabel">
5379 <title><structname>pg_seclabel</structname></title>
5381 <indexterm zone="catalog-pg-seclabel">
5382 <primary>pg_seclabel</primary>
5386 The catalog <structname>pg_seclabel</structname> stores security
5387 labels on database objects. Security labels can be manipulated
5388 with the <xref linkend="sql-security-label"> command. For an easier
5389 way to view security labels, see <xref linkend="view-pg-seclabels">.
5393 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5394 which performs a similar function for security labels of database objects
5395 that are shared across a database cluster.
5399 <title><structname>pg_seclabel</structname> Columns</title>
5406 <entry>References</entry>
5407 <entry>Description</entry>
5413 <entry><structfield>objoid</structfield></entry>
5414 <entry><type>oid</type></entry>
5415 <entry>any OID column</entry>
5416 <entry>The OID of the object this security label pertains to</entry>
5420 <entry><structfield>classoid</structfield></entry>
5421 <entry><type>oid</type></entry>
5422 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5423 <entry>The OID of the system catalog this object appears in</entry>
5427 <entry><structfield>objsubid</structfield></entry>
5428 <entry><type>int4</type></entry>
5431 For a security label on a table column, this is the column number (the
5432 <structfield>objoid</> and <structfield>classoid</> refer to
5433 the table itself). For all other object types, this column is
5439 <entry><structfield>provider</structfield></entry>
5440 <entry><type>text</type></entry>
5442 <entry>The label provider associated with this label.</entry>
5446 <entry><structfield>label</structfield></entry>
5447 <entry><type>text</type></entry>
5449 <entry>The security label applied to this object.</entry>
5456 <sect1 id="catalog-pg-shdepend">
5457 <title><structname>pg_shdepend</structname></title>
5459 <indexterm zone="catalog-pg-shdepend">
5460 <primary>pg_shdepend</primary>
5464 The catalog <structname>pg_shdepend</structname> records the
5465 dependency relationships between database objects and shared objects,
5466 such as roles. This information allows
5467 <productname>PostgreSQL</productname> to ensure that those objects are
5468 unreferenced before attempting to delete them.
5472 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5473 which performs a similar function for dependencies involving objects
5474 within a single database.
5478 Unlike most system catalogs, <structname>pg_shdepend</structname>
5479 is shared across all databases of a cluster: there is only one
5480 copy of <structname>pg_shdepend</structname> per cluster, not
5485 <title><structname>pg_shdepend</> Columns</title>
5492 <entry>References</entry>
5493 <entry>Description</entry>
5499 <entry><structfield>dbid</structfield></entry>
5500 <entry><type>oid</type></entry>
5501 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5502 <entry>The OID of the database the dependent object is in,
5503 or zero for a shared object</entry>
5507 <entry><structfield>classid</structfield></entry>
5508 <entry><type>oid</type></entry>
5509 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5510 <entry>The OID of the system catalog the dependent object is in</entry>
5514 <entry><structfield>objid</structfield></entry>
5515 <entry><type>oid</type></entry>
5516 <entry>any OID column</entry>
5517 <entry>The OID of the specific dependent object</entry>
5521 <entry><structfield>objsubid</structfield></entry>
5522 <entry><type>int4</type></entry>
5525 For a table column, this is the column number (the
5526 <structfield>objid</> and <structfield>classid</> refer to the
5527 table itself). For all other object types, this column is zero.
5532 <entry><structfield>refclassid</structfield></entry>
5533 <entry><type>oid</type></entry>
5534 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5535 <entry>The OID of the system catalog the referenced object is in
5536 (must be a shared catalog)</entry>
5540 <entry><structfield>refobjid</structfield></entry>
5541 <entry><type>oid</type></entry>
5542 <entry>any OID column</entry>
5543 <entry>The OID of the specific referenced object</entry>
5547 <entry><structfield>deptype</structfield></entry>
5548 <entry><type>char</type></entry>
5551 A code defining the specific semantics of this dependency relationship; see text
5560 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5561 the referenced object cannot be dropped without also dropping the dependent
5562 object. However, there are several subflavors identified by
5563 <structfield>deptype</>:
5567 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5570 The referenced object (which must be a role) is the owner of the
5577 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5580 The referenced object (which must be a role) is mentioned in the
5581 ACL (access control list, i.e., privileges list) of the
5582 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5583 not made for the owner of the object, since the owner will have
5584 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5590 <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
5593 The referenced object (which must be a role) is mentioned as the
5594 target of a dependent policy object.
5600 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5603 There is no dependent object; this type of entry is a signal
5604 that the system itself depends on the referenced object, and so
5605 that object must never be deleted. Entries of this type are
5606 created only by <command>initdb</command>. The columns for the
5607 dependent object contain zeroes.
5613 Other dependency flavors might be needed in future. Note in particular
5614 that the current definition only supports roles as referenced objects.
5619 <sect1 id="catalog-pg-shdescription">
5620 <title><structname>pg_shdescription</structname></title>
5622 <indexterm zone="catalog-pg-shdescription">
5623 <primary>pg_shdescription</primary>
5627 The catalog <structname>pg_shdescription</structname> stores optional
5628 descriptions (comments) for shared database objects. Descriptions can be
5629 manipulated with the <xref linkend="sql-comment"> command and viewed with
5630 <application>psql</application>'s <literal>\d</literal> commands.
5634 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5635 which performs a similar function for descriptions involving objects
5636 within a single database.
5640 Unlike most system catalogs, <structname>pg_shdescription</structname>
5641 is shared across all databases of a cluster: there is only one
5642 copy of <structname>pg_shdescription</structname> per cluster, not
5647 <title><structname>pg_shdescription</> Columns</title>
5654 <entry>References</entry>
5655 <entry>Description</entry>
5661 <entry><structfield>objoid</structfield></entry>
5662 <entry><type>oid</type></entry>
5663 <entry>any OID column</entry>
5664 <entry>The OID of the object this description pertains to</entry>
5668 <entry><structfield>classoid</structfield></entry>
5669 <entry><type>oid</type></entry>
5670 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5671 <entry>The OID of the system catalog this object appears in</entry>
5675 <entry><structfield>description</structfield></entry>
5676 <entry><type>text</type></entry>
5678 <entry>Arbitrary text that serves as the description of this object</entry>
5686 <sect1 id="catalog-pg-shseclabel">
5687 <title><structname>pg_shseclabel</structname></title>
5689 <indexterm zone="catalog-pg-shseclabel">
5690 <primary>pg_shseclabel</primary>
5694 The catalog <structname>pg_shseclabel</structname> stores security
5695 labels on shared database objects. Security labels can be manipulated
5696 with the <xref linkend="sql-security-label"> command. For an easier
5697 way to view security labels, see <xref linkend="view-pg-seclabels">.
5701 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5702 which performs a similar function for security labels involving objects
5703 within a single database.
5707 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5708 is shared across all databases of a cluster: there is only one
5709 copy of <structname>pg_shseclabel</structname> per cluster, not
5714 <title><structname>pg_shseclabel</structname> Columns</title>
5720 <entry>References</entry>
5721 <entry>Description</entry>
5726 <entry><structfield>objoid</structfield></entry>
5727 <entry><type>oid</type></entry>
5728 <entry>any OID column</entry>
5729 <entry>The OID of the object this security label pertains to</entry>
5732 <entry><structfield>classoid</structfield></entry>
5733 <entry><type>oid</type></entry>
5734 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5735 <entry>The OID of the system catalog this object appears in</entry>
5738 <entry><structfield>provider</structfield></entry>
5739 <entry><type>text</type></entry>
5741 <entry>The label provider associated with this label.</entry>
5744 <entry><structfield>label</structfield></entry>
5745 <entry><type>text</type></entry>
5747 <entry>The security label applied to this object.</entry>
5754 <sect1 id="catalog-pg-statistic">
5755 <title><structname>pg_statistic</structname></title>
5757 <indexterm zone="catalog-pg-statistic">
5758 <primary>pg_statistic</primary>
5762 The catalog <structname>pg_statistic</structname> stores
5763 statistical data about the contents of the database. Entries are
5764 created by <xref linkend="sql-analyze">
5765 and subsequently used by the query planner. Note that all the
5766 statistical data is inherently approximate, even assuming that it
5771 Normally there is one entry, with <structfield>stainherit</> =
5772 <literal>false</>, for each table column that has been analyzed.
5773 If the table has inheritance children, a second entry with
5774 <structfield>stainherit</> = <literal>true</> is also created. This row
5775 represents the column's statistics over the inheritance tree, i.e.,
5776 statistics for the data you'd see with
5777 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5778 whereas the <structfield>stainherit</> = <literal>false</> row represents
5780 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5784 <structname>pg_statistic</structname> also stores statistical data about
5785 the values of index expressions. These are described as if they were
5786 actual data columns; in particular, <structfield>starelid</structfield>
5787 references the index. No entry is made for an ordinary non-expression
5788 index column, however, since it would be redundant with the entry
5789 for the underlying table column. Currently, entries for index expressions
5790 always have <structfield>stainherit</> = <literal>false</>.
5794 Since different kinds of statistics might be appropriate for different
5795 kinds of data, <structname>pg_statistic</structname> is designed not
5796 to assume very much about what sort of statistics it stores. Only
5797 extremely general statistics (such as nullness) are given dedicated
5798 columns in <structname>pg_statistic</structname>. Everything else
5799 is stored in <quote>slots</quote>, which are groups of associated columns
5800 whose content is identified by a code number in one of the slot's columns.
5801 For more information see
5802 <filename>src/include/catalog/pg_statistic.h</filename>.
5806 <structname>pg_statistic</structname> should not be readable by the
5807 public, since even statistical information about a table's contents
5808 might be considered sensitive. (Example: minimum and maximum values
5809 of a salary column might be quite interesting.)
5810 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
5811 is a publicly readable view on
5812 <structname>pg_statistic</structname> that only exposes information
5813 about those tables that are readable by the current user.
5817 <title><structname>pg_statistic</> Columns</title>
5824 <entry>References</entry>
5825 <entry>Description</entry>
5831 <entry><structfield>starelid</structfield></entry>
5832 <entry><type>oid</type></entry>
5833 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5834 <entry>The table or index that the described column belongs to</entry>
5838 <entry><structfield>staattnum</structfield></entry>
5839 <entry><type>int2</type></entry>
5840 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5841 <entry>The number of the described column</entry>
5845 <entry><structfield>stainherit</structfield></entry>
5846 <entry><type>bool</type></entry>
5848 <entry>If true, the stats include inheritance child columns, not just the
5849 values in the specified relation</entry>
5853 <entry><structfield>stanullfrac</structfield></entry>
5854 <entry><type>float4</type></entry>
5856 <entry>The fraction of the column's entries that are null</entry>
5860 <entry><structfield>stawidth</structfield></entry>
5861 <entry><type>int4</type></entry>
5863 <entry>The average stored width, in bytes, of nonnull entries</entry>
5867 <entry><structfield>stadistinct</structfield></entry>
5868 <entry><type>float4</type></entry>
5870 <entry>The number of distinct nonnull data values in the column.
5871 A value greater than zero is the actual number of distinct values.
5872 A value less than zero is the negative of a multiplier for the number
5873 of rows in the table; for example, a column in which about 80% of the
5874 values are nonnull and each nonnull value appears about twice on
5875 average could be represented by <structfield>stadistinct</> = -0.4.
5876 A zero value means the number of distinct values is unknown.
5881 <entry><structfield>stakind<replaceable>N</></structfield></entry>
5882 <entry><type>int2</type></entry>
5885 A code number indicating the kind of statistics stored in the
5886 <replaceable>N</>th <quote>slot</quote> of the
5887 <structname>pg_statistic</structname> row.
5892 <entry><structfield>staop<replaceable>N</></structfield></entry>
5893 <entry><type>oid</type></entry>
5894 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
5896 An operator used to derive the statistics stored in the
5897 <replaceable>N</>th <quote>slot</quote>. For example, a
5898 histogram slot would show the <literal><</literal> operator
5899 that defines the sort order of the data.
5904 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
5905 <entry><type>float4[]</type></entry>
5908 Numerical statistics of the appropriate kind for the
5909 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5910 kind does not involve numerical values
5915 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
5916 <entry><type>anyarray</type></entry>
5919 Column data values of the appropriate kind for the
5920 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5921 kind does not store any data values. Each array's element
5922 values are actually of the specific column's data type, or a related
5923 type such as an array's element type, so there is no way to define
5924 these columns' type more specifically than <type>anyarray</>.
5934 <sect1 id="catalog-pg-tablespace">
5935 <title><structname>pg_tablespace</structname></title>
5937 <indexterm zone="catalog-pg-tablespace">
5938 <primary>pg_tablespace</primary>
5942 The catalog <structname>pg_tablespace</structname> stores information
5943 about the available tablespaces. Tables can be placed in particular
5944 tablespaces to aid administration of disk layout.
5948 Unlike most system catalogs, <structname>pg_tablespace</structname>
5949 is shared across all databases of a cluster: there is only one
5950 copy of <structname>pg_tablespace</structname> per cluster, not
5955 <title><structname>pg_tablespace</> Columns</title>
5962 <entry>References</entry>
5963 <entry>Description</entry>
5969 <entry><structfield>oid</structfield></entry>
5970 <entry><type>oid</type></entry>
5972 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5976 <entry><structfield>spcname</structfield></entry>
5977 <entry><type>name</type></entry>
5979 <entry>Tablespace name</entry>
5983 <entry><structfield>spcowner</structfield></entry>
5984 <entry><type>oid</type></entry>
5985 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5986 <entry>Owner of the tablespace, usually the user who created it</entry>
5990 <entry><structfield>spcacl</structfield></entry>
5991 <entry><type>aclitem[]</type></entry>
5994 Access privileges; see
5995 <xref linkend="sql-grant"> and
5996 <xref linkend="sql-revoke">
6002 <entry><structfield>spcoptions</structfield></entry>
6003 <entry><type>text[]</type></entry>
6006 Tablespace-level options, as <quote>keyword=value</> strings
6015 <sect1 id="catalog-pg-transform">
6016 <title><structname>pg_transform</structname></title>
6018 <indexterm zone="catalog-pg-transform">
6019 <primary>pg_transform</primary>
6023 The catalog <structname>pg_transform</structname> stores information about
6024 transforms, which are a mechanism to adapt data types to procedural
6025 languages. See <xref linkend="sql-createtransform"> for more information.
6029 <title><structname>pg_transform</> Columns</title>
6036 <entry>References</entry>
6037 <entry>Description</entry>
6043 <entry><structfield>trftype</structfield></entry>
6044 <entry><type>oid</type></entry>
6045 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6046 <entry>OID of the data type this transform is for</entry>
6050 <entry><structfield>trflang</structfield></entry>
6051 <entry><type>oid</type></entry>
6052 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6053 <entry>OID of the language this transform is for</entry>
6057 <entry><structfield>trffromsql</structfield></entry>
6058 <entry><type>regproc</type></entry>
6059 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6061 The OID of the function to use when converting the data type for input
6062 to the procedural language (e.g., function parameters). Zero is stored
6063 if this operation is not supported.
6068 <entry><structfield>trftosql</structfield></entry>
6069 <entry><type>regproc</type></entry>
6070 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6072 The OID of the function to use when converting output from the
6073 procedural language (e.g., return values) to the data type. Zero is
6074 stored if this operation is not supported.
6083 <sect1 id="catalog-pg-trigger">
6084 <title><structname>pg_trigger</structname></title>
6086 <indexterm zone="catalog-pg-trigger">
6087 <primary>pg_trigger</primary>
6091 The catalog <structname>pg_trigger</structname> stores triggers on tables
6093 See <xref linkend="sql-createtrigger">
6094 for more information.
6098 <title><structname>pg_trigger</> Columns</title>
6105 <entry>References</entry>
6106 <entry>Description</entry>
6112 <entry><structfield>oid</structfield></entry>
6113 <entry><type>oid</type></entry>
6115 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6119 <entry><structfield>tgrelid</structfield></entry>
6120 <entry><type>oid</type></entry>
6121 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6122 <entry>The table this trigger is on</entry>
6126 <entry><structfield>tgname</structfield></entry>
6127 <entry><type>name</type></entry>
6129 <entry>Trigger name (must be unique among triggers of same table)</entry>
6133 <entry><structfield>tgfoid</structfield></entry>
6134 <entry><type>oid</type></entry>
6135 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6136 <entry>The function to be called</entry>
6140 <entry><structfield>tgtype</structfield></entry>
6141 <entry><type>int2</type></entry>
6143 <entry>Bit mask identifying trigger firing conditions</entry>
6147 <entry><structfield>tgenabled</structfield></entry>
6148 <entry><type>char</type></entry>
6151 Controls in which <xref linkend="guc-session-replication-role"> modes
6153 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6154 <literal>D</> = trigger is disabled,
6155 <literal>R</> = trigger fires in <quote>replica</> mode,
6156 <literal>A</> = trigger fires always.
6161 <entry><structfield>tgisinternal</structfield></entry>
6162 <entry><type>bool</type></entry>
6164 <entry>True if trigger is internally generated (usually, to enforce
6165 the constraint identified by <structfield>tgconstraint</>)</entry>
6169 <entry><structfield>tgconstrrelid</structfield></entry>
6170 <entry><type>oid</type></entry>
6171 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6172 <entry>The table referenced by a referential integrity constraint</entry>
6176 <entry><structfield>tgconstrindid</structfield></entry>
6177 <entry><type>oid</type></entry>
6178 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6179 <entry>The index supporting a unique, primary key, referential integrity,
6180 or exclusion constraint</entry>
6184 <entry><structfield>tgconstraint</structfield></entry>
6185 <entry><type>oid</type></entry>
6186 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6187 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6191 <entry><structfield>tgdeferrable</structfield></entry>
6192 <entry><type>bool</type></entry>
6194 <entry>True if constraint trigger is deferrable</entry>
6198 <entry><structfield>tginitdeferred</structfield></entry>
6199 <entry><type>bool</type></entry>
6201 <entry>True if constraint trigger is initially deferred</entry>
6205 <entry><structfield>tgnargs</structfield></entry>
6206 <entry><type>int2</type></entry>
6208 <entry>Number of argument strings passed to trigger function</entry>
6212 <entry><structfield>tgattr</structfield></entry>
6213 <entry><type>int2vector</type></entry>
6214 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6215 <entry>Column numbers, if trigger is column-specific; otherwise an
6220 <entry><structfield>tgargs</structfield></entry>
6221 <entry><type>bytea</type></entry>
6223 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6227 <entry><structfield>tgqual</structfield></entry>
6228 <entry><type>pg_node_tree</type></entry>
6230 <entry>Expression tree (in <function>nodeToString()</function>
6231 representation) for the trigger's <literal>WHEN</> condition, or null
6239 Currently, column-specific triggering is supported only for
6240 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6241 only for that event type. <structfield>tgtype</structfield> might
6242 contain bits for other event types as well, but those are presumed
6243 to be table-wide regardless of what is in <structfield>tgattr</>.
6248 When <structfield>tgconstraint</> is nonzero,
6249 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6250 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6251 largely redundant with the referenced <structname>pg_constraint</> entry.
6252 However, it is possible for a non-deferrable trigger to be associated
6253 with a deferrable constraint: foreign key constraints can have some
6254 deferrable and some non-deferrable triggers.
6260 <literal>pg_class.relhastriggers</literal>
6261 must be true if a relation has any triggers in this catalog.
6268 <sect1 id="catalog-pg-ts-config">
6269 <title><structname>pg_ts_config</structname></title>
6271 <indexterm zone="catalog-pg-ts-config">
6272 <primary>pg_ts_config</primary>
6276 The <structname>pg_ts_config</structname> catalog contains entries
6277 representing text search configurations. A configuration specifies
6278 a particular text search parser and a list of dictionaries to use
6279 for each of the parser's output token types. The parser is shown
6280 in the <structname>pg_ts_config</structname> entry, but the
6281 token-to-dictionary mapping is defined by subsidiary entries in <link
6282 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6286 <productname>PostgreSQL</productname>'s text search features are
6287 described at length in <xref linkend="textsearch">.
6291 <title><structname>pg_ts_config</> Columns</title>
6298 <entry>References</entry>
6299 <entry>Description</entry>
6305 <entry><structfield>oid</structfield></entry>
6306 <entry><type>oid</type></entry>
6308 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6312 <entry><structfield>cfgname</structfield></entry>
6313 <entry><type>name</type></entry>
6315 <entry>Text search configuration name</entry>
6319 <entry><structfield>cfgnamespace</structfield></entry>
6320 <entry><type>oid</type></entry>
6321 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6323 The OID of the namespace that contains this configuration
6328 <entry><structfield>cfgowner</structfield></entry>
6329 <entry><type>oid</type></entry>
6330 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6331 <entry>Owner of the configuration</entry>
6335 <entry><structfield>cfgparser</structfield></entry>
6336 <entry><type>oid</type></entry>
6337 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6338 <entry>The OID of the text search parser for this configuration</entry>
6346 <sect1 id="catalog-pg-ts-config-map">
6347 <title><structname>pg_ts_config_map</structname></title>
6349 <indexterm zone="catalog-pg-ts-config-map">
6350 <primary>pg_ts_config_map</primary>
6354 The <structname>pg_ts_config_map</structname> catalog contains entries
6355 showing which text search dictionaries should be consulted, and in
6356 what order, for each output token type of each text search configuration's
6361 <productname>PostgreSQL</productname>'s text search features are
6362 described at length in <xref linkend="textsearch">.
6366 <title><structname>pg_ts_config_map</> Columns</title>
6373 <entry>References</entry>
6374 <entry>Description</entry>
6380 <entry><structfield>mapcfg</structfield></entry>
6381 <entry><type>oid</type></entry>
6382 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6383 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6387 <entry><structfield>maptokentype</structfield></entry>
6388 <entry><type>integer</type></entry>
6390 <entry>A token type emitted by the configuration's parser</entry>
6394 <entry><structfield>mapseqno</structfield></entry>
6395 <entry><type>integer</type></entry>
6397 <entry>Order in which to consult this entry (lower
6398 <structfield>mapseqno</>s first)</entry>
6402 <entry><structfield>mapdict</structfield></entry>
6403 <entry><type>oid</type></entry>
6404 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6405 <entry>The OID of the text search dictionary to consult</entry>
6413 <sect1 id="catalog-pg-ts-dict">
6414 <title><structname>pg_ts_dict</structname></title>
6416 <indexterm zone="catalog-pg-ts-dict">
6417 <primary>pg_ts_dict</primary>
6421 The <structname>pg_ts_dict</structname> catalog contains entries
6422 defining text search dictionaries. A dictionary depends on a text
6423 search template, which specifies all the implementation functions
6424 needed; the dictionary itself provides values for the user-settable
6425 parameters supported by the template. This division of labor allows
6426 dictionaries to be created by unprivileged users. The parameters
6427 are specified by a text string <structfield>dictinitoption</>,
6428 whose format and meaning vary depending on the template.
6432 <productname>PostgreSQL</productname>'s text search features are
6433 described at length in <xref linkend="textsearch">.
6437 <title><structname>pg_ts_dict</> Columns</title>
6444 <entry>References</entry>
6445 <entry>Description</entry>
6451 <entry><structfield>oid</structfield></entry>
6452 <entry><type>oid</type></entry>
6454 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6458 <entry><structfield>dictname</structfield></entry>
6459 <entry><type>name</type></entry>
6461 <entry>Text search dictionary name</entry>
6465 <entry><structfield>dictnamespace</structfield></entry>
6466 <entry><type>oid</type></entry>
6467 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6469 The OID of the namespace that contains this dictionary
6474 <entry><structfield>dictowner</structfield></entry>
6475 <entry><type>oid</type></entry>
6476 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6477 <entry>Owner of the dictionary</entry>
6481 <entry><structfield>dicttemplate</structfield></entry>
6482 <entry><type>oid</type></entry>
6483 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6484 <entry>The OID of the text search template for this dictionary</entry>
6488 <entry><structfield>dictinitoption</structfield></entry>
6489 <entry><type>text</type></entry>
6491 <entry>Initialization option string for the template</entry>
6499 <sect1 id="catalog-pg-ts-parser">
6500 <title><structname>pg_ts_parser</structname></title>
6502 <indexterm zone="catalog-pg-ts-parser">
6503 <primary>pg_ts_parser</primary>
6507 The <structname>pg_ts_parser</structname> catalog contains entries
6508 defining text search parsers. A parser is responsible for splitting
6509 input text into lexemes and assigning a token type to each lexeme.
6510 Since a parser must be implemented by C-language-level functions,
6511 creation of new parsers is restricted to database superusers.
6515 <productname>PostgreSQL</productname>'s text search features are
6516 described at length in <xref linkend="textsearch">.
6520 <title><structname>pg_ts_parser</> Columns</title>
6527 <entry>References</entry>
6528 <entry>Description</entry>
6534 <entry><structfield>oid</structfield></entry>
6535 <entry><type>oid</type></entry>
6537 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6541 <entry><structfield>prsname</structfield></entry>
6542 <entry><type>name</type></entry>
6544 <entry>Text search parser name</entry>
6548 <entry><structfield>prsnamespace</structfield></entry>
6549 <entry><type>oid</type></entry>
6550 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6552 The OID of the namespace that contains this parser
6557 <entry><structfield>prsstart</structfield></entry>
6558 <entry><type>regproc</type></entry>
6559 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6560 <entry>OID of the parser's startup function</entry>
6564 <entry><structfield>prstoken</structfield></entry>
6565 <entry><type>regproc</type></entry>
6566 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6567 <entry>OID of the parser's next-token function</entry>
6571 <entry><structfield>prsend</structfield></entry>
6572 <entry><type>regproc</type></entry>
6573 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6574 <entry>OID of the parser's shutdown function</entry>
6578 <entry><structfield>prsheadline</structfield></entry>
6579 <entry><type>regproc</type></entry>
6580 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6581 <entry>OID of the parser's headline function</entry>
6585 <entry><structfield>prslextype</structfield></entry>
6586 <entry><type>regproc</type></entry>
6587 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6588 <entry>OID of the parser's lextype function</entry>
6596 <sect1 id="catalog-pg-ts-template">
6597 <title><structname>pg_ts_template</structname></title>
6599 <indexterm zone="catalog-pg-ts-template">
6600 <primary>pg_ts_template</primary>
6604 The <structname>pg_ts_template</structname> catalog contains entries
6605 defining text search templates. A template is the implementation
6606 skeleton for a class of text search dictionaries.
6607 Since a template must be implemented by C-language-level functions,
6608 creation of new templates is restricted to database superusers.
6612 <productname>PostgreSQL</productname>'s text search features are
6613 described at length in <xref linkend="textsearch">.
6617 <title><structname>pg_ts_template</> Columns</title>
6624 <entry>References</entry>
6625 <entry>Description</entry>
6631 <entry><structfield>oid</structfield></entry>
6632 <entry><type>oid</type></entry>
6634 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6638 <entry><structfield>tmplname</structfield></entry>
6639 <entry><type>name</type></entry>
6641 <entry>Text search template name</entry>
6645 <entry><structfield>tmplnamespace</structfield></entry>
6646 <entry><type>oid</type></entry>
6647 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6649 The OID of the namespace that contains this template
6654 <entry><structfield>tmplinit</structfield></entry>
6655 <entry><type>regproc</type></entry>
6656 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6657 <entry>OID of the template's initialization function</entry>
6661 <entry><structfield>tmpllexize</structfield></entry>
6662 <entry><type>regproc</type></entry>
6663 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6664 <entry>OID of the template's lexize function</entry>
6672 <sect1 id="catalog-pg-type">
6673 <title><structname>pg_type</structname></title>
6675 <indexterm zone="catalog-pg-type">
6676 <primary>pg_type</primary>
6680 The catalog <structname>pg_type</structname> stores information about data
6681 types. Base types and enum types (scalar types) are created with
6682 <xref linkend="sql-createtype">, and
6684 <xref linkend="sql-createdomain">.
6685 A composite type is automatically created for each table in the database, to
6686 represent the row structure of the table. It is also possible to create
6687 composite types with <command>CREATE TYPE AS</command>.
6691 <title><structname>pg_type</> Columns</title>
6698 <entry>References</entry>
6699 <entry>Description</entry>
6705 <entry><structfield>oid</structfield></entry>
6706 <entry><type>oid</type></entry>
6708 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6712 <entry><structfield>typname</structfield></entry>
6713 <entry><type>name</type></entry>
6715 <entry>Data type name</entry>
6719 <entry><structfield>typnamespace</structfield></entry>
6720 <entry><type>oid</type></entry>
6721 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6723 The OID of the namespace that contains this type
6728 <entry><structfield>typowner</structfield></entry>
6729 <entry><type>oid</type></entry>
6730 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6731 <entry>Owner of the type</entry>
6735 <entry><structfield>typlen</structfield></entry>
6736 <entry><type>int2</type></entry>
6739 For a fixed-size type, <structfield>typlen</structfield> is the number
6740 of bytes in the internal representation of the type. But for a
6741 variable-length type, <structfield>typlen</structfield> is negative.
6742 -1 indicates a <quote>varlena</> type (one that has a length word),
6743 -2 indicates a null-terminated C string.
6748 <entry><structfield>typbyval</structfield></entry>
6749 <entry><type>bool</type></entry>
6752 <structfield>typbyval</structfield> determines whether internal
6753 routines pass a value of this type by value or by reference.
6754 <structfield>typbyval</structfield> had better be false if
6755 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6756 where Datum is 8 bytes).
6757 Variable-length types are always passed by reference. Note that
6758 <structfield>typbyval</structfield> can be false even if the
6759 length would allow pass-by-value.
6764 <entry><structfield>typtype</structfield></entry>
6765 <entry><type>char</type></entry>
6768 <structfield>typtype</structfield> is
6769 <literal>b</literal> for a base type,
6770 <literal>c</literal> for a composite type (e.g., a table's row type),
6771 <literal>d</literal> for a domain,
6772 <literal>e</literal> for an enum type,
6773 <literal>p</literal> for a pseudo-type, or
6774 <literal>r</literal> for a range type.
6775 See also <structfield>typrelid</structfield> and
6776 <structfield>typbasetype</structfield>.
6781 <entry><structfield>typcategory</structfield></entry>
6782 <entry><type>char</type></entry>
6785 <structfield>typcategory</structfield> is an arbitrary classification
6786 of data types that is used by the parser to determine which implicit
6787 casts should be <quote>preferred</>.
6788 See <xref linkend="catalog-typcategory-table">.
6793 <entry><structfield>typispreferred</structfield></entry>
6794 <entry><type>bool</type></entry>
6797 True if the type is a preferred cast target within its
6798 <structfield>typcategory</structfield>
6803 <entry><structfield>typisdefined</structfield></entry>
6804 <entry><type>bool</type></entry>
6807 True if the type is defined, false if this is a placeholder
6808 entry for a not-yet-defined type. When
6809 <structfield>typisdefined</structfield> is false, nothing
6810 except the type name, namespace, and OID can be relied on.
6815 <entry><structfield>typdelim</structfield></entry>
6816 <entry><type>char</type></entry>
6819 Character that separates two values of this type when parsing
6820 array input. Note that the delimiter is associated with the array
6821 element data type, not the array data type.
6826 <entry><structfield>typrelid</structfield></entry>
6827 <entry><type>oid</type></entry>
6828 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6830 If this is a composite type (see
6831 <structfield>typtype</structfield>), then this column points to
6832 the <structname>pg_class</structname> entry that defines the
6833 corresponding table. (For a free-standing composite type, the
6834 <structname>pg_class</structname> entry doesn't really represent
6835 a table, but it is needed anyway for the type's
6836 <structname>pg_attribute</structname> entries to link to.)
6837 Zero for non-composite types.
6842 <entry><structfield>typelem</structfield></entry>
6843 <entry><type>oid</type></entry>
6844 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6846 If <structfield>typelem</structfield> is not 0 then it
6847 identifies another row in <structname>pg_type</structname>.
6848 The current type can then be subscripted like an array yielding
6849 values of type <structfield>typelem</structfield>. A
6850 <quote>true</quote> array type is variable length
6851 (<structfield>typlen</structfield> = -1),
6852 but some fixed-length (<structfield>typlen</structfield> > 0) types
6853 also have nonzero <structfield>typelem</structfield>, for example
6854 <type>name</type> and <type>point</type>.
6855 If a fixed-length type has a <structfield>typelem</structfield> then
6856 its internal representation must be some number of values of the
6857 <structfield>typelem</structfield> data type with no other data.
6858 Variable-length array types have a header defined by the array
6864 <entry><structfield>typarray</structfield></entry>
6865 <entry><type>oid</type></entry>
6866 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6868 If <structfield>typarray</structfield> is not 0 then it
6869 identifies another row in <structname>pg_type</structname>, which
6870 is the <quote>true</quote> array type having this type as element
6875 <entry><structfield>typinput</structfield></entry>
6876 <entry><type>regproc</type></entry>
6877 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6878 <entry>Input conversion function (text format)</entry>
6882 <entry><structfield>typoutput</structfield></entry>
6883 <entry><type>regproc</type></entry>
6884 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6885 <entry>Output conversion function (text format)</entry>
6889 <entry><structfield>typreceive</structfield></entry>
6890 <entry><type>regproc</type></entry>
6891 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6892 <entry>Input conversion function (binary format), or 0 if none</entry>
6896 <entry><structfield>typsend</structfield></entry>
6897 <entry><type>regproc</type></entry>
6898 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6899 <entry>Output conversion function (binary format), or 0 if none</entry>
6903 <entry><structfield>typmodin</structfield></entry>
6904 <entry><type>regproc</type></entry>
6905 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6906 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
6910 <entry><structfield>typmodout</structfield></entry>
6911 <entry><type>regproc</type></entry>
6912 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6913 <entry>Type modifier output function, or 0 to use the standard format</entry>
6917 <entry><structfield>typanalyze</structfield></entry>
6918 <entry><type>regproc</type></entry>
6919 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6920 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
6924 <entry><structfield>typalign</structfield></entry>
6925 <entry><type>char</type></entry>
6929 <structfield>typalign</structfield> is the alignment required
6930 when storing a value of this type. It applies to storage on
6931 disk as well as most representations of the value inside
6932 <productname>PostgreSQL</>.
6933 When multiple values are stored consecutively, such
6934 as in the representation of a complete row on disk, padding is
6935 inserted before a datum of this type so that it begins on the
6936 specified boundary. The alignment reference is the beginning
6937 of the first datum in the sequence.
6941 Possible values are:
6944 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
6947 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
6950 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
6953 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
6958 For types used in system tables, it is critical that the size
6959 and alignment defined in <structname>pg_type</structname>
6960 agree with the way that the compiler will lay out the column in
6961 a structure representing a table row.
6967 <entry><structfield>typstorage</structfield></entry>
6968 <entry><type>char</type></entry>
6971 <structfield>typstorage</structfield> tells for varlena
6972 types (those with <structfield>typlen</structfield> = -1) if
6973 the type is prepared for toasting and what the default strategy
6974 for attributes of this type should be.
6978 <para><literal>p</>: Value must always be stored plain.</para>
6982 <literal>e</>: Value can be stored in a <quote>secondary</quote>
6983 relation (if relation has one, see
6984 <literal>pg_class.reltoastrelid</literal>).
6988 <para><literal>m</>: Value can be stored compressed inline.</para>
6991 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
6994 Note that <literal>m</> columns can also be moved out to secondary
6995 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7001 <entry><structfield>typnotnull</structfield></entry>
7002 <entry><type>bool</type></entry>
7005 <structfield>typnotnull</structfield> represents a not-null
7006 constraint on a type. Used for domains only.
7011 <entry><structfield>typbasetype</structfield></entry>
7012 <entry><type>oid</type></entry>
7013 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7015 If this is a domain (see <structfield>typtype</structfield>), then
7016 <structfield>typbasetype</structfield> identifies the type that this
7017 one is based on. Zero if this type is not a domain.
7022 <entry><structfield>typtypmod</structfield></entry>
7023 <entry><type>int4</type></entry>
7026 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7027 to be applied to their base type (-1 if base type does not use a
7028 <literal>typmod</>). -1 if this type is not a domain.
7033 <entry><structfield>typndims</structfield></entry>
7034 <entry><type>int4</type></entry>
7037 <structfield>typndims</structfield> is the number of array dimensions
7038 for a domain over an array (that is, <structfield>typbasetype</> is
7040 Zero for types other than domains over array types.
7045 <entry><structfield>typcollation</structfield></entry>
7046 <entry><type>oid</type></entry>
7047 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7049 <structfield>typcollation</structfield> specifies the collation
7050 of the type. If the type does not support collations, this will
7051 be zero. A base type that supports collations will have
7052 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7053 collatable type can have some other collation OID, if one was
7054 specified for the domain.
7059 <entry><structfield>typdefaultbin</structfield></entry>
7060 <entry><type>pg_node_tree</type></entry>
7063 If <structfield>typdefaultbin</> is not null, it is the
7064 <function>nodeToString()</function>
7065 representation of a default expression for the type. This is
7066 only used for domains.
7071 <entry><structfield>typdefault</structfield></entry>
7072 <entry><type>text</type></entry>
7075 <structfield>typdefault</> is null if the type has no associated
7076 default value. If <structfield>typdefaultbin</> is not null,
7077 <structfield>typdefault</> must contain a human-readable version of the
7078 default expression represented by <structfield>typdefaultbin</>. If
7079 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7080 not, then <structfield>typdefault</> is the external representation of
7081 the type's default value, which can be fed to the type's input
7082 converter to produce a constant.
7087 <entry><structfield>typacl</structfield></entry>
7088 <entry><type>aclitem[]</type></entry>
7091 Access privileges; see
7092 <xref linkend="sql-grant"> and
7093 <xref linkend="sql-revoke">
7102 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7103 of <structfield>typcategory</>. Any future additions to this list will
7104 also be upper-case ASCII letters. All other ASCII characters are reserved
7105 for user-defined categories.
7108 <table id="catalog-typcategory-table">
7109 <title><structfield>typcategory</> Codes</title>
7115 <entry>Category</entry>
7121 <entry><literal>A</literal></entry>
7122 <entry>Array types</entry>
7125 <entry><literal>B</literal></entry>
7126 <entry>Boolean types</entry>
7129 <entry><literal>C</literal></entry>
7130 <entry>Composite types</entry>
7133 <entry><literal>D</literal></entry>
7134 <entry>Date/time types</entry>
7137 <entry><literal>E</literal></entry>
7138 <entry>Enum types</entry>
7141 <entry><literal>G</literal></entry>
7142 <entry>Geometric types</entry>
7145 <entry><literal>I</literal></entry>
7146 <entry>Network address types</entry>
7149 <entry><literal>N</literal></entry>
7150 <entry>Numeric types</entry>
7153 <entry><literal>P</literal></entry>
7154 <entry>Pseudo-types</entry>
7157 <entry><literal>R</literal></entry>
7158 <entry>Range types</entry>
7161 <entry><literal>S</literal></entry>
7162 <entry>String types</entry>
7165 <entry><literal>T</literal></entry>
7166 <entry>Timespan types</entry>
7169 <entry><literal>U</literal></entry>
7170 <entry>User-defined types</entry>
7173 <entry><literal>V</literal></entry>
7174 <entry>Bit-string types</entry>
7177 <entry><literal>X</literal></entry>
7178 <entry><type>unknown</> type</entry>
7187 <sect1 id="catalog-pg-user-mapping">
7188 <title><structname>pg_user_mapping</structname></title>
7190 <indexterm zone="catalog-pg-user-mapping">
7191 <primary>pg_user_mapping</primary>
7195 The catalog <structname>pg_user_mapping</structname> stores
7196 the mappings from local user to remote. Access to this catalog is
7197 restricted from normal users, use the view
7198 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7203 <title><structname>pg_user_mapping</> Columns</title>
7210 <entry>References</entry>
7211 <entry>Description</entry>
7217 <entry><structfield>oid</structfield></entry>
7218 <entry><type>oid</type></entry>
7220 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7224 <entry><structfield>umuser</structfield></entry>
7225 <entry><type>oid</type></entry>
7226 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7227 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7231 <entry><structfield>umserver</structfield></entry>
7232 <entry><type>oid</type></entry>
7233 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7235 The OID of the foreign server that contains this mapping
7240 <entry><structfield>umoptions</structfield></entry>
7241 <entry><type>text[]</type></entry>
7244 User mapping specific options, as <quote>keyword=value</> strings
7253 <sect1 id="views-overview">
7254 <title>System Views</title>
7257 In addition to the system catalogs, <productname>PostgreSQL</productname>
7258 provides a number of built-in views. Some system views provide convenient
7259 access to some commonly used queries on the system catalogs. Other views
7260 provide access to internal server state.
7264 The information schema (<xref linkend="information-schema">) provides
7265 an alternative set of views which overlap the functionality of the system
7266 views. Since the information schema is SQL-standard whereas the views
7267 described here are <productname>PostgreSQL</productname>-specific,
7268 it's usually better to use the information schema if it provides all
7269 the information you need.
7273 <xref linkend="view-table"> lists the system views described here.
7274 More detailed documentation of each view follows below.
7275 There are some additional views that provide access to the results of
7276 the statistics collector; they are described in <xref
7277 linkend="monitoring-stats-views-table">.
7281 Except where noted, all the views described here are read-only.
7284 <table id="view-table">
7285 <title>System Views</title>
7290 <entry>View Name</entry>
7291 <entry>Purpose</entry>
7297 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7298 <entry>available extensions</entry>
7302 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7303 <entry>available versions of extensions</entry>
7307 <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
7308 <entry>compile-time configuration parameters</entry>
7312 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7313 <entry>open cursors</entry>
7317 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
7318 <entry>summary of configuration file contents</entry>
7322 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7323 <entry>groups of database users</entry>
7327 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7328 <entry>indexes</entry>
7332 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7333 <entry>locks currently held or awaited</entry>
7337 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7338 <entry>materialized views</entry>
7342 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7343 <entry>policies</entry>
7347 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7348 <entry>prepared statements</entry>
7352 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7353 <entry>prepared transactions</entry>
7357 <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
7358 <entry>information about replication origins, including replication progress</entry>
7362 <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
7363 <entry>replication slot information</entry>
7367 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7368 <entry>database roles</entry>
7372 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7373 <entry>rules</entry>
7377 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7378 <entry>security labels</entry>
7382 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7383 <entry>parameter settings</entry>
7387 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7388 <entry>database users</entry>
7392 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7393 <entry>planner statistics</entry>
7397 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7398 <entry>tables</entry>
7402 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7403 <entry>time zone abbreviations</entry>
7407 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7408 <entry>time zone names</entry>
7412 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7413 <entry>database users</entry>
7417 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7418 <entry>user mappings</entry>
7422 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7423 <entry>views</entry>
7431 <sect1 id="view-pg-available-extensions">
7432 <title><structname>pg_available_extensions</structname></title>
7434 <indexterm zone="view-pg-available-extensions">
7435 <primary>pg_available_extensions</primary>
7439 The <structname>pg_available_extensions</structname> view lists the
7440 extensions that are available for installation.
7442 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7443 catalog, which shows the extensions currently installed.
7447 <title><structname>pg_available_extensions</> Columns</title>
7454 <entry>Description</entry>
7460 <entry><structfield>name</structfield></entry>
7461 <entry><type>name</type></entry>
7462 <entry>Extension name</entry>
7466 <entry><structfield>default_version</structfield></entry>
7467 <entry><type>text</type></entry>
7468 <entry>Name of default version, or <literal>NULL</literal> if none is
7473 <entry><structfield>installed_version</structfield></entry>
7474 <entry><type>text</type></entry>
7475 <entry>Currently installed version of the extension,
7476 or <literal>NULL</literal> if not installed</entry>
7480 <entry><structfield>comment</structfield></entry>
7481 <entry><type>text</type></entry>
7482 <entry>Comment string from the extension's control file</entry>
7489 The <structname>pg_available_extensions</structname> view is read only.
7493 <sect1 id="view-pg-available-extension-versions">
7494 <title><structname>pg_available_extension_versions</structname></title>
7496 <indexterm zone="view-pg-available-extension-versions">
7497 <primary>pg_available_extension_versions</primary>
7501 The <structname>pg_available_extension_versions</structname> view lists the
7502 specific extension versions that are available for installation.
7504 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7505 catalog, which shows the extensions currently installed.
7509 <title><structname>pg_available_extension_versions</> Columns</title>
7516 <entry>Description</entry>
7522 <entry><structfield>name</structfield></entry>
7523 <entry><type>name</type></entry>
7524 <entry>Extension name</entry>
7528 <entry><structfield>version</structfield></entry>
7529 <entry><type>text</type></entry>
7530 <entry>Version name</entry>
7534 <entry><structfield>installed</structfield></entry>
7535 <entry><type>bool</type></entry>
7536 <entry>True if this version of this extension is currently
7541 <entry><structfield>superuser</structfield></entry>
7542 <entry><type>bool</type></entry>
7543 <entry>True if only superusers are allowed to install this extension</entry>
7547 <entry><structfield>relocatable</structfield></entry>
7548 <entry><type>bool</type></entry>
7549 <entry>True if extension can be relocated to another schema</entry>
7553 <entry><structfield>schema</structfield></entry>
7554 <entry><type>name</type></entry>
7555 <entry>Name of the schema that the extension must be installed into,
7556 or <literal>NULL</literal> if partially or fully relocatable</entry>
7560 <entry><structfield>requires</structfield></entry>
7561 <entry><type>name[]</type></entry>
7562 <entry>Names of prerequisite extensions,
7563 or <literal>NULL</literal> if none</entry>
7567 <entry><structfield>comment</structfield></entry>
7568 <entry><type>text</type></entry>
7569 <entry>Comment string from the extension's control file</entry>
7576 The <structname>pg_available_extension_versions</structname> view is read
7581 <sect1 id="view-pg-config">
7582 <title><structname>pg_config</structname></title>
7584 <indexterm zone="view-pg-config">
7585 <primary>pg_config</primary>
7589 The view <structname>pg_config</structname> describes the
7590 compile-time configuration parameters of the currently installed
7591 version of <productname>PostgreSQL</>. It is intended, for example, to
7592 be used by software packages that want to interface to
7593 <productname>PostgreSQL</> to facilitate finding the required header
7594 files and libraries. It provides the same basic information as the
7595 <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
7600 <title><structname>pg_config</> Columns</title>
7606 <entry>Description</entry>
7612 <entry><structfield>name</structfield></entry>
7613 <entry><type>text</type></entry>
7614 <entry>The parameter name</entry>
7618 <entry><structfield>setting</structfield></entry>
7619 <entry><type>text</type></entry>
7620 <entry>The parameter value</entry>
7628 <sect1 id="view-pg-cursors">
7629 <title><structname>pg_cursors</structname></title>
7631 <indexterm zone="view-pg-cursors">
7632 <primary>pg_cursors</primary>
7636 The <structname>pg_cursors</structname> view lists the cursors that
7637 are currently available. Cursors can be defined in several ways:
7641 via the <xref linkend="sql-declare">
7648 via the Bind message in the frontend/backend protocol, as
7649 described in <xref linkend="protocol-flow-ext-query">
7655 via the Server Programming Interface (SPI), as described in
7656 <xref linkend="spi-interface">
7661 The <structname>pg_cursors</structname> view displays cursors
7662 created by any of these means. Cursors only exist for the duration
7663 of the transaction that defines them, unless they have been
7664 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7665 cursors are only present in the view until the end of their
7666 creating transaction.
7670 Cursors are used internally to implement some of the components
7671 of <productname>PostgreSQL</>, such as procedural languages.
7672 Therefore, the <structname>pg_cursors</> view might include cursors
7673 that have not been explicitly created by the user.
7679 <title><structname>pg_cursors</> Columns</title>
7686 <entry>Description</entry>
7692 <entry><structfield>name</structfield></entry>
7693 <entry><type>text</type></entry>
7694 <entry>The name of the cursor</entry>
7698 <entry><structfield>statement</structfield></entry>
7699 <entry><type>text</type></entry>
7700 <entry>The verbatim query string submitted to declare this cursor</entry>
7704 <entry><structfield>is_holdable</structfield></entry>
7705 <entry><type>boolean</type></entry>
7707 <literal>true</literal> if the cursor is holdable (that is, it
7708 can be accessed after the transaction that declared the cursor
7709 has committed); <literal>false</literal> otherwise
7714 <entry><structfield>is_binary</structfield></entry>
7715 <entry><type>boolean</type></entry>
7717 <literal>true</literal> if the cursor was declared
7718 <literal>BINARY</literal>; <literal>false</literal>
7724 <entry><structfield>is_scrollable</structfield></entry>
7725 <entry><type>boolean</type></entry>
7727 <literal>true</> if the cursor is scrollable (that is, it
7728 allows rows to be retrieved in a nonsequential manner);
7729 <literal>false</literal> otherwise
7734 <entry><structfield>creation_time</structfield></entry>
7735 <entry><type>timestamptz</type></entry>
7736 <entry>The time at which the cursor was declared</entry>
7743 The <structname>pg_cursors</structname> view is read only.
7748 <sect1 id="view-pg-file-settings">
7749 <title><structname>pg_file_settings</structname></title>
7751 <indexterm zone="view-pg-file-settings">
7752 <primary>pg_file_settings</primary>
7756 The view <structname>pg_file_settings</structname> provides a summary of
7757 the contents of the server's configuration file(s). A row appears in
7758 this view for each <quote>name = value</> entry appearing in the files,
7759 with annotations indicating whether the value could be applied
7760 successfully. Additional row(s) may appear for problems not linked to
7761 a <quote>name = value</> entry, such as syntax errors in the files.
7765 This view is helpful for checking whether planned changes in the
7766 configuration files will work, or for diagnosing a previous failure.
7767 Note that this view reports on the <emphasis>current</> contents of the
7768 files, not on what was last applied by the server. (The
7769 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
7770 view is usually sufficient to determine that.)
7774 The <structname>pg_file_settings</structname> view can be read only by
7779 <title><structname>pg_file_settings</> Columns</title>
7786 <entry>Description</entry>
7791 <entry><structfield>sourcefile</structfield></entry>
7792 <entry><structfield>text</structfield></entry>
7793 <entry>Full path name of the configuration file</entry>
7796 <entry><structfield>sourceline</structfield></entry>
7797 <entry><structfield>integer</structfield></entry>
7799 Line number within the configuration file where the entry appears
7803 <entry><structfield>seqno</structfield></entry>
7804 <entry><structfield>integer</structfield></entry>
7805 <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
7808 <entry><structfield>name</structfield></entry>
7809 <entry><structfield>text</structfield></entry>
7810 <entry>Configuration parameter name</entry>
7813 <entry><structfield>setting</structfield></entry>
7814 <entry><structfield>text</structfield></entry>
7815 <entry>Value to be assigned to the parameter</entry>
7818 <entry><structfield>applied</structfield></entry>
7819 <entry><structfield>boolean</structfield></entry>
7820 <entry>True if the value can be applied successfully</entry>
7823 <entry><structfield>error</structfield></entry>
7824 <entry><structfield>text</structfield></entry>
7825 <entry>If not null, an error message indicating why this entry could
7826 not be applied</entry>
7833 If the configuration file contains syntax errors or invalid parameter
7834 names, the server will not attempt to apply any settings from it, and
7835 therefore all the <structfield>applied</> fields will read as false.
7836 In such a case there will be one or more rows with
7837 non-null <structfield>error</structfield> fields indicating the
7838 problem(s). Otherwise, individual settings will be applied if possible.
7839 If an individual setting cannot be applied (e.g., invalid value, or the
7840 setting cannot be changed after server start) it will have an appropriate
7841 message in the <structfield>error</structfield> field. Another way that
7842 an entry might have <structfield>applied</> = false is that it is
7843 overridden by a later entry for the same parameter name; this case is not
7844 considered an error so nothing appears in
7845 the <structfield>error</structfield> field.
7849 See <xref linkend="config-setting"> for more information about the various
7850 ways to change run-time parameters.
7855 <sect1 id="view-pg-group">
7856 <title><structname>pg_group</structname></title>
7858 <indexterm zone="view-pg-group">
7859 <primary>pg_group</primary>
7863 The view <structname>pg_group</structname> exists for backwards
7864 compatibility: it emulates a catalog that existed in
7865 <productname>PostgreSQL</productname> before version 8.1.
7866 It shows the names and members of all roles that are marked as not
7867 <structfield>rolcanlogin</>, which is an approximation to the set
7868 of roles that are being used as groups.
7872 <title><structname>pg_group</> Columns</title>
7879 <entry>References</entry>
7880 <entry>Description</entry>
7886 <entry><structfield>groname</structfield></entry>
7887 <entry><type>name</type></entry>
7888 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7889 <entry>Name of the group</entry>
7893 <entry><structfield>grosysid</structfield></entry>
7894 <entry><type>oid</type></entry>
7895 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7896 <entry>ID of this group</entry>
7900 <entry><structfield>grolist</structfield></entry>
7901 <entry><type>oid[]</type></entry>
7902 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7903 <entry>An array containing the IDs of the roles in this group</entry>
7911 <sect1 id="view-pg-indexes">
7912 <title><structname>pg_indexes</structname></title>
7914 <indexterm zone="view-pg-indexes">
7915 <primary>pg_indexes</primary>
7919 The view <structname>pg_indexes</structname> provides access to
7920 useful information about each index in the database.
7924 <title><structname>pg_indexes</> Columns</title>
7931 <entry>References</entry>
7932 <entry>Description</entry>
7937 <entry><structfield>schemaname</structfield></entry>
7938 <entry><type>name</type></entry>
7939 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7940 <entry>Name of schema containing table and index</entry>
7943 <entry><structfield>tablename</structfield></entry>
7944 <entry><type>name</type></entry>
7945 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7946 <entry>Name of table the index is for</entry>
7949 <entry><structfield>indexname</structfield></entry>
7950 <entry><type>name</type></entry>
7951 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7952 <entry>Name of index</entry>
7955 <entry><structfield>tablespace</structfield></entry>
7956 <entry><type>name</type></entry>
7957 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7958 <entry>Name of tablespace containing index (null if default for database)</entry>
7961 <entry><structfield>indexdef</structfield></entry>
7962 <entry><type>text</type></entry>
7964 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
7973 <sect1 id="view-pg-locks">
7974 <title><structname>pg_locks</structname></title>
7976 <indexterm zone="view-pg-locks">
7977 <primary>pg_locks</primary>
7981 The view <structname>pg_locks</structname> provides access to
7982 information about the locks held by active processes within the
7983 database server. See <xref linkend="mvcc"> for more discussion
7988 <structname>pg_locks</structname> contains one row per active lockable
7989 object, requested lock mode, and relevant process. Thus, the same
7990 lockable object might
7991 appear many times, if multiple processes are holding or waiting
7992 for locks on it. However, an object that currently has no locks on it
7993 will not appear at all.
7997 There are several distinct types of lockable objects:
7998 whole relations (e.g., tables), individual pages of relations,
7999 individual tuples of relations,
8000 transaction IDs (both virtual and permanent IDs),
8001 and general database objects (identified by class OID and object OID,
8002 in the same way as in <structname>pg_description</structname> or
8003 <structname>pg_depend</structname>). Also, the right to extend a
8004 relation is represented as a separate lockable object.
8005 Also, <quote>advisory</> locks can be taken on numbers that have
8006 user-defined meanings.
8010 <title><structname>pg_locks</> Columns</title>
8017 <entry>References</entry>
8018 <entry>Description</entry>
8023 <entry><structfield>locktype</structfield></entry>
8024 <entry><type>text</type></entry>
8027 Type of the lockable object:
8028 <literal>relation</>,
8032 <literal>transactionid</>,
8033 <literal>virtualxid</>,
8035 <literal>userlock</>, or
8036 <literal>advisory</>
8040 <entry><structfield>database</structfield></entry>
8041 <entry><type>oid</type></entry>
8042 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8044 OID of the database in which the lock target exists, or
8045 zero if the target is a shared object, or
8046 null if the target is a transaction ID
8050 <entry><structfield>relation</structfield></entry>
8051 <entry><type>oid</type></entry>
8052 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8054 OID of the relation targeted by the lock, or null if the target is not
8055 a relation or part of a relation
8059 <entry><structfield>page</structfield></entry>
8060 <entry><type>integer</type></entry>
8063 Page number targeted by the lock within the relation,
8064 or null if the target is not a relation page or tuple
8068 <entry><structfield>tuple</structfield></entry>
8069 <entry><type>smallint</type></entry>
8072 Tuple number targeted by the lock within the page,
8073 or null if the target is not a tuple
8077 <entry><structfield>virtualxid</structfield></entry>
8078 <entry><type>text</type></entry>
8081 Virtual ID of the transaction targeted by the lock,
8082 or null if the target is not a virtual transaction ID
8086 <entry><structfield>transactionid</structfield></entry>
8087 <entry><type>xid</type></entry>
8090 ID of the transaction targeted by the lock,
8091 or null if the target is not a transaction ID
8095 <entry><structfield>classid</structfield></entry>
8096 <entry><type>oid</type></entry>
8097 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8099 OID of the system catalog containing the lock target, or null if the
8100 target is not a general database object
8104 <entry><structfield>objid</structfield></entry>
8105 <entry><type>oid</type></entry>
8106 <entry>any OID column</entry>
8108 OID of the lock target within its system catalog, or null if the
8109 target is not a general database object
8113 <entry><structfield>objsubid</structfield></entry>
8114 <entry><type>smallint</type></entry>
8117 Column number targeted by the lock (the
8118 <structfield>classid</> and <structfield>objid</> refer to the
8120 or zero if the target is some other general database object,
8121 or null if the target is not a general database object
8125 <entry><structfield>virtualtransaction</structfield></entry>
8126 <entry><type>text</type></entry>
8129 Virtual ID of the transaction that is holding or awaiting this lock
8133 <entry><structfield>pid</structfield></entry>
8134 <entry><type>integer</type></entry>
8137 Process ID of the server process holding or awaiting this
8138 lock, or null if the lock is held by a prepared transaction
8142 <entry><structfield>mode</structfield></entry>
8143 <entry><type>text</type></entry>
8145 <entry>Name of the lock mode held or desired by this process (see <xref
8146 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8149 <entry><structfield>granted</structfield></entry>
8150 <entry><type>boolean</type></entry>
8152 <entry>True if lock is held, false if lock is awaited</entry>
8155 <entry><structfield>fastpath</structfield></entry>
8156 <entry><type>boolean</type></entry>
8158 <entry>True if lock was taken via fast path, false if taken via main
8166 <structfield>granted</structfield> is true in a row representing a lock
8167 held by the indicated process. False indicates that this process is
8168 currently waiting to acquire this lock, which implies that at least one
8169 other process is holding or waiting for a conflicting lock mode on the same
8170 lockable object. The waiting process will sleep until the other lock is
8171 released (or a deadlock situation is detected). A single process can be
8172 waiting to acquire at most one lock at a time.
8176 Throughout running a transaction, a server process holds an exclusive lock
8177 on the transaction's virtual transaction ID. If a permanent ID is assigned
8178 to the transaction (which normally happens only if the transaction changes
8179 the state of the database), it also holds an exclusive lock on the
8180 transaction's permanent transaction ID until it ends. When a process finds
8181 it necessary to wait specifically for another transaction to end, it does
8182 so by attempting to acquire share lock on the other transaction's ID
8183 (either virtual or permanent ID depending on the situation). That will
8184 succeed only when the other transaction terminates and releases its locks.
8188 Although tuples are a lockable type of object,
8189 information about row-level locks is stored on disk, not in memory,
8190 and therefore row-level locks normally do not appear in this view.
8191 If a process is waiting for a
8192 row-level lock, it will usually appear in the view as waiting for the
8193 permanent transaction ID of the current holder of that row lock.
8197 Advisory locks can be acquired on keys consisting of either a single
8198 <type>bigint</type> value or two integer values.
8199 A <type>bigint</type> key is displayed with its
8200 high-order half in the <structfield>classid</> column, its low-order half
8201 in the <structfield>objid</> column, and <structfield>objsubid</> equal
8202 to 1. The original <type>bigint</type> value can be reassembled with the
8203 expression <literal>(classid::bigint << 32) |
8204 objid::bigint</literal>. Integer keys are displayed with the
8206 <structfield>classid</> column, the second key in the <structfield>objid</>
8207 column, and <structfield>objsubid</> equal to 2. The actual meaning of
8208 the keys is up to the user. Advisory locks are local to each database,
8209 so the <structfield>database</> column is meaningful for an advisory lock.
8213 <structname>pg_locks</structname> provides a global view of all locks
8214 in the database cluster, not only those relevant to the current database.
8215 Although its <structfield>relation</structfield> column can be joined
8216 against <structname>pg_class</>.<structfield>oid</> to identify locked
8217 relations, this will only work correctly for relations in the current
8218 database (those for which the <structfield>database</structfield> column
8219 is either the current database's OID or zero).
8223 The <structfield>pid</structfield> column can be joined to the
8224 <structfield>pid</structfield> column of the <link
8225 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8227 information on the session holding or awaiting each lock,
8230 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8231 ON pl.pid = psa.pid;
8233 Also, if you are using prepared transactions, the
8234 <structfield>virtualtransaction</> column can be joined to the
8235 <structfield>transaction</structfield> column of the <link
8236 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8237 view to get more information on prepared transactions that hold locks.
8238 (A prepared transaction can never be waiting for a lock,
8239 but it continues to hold the locks it acquired while running.)
8242 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8243 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8248 While it is possible to obtain information about which processes block
8249 which other processes by joining <structname>pg_locks</structname> against
8250 itself, this is very difficult to get right in detail. Such a query would
8251 have to encode knowledge about which lock modes conflict with which
8252 others. Worse, the <structname>pg_locks</structname> view does not expose
8253 information about which processes are ahead of which others in lock wait
8254 queues, nor information about which processes are parallel workers running
8255 on behalf of which other client sessions. It is better to use
8256 the <function>pg_blocking_pids()</> function
8257 (see <xref linkend="functions-info-session-table">) to identify which
8258 process(es) a waiting process is blocked behind.
8262 The <structname>pg_locks</structname> view displays data from both the
8263 regular lock manager and the predicate lock manager, which are
8264 separate systems; in addition, the regular lock manager subdivides its
8265 locks into regular and <firstterm>fast-path</> locks.
8266 This data is not guaranteed to be entirely consistent.
8267 When the view is queried,
8268 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8269 is gathered from each backend one at a time, without freezing the state of
8270 the entire lock manager, so it is possible for locks to be taken or
8271 released while information is gathered. Note, however, that these locks are
8272 known not to conflict with any other lock currently in place. After
8273 all backends have been queried for fast-path locks, the remainder of the
8274 regular lock manager is locked as a unit, and a consistent snapshot of all
8275 remaining locks is collected as an atomic action. After unlocking the
8276 regular lock manager, the predicate lock manager is similarly locked and all
8277 predicate locks are collected as an atomic action. Thus, with the exception
8278 of fast-path locks, each lock manager will deliver a consistent set of
8279 results, but as we do not lock both lock managers simultaneously, it is
8280 possible for locks to be taken or released after we interrogate the regular
8281 lock manager and before we interrogate the predicate lock manager.
8285 Locking the regular and/or predicate lock manager could have some
8286 impact on database performance if this view is very frequently accessed.
8287 The locks are held only for the minimum amount of time necessary to
8288 obtain data from the lock managers, but this does not completely eliminate
8289 the possibility of a performance impact.
8294 <sect1 id="view-pg-matviews">
8295 <title><structname>pg_matviews</structname></title>
8297 <indexterm zone="view-pg-matviews">
8298 <primary>pg_matviews</primary>
8301 <indexterm zone="view-pg-matviews">
8302 <primary>materialized views</primary>
8306 The view <structname>pg_matviews</structname> provides access to
8307 useful information about each materialized view in the database.
8311 <title><structname>pg_matviews</> Columns</title>
8318 <entry>References</entry>
8319 <entry>Description</entry>
8324 <entry><structfield>schemaname</structfield></entry>
8325 <entry><type>name</type></entry>
8326 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8327 <entry>Name of schema containing materialized view</entry>
8330 <entry><structfield>matviewname</structfield></entry>
8331 <entry><type>name</type></entry>
8332 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8333 <entry>Name of materialized view</entry>
8336 <entry><structfield>matviewowner</structfield></entry>
8337 <entry><type>name</type></entry>
8338 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8339 <entry>Name of materialized view's owner</entry>
8342 <entry><structfield>tablespace</structfield></entry>
8343 <entry><type>name</type></entry>
8344 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8345 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8348 <entry><structfield>hasindexes</structfield></entry>
8349 <entry><type>boolean</type></entry>
8351 <entry>True if materialized view has (or recently had) any indexes</entry>
8354 <entry><structfield>ispopulated</structfield></entry>
8355 <entry><type>boolean</type></entry>
8357 <entry>True if materialized view is currently populated</entry>
8360 <entry><structfield>definition</structfield></entry>
8361 <entry><type>text</type></entry>
8363 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8371 <sect1 id="view-pg-policies">
8372 <title><structname>pg_policies</structname></title>
8374 <indexterm zone="view-pg-policies">
8375 <primary>pg_policies</primary>
8379 The view <structname>pg_policies</structname> provides access to
8380 useful information about each row-level security policy in the database.
8384 <title><structname>pg_policies</> Columns</title>
8391 <entry>References</entry>
8392 <entry>Description</entry>
8397 <entry><structfield>schemaname</structfield></entry>
8398 <entry><type>name</type></entry>
8399 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8400 <entry>Name of schema containing table policy is on</entry>
8403 <entry><structfield>tablename</structfield></entry>
8404 <entry><type>name</type></entry>
8405 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8406 <entry>Name of table policy is on</entry>
8409 <entry><structfield>policyname</structfield></entry>
8410 <entry><type>name</type></entry>
8411 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
8412 <entry>Name of policy</entry>
8415 <entry><structfield>roles</structfield></entry>
8416 <entry><type>name[]</type></entry>
8418 <entry>The roles to which this policy applies</entry>
8421 <entry><structfield>cmd</structfield></entry>
8422 <entry><type>text</type></entry>
8424 <entry>The command type to which the policy is applied</entry>
8427 <entry><structfield>qual</structfield></entry>
8428 <entry><type>text</type></entry>
8430 <entry>The expression added to the security barrier qualifications for
8431 queries that this policy applies to</entry>
8434 <entry><structfield>with_check</structfield></entry>
8435 <entry><type>text</type></entry>
8437 <entry>The expression added to the WITH CHECK qualifications for
8438 queries that attempt to add rows to this table</entry>
8446 <sect1 id="view-pg-prepared-statements">
8447 <title><structname>pg_prepared_statements</structname></title>
8449 <indexterm zone="view-pg-prepared-statements">
8450 <primary>pg_prepared_statements</primary>
8454 The <structname>pg_prepared_statements</structname> view displays
8455 all the prepared statements that are available in the current
8456 session. See <xref linkend="sql-prepare"> for more information about prepared
8461 <structname>pg_prepared_statements</structname> contains one row
8462 for each prepared statement. Rows are added to the view when a new
8463 prepared statement is created and removed when a prepared statement
8464 is released (for example, via the <xref linkend="sql-deallocate"> command).
8468 <title><structname>pg_prepared_statements</> Columns</title>
8475 <entry>Description</entry>
8480 <entry><structfield>name</structfield></entry>
8481 <entry><type>text</type></entry>
8483 The identifier of the prepared statement
8487 <entry><structfield>statement</structfield></entry>
8488 <entry><type>text</type></entry>
8490 The query string submitted by the client to create this
8491 prepared statement. For prepared statements created via SQL,
8492 this is the <command>PREPARE</command> statement submitted by
8493 the client. For prepared statements created via the
8494 frontend/backend protocol, this is the text of the prepared
8499 <entry><structfield>prepare_time</structfield></entry>
8500 <entry><type>timestamptz</type></entry>
8502 The time at which the prepared statement was created
8506 <entry><structfield>parameter_types</structfield></entry>
8507 <entry><type>regtype[]</type></entry>
8509 The expected parameter types for the prepared statement in the
8510 form of an array of <type>regtype</type>. The OID corresponding
8511 to an element of this array can be obtained by casting the
8512 <type>regtype</type> value to <type>oid</type>.
8516 <entry><structfield>from_sql</structfield></entry>
8517 <entry><type>boolean</type></entry>
8519 <literal>true</literal> if the prepared statement was created
8520 via the <command>PREPARE</command> SQL command;
8521 <literal>false</literal> if the statement was prepared via the
8522 frontend/backend protocol
8530 The <structname>pg_prepared_statements</structname> view is read only.
8534 <sect1 id="view-pg-prepared-xacts">
8535 <title><structname>pg_prepared_xacts</structname></title>
8537 <indexterm zone="view-pg-prepared-xacts">
8538 <primary>pg_prepared_xacts</primary>
8542 The view <structname>pg_prepared_xacts</structname> displays
8543 information about transactions that are currently prepared for two-phase
8544 commit (see <xref linkend="sql-prepare-transaction"> for details).
8548 <structname>pg_prepared_xacts</structname> contains one row per prepared
8549 transaction. An entry is removed when the transaction is committed or
8554 <title><structname>pg_prepared_xacts</> Columns</title>
8561 <entry>References</entry>
8562 <entry>Description</entry>
8567 <entry><structfield>transaction</structfield></entry>
8568 <entry><type>xid</type></entry>
8571 Numeric transaction identifier of the prepared transaction
8575 <entry><structfield>gid</structfield></entry>
8576 <entry><type>text</type></entry>
8579 Global transaction identifier that was assigned to the transaction
8583 <entry><structfield>prepared</structfield></entry>
8584 <entry><type>timestamp with time zone</type></entry>
8587 Time at which the transaction was prepared for commit
8591 <entry><structfield>owner</structfield></entry>
8592 <entry><type>name</type></entry>
8593 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8595 Name of the user that executed the transaction
8599 <entry><structfield>database</structfield></entry>
8600 <entry><type>name</type></entry>
8601 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8603 Name of the database in which the transaction was executed
8611 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8612 internal transaction manager data structures are momentarily locked, and
8613 a copy is made for the view to display. This ensures that the
8614 view produces a consistent set of results, while not blocking
8615 normal operations longer than necessary. Nonetheless
8616 there could be some impact on database performance if this view is
8617 frequently accessed.
8622 <sect1 id="view-pg-replication-origin-status">
8623 <title><structname>pg_replication_origin_status</structname></title>
8625 <indexterm zone="view-pg-replication-origin-status">
8626 <primary>pg_replication_origin_status</primary>
8630 The <structname>pg_replication_origin_status</structname> view
8631 contains information about how far replay for a certain origin has
8632 progressed. For more on replication origins
8633 see <xref linkend="replication-origins">.
8638 <title><structname>pg_replication_origin_status</structname> Columns</title>
8645 <entry>References</entry>
8646 <entry>Description</entry>
8652 <entry><structfield>local_id</structfield></entry>
8653 <entry><type>Oid</type></entry>
8654 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
8655 <entry>internal node identifier</entry>
8659 <entry><structfield>external_id</structfield></entry>
8660 <entry><type>text</type></entry>
8661 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
8662 <entry>external node identifier</entry>
8666 <entry><structfield>remote_lsn</structfield></entry>
8667 <entry><type>pg_lsn</type></entry>
8669 <entry>The origin node's LSN up to which data has been replicated.</entry>
8673 <entry><structfield>local_lsn</structfield></entry>
8674 <entry><type>pg_lsn</type></entry>
8677 This node's LSN at which <literal>remote_lsn</literal> has
8678 been replicated. Used to flush commit records before persisting
8679 data to disk when using asynchronous commits.
8687 <sect1 id="view-pg-replication-slots">
8688 <title><structname>pg_replication_slots</structname></title>
8690 <indexterm zone="view-pg-replication-slots">
8691 <primary>pg_replication_slots</primary>
8695 The <structname>pg_replication_slots</structname> view provides a listing
8696 of all replication slots that currently exist on the database cluster,
8697 along with their current state.
8701 For more on replication slots,
8702 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
8707 <title><structname>pg_replication_slots</structname> Columns</title>
8714 <entry>References</entry>
8715 <entry>Description</entry>
8721 <entry><structfield>slot_name</structfield></entry>
8722 <entry><type>name</type></entry>
8724 <entry>A unique, cluster-wide identifier for the replication slot</entry>
8728 <entry><structfield>plugin</structfield></entry>
8729 <entry><type>name</type></entry>
8731 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
8735 <entry><structfield>slot_type</structfield></entry>
8736 <entry><type>text</type></entry>
8738 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
8742 <entry><structfield>datoid</structfield></entry>
8743 <entry><type>oid</type></entry>
8744 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8745 <entry>The OID of the database this slot is associated with, or
8746 null. Only logical slots have an associated database.</entry>
8750 <entry><structfield>database</structfield></entry>
8751 <entry><type>text</type></entry>
8752 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8753 <entry>The name of the database this slot is associated with, or
8754 null. Only logical slots have an associated database.</entry>
8758 <entry><structfield>active</structfield></entry>
8759 <entry><type>boolean</type></entry>
8761 <entry>True if this slot is currently actively being used</entry>
8765 <entry><structfield>active_pid</structfield></entry>
8766 <entry><type>integer</type></entry>
8768 <entry>The process ID of the session using this slot if the slot
8769 is currently actively being used. <literal>NULL</literal> if
8775 <entry><structfield>xmin</structfield></entry>
8776 <entry><type>xid</type></entry>
8778 <entry>The oldest transaction that this slot needs the database to
8779 retain. <literal>VACUUM</literal> cannot remove tuples deleted
8780 by any later transaction.
8785 <entry><structfield>catalog_xmin</structfield></entry>
8786 <entry><type>xid</type></entry>
8788 <entry>The oldest transaction affecting the system catalogs that this
8789 slot needs the database to retain. <literal>VACUUM</literal> cannot
8790 remove catalog tuples deleted by any later transaction.
8795 <entry><structfield>restart_lsn</structfield></entry>
8796 <entry><type>pg_lsn</type></entry>
8798 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
8799 might be required by the consumer of this slot and thus won't be
8800 automatically removed during checkpoints.
8805 <entry><structfield>confirmed_flush_lsn</structfield></entry>
8806 <entry><type>pg_lsn</type></entry>
8808 <entry>The address (<literal>LSN</literal>) up to which the logical
8809 slot's consumer has confirmed receiving data. Data older than this is
8810 not available anymore. <literal>NULL</> for physical slots.
8819 <sect1 id="view-pg-roles">
8820 <title><structname>pg_roles</structname></title>
8822 <indexterm zone="view-pg-roles">
8823 <primary>pg_roles</primary>
8827 The view <structname>pg_roles</structname> provides access to
8828 information about database roles. This is simply a publicly
8830 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8831 that blanks out the password field.
8835 This view explicitly exposes the OID column of the underlying table,
8836 since that is needed to do joins to other catalogs.
8840 <title><structname>pg_roles</> Columns</title>
8847 <entry>References</entry>
8848 <entry>Description</entry>
8854 <entry><structfield>rolname</structfield></entry>
8855 <entry><type>name</type></entry>
8857 <entry>Role name</entry>
8861 <entry><structfield>rolsuper</structfield></entry>
8862 <entry><type>bool</type></entry>
8864 <entry>Role has superuser privileges</entry>
8868 <entry><structfield>rolinherit</structfield></entry>
8869 <entry><type>bool</type></entry>
8871 <entry>Role automatically inherits privileges of roles it is a
8876 <entry><structfield>rolcreaterole</structfield></entry>
8877 <entry><type>bool</type></entry>
8879 <entry>Role can create more roles</entry>
8883 <entry><structfield>rolcreatedb</structfield></entry>
8884 <entry><type>bool</type></entry>
8886 <entry>Role can create databases</entry>
8890 <entry><structfield>rolcanlogin</structfield></entry>
8891 <entry><type>bool</type></entry>
8894 Role can log in. That is, this role can be given as the initial
8895 session authorization identifier
8900 <entry><structfield>rolreplication</structfield></entry>
8901 <entry><type>bool</type></entry>
8904 Role is a replication role. That is, this role can initiate streaming
8905 replication (see <xref linkend="streaming-replication">) and set/unset
8906 the system backup mode using <function>pg_start_backup</> and
8907 <function>pg_stop_backup</>
8912 <entry><structfield>rolconnlimit</structfield></entry>
8913 <entry><type>int4</type></entry>
8916 For roles that can log in, this sets maximum number of concurrent
8917 connections this role can make. -1 means no limit.
8922 <entry><structfield>rolpassword</structfield></entry>
8923 <entry><type>text</type></entry>
8925 <entry>Not the password (always reads as <literal>********</>)</entry>
8929 <entry><structfield>rolvaliduntil</structfield></entry>
8930 <entry><type>timestamptz</type></entry>
8932 <entry>Password expiry time (only used for password authentication);
8933 null if no expiration</entry>
8937 <entry><structfield>rolbypassrls</structfield></entry>
8938 <entry><type>bool</type></entry>
8941 Role bypasses every row level security policy, see
8942 <xref linkend="ddl-rowsecurity"> for more information.
8947 <entry><structfield>rolconfig</structfield></entry>
8948 <entry><type>text[]</type></entry>
8950 <entry>Role-specific defaults for run-time configuration variables</entry>
8954 <entry><structfield>oid</structfield></entry>
8955 <entry><type>oid</type></entry>
8956 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8957 <entry>ID of role</entry>
8965 <sect1 id="view-pg-rules">
8966 <title><structname>pg_rules</structname></title>
8968 <indexterm zone="view-pg-rules">
8969 <primary>pg_rules</primary>
8973 The view <structname>pg_rules</structname> provides access to
8974 useful information about query rewrite rules.
8978 <title><structname>pg_rules</> Columns</title>
8985 <entry>References</entry>
8986 <entry>Description</entry>
8991 <entry><structfield>schemaname</structfield></entry>
8992 <entry><type>name</type></entry>
8993 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8994 <entry>Name of schema containing table</entry>
8997 <entry><structfield>tablename</structfield></entry>
8998 <entry><type>name</type></entry>
8999 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9000 <entry>Name of table the rule is for</entry>
9003 <entry><structfield>rulename</structfield></entry>
9004 <entry><type>name</type></entry>
9005 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
9006 <entry>Name of rule</entry>
9009 <entry><structfield>definition</structfield></entry>
9010 <entry><type>text</type></entry>
9012 <entry>Rule definition (a reconstructed creation command)</entry>
9019 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
9020 of views and materialized views; those can be seen in
9021 <structname>pg_views</> and <structname>pg_matviews</>.
9026 <sect1 id="view-pg-seclabels">
9027 <title><structname>pg_seclabels</structname></title>
9029 <indexterm zone="view-pg-seclabels">
9030 <primary>pg_seclabels</primary>
9034 The view <structname>pg_seclabels</structname> provides information about
9035 security labels. It as an easier-to-query version of the
9036 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9040 <title><structname>pg_seclabels</> Columns</title>
9047 <entry>References</entry>
9048 <entry>Description</entry>
9053 <entry><structfield>objoid</structfield></entry>
9054 <entry><type>oid</type></entry>
9055 <entry>any OID column</entry>
9056 <entry>The OID of the object this security label pertains to</entry>
9059 <entry><structfield>classoid</structfield></entry>
9060 <entry><type>oid</type></entry>
9061 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9062 <entry>The OID of the system catalog this object appears in</entry>
9065 <entry><structfield>objsubid</structfield></entry>
9066 <entry><type>int4</type></entry>
9069 For a security label on a table column, this is the column number (the
9070 <structfield>objoid</> and <structfield>classoid</> refer to
9071 the table itself). For all other object types, this column is
9076 <entry><structfield>objtype</structfield></entry>
9077 <entry><type>text</type></entry>
9080 The type of object to which this label applies, as text.
9084 <entry><structfield>objnamespace</structfield></entry>
9085 <entry><type>oid</type></entry>
9086 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9088 The OID of the namespace for this object, if applicable;
9093 <entry><structfield>objname</structfield></entry>
9094 <entry><type>text</type></entry>
9097 The name of the object to which this label applies, as text.
9101 <entry><structfield>provider</structfield></entry>
9102 <entry><type>text</type></entry>
9103 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9104 <entry>The label provider associated with this label.</entry>
9107 <entry><structfield>label</structfield></entry>
9108 <entry><type>text</type></entry>
9109 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
9110 <entry>The security label applied to this object.</entry>
9117 <sect1 id="view-pg-settings">
9118 <title><structname>pg_settings</structname></title>
9120 <indexterm zone="view-pg-settings">
9121 <primary>pg_settings</primary>
9125 The view <structname>pg_settings</structname> provides access to
9126 run-time parameters of the server. It is essentially an alternative
9127 interface to the <xref linkend="sql-show">
9128 and <xref linkend="sql-set"> commands.
9129 It also provides access to some facts about each parameter that are
9130 not directly available from <command>SHOW</>, such as minimum and
9135 <title><structname>pg_settings</> Columns</title>
9142 <entry>Description</entry>
9147 <entry><structfield>name</structfield></entry>
9148 <entry><type>text</type></entry>
9149 <entry>Run-time configuration parameter name</entry>
9152 <entry><structfield>setting</structfield></entry>
9153 <entry><type>text</type></entry>
9154 <entry>Current value of the parameter</entry>
9157 <entry><structfield>unit</structfield></entry>
9158 <entry><type>text</type></entry>
9159 <entry>Implicit unit of the parameter</entry>
9162 <entry><structfield>category</structfield></entry>
9163 <entry><type>text</type></entry>
9164 <entry>Logical group of the parameter</entry>
9167 <entry><structfield>short_desc</structfield></entry>
9168 <entry><type>text</type></entry>
9169 <entry>A brief description of the parameter</entry>
9172 <entry><structfield>extra_desc</structfield></entry>
9173 <entry><type>text</type></entry>
9174 <entry>Additional, more detailed, description of the parameter</entry>
9177 <entry><structfield>context</structfield></entry>
9178 <entry><type>text</type></entry>
9179 <entry>Context required to set the parameter's value (see below)</entry>
9182 <entry><structfield>vartype</structfield></entry>
9183 <entry><type>text</type></entry>
9184 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
9185 <literal>integer</>, <literal>real</>, or <literal>string</>)
9189 <entry><structfield>source</structfield></entry>
9190 <entry><type>text</type></entry>
9191 <entry>Source of the current parameter value</entry>
9194 <entry><structfield>min_val</structfield></entry>
9195 <entry><type>text</type></entry>
9196 <entry>Minimum allowed value of the parameter (null for non-numeric
9200 <entry><structfield>max_val</structfield></entry>
9201 <entry><type>text</type></entry>
9202 <entry>Maximum allowed value of the parameter (null for non-numeric
9206 <entry><structfield>enumvals</structfield></entry>
9207 <entry><type>text[]</type></entry>
9208 <entry>Allowed values of an enum parameter (null for non-enum
9212 <entry><structfield>boot_val</structfield></entry>
9213 <entry><type>text</type></entry>
9214 <entry>Parameter value assumed at server startup if the parameter is
9215 not otherwise set</entry>
9218 <entry><structfield>reset_val</structfield></entry>
9219 <entry><type>text</type></entry>
9220 <entry>Value that <command>RESET</command> would reset the parameter to
9221 in the current session</entry>
9224 <entry><structfield>sourcefile</structfield></entry>
9225 <entry><type>text</type></entry>
9226 <entry>Configuration file the current value was set in (null for
9227 values set from sources other than configuration files, or when
9228 examined by a non-superuser);
9229 helpful when using <literal>include</> directives in configuration files</entry>
9232 <entry><structfield>sourceline</structfield></entry>
9233 <entry><type>integer</type></entry>
9234 <entry>Line number within the configuration file the current value was
9235 set at (null for values set from sources other than configuration files,
9236 or when examined by a non-superuser)
9240 <entry><structfield>pending_restart</structfield></entry>
9241 <entry><type>boolean</type></entry>
9242 <entry><literal>true</literal> if the value has been changed in the
9243 configuration file but needs a restart; or <literal>false</literal>
9252 There are several possible values of <structfield>context</structfield>.
9253 In order of decreasing difficulty of changing the setting, they are:
9258 <!-- PGC_INTERNAL -->
9259 <term><literal>internal</literal></term>
9262 These settings cannot be changed directly; they reflect internally
9263 determined values. Some of them may be adjustable by rebuilding the
9264 server with different configuration options, or by changing options
9265 supplied to <command>initdb</command>.
9270 <!-- PGC_POSTMASTER -->
9271 <term><literal>postmaster</literal></term>
9274 These settings can only be applied when the server starts, so any change
9275 requires restarting the server. Values for these settings are typically
9276 stored in the <filename>postgresql.conf</filename> file, or passed on
9277 the command line when starting the server. Of course, settings with any
9278 of the lower <structfield>context</structfield> types can also be
9279 set at server start time.
9285 <term><literal>sighup</literal></term>
9288 Changes to these settings can be made in
9289 <filename>postgresql.conf</filename> without restarting the server.
9290 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
9291 cause it to re-read <filename>postgresql.conf</filename> and apply
9292 the changes. The postmaster will also forward the
9293 <systemitem>SIGHUP</systemitem> signal to its child processes so that
9294 they all pick up the new value.
9299 <!-- PGC_SU_BACKEND -->
9300 <term><literal>superuser-backend</literal></term>
9303 Changes to these settings can be made in
9304 <filename>postgresql.conf</filename> without restarting the server.
9305 They can also be set for a particular session in the connection request
9306 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9307 environment variable), but only if the connecting user is a superuser.
9308 However, these settings never change in a session after it is started.
9309 If you change them in <filename>postgresql.conf</filename>, send a
9310 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9311 re-read <filename>postgresql.conf</filename>. The new values will only
9312 affect subsequently-launched sessions.
9317 <!-- PGC_BACKEND -->
9318 <term><literal>backend</literal></term>
9321 Changes to these settings can be made in
9322 <filename>postgresql.conf</filename> without restarting the server.
9323 They can also be set for a particular session in the connection request
9324 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9325 environment variable); any user can make such a change for their session.
9326 However, these settings never change in a session after it is started.
9327 If you change them in <filename>postgresql.conf</filename>, send a
9328 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9329 re-read <filename>postgresql.conf</filename>. The new values will only
9330 affect subsequently-launched sessions.
9336 <term><literal>superuser</literal></term>
9339 These settings can be set from <filename>postgresql.conf</filename>,
9340 or within a session via the <command>SET</> command; but only superusers
9341 can change them via <command>SET</>. Changes in
9342 <filename>postgresql.conf</filename> will affect existing sessions
9343 only if no session-local value has been established with <command>SET</>.
9348 <!-- PGC_USERSET -->
9349 <term><literal>user</literal></term>
9352 These settings can be set from <filename>postgresql.conf</filename>,
9353 or within a session via the <command>SET</> command. Any user is
9354 allowed to change their session-local value. Changes in
9355 <filename>postgresql.conf</filename> will affect existing sessions
9356 only if no session-local value has been established with <command>SET</>.
9363 See <xref linkend="config-setting"> for more information about the various
9364 ways to change these parameters.
9368 The <structname>pg_settings</structname> view cannot be inserted into or
9369 deleted from, but it can be updated. An <command>UPDATE</command> applied
9370 to a row of <structname>pg_settings</structname> is equivalent to executing
9371 the <xref linkend="sql-set"> command on that named
9372 parameter. The change only affects the value used by the current
9373 session. If an <command>UPDATE</command> is issued within a transaction
9374 that is later aborted, the effects of the <command>UPDATE</command> command
9375 disappear when the transaction is rolled back. Once the surrounding
9376 transaction is committed, the effects will persist until the end of the
9377 session, unless overridden by another <command>UPDATE</command> or
9378 <command>SET</command>.
9383 <sect1 id="view-pg-shadow">
9384 <title><structname>pg_shadow</structname></title>
9386 <indexterm zone="view-pg-shadow">
9387 <primary>pg_shadow</primary>
9391 The view <structname>pg_shadow</structname> exists for backwards
9392 compatibility: it emulates a catalog that existed in
9393 <productname>PostgreSQL</productname> before version 8.1.
9394 It shows properties of all roles that are marked as
9395 <structfield>rolcanlogin</> in
9396 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
9400 The name stems from the fact that this table
9401 should not be readable by the public since it contains passwords.
9402 <link linkend="view-pg-user"><structname>pg_user</structname></link>
9403 is a publicly readable view on
9404 <structname>pg_shadow</structname> that blanks out the password field.
9408 <title><structname>pg_shadow</> Columns</title>
9415 <entry>References</entry>
9416 <entry>Description</entry>
9422 <entry><structfield>usename</structfield></entry>
9423 <entry><type>name</type></entry>
9424 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9425 <entry>User name</entry>
9429 <entry><structfield>usesysid</structfield></entry>
9430 <entry><type>oid</type></entry>
9431 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9432 <entry>ID of this user</entry>
9436 <entry><structfield>usecreatedb</structfield></entry>
9437 <entry><type>bool</type></entry>
9439 <entry>User can create databases</entry>
9443 <entry><structfield>usesuper</structfield></entry>
9444 <entry><type>bool</type></entry>
9446 <entry>User is a superuser</entry>
9450 <entry><structfield>userepl</structfield></entry>
9451 <entry><type>bool</type></entry>
9454 User can initiate streaming replication and put the system in and
9460 <entry><structfield>usebypassrls</structfield></entry>
9461 <entry><type>bool</type></entry>
9464 User bypasses every row level security policy, see
9465 <xref linkend="ddl-rowsecurity"> for more information.
9470 <entry><structfield>passwd</structfield></entry>
9471 <entry><type>text</type></entry>
9473 <entry>Password (possibly encrypted); null if none. See
9474 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9475 for details of how encrypted passwords are stored.</entry>
9479 <entry><structfield>valuntil</structfield></entry>
9480 <entry><type>abstime</type></entry>
9482 <entry>Password expiry time (only used for password authentication)</entry>
9486 <entry><structfield>useconfig</structfield></entry>
9487 <entry><type>text[]</type></entry>
9489 <entry>Session defaults for run-time configuration variables</entry>
9497 <sect1 id="view-pg-stats">
9498 <title><structname>pg_stats</structname></title>
9500 <indexterm zone="view-pg-stats">
9501 <primary>pg_stats</primary>
9505 The view <structname>pg_stats</structname> provides access to
9506 the information stored in the <link
9507 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
9508 catalog. This view allows access only to rows of
9509 <structname>pg_statistic</structname> that correspond to tables the
9510 user has permission to read, and therefore it is safe to allow public
9511 read access to this view.
9515 <structname>pg_stats</structname> is also designed to present the
9516 information in a more readable format than the underlying catalog
9517 — at the cost that its schema must be extended whenever new slot types
9518 are defined for <structname>pg_statistic</structname>.
9522 <title><structname>pg_stats</> Columns</title>
9529 <entry>References</entry>
9530 <entry>Description</entry>
9535 <entry><structfield>schemaname</structfield></entry>
9536 <entry><type>name</type></entry>
9537 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9538 <entry>Name of schema containing table</entry>
9542 <entry><structfield>tablename</structfield></entry>
9543 <entry><type>name</type></entry>
9544 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9545 <entry>Name of table</entry>
9549 <entry><structfield>attname</structfield></entry>
9550 <entry><type>name</type></entry>
9551 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9552 <entry>Name of the column described by this row</entry>
9556 <entry><structfield>inherited</structfield></entry>
9557 <entry><type>bool</type></entry>
9559 <entry>If true, this row includes inheritance child columns, not just the
9560 values in the specified table</entry>
9564 <entry><structfield>null_frac</structfield></entry>
9565 <entry><type>real</type></entry>
9567 <entry>Fraction of column entries that are null</entry>
9571 <entry><structfield>avg_width</structfield></entry>
9572 <entry><type>integer</type></entry>
9574 <entry>Average width in bytes of column's entries</entry>
9578 <entry><structfield>n_distinct</structfield></entry>
9579 <entry><type>real</type></entry>
9582 If greater than zero, the estimated number of distinct values in the
9583 column. If less than zero, the negative of the number of distinct
9584 values divided by the number of rows. (The negated form is used when
9585 <command>ANALYZE</> believes that the number of distinct values is
9586 likely to increase as the table grows; the positive form is used when
9587 the column seems to have a fixed number of possible values.) For
9588 example, -1 indicates a unique column in which the number of distinct
9589 values is the same as the number of rows.
9594 <entry><structfield>most_common_vals</structfield></entry>
9595 <entry><type>anyarray</type></entry>
9598 A list of the most common values in the column. (Null if
9599 no values seem to be more common than any others.)
9604 <entry><structfield>most_common_freqs</structfield></entry>
9605 <entry><type>real[]</type></entry>
9608 A list of the frequencies of the most common values,
9609 i.e., number of occurrences of each divided by total number of rows.
9610 (Null when <structfield>most_common_vals</structfield> is.)
9615 <entry><structfield>histogram_bounds</structfield></entry>
9616 <entry><type>anyarray</type></entry>
9619 A list of values that divide the column's values into groups of
9620 approximately equal population. The values in
9621 <structfield>most_common_vals</>, if present, are omitted from this
9622 histogram calculation. (This column is null if the column data type
9623 does not have a <literal><</> operator or if the
9624 <structfield>most_common_vals</> list accounts for the entire
9630 <entry><structfield>correlation</structfield></entry>
9631 <entry><type>real</type></entry>
9634 Statistical correlation between physical row ordering and
9635 logical ordering of the column values. This ranges from -1 to +1.
9636 When the value is near -1 or +1, an index scan on the column will
9637 be estimated to be cheaper than when it is near zero, due to reduction
9638 of random access to the disk. (This column is null if the column data
9639 type does not have a <literal><</> operator.)
9644 <entry><structfield>most_common_elems</structfield></entry>
9645 <entry><type>anyarray</type></entry>
9648 A list of non-null element values most often appearing within values of
9649 the column. (Null for scalar types.)
9654 <entry><structfield>most_common_elem_freqs</structfield></entry>
9655 <entry><type>real[]</type></entry>
9658 A list of the frequencies of the most common element values, i.e., the
9659 fraction of rows containing at least one instance of the given value.
9660 Two or three additional values follow the per-element frequencies;
9661 these are the minimum and maximum of the preceding per-element
9662 frequencies, and optionally the frequency of null elements.
9663 (Null when <structfield>most_common_elems</structfield> is.)
9668 <entry><structfield>elem_count_histogram</structfield></entry>
9669 <entry><type>real[]</type></entry>
9672 A histogram of the counts of distinct non-null element values within the
9673 values of the column, followed by the average number of distinct
9674 non-null elements. (Null for scalar types.)
9682 The maximum number of entries in the array fields can be controlled on a
9683 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9684 command, or globally by setting the
9685 <xref linkend="guc-default-statistics-target"> run-time parameter.
9690 <sect1 id="view-pg-tables">
9691 <title><structname>pg_tables</structname></title>
9693 <indexterm zone="view-pg-tables">
9694 <primary>pg_tables</primary>
9698 The view <structname>pg_tables</structname> provides access to
9699 useful information about each table in the database.
9703 <title><structname>pg_tables</> Columns</title>
9710 <entry>References</entry>
9711 <entry>Description</entry>
9716 <entry><structfield>schemaname</structfield></entry>
9717 <entry><type>name</type></entry>
9718 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9719 <entry>Name of schema containing table</entry>
9722 <entry><structfield>tablename</structfield></entry>
9723 <entry><type>name</type></entry>
9724 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9725 <entry>Name of table</entry>
9728 <entry><structfield>tableowner</structfield></entry>
9729 <entry><type>name</type></entry>
9730 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9731 <entry>Name of table's owner</entry>
9734 <entry><structfield>tablespace</structfield></entry>
9735 <entry><type>name</type></entry>
9736 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9737 <entry>Name of tablespace containing table (null if default for database)</entry>
9740 <entry><structfield>hasindexes</structfield></entry>
9741 <entry><type>boolean</type></entry>
9742 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9743 <entry>True if table has (or recently had) any indexes</entry>
9746 <entry><structfield>hasrules</structfield></entry>
9747 <entry><type>boolean</type></entry>
9748 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9749 <entry>True if table has (or once had) rules</entry>
9752 <entry><structfield>hastriggers</structfield></entry>
9753 <entry><type>boolean</type></entry>
9754 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9755 <entry>True if table has (or once had) triggers</entry>
9758 <entry><structfield>rowsecurity</structfield></entry>
9759 <entry><type>boolean</type></entry>
9760 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
9761 <entry>True if row security is enabled on the table</entry>
9769 <sect1 id="view-pg-timezone-abbrevs">
9770 <title><structname>pg_timezone_abbrevs</structname></title>
9772 <indexterm zone="view-pg-timezone-abbrevs">
9773 <primary>pg_timezone_abbrevs</primary>
9777 The view <structname>pg_timezone_abbrevs</structname> provides a list
9778 of time zone abbreviations that are currently recognized by the datetime
9779 input routines. The contents of this view change when the
9780 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9784 <title><structname>pg_timezone_abbrevs</> Columns</title>
9791 <entry>Description</entry>
9796 <entry><structfield>abbrev</structfield></entry>
9797 <entry><type>text</type></entry>
9798 <entry>Time zone abbreviation</entry>
9801 <entry><structfield>utc_offset</structfield></entry>
9802 <entry><type>interval</type></entry>
9803 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9806 <entry><structfield>is_dst</structfield></entry>
9807 <entry><type>boolean</type></entry>
9808 <entry>True if this is a daylight-savings abbreviation</entry>
9815 While most timezone abbreviations represent fixed offsets from UTC,
9816 there are some that have historically varied in value
9817 (see <xref linkend="datetime-config-files"> for more information).
9818 In such cases this view presents their current meaning.
9823 <sect1 id="view-pg-timezone-names">
9824 <title><structname>pg_timezone_names</structname></title>
9826 <indexterm zone="view-pg-timezone-names">
9827 <primary>pg_timezone_names</primary>
9831 The view <structname>pg_timezone_names</structname> provides a list
9832 of time zone names that are recognized by <command>SET TIMEZONE</>,
9833 along with their associated abbreviations, UTC offsets,
9834 and daylight-savings status. (Technically,
9835 <productname>PostgreSQL</productname> does not use UTC because leap
9836 seconds are not handled.)
9837 Unlike the abbreviations shown in <link
9838 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9839 date rules. Therefore, the associated information changes across local DST
9840 boundaries. The displayed information is computed based on the current
9841 value of <function>CURRENT_TIMESTAMP</>.
9845 <title><structname>pg_timezone_names</> Columns</title>
9852 <entry>Description</entry>
9857 <entry><structfield>name</structfield></entry>
9858 <entry><type>text</type></entry>
9859 <entry>Time zone name</entry>
9862 <entry><structfield>abbrev</structfield></entry>
9863 <entry><type>text</type></entry>
9864 <entry>Time zone abbreviation</entry>
9867 <entry><structfield>utc_offset</structfield></entry>
9868 <entry><type>interval</type></entry>
9869 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9872 <entry><structfield>is_dst</structfield></entry>
9873 <entry><type>boolean</type></entry>
9874 <entry>True if currently observing daylight savings</entry>
9882 <sect1 id="view-pg-user">
9883 <title><structname>pg_user</structname></title>
9885 <indexterm zone="view-pg-user">
9886 <primary>pg_user</primary>
9890 The view <structname>pg_user</structname> provides access to
9891 information about database users. This is simply a publicly
9893 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9894 that blanks out the password field.
9898 <title><structname>pg_user</> Columns</title>
9905 <entry>Description</entry>
9910 <entry><structfield>usename</structfield></entry>
9911 <entry><type>name</type></entry>
9912 <entry>User name</entry>
9916 <entry><structfield>usesysid</structfield></entry>
9917 <entry><type>oid</type></entry>
9918 <entry>ID of this user</entry>
9922 <entry><structfield>usecreatedb</structfield></entry>
9923 <entry><type>bool</type></entry>
9924 <entry>User can create databases</entry>
9928 <entry><structfield>usesuper</structfield></entry>
9929 <entry><type>bool</type></entry>
9930 <entry>User is a superuser</entry>
9934 <entry><structfield>userepl</structfield></entry>
9935 <entry><type>bool</type></entry>
9937 User can initiate streaming replication and put the system in and
9943 <entry><structfield>usebypassrls</structfield></entry>
9944 <entry><type>bool</type></entry>
9946 User bypasses every row level security policy, see
9947 <xref linkend="ddl-rowsecurity"> for more information.
9952 <entry><structfield>passwd</structfield></entry>
9953 <entry><type>text</type></entry>
9954 <entry>Not the password (always reads as <literal>********</>)</entry>
9958 <entry><structfield>valuntil</structfield></entry>
9959 <entry><type>abstime</type></entry>
9960 <entry>Password expiry time (only used for password authentication)</entry>
9964 <entry><structfield>useconfig</structfield></entry>
9965 <entry><type>text[]</type></entry>
9966 <entry>Session defaults for run-time configuration variables</entry>
9974 <sect1 id="view-pg-user-mappings">
9975 <title><structname>pg_user_mappings</structname></title>
9977 <indexterm zone="view-pg-user-mappings">
9978 <primary>pg_user_mappings</primary>
9982 The view <structname>pg_user_mappings</structname> provides access
9983 to information about user mappings. This is essentially a publicly
9985 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9986 that leaves out the options field if the user has no rights to use
9991 <title><structname>pg_user_mappings</> Columns</title>
9998 <entry>References</entry>
9999 <entry>Description</entry>
10005 <entry><structfield>umid</structfield></entry>
10006 <entry><type>oid</type></entry>
10007 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
10008 <entry>OID of the user mapping</entry>
10012 <entry><structfield>srvid</structfield></entry>
10013 <entry><type>oid</type></entry>
10014 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
10016 The OID of the foreign server that contains this mapping
10021 <entry><structfield>srvname</structfield></entry>
10022 <entry><type>name</type></entry>
10023 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
10025 Name of the foreign server
10030 <entry><structfield>umuser</structfield></entry>
10031 <entry><type>oid</type></entry>
10032 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10033 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
10037 <entry><structfield>usename</structfield></entry>
10038 <entry><type>name</type></entry>
10040 <entry>Name of the local user to be mapped</entry>
10044 <entry><structfield>umoptions</structfield></entry>
10045 <entry><type>text[]</type></entry>
10048 User mapping specific options, as <quote>keyword=value</>
10049 strings, if the current user is the owner of the foreign
10059 <sect1 id="view-pg-views">
10060 <title><structname>pg_views</structname></title>
10062 <indexterm zone="view-pg-views">
10063 <primary>pg_views</primary>
10067 The view <structname>pg_views</structname> provides access to
10068 useful information about each view in the database.
10072 <title><structname>pg_views</> Columns</title>
10077 <entry>Name</entry>
10078 <entry>Type</entry>
10079 <entry>References</entry>
10080 <entry>Description</entry>
10085 <entry><structfield>schemaname</structfield></entry>
10086 <entry><type>name</type></entry>
10087 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10088 <entry>Name of schema containing view</entry>
10091 <entry><structfield>viewname</structfield></entry>
10092 <entry><type>name</type></entry>
10093 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10094 <entry>Name of view</entry>
10097 <entry><structfield>viewowner</structfield></entry>
10098 <entry><type>name</type></entry>
10099 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10100 <entry>Name of view's owner</entry>
10103 <entry><structfield>definition</structfield></entry>
10104 <entry><type>text</type></entry>
10106 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>