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>aggserialtype</structfield></entry>
468 <entry><type>oid</type></entry>
469 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
470 <entry>Return data type of the aggregate function's serialization function (zero if none)</entry>
473 <entry><structfield>aggtransspace</structfield></entry>
474 <entry><type>int4</type></entry>
476 <entry>Approximate average size (in bytes) of the transition state
477 data, or zero to use a default estimate</entry>
480 <entry><structfield>aggmtranstype</structfield></entry>
481 <entry><type>oid</type></entry>
482 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
483 <entry>Data type of the aggregate function's internal transition (state)
484 data for moving-aggregate mode (zero if none)</entry>
487 <entry><structfield>aggmtransspace</structfield></entry>
488 <entry><type>int4</type></entry>
490 <entry>Approximate average size (in bytes) of the transition state data
491 for moving-aggregate mode, or zero to use a default estimate</entry>
494 <entry><structfield>agginitval</structfield></entry>
495 <entry><type>text</type></entry>
498 The initial value of the transition state. This is a text
499 field containing the initial value in its external string
500 representation. If this field is null, the transition state
501 value starts out null.
505 <entry><structfield>aggminitval</structfield></entry>
506 <entry><type>text</type></entry>
509 The initial value of the transition state for moving-aggregate mode.
510 This is a text field containing the initial value in its external
511 string representation. If this field is null, the transition state
512 value starts out null.
520 New aggregate functions are registered with the <xref
521 linkend="sql-createaggregate">
522 command. See <xref linkend="xaggr"> for more information about
523 writing aggregate functions and the meaning of the transition
530 <sect1 id="catalog-pg-am">
531 <title><structname>pg_am</structname></title>
533 <indexterm zone="catalog-pg-am">
534 <primary>pg_am</primary>
538 The catalog <structname>pg_am</structname> stores information about index
539 access methods. There is one row for each index access method supported by
540 the system. The requirements for index access methods are discussed in
541 detail in <xref linkend="indexam">.
545 <title><structname>pg_am</> Columns</title>
552 <entry>References</entry>
553 <entry>Description</entry>
559 <entry><structfield>oid</structfield></entry>
560 <entry><type>oid</type></entry>
562 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
566 <entry><structfield>amname</structfield></entry>
567 <entry><type>name</type></entry>
569 <entry>Name of the access method</entry>
573 <entry><structfield>amhandler</structfield></entry>
574 <entry><type>oid</type></entry>
575 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
577 OID of a handler function that is responsible for supplying information
578 about the access method
589 <sect1 id="catalog-pg-amop">
590 <title><structname>pg_amop</structname></title>
592 <indexterm zone="catalog-pg-amop">
593 <primary>pg_amop</primary>
597 The catalog <structname>pg_amop</structname> stores information about
598 operators associated with access method operator families. There is one
599 row for each operator that is a member of an operator family. A family
600 member can be either a <firstterm>search</> operator or an
601 <firstterm>ordering</> operator. An operator
602 can appear in more than one family, but cannot appear in more than one
603 search position nor more than one ordering position within a family.
604 (It is allowed, though unlikely, for an operator to be used for both
605 search and ordering purposes.)
609 <title><structname>pg_amop</> Columns</title>
616 <entry>References</entry>
617 <entry>Description</entry>
623 <entry><structfield>oid</structfield></entry>
624 <entry><type>oid</type></entry>
626 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
630 <entry><structfield>amopfamily</structfield></entry>
631 <entry><type>oid</type></entry>
632 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
633 <entry>The operator family this entry is for</entry>
637 <entry><structfield>amoplefttype</structfield></entry>
638 <entry><type>oid</type></entry>
639 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
640 <entry>Left-hand input data type of operator</entry>
644 <entry><structfield>amoprighttype</structfield></entry>
645 <entry><type>oid</type></entry>
646 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
647 <entry>Right-hand input data type of operator</entry>
651 <entry><structfield>amopstrategy</structfield></entry>
652 <entry><type>int2</type></entry>
654 <entry>Operator strategy number</entry>
658 <entry><structfield>amoppurpose</structfield></entry>
659 <entry><type>char</type></entry>
661 <entry>Operator purpose, either <literal>s</> for search or
662 <literal>o</> for ordering</entry>
666 <entry><structfield>amopopr</structfield></entry>
667 <entry><type>oid</type></entry>
668 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
669 <entry>OID of the operator</entry>
673 <entry><structfield>amopmethod</structfield></entry>
674 <entry><type>oid</type></entry>
675 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
676 <entry>Index access method operator family is for</entry>
680 <entry><structfield>amopsortfamily</structfield></entry>
681 <entry><type>oid</type></entry>
682 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
683 <entry>The B-tree operator family this entry sorts according to, if an
684 ordering operator; zero if a search operator</entry>
692 A <quote>search</> operator entry indicates that an index of this operator
693 family can be searched to find all rows satisfying
695 <replaceable>indexed_column</>
696 <replaceable>operator</>
697 <replaceable>constant</>.
698 Obviously, such an operator must return <type>boolean</type>, and its left-hand input
699 type must match the index's column data type.
703 An <quote>ordering</> operator entry indicates that an index of this
704 operator family can be scanned to return rows in the order represented by
706 <replaceable>indexed_column</>
707 <replaceable>operator</>
708 <replaceable>constant</>.
709 Such an operator could return any sortable data type, though again
710 its left-hand input type must match the index's column data type.
711 The exact semantics of the <literal>ORDER BY</> are specified by the
712 <structfield>amopsortfamily</structfield> column, which must reference
713 a B-tree operator family for the operator's result type.
718 At present, it's assumed that the sort order for an ordering operator
719 is the default for the referenced operator family, i.e., <literal>ASC NULLS
720 LAST</>. This might someday be relaxed by adding additional columns
721 to specify sort options explicitly.
726 An entry's <structfield>amopmethod</> must match the
727 <structname>opfmethod</> of its containing operator family (including
728 <structfield>amopmethod</> here is an intentional denormalization of the
729 catalog structure for performance reasons). Also,
730 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
731 the <structfield>oprleft</> and <structfield>oprright</> fields of the
732 referenced <structname>pg_operator</> entry.
738 <sect1 id="catalog-pg-amproc">
739 <title><structname>pg_amproc</structname></title>
741 <indexterm zone="catalog-pg-amproc">
742 <primary>pg_amproc</primary>
746 The catalog <structname>pg_amproc</structname> stores information about
747 support procedures associated with access method operator families. There
748 is one row for each support procedure belonging to an operator family.
752 <title><structname>pg_amproc</structname> Columns</title>
759 <entry>References</entry>
760 <entry>Description</entry>
766 <entry><structfield>oid</structfield></entry>
767 <entry><type>oid</type></entry>
769 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
773 <entry><structfield>amprocfamily</structfield></entry>
774 <entry><type>oid</type></entry>
775 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
776 <entry>The operator family this entry is for</entry>
780 <entry><structfield>amproclefttype</structfield></entry>
781 <entry><type>oid</type></entry>
782 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
783 <entry>Left-hand input data type of associated operator</entry>
787 <entry><structfield>amprocrighttype</structfield></entry>
788 <entry><type>oid</type></entry>
789 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
790 <entry>Right-hand input data type of associated operator</entry>
794 <entry><structfield>amprocnum</structfield></entry>
795 <entry><type>int2</type></entry>
797 <entry>Support procedure number</entry>
801 <entry><structfield>amproc</structfield></entry>
802 <entry><type>regproc</type></entry>
803 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
804 <entry>OID of the procedure</entry>
812 The usual interpretation of the
813 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
814 is that they identify the left and right input types of the operator(s)
815 that a particular support procedure supports. For some access methods
816 these match the input data type(s) of the support procedure itself, for
817 others not. There is a notion of <quote>default</> support procedures for
818 an index, which are those with <structfield>amproclefttype</> and
819 <structfield>amprocrighttype</> both equal to the index operator class's
820 <structfield>opcintype</>.
826 <sect1 id="catalog-pg-attrdef">
827 <title><structname>pg_attrdef</structname></title>
829 <indexterm zone="catalog-pg-attrdef">
830 <primary>pg_attrdef</primary>
834 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
835 about columns is stored in <structname>pg_attribute</structname>
836 (see below). Only columns that explicitly specify a default value
837 (when the table is created or the column is added) will have an
842 <title><structname>pg_attrdef</> Columns</title>
849 <entry>References</entry>
850 <entry>Description</entry>
856 <entry><structfield>oid</structfield></entry>
857 <entry><type>oid</type></entry>
859 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
863 <entry><structfield>adrelid</structfield></entry>
864 <entry><type>oid</type></entry>
865 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
866 <entry>The table this column belongs to</entry>
870 <entry><structfield>adnum</structfield></entry>
871 <entry><type>int2</type></entry>
872 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
873 <entry>The number of the column</entry>
877 <entry><structfield>adbin</structfield></entry>
878 <entry><type>pg_node_tree</type></entry>
880 <entry>The internal representation of the column default value</entry>
884 <entry><structfield>adsrc</structfield></entry>
885 <entry><type>text</type></entry>
887 <entry>A human-readable representation of the default value</entry>
894 The <structfield>adsrc</structfield> field is historical, and is best
895 not used, because it does not track outside changes that might affect
896 the representation of the default value. Reverse-compiling the
897 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
898 example) is a better way to display the default value.
904 <sect1 id="catalog-pg-attribute">
905 <title><structname>pg_attribute</structname></title>
907 <indexterm zone="catalog-pg-attribute">
908 <primary>pg_attribute</primary>
912 The catalog <structname>pg_attribute</structname> stores information about
913 table columns. There will be exactly one
914 <structname>pg_attribute</structname> row for every column in every
915 table in the database. (There will also be attribute entries for
916 indexes, and indeed all objects that have <structname>pg_class</structname>
921 The term attribute is equivalent to column and is used for
926 <title><structname>pg_attribute</> Columns</title>
933 <entry>References</entry>
934 <entry>Description</entry>
940 <entry><structfield>attrelid</structfield></entry>
941 <entry><type>oid</type></entry>
942 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
943 <entry>The table this column belongs to</entry>
947 <entry><structfield>attname</structfield></entry>
948 <entry><type>name</type></entry>
950 <entry>The column name</entry>
954 <entry><structfield>atttypid</structfield></entry>
955 <entry><type>oid</type></entry>
956 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
957 <entry>The data type of this column</entry>
961 <entry><structfield>attstattarget</structfield></entry>
962 <entry><type>int4</type></entry>
965 <structfield>attstattarget</structfield> controls the level of detail
966 of statistics accumulated for this column by
967 <xref linkend="sql-analyze">.
968 A zero value indicates that no statistics should be collected.
969 A negative value says to use the system default statistics target.
970 The exact meaning of positive values is data type-dependent.
971 For scalar data types, <structfield>attstattarget</structfield>
972 is both the target number of <quote>most common values</quote>
973 to collect, and the target number of histogram bins to create.
978 <entry><structfield>attlen</structfield></entry>
979 <entry><type>int2</type></entry>
982 A copy of <literal>pg_type.typlen</literal> of this column's
988 <entry><structfield>attnum</structfield></entry>
989 <entry><type>int2</type></entry>
992 The number of the column. Ordinary columns are numbered from 1
993 up. System columns, such as <structfield>oid</structfield>,
994 have (arbitrary) negative numbers.
999 <entry><structfield>attndims</structfield></entry>
1000 <entry><type>int4</type></entry>
1003 Number of dimensions, if the column is an array type; otherwise 0.
1004 (Presently, the number of dimensions of an array is not enforced,
1005 so any nonzero value effectively means <quote>it's an array</>.)
1010 <entry><structfield>attcacheoff</structfield></entry>
1011 <entry><type>int4</type></entry>
1014 Always -1 in storage, but when loaded into a row descriptor
1015 in memory this might be updated to cache the offset of the attribute
1021 <entry><structfield>atttypmod</structfield></entry>
1022 <entry><type>int4</type></entry>
1025 <structfield>atttypmod</structfield> records type-specific data
1026 supplied at table creation time (for example, the maximum
1027 length of a <type>varchar</type> column). It is passed to
1028 type-specific input functions and length coercion functions.
1029 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1034 <entry><structfield>attbyval</structfield></entry>
1035 <entry><type>bool</type></entry>
1038 A copy of <literal>pg_type.typbyval</> of this column's type
1043 <entry><structfield>attstorage</structfield></entry>
1044 <entry><type>char</type></entry>
1047 Normally a copy of <literal>pg_type.typstorage</> of this
1048 column's type. For TOAST-able data types, this can be altered
1049 after column creation to control storage policy.
1054 <entry><structfield>attalign</structfield></entry>
1055 <entry><type>char</type></entry>
1058 A copy of <literal>pg_type.typalign</> of this column's type
1063 <entry><structfield>attnotnull</structfield></entry>
1064 <entry><type>bool</type></entry>
1067 This represents a not-null constraint.
1072 <entry><structfield>atthasdef</structfield></entry>
1073 <entry><type>bool</type></entry>
1076 This column has a default value, in which case there will be a
1077 corresponding entry in the <structname>pg_attrdef</structname>
1078 catalog that actually defines the value.
1083 <entry><structfield>attisdropped</structfield></entry>
1084 <entry><type>bool</type></entry>
1087 This column has been dropped and is no longer valid. A dropped
1088 column is still physically present in the table, but is
1089 ignored by the parser and so cannot be accessed via SQL.
1094 <entry><structfield>attislocal</structfield></entry>
1095 <entry><type>bool</type></entry>
1098 This column is defined locally in the relation. Note that a column can
1099 be locally defined and inherited simultaneously.
1104 <entry><structfield>attinhcount</structfield></entry>
1105 <entry><type>int4</type></entry>
1108 The number of direct ancestors this column has. A column with a
1109 nonzero number of ancestors cannot be dropped nor renamed.
1114 <entry><structfield>attcollation</structfield></entry>
1115 <entry><type>oid</type></entry>
1116 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1118 The defined collation of the column, or zero if the column is
1119 not of a collatable data type.
1124 <entry><structfield>attacl</structfield></entry>
1125 <entry><type>aclitem[]</type></entry>
1128 Column-level access privileges, if any have been granted specifically
1134 <entry><structfield>attoptions</structfield></entry>
1135 <entry><type>text[]</type></entry>
1138 Attribute-level options, as <quote>keyword=value</> strings
1143 <entry><structfield>attfdwoptions</structfield></entry>
1144 <entry><type>text[]</type></entry>
1147 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1156 In a dropped column's <structname>pg_attribute</structname> entry,
1157 <structfield>atttypid</structfield> is reset to zero, but
1158 <structfield>attlen</structfield> and the other fields copied from
1159 <structname>pg_type</> are still valid. This arrangement is needed
1160 to cope with the situation where the dropped column's data type was
1161 later dropped, and so there is no <structname>pg_type</> row anymore.
1162 <structfield>attlen</structfield> and the other fields can be used
1163 to interpret the contents of a row of the table.
1168 <sect1 id="catalog-pg-authid">
1169 <title><structname>pg_authid</structname></title>
1171 <indexterm zone="catalog-pg-authid">
1172 <primary>pg_authid</primary>
1176 The catalog <structname>pg_authid</structname> contains information about
1177 database authorization identifiers (roles). A role subsumes the concepts
1178 of <quote>users</> and <quote>groups</>. A user is essentially just a
1179 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1180 without <structfield>rolcanlogin</>) can have other roles as members; see
1181 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1185 Since this catalog contains passwords, it must not be publicly readable.
1186 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1187 is a publicly readable view on
1188 <structname>pg_authid</structname> that blanks out the password field.
1192 <xref linkend="user-manag"> contains detailed information about user and
1193 privilege management.
1197 Because user identities are cluster-wide,
1198 <structname>pg_authid</structname>
1199 is shared across all databases of a cluster: there is only one
1200 copy of <structname>pg_authid</structname> per cluster, not
1205 <title><structname>pg_authid</> Columns</title>
1212 <entry>Description</entry>
1219 <entry><structfield>oid</structfield></entry>
1220 <entry><type>oid</type></entry>
1221 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1225 <entry><structfield>rolname</structfield></entry>
1226 <entry><type>name</type></entry>
1227 <entry>Role name</entry>
1231 <entry><structfield>rolsuper</structfield></entry>
1232 <entry><type>bool</type></entry>
1233 <entry>Role has superuser privileges</entry>
1237 <entry><structfield>rolinherit</structfield></entry>
1238 <entry><type>bool</type></entry>
1239 <entry>Role automatically inherits privileges of roles it is a
1244 <entry><structfield>rolcreaterole</structfield></entry>
1245 <entry><type>bool</type></entry>
1246 <entry>Role can create more roles</entry>
1250 <entry><structfield>rolcreatedb</structfield></entry>
1251 <entry><type>bool</type></entry>
1252 <entry>Role can create databases</entry>
1256 <entry><structfield>rolcanlogin</structfield></entry>
1257 <entry><type>bool</type></entry>
1259 Role can log in. That is, this role can be given as the initial
1260 session authorization identifier
1265 <entry><structfield>rolreplication</structfield></entry>
1266 <entry><type>bool</type></entry>
1268 Role is a replication role. That is, this role can initiate streaming
1269 replication (see <xref linkend="streaming-replication">) and set/unset
1270 the system backup mode using <function>pg_start_backup</> and
1271 <function>pg_stop_backup</>
1276 <entry><structfield>rolbypassrls</structfield></entry>
1277 <entry><type>bool</type></entry>
1279 Role bypasses every row level security policy, see
1280 <xref linkend="ddl-rowsecurity"> for more information.
1285 <entry><structfield>rolconnlimit</structfield></entry>
1286 <entry><type>int4</type></entry>
1288 For roles that can log in, this sets maximum number of concurrent
1289 connections this role can make. -1 means no limit.
1294 <entry><structfield>rolpassword</structfield></entry>
1295 <entry><type>text</type></entry>
1297 Password (possibly encrypted); null if none. If the password
1298 is encrypted, this column will begin with the string <literal>md5</>
1299 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1300 will be of the user's password concatenated to their user name.
1301 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1302 <productname>PostgreSQL</> will store the md5 hash of
1303 <literal>xyzzyjoe</>. A password that does not follow that
1304 format is assumed to be unencrypted.
1309 <entry><structfield>rolvaliduntil</structfield></entry>
1310 <entry><type>timestamptz</type></entry>
1311 <entry>Password expiry time (only used for password authentication);
1312 null if no expiration</entry>
1321 <sect1 id="catalog-pg-auth-members">
1322 <title><structname>pg_auth_members</structname></title>
1324 <indexterm zone="catalog-pg-auth-members">
1325 <primary>pg_auth_members</primary>
1329 The catalog <structname>pg_auth_members</structname> shows the membership
1330 relations between roles. Any non-circular set of relationships is allowed.
1334 Because user identities are cluster-wide,
1335 <structname>pg_auth_members</structname>
1336 is shared across all databases of a cluster: there is only one
1337 copy of <structname>pg_auth_members</structname> per cluster, not
1342 <title><structname>pg_auth_members</> Columns</title>
1349 <entry>References</entry>
1350 <entry>Description</entry>
1356 <entry><structfield>roleid</structfield></entry>
1357 <entry><type>oid</type></entry>
1358 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1359 <entry>ID of a role that has a member</entry>
1363 <entry><structfield>member</structfield></entry>
1364 <entry><type>oid</type></entry>
1365 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1366 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1370 <entry><structfield>grantor</structfield></entry>
1371 <entry><type>oid</type></entry>
1372 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1373 <entry>ID of the role that granted this membership</entry>
1377 <entry><structfield>admin_option</structfield></entry>
1378 <entry><type>bool</type></entry>
1380 <entry>True if <structfield>member</> can grant membership in
1381 <structfield>roleid</> to others</entry>
1390 <sect1 id="catalog-pg-cast">
1391 <title><structname>pg_cast</structname></title>
1393 <indexterm zone="catalog-pg-cast">
1394 <primary>pg_cast</primary>
1398 The catalog <structname>pg_cast</structname> stores data type conversion
1399 paths, both built-in and user-defined.
1403 It should be noted that <structname>pg_cast</structname> does not represent
1404 every type conversion that the system knows how to perform; only those that
1405 cannot be deduced from some generic rule. For example, casting between a
1406 domain and its base type is not explicitly represented in
1407 <structname>pg_cast</structname>. Another important exception is that
1408 <quote>automatic I/O conversion casts</>, those performed using a data
1409 type's own I/O functions to convert to or from <type>text</> or other
1410 string types, are not explicitly represented in
1411 <structname>pg_cast</structname>.
1415 <title><structname>pg_cast</> Columns</title>
1422 <entry>References</entry>
1423 <entry>Description</entry>
1429 <entry><structfield>oid</structfield></entry>
1430 <entry><type>oid</type></entry>
1432 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1436 <entry><structfield>castsource</structfield></entry>
1437 <entry><type>oid</type></entry>
1438 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1439 <entry>OID of the source data type</entry>
1443 <entry><structfield>casttarget</structfield></entry>
1444 <entry><type>oid</type></entry>
1445 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1446 <entry>OID of the target data type</entry>
1450 <entry><structfield>castfunc</structfield></entry>
1451 <entry><type>oid</type></entry>
1452 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1454 The OID of the function to use to perform this cast. Zero is
1455 stored if the cast method doesn't require a function.
1460 <entry><structfield>castcontext</structfield></entry>
1461 <entry><type>char</type></entry>
1464 Indicates what contexts the cast can be invoked in.
1465 <literal>e</> means only as an explicit cast (using
1466 <literal>CAST</> or <literal>::</> syntax).
1467 <literal>a</> means implicitly in assignment
1468 to a target column, as well as explicitly.
1469 <literal>i</> means implicitly in expressions, as well as the
1474 <entry><structfield>castmethod</structfield></entry>
1475 <entry><type>char</type></entry>
1478 Indicates how the cast is performed.
1479 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1480 <literal>i</> means that the input/output functions are used.
1481 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1489 The cast functions listed in <structname>pg_cast</structname> must
1490 always take the cast source type as their first argument type, and
1491 return the cast destination type as their result type. A cast
1492 function can have up to three arguments. The second argument,
1493 if present, must be type <type>integer</>; it receives the type
1494 modifier associated with the destination type, or -1
1495 if there is none. The third argument,
1496 if present, must be type <type>boolean</>; it receives <literal>true</>
1497 if the cast is an explicit cast, <literal>false</> otherwise.
1501 It is legitimate to create a <structname>pg_cast</structname> entry
1502 in which the source and target types are the same, if the associated
1503 function takes more than one argument. Such entries represent
1504 <quote>length coercion functions</> that coerce values of the type
1505 to be legal for a particular type modifier value.
1509 When a <structname>pg_cast</structname> entry has different source and
1510 target types and a function that takes more than one argument, it
1511 represents converting from one type to another and applying a length
1512 coercion in a single step. When no such entry is available, coercion
1513 to a type that uses a type modifier involves two steps, one to
1514 convert between data types and a second to apply the modifier.
1518 <sect1 id="catalog-pg-class">
1519 <title><structname>pg_class</structname></title>
1521 <indexterm zone="catalog-pg-class">
1522 <primary>pg_class</primary>
1526 The catalog <structname>pg_class</structname> catalogs tables and most
1527 everything else that has columns or is otherwise similar to a
1528 table. This includes indexes (but see also
1529 <structname>pg_index</structname>), sequences, views, materialized
1530 views, composite types, and TOAST tables; see <structfield>relkind</>.
1531 Below, when we mean all of these
1532 kinds of objects we speak of <quote>relations</quote>. Not all
1533 columns are meaningful for all relation types.
1537 <title><structname>pg_class</> Columns</title>
1544 <entry>References</entry>
1545 <entry>Description</entry>
1551 <entry><structfield>oid</structfield></entry>
1552 <entry><type>oid</type></entry>
1554 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1558 <entry><structfield>relname</structfield></entry>
1559 <entry><type>name</type></entry>
1561 <entry>Name of the table, index, view, etc.</entry>
1565 <entry><structfield>relnamespace</structfield></entry>
1566 <entry><type>oid</type></entry>
1567 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1569 The OID of the namespace that contains this relation
1574 <entry><structfield>reltype</structfield></entry>
1575 <entry><type>oid</type></entry>
1576 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1578 The OID of the data type that corresponds to this table's row type,
1579 if any (zero for indexes, which have no <structname>pg_type</> entry)
1584 <entry><structfield>reloftype</structfield></entry>
1585 <entry><type>oid</type></entry>
1586 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1588 For typed tables, the OID of the underlying composite type,
1589 zero for all other relations
1594 <entry><structfield>relowner</structfield></entry>
1595 <entry><type>oid</type></entry>
1596 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1597 <entry>Owner of the relation</entry>
1601 <entry><structfield>relam</structfield></entry>
1602 <entry><type>oid</type></entry>
1603 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1604 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1608 <entry><structfield>relfilenode</structfield></entry>
1609 <entry><type>oid</type></entry>
1611 <entry>Name of the on-disk file of this relation; zero means this
1612 is a <quote>mapped</> relation whose disk file name is determined
1613 by low-level state</entry>
1617 <entry><structfield>reltablespace</structfield></entry>
1618 <entry><type>oid</type></entry>
1619 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1621 The tablespace in which this relation is stored. If zero,
1622 the database's default tablespace is implied. (Not meaningful
1623 if the relation has no on-disk file.)
1628 <entry><structfield>relpages</structfield></entry>
1629 <entry><type>int4</type></entry>
1632 Size of the on-disk representation of this table in pages (of size
1633 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1634 planner. It is updated by <command>VACUUM</command>,
1635 <command>ANALYZE</command>, and a few DDL commands such as
1636 <command>CREATE INDEX</command>.
1641 <entry><structfield>reltuples</structfield></entry>
1642 <entry><type>float4</type></entry>
1645 Number of rows in the table. This is only an estimate used by the
1646 planner. It is updated by <command>VACUUM</command>,
1647 <command>ANALYZE</command>, and a few DDL commands such as
1648 <command>CREATE INDEX</command>.
1653 <entry><structfield>relallvisible</structfield></entry>
1654 <entry><type>int4</type></entry>
1657 Number of pages that are marked all-visible in the table's
1658 visibility map. This is only an estimate used by the
1659 planner. It is updated by <command>VACUUM</command>,
1660 <command>ANALYZE</command>, and a few DDL commands such as
1661 <command>CREATE INDEX</command>.
1666 <entry><structfield>reltoastrelid</structfield></entry>
1667 <entry><type>oid</type></entry>
1668 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1670 OID of the TOAST table associated with this table, 0 if none. The
1671 TOAST table stores large attributes <quote>out of line</quote> in a
1677 <entry><structfield>relhasindex</structfield></entry>
1678 <entry><type>bool</type></entry>
1681 True if this is a table and it has (or recently had) any indexes
1686 <entry><structfield>relisshared</structfield></entry>
1687 <entry><type>bool</type></entry>
1690 True if this table is shared across all databases in the cluster. Only
1691 certain system catalogs (such as <structname>pg_database</structname>)
1697 <entry><structfield>relpersistence</structfield></entry>
1698 <entry><type>char</type></entry>
1701 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1702 <literal>t</> = temporary table
1707 <entry><structfield>relkind</structfield></entry>
1708 <entry><type>char</type></entry>
1711 <literal>r</> = ordinary table, <literal>i</> = index,
1712 <literal>S</> = sequence, <literal>v</> = view,
1713 <literal>m</> = materialized view,
1714 <literal>c</> = composite type, <literal>t</> = TOAST table,
1715 <literal>f</> = foreign table
1720 <entry><structfield>relnatts</structfield></entry>
1721 <entry><type>int2</type></entry>
1724 Number of user columns in the relation (system columns not
1725 counted). There must be this many corresponding entries in
1726 <structname>pg_attribute</structname>. See also
1727 <literal>pg_attribute.attnum</literal>.
1732 <entry><structfield>relchecks</structfield></entry>
1733 <entry><type>int2</type></entry>
1736 Number of <literal>CHECK</> constraints on the table; see
1737 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1742 <entry><structfield>relhasoids</structfield></entry>
1743 <entry><type>bool</type></entry>
1746 True if we generate an OID for each row of the relation
1751 <entry><structfield>relhaspkey</structfield></entry>
1752 <entry><type>bool</type></entry>
1755 True if the table has (or once had) a primary key
1760 <entry><structfield>relhasrules</structfield></entry>
1761 <entry><type>bool</type></entry>
1764 True if table has (or once had) rules; see
1765 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1770 <entry><structfield>relhastriggers</structfield></entry>
1771 <entry><type>bool</type></entry>
1774 True if table has (or once had) triggers; see
1775 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1780 <entry><structfield>relhassubclass</structfield></entry>
1781 <entry><type>bool</type></entry>
1783 <entry>True if table has (or once had) any inheritance children</entry>
1787 <entry><structfield>relrowsecurity</structfield></entry>
1788 <entry><type>bool</type></entry>
1791 True if table has row level security enabled; see
1792 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1797 <entry><structfield>relforcerowsecurity</structfield></entry>
1798 <entry><type>bool</type></entry>
1801 True if row level security (when enabled) will also apply to table owner; see
1802 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1807 <entry><structfield>relispopulated</structfield></entry>
1808 <entry><type>bool</type></entry>
1810 <entry>True if relation is populated (this is true for all
1811 relations other than some materialized views)</entry>
1815 <entry><structfield>relreplident</structfield></entry>
1816 <entry><type>char</type></entry>
1819 Columns used to form <quote>replica identity</> for rows:
1820 <literal>d</> = default (primary key, if any),
1821 <literal>n</> = nothing,
1822 <literal>f</> = all columns
1823 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1828 <entry><structfield>relfrozenxid</structfield></entry>
1829 <entry><type>xid</type></entry>
1832 All transaction IDs before this one have been replaced with a permanent
1833 (<quote>frozen</>) transaction ID in this table. This is used to track
1834 whether the table needs to be vacuumed in order to prevent transaction
1835 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1836 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1841 <entry><structfield>relminmxid</structfield></entry>
1842 <entry><type>xid</type></entry>
1845 All multixact IDs before this one have been replaced by a
1846 transaction ID in this table. This is used to track
1847 whether the table needs to be vacuumed in order to prevent multixact ID
1848 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
1849 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1854 <entry><structfield>relacl</structfield></entry>
1855 <entry><type>aclitem[]</type></entry>
1858 Access privileges; see
1859 <xref linkend="sql-grant"> and
1860 <xref linkend="sql-revoke">
1866 <entry><structfield>reloptions</structfield></entry>
1867 <entry><type>text[]</type></entry>
1870 Access-method-specific options, as <quote>keyword=value</> strings
1878 Several of the Boolean flags in <structname>pg_class</> are maintained
1879 lazily: they are guaranteed to be true if that's the correct state, but
1880 may not be reset to false immediately when the condition is no longer
1881 true. For example, <structfield>relhasindex</> is set by
1882 <command>CREATE INDEX</command>, but it is never cleared by
1883 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1884 <structfield>relhasindex</> if it finds the table has no indexes. This
1885 arrangement avoids race conditions and improves concurrency.
1889 <sect1 id="catalog-pg-collation">
1890 <title><structname>pg_collation</structname></title>
1892 <indexterm zone="catalog-pg-collation">
1893 <primary>pg_collation</primary>
1897 The catalog <structname>pg_collation</structname> describes the
1898 available collations, which are essentially mappings from an SQL
1899 name to operating system locale categories.
1900 See <xref linkend="collation"> for more information.
1904 <title><structname>pg_collation</> Columns</title>
1911 <entry>References</entry>
1912 <entry>Description</entry>
1918 <entry><structfield>oid</structfield></entry>
1919 <entry><type>oid</type></entry>
1921 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1925 <entry><structfield>collname</structfield></entry>
1926 <entry><type>name</type></entry>
1928 <entry>Collation name (unique per namespace and encoding)</entry>
1932 <entry><structfield>collnamespace</structfield></entry>
1933 <entry><type>oid</type></entry>
1934 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1936 The OID of the namespace that contains this collation
1941 <entry><structfield>collowner</structfield></entry>
1942 <entry><type>oid</type></entry>
1943 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1944 <entry>Owner of the collation</entry>
1948 <entry><structfield>collencoding</structfield></entry>
1949 <entry><type>int4</type></entry>
1951 <entry>Encoding in which the collation is applicable, or -1 if it
1952 works for any encoding</entry>
1956 <entry><structfield>collcollate</structfield></entry>
1957 <entry><type>name</type></entry>
1959 <entry><symbol>LC_COLLATE</> for this collation object</entry>
1963 <entry><structfield>collctype</structfield></entry>
1964 <entry><type>name</type></entry>
1966 <entry><symbol>LC_CTYPE</> for this collation object</entry>
1973 Note that the unique key on this catalog is (<structfield>collname</>,
1974 <structfield>collencoding</>, <structfield>collnamespace</>) not just
1975 (<structfield>collname</>, <structfield>collnamespace</>).
1976 <productname>PostgreSQL</productname> generally ignores all
1977 collations that do not have <structfield>collencoding</> equal to
1978 either the current database's encoding or -1, and creation of new entries
1979 with the same name as an entry with <structfield>collencoding</> = -1
1980 is forbidden. Therefore it is sufficient to use a qualified SQL name
1981 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
1982 even though this is not unique according to the catalog definition.
1983 The reason for defining the catalog this way is that
1984 <application>initdb</> fills it in at cluster initialization time with
1985 entries for all locales available on the system, so it must be able to
1986 hold entries for all encodings that might ever be used in the cluster.
1990 In the <literal>template0</> database, it could be useful to create
1991 collations whose encoding does not match the database encoding,
1992 since they could match the encodings of databases later cloned from
1993 <literal>template0</>. This would currently have to be done manually.
1997 <sect1 id="catalog-pg-constraint">
1998 <title><structname>pg_constraint</structname></title>
2000 <indexterm zone="catalog-pg-constraint">
2001 <primary>pg_constraint</primary>
2005 The catalog <structname>pg_constraint</structname> stores check, primary
2006 key, unique, foreign key, and exclusion constraints on tables.
2007 (Column constraints are not treated specially. Every column constraint is
2008 equivalent to some table constraint.)
2009 Not-null constraints are represented in the <structname>pg_attribute</>
2014 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2015 TRIGGER</>) also give rise to an entry in this table.
2019 Check constraints on domains are stored here, too.
2023 <title><structname>pg_constraint</> Columns</title>
2030 <entry>References</entry>
2031 <entry>Description</entry>
2037 <entry><structfield>oid</structfield></entry>
2038 <entry><type>oid</type></entry>
2040 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2044 <entry><structfield>conname</structfield></entry>
2045 <entry><type>name</type></entry>
2047 <entry>Constraint name (not necessarily unique!)</entry>
2051 <entry><structfield>connamespace</structfield></entry>
2052 <entry><type>oid</type></entry>
2053 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2055 The OID of the namespace that contains this constraint
2060 <entry><structfield>contype</structfield></entry>
2061 <entry><type>char</type></entry>
2064 <literal>c</> = check constraint,
2065 <literal>f</> = foreign key constraint,
2066 <literal>p</> = primary key constraint,
2067 <literal>u</> = unique constraint,
2068 <literal>t</> = constraint trigger,
2069 <literal>x</> = exclusion constraint
2074 <entry><structfield>condeferrable</structfield></entry>
2075 <entry><type>bool</type></entry>
2077 <entry>Is the constraint deferrable?</entry>
2081 <entry><structfield>condeferred</structfield></entry>
2082 <entry><type>bool</type></entry>
2084 <entry>Is the constraint deferred by default?</entry>
2088 <entry><structfield>convalidated</structfield></entry>
2089 <entry><type>bool</type></entry>
2091 <entry>Has the constraint been validated?
2092 Currently, can only be false for foreign keys and CHECK constraints</entry>
2096 <entry><structfield>conrelid</structfield></entry>
2097 <entry><type>oid</type></entry>
2098 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2099 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2103 <entry><structfield>contypid</structfield></entry>
2104 <entry><type>oid</type></entry>
2105 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2106 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2110 <entry><structfield>conindid</structfield></entry>
2111 <entry><type>oid</type></entry>
2112 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2113 <entry>The index supporting this constraint, if it's a unique, primary
2114 key, foreign key, or exclusion constraint; else 0</entry>
2118 <entry><structfield>confrelid</structfield></entry>
2119 <entry><type>oid</type></entry>
2120 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2121 <entry>If a foreign key, the referenced table; else 0</entry>
2125 <entry><structfield>confupdtype</structfield></entry>
2126 <entry><type>char</type></entry>
2128 <entry>Foreign key update action code:
2129 <literal>a</> = no action,
2130 <literal>r</> = restrict,
2131 <literal>c</> = cascade,
2132 <literal>n</> = set null,
2133 <literal>d</> = set default
2138 <entry><structfield>confdeltype</structfield></entry>
2139 <entry><type>char</type></entry>
2141 <entry>Foreign key deletion action code:
2142 <literal>a</> = no action,
2143 <literal>r</> = restrict,
2144 <literal>c</> = cascade,
2145 <literal>n</> = set null,
2146 <literal>d</> = set default
2151 <entry><structfield>confmatchtype</structfield></entry>
2152 <entry><type>char</type></entry>
2154 <entry>Foreign key match type:
2155 <literal>f</> = full,
2156 <literal>p</> = partial,
2157 <literal>s</> = simple
2162 <entry><structfield>conislocal</structfield></entry>
2163 <entry><type>bool</type></entry>
2166 This constraint is defined locally for the relation. Note that a
2167 constraint can be locally defined and inherited simultaneously.
2172 <entry><structfield>coninhcount</structfield></entry>
2173 <entry><type>int4</type></entry>
2176 The number of direct inheritance ancestors this constraint has.
2178 a nonzero number of ancestors cannot be dropped nor renamed.
2183 <entry><structfield>connoinherit</structfield></entry>
2184 <entry><type>bool</type></entry>
2187 This constraint is defined locally for the relation. It is a
2188 non-inheritable constraint.
2193 <entry><structfield>conkey</structfield></entry>
2194 <entry><type>int2[]</type></entry>
2195 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2196 <entry>If a table constraint (including foreign keys, but not constraint
2197 triggers), list of the constrained columns</entry>
2201 <entry><structfield>confkey</structfield></entry>
2202 <entry><type>int2[]</type></entry>
2203 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2204 <entry>If a foreign key, list of the referenced columns</entry>
2208 <entry><structfield>conpfeqop</structfield></entry>
2209 <entry><type>oid[]</type></entry>
2210 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2211 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2215 <entry><structfield>conppeqop</structfield></entry>
2216 <entry><type>oid[]</type></entry>
2217 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2218 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2222 <entry><structfield>conffeqop</structfield></entry>
2223 <entry><type>oid[]</type></entry>
2224 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2225 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2229 <entry><structfield>conexclop</structfield></entry>
2230 <entry><type>oid[]</type></entry>
2231 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2232 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2236 <entry><structfield>conbin</structfield></entry>
2237 <entry><type>pg_node_tree</type></entry>
2239 <entry>If a check constraint, an internal representation of the expression</entry>
2243 <entry><structfield>consrc</structfield></entry>
2244 <entry><type>text</type></entry>
2246 <entry>If a check constraint, a human-readable representation of the expression</entry>
2253 In the case of an exclusion constraint, <structfield>conkey</structfield>
2254 is only useful for constraint elements that are simple column references.
2255 For other cases, a zero appears in <structfield>conkey</structfield>
2256 and the associated index must be consulted to discover the expression
2257 that is constrained. (<structfield>conkey</structfield> thus has the
2258 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2264 <structfield>consrc</structfield> is not updated when referenced objects
2265 change; for example, it won't track renaming of columns. Rather than
2266 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2267 to extract the definition of a check constraint.
2273 <literal>pg_class.relchecks</literal> needs to agree with the
2274 number of check-constraint entries found in this table for each
2281 <sect1 id="catalog-pg-conversion">
2282 <title><structname>pg_conversion</structname></title>
2284 <indexterm zone="catalog-pg-conversion">
2285 <primary>pg_conversion</primary>
2289 The catalog <structname>pg_conversion</structname> describes
2290 encoding conversion procedures. See <xref linkend="sql-createconversion">
2291 for more information.
2295 <title><structname>pg_conversion</> Columns</title>
2302 <entry>References</entry>
2303 <entry>Description</entry>
2309 <entry><structfield>oid</structfield></entry>
2310 <entry><type>oid</type></entry>
2312 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2316 <entry><structfield>conname</structfield></entry>
2317 <entry><type>name</type></entry>
2319 <entry>Conversion name (unique within a namespace)</entry>
2323 <entry><structfield>connamespace</structfield></entry>
2324 <entry><type>oid</type></entry>
2325 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2327 The OID of the namespace that contains this conversion
2332 <entry><structfield>conowner</structfield></entry>
2333 <entry><type>oid</type></entry>
2334 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2335 <entry>Owner of the conversion</entry>
2339 <entry><structfield>conforencoding</structfield></entry>
2340 <entry><type>int4</type></entry>
2342 <entry>Source encoding ID</entry>
2346 <entry><structfield>contoencoding</structfield></entry>
2347 <entry><type>int4</type></entry>
2349 <entry>Destination encoding ID</entry>
2353 <entry><structfield>conproc</structfield></entry>
2354 <entry><type>regproc</type></entry>
2355 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2356 <entry>Conversion procedure</entry>
2360 <entry><structfield>condefault</structfield></entry>
2361 <entry><type>bool</type></entry>
2363 <entry>True if this is the default conversion</entry>
2372 <sect1 id="catalog-pg-database">
2373 <title><structname>pg_database</structname></title>
2375 <indexterm zone="catalog-pg-database">
2376 <primary>pg_database</primary>
2380 The catalog <structname>pg_database</structname> stores information about
2381 the available databases. Databases are created with the <xref
2382 linkend="sql-createdatabase"> command.
2383 Consult <xref linkend="managing-databases"> for details about the meaning
2384 of some of the parameters.
2388 Unlike most system catalogs, <structname>pg_database</structname>
2389 is shared across all databases of a cluster: there is only one
2390 copy of <structname>pg_database</structname> per cluster, not
2395 <title><structname>pg_database</> Columns</title>
2402 <entry>References</entry>
2403 <entry>Description</entry>
2409 <entry><structfield>oid</structfield></entry>
2410 <entry><type>oid</type></entry>
2412 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2416 <entry><structfield>datname</structfield></entry>
2417 <entry><type>name</type></entry>
2419 <entry>Database name</entry>
2423 <entry><structfield>datdba</structfield></entry>
2424 <entry><type>oid</type></entry>
2425 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2426 <entry>Owner of the database, usually the user who created it</entry>
2430 <entry><structfield>encoding</structfield></entry>
2431 <entry><type>int4</type></entry>
2433 <entry>Character encoding for this database
2434 (<function>pg_encoding_to_char()</function> can translate
2435 this number to the encoding name)</entry>
2439 <entry><structfield>datcollate</structfield></entry>
2440 <entry><type>name</type></entry>
2442 <entry>LC_COLLATE for this database</entry>
2446 <entry><structfield>datctype</structfield></entry>
2447 <entry><type>name</type></entry>
2449 <entry>LC_CTYPE for this database</entry>
2453 <entry><structfield>datistemplate</structfield></entry>
2454 <entry><type>bool</type></entry>
2457 If true, then this database can be cloned by
2458 any user with <literal>CREATEDB</> privileges;
2459 if false, then only superusers or the owner of
2460 the database can clone it.
2465 <entry><structfield>datallowconn</structfield></entry>
2466 <entry><type>bool</type></entry>
2469 If false then no one can connect to this database. This is
2470 used to protect the <literal>template0</> database from being altered.
2475 <entry><structfield>datconnlimit</structfield></entry>
2476 <entry><type>int4</type></entry>
2479 Sets maximum number of concurrent connections that can be made
2480 to this database. -1 means no limit.
2485 <entry><structfield>datlastsysoid</structfield></entry>
2486 <entry><type>oid</type></entry>
2489 Last system OID in the database; useful
2490 particularly to <application>pg_dump</application>
2495 <entry><structfield>datfrozenxid</structfield></entry>
2496 <entry><type>xid</type></entry>
2499 All transaction IDs before this one have been replaced with a permanent
2500 (<quote>frozen</>) transaction ID in this database. This is used to
2501 track whether the database needs to be vacuumed in order to prevent
2502 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2503 It is the minimum of the per-table
2504 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2509 <entry><structfield>datminmxid</structfield></entry>
2510 <entry><type>xid</type></entry>
2513 All multixact IDs before this one have been replaced with a
2514 transaction ID in this database. This is used to
2515 track whether the database needs to be vacuumed in order to prevent
2516 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2517 It is the minimum of the per-table
2518 <structname>pg_class</>.<structfield>relminmxid</> values.
2523 <entry><structfield>dattablespace</structfield></entry>
2524 <entry><type>oid</type></entry>
2525 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2527 The default tablespace for the database.
2528 Within this database, all tables for which
2529 <structname>pg_class</>.<structfield>reltablespace</> is zero
2530 will be stored in this tablespace; in particular, all the non-shared
2531 system catalogs will be there.
2536 <entry><structfield>datacl</structfield></entry>
2537 <entry><type>aclitem[]</type></entry>
2540 Access privileges; see
2541 <xref linkend="sql-grant"> and
2542 <xref linkend="sql-revoke">
2552 <sect1 id="catalog-pg-db-role-setting">
2553 <title><structname>pg_db_role_setting</structname></title>
2555 <indexterm zone="catalog-pg-db-role-setting">
2556 <primary>pg_db_role_setting</primary>
2560 The catalog <structname>pg_db_role_setting</structname> records the default
2561 values that have been set for run-time configuration variables,
2562 for each role and database combination.
2566 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2567 is shared across all databases of a cluster: there is only one
2568 copy of <structname>pg_db_role_setting</structname> per cluster, not
2573 <title><structname>pg_db_role_setting</> Columns</title>
2580 <entry>References</entry>
2581 <entry>Description</entry>
2587 <entry><structfield>setdatabase</structfield></entry>
2588 <entry><type>oid</type></entry>
2589 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2590 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2594 <entry><structfield>setrole</structfield></entry>
2595 <entry><type>oid</type></entry>
2596 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2597 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2601 <entry><structfield>setconfig</structfield></entry>
2602 <entry><type>text[]</type></entry>
2604 <entry>Defaults for run-time configuration variables</entry>
2612 <sect1 id="catalog-pg-default-acl">
2613 <title><structname>pg_default_acl</structname></title>
2615 <indexterm zone="catalog-pg-default-acl">
2616 <primary>pg_default_acl</primary>
2620 The catalog <structname>pg_default_acl</> stores initial
2621 privileges to be assigned to newly created objects.
2625 <title><structname>pg_default_acl</> Columns</title>
2632 <entry>References</entry>
2633 <entry>Description</entry>
2639 <entry><structfield>oid</structfield></entry>
2640 <entry><type>oid</type></entry>
2642 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2646 <entry><structfield>defaclrole</structfield></entry>
2647 <entry><type>oid</type></entry>
2648 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2649 <entry>The OID of the role associated with this entry</entry>
2653 <entry><structfield>defaclnamespace</structfield></entry>
2654 <entry><type>oid</type></entry>
2655 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2656 <entry>The OID of the namespace associated with this entry,
2657 or 0 if none</entry>
2661 <entry><structfield>defaclobjtype</structfield></entry>
2662 <entry><type>char</type></entry>
2665 Type of object this entry is for:
2666 <literal>r</> = relation (table, view),
2667 <literal>S</> = sequence,
2668 <literal>f</> = function,
2669 <literal>T</> = type
2674 <entry><structfield>defaclacl</structfield></entry>
2675 <entry><type>aclitem[]</type></entry>
2678 Access privileges that this type of object should have on creation
2686 A <structname>pg_default_acl</> entry shows the initial privileges to
2687 be assigned to an object belonging to the indicated user. There are
2688 currently two types of entry: <quote>global</> entries with
2689 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2690 that reference a particular schema. If a global entry is present then
2691 it <emphasis>overrides</> the normal hard-wired default privileges
2692 for the object type. A per-schema entry, if present, represents privileges
2693 to be <emphasis>added to</> the global or hard-wired default privileges.
2697 Note that when an ACL entry in another catalog is null, it is taken
2698 to represent the hard-wired default privileges for its object,
2699 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2700 at the moment. <structname>pg_default_acl</> is only consulted during
2707 <sect1 id="catalog-pg-depend">
2708 <title><structname>pg_depend</structname></title>
2710 <indexterm zone="catalog-pg-depend">
2711 <primary>pg_depend</primary>
2715 The catalog <structname>pg_depend</structname> records the dependency
2716 relationships between database objects. This information allows
2717 <command>DROP</> commands to find which other objects must be dropped
2718 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2723 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2724 which performs a similar function for dependencies involving objects
2725 that are shared across a database cluster.
2729 <title><structname>pg_depend</> Columns</title>
2736 <entry>References</entry>
2737 <entry>Description</entry>
2743 <entry><structfield>classid</structfield></entry>
2744 <entry><type>oid</type></entry>
2745 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2746 <entry>The OID of the system catalog the dependent object is in</entry>
2750 <entry><structfield>objid</structfield></entry>
2751 <entry><type>oid</type></entry>
2752 <entry>any OID column</entry>
2753 <entry>The OID of the specific dependent object</entry>
2757 <entry><structfield>objsubid</structfield></entry>
2758 <entry><type>int4</type></entry>
2761 For a table column, this is the column number (the
2762 <structfield>objid</> and <structfield>classid</> refer to the
2763 table itself). For all other object types, this column is
2769 <entry><structfield>refclassid</structfield></entry>
2770 <entry><type>oid</type></entry>
2771 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2772 <entry>The OID of the system catalog the referenced object is in</entry>
2776 <entry><structfield>refobjid</structfield></entry>
2777 <entry><type>oid</type></entry>
2778 <entry>any OID column</entry>
2779 <entry>The OID of the specific referenced object</entry>
2783 <entry><structfield>refobjsubid</structfield></entry>
2784 <entry><type>int4</type></entry>
2787 For a table column, this is the column number (the
2788 <structfield>refobjid</> and <structfield>refclassid</> refer
2789 to the table itself). For all other object types, this column
2795 <entry><structfield>deptype</structfield></entry>
2796 <entry><type>char</type></entry>
2799 A code defining the specific semantics of this dependency relationship; see text
2808 In all cases, a <structname>pg_depend</structname> entry indicates that the
2809 referenced object cannot be dropped without also dropping the dependent
2810 object. However, there are several subflavors identified by
2811 <structfield>deptype</>:
2815 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2818 A normal relationship between separately-created objects. The
2819 dependent object can be dropped without affecting the
2820 referenced object. The referenced object can only be dropped
2821 by specifying <literal>CASCADE</>, in which case the dependent
2822 object is dropped, too. Example: a table column has a normal
2823 dependency on its data type.
2829 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2832 The dependent object can be dropped separately from the
2833 referenced object, and should be automatically dropped
2834 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2835 mode) if the referenced object is dropped. Example: a named
2836 constraint on a table is made autodependent on the table, so
2837 that it will go away if the table is dropped.
2843 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2846 The dependent object was created as part of creation of the
2847 referenced object, and is really just a part of its internal
2848 implementation. A <command>DROP</> of the dependent object
2849 will be disallowed outright (we'll tell the user to issue a
2850 <command>DROP</> against the referenced object, instead). A
2851 <command>DROP</> of the referenced object will be propagated
2852 through to drop the dependent object whether
2853 <command>CASCADE</> is specified or not. Example: a trigger
2854 that's created to enforce a foreign-key constraint is made
2855 internally dependent on the constraint's
2856 <structname>pg_constraint</> entry.
2862 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2865 The dependent object is a member of the <firstterm>extension</> that is
2866 the referenced object (see
2867 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2868 The dependent object can be dropped only via
2869 <command>DROP EXTENSION</> on the referenced object. Functionally
2870 this dependency type acts the same as an internal dependency, but
2871 it's kept separate for clarity and to simplify <application>pg_dump</>.
2877 <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2880 The dependent object is not a member of the extension that is the
2881 referenced object (and so should not be ignored by pg_dump), but
2882 cannot function without it and should be dropped when the
2883 extension itself is. The dependent object may be dropped on its
2890 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2893 There is no dependent object; this type of entry is a signal
2894 that the system itself depends on the referenced object, and so
2895 that object must never be deleted. Entries of this type are
2896 created only by <command>initdb</command>. The columns for the
2897 dependent object contain zeroes.
2903 Other dependency flavors might be needed in future.
2909 <sect1 id="catalog-pg-description">
2910 <title><structname>pg_description</structname></title>
2912 <indexterm zone="catalog-pg-description">
2913 <primary>pg_description</primary>
2917 The catalog <structname>pg_description</> stores optional descriptions
2918 (comments) for each database object. Descriptions can be manipulated
2919 with the <xref linkend="sql-comment"> command and viewed with
2920 <application>psql</application>'s <literal>\d</literal> commands.
2921 Descriptions of many built-in system objects are provided in the initial
2922 contents of <structname>pg_description</structname>.
2926 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2927 which performs a similar function for descriptions involving objects that
2928 are shared across a database cluster.
2932 <title><structname>pg_description</> Columns</title>
2939 <entry>References</entry>
2940 <entry>Description</entry>
2946 <entry><structfield>objoid</structfield></entry>
2947 <entry><type>oid</type></entry>
2948 <entry>any OID column</entry>
2949 <entry>The OID of the object this description pertains to</entry>
2953 <entry><structfield>classoid</structfield></entry>
2954 <entry><type>oid</type></entry>
2955 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2956 <entry>The OID of the system catalog this object appears in</entry>
2960 <entry><structfield>objsubid</structfield></entry>
2961 <entry><type>int4</type></entry>
2964 For a comment on a table column, this is the column number (the
2965 <structfield>objoid</> and <structfield>classoid</> refer to
2966 the table itself). For all other object types, this column is
2972 <entry><structfield>description</structfield></entry>
2973 <entry><type>text</type></entry>
2975 <entry>Arbitrary text that serves as the description of this object</entry>
2984 <sect1 id="catalog-pg-enum">
2985 <title><structname>pg_enum</structname></title>
2987 <indexterm zone="catalog-pg-enum">
2988 <primary>pg_enum</primary>
2992 The <structname>pg_enum</structname> catalog contains entries
2993 showing the values and labels for each enum type. The
2994 internal representation of a given enum value is actually the OID
2995 of its associated row in <structname>pg_enum</structname>.
2999 <title><structname>pg_enum</> Columns</title>
3006 <entry>References</entry>
3007 <entry>Description</entry>
3013 <entry><structfield>oid</structfield></entry>
3014 <entry><type>oid</type></entry>
3016 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3020 <entry><structfield>enumtypid</structfield></entry>
3021 <entry><type>oid</type></entry>
3022 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3023 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3027 <entry><structfield>enumsortorder</structfield></entry>
3028 <entry><type>float4</type></entry>
3030 <entry>The sort position of this enum value within its enum type</entry>
3034 <entry><structfield>enumlabel</structfield></entry>
3035 <entry><type>name</type></entry>
3037 <entry>The textual label for this enum value</entry>
3044 The OIDs for <structname>pg_enum</structname> rows follow a special
3045 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3046 as the sort ordering of their enum type. That is, if two even OIDs
3047 belong to the same enum type, the smaller OID must have the smaller
3048 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3049 need bear no relationship to the sort order. This rule allows the
3050 enum comparison routines to avoid catalog lookups in many common cases.
3051 The routines that create and alter enum types attempt to assign even
3052 OIDs to enum values whenever possible.
3056 When an enum type is created, its members are assigned sort-order
3057 positions 1..<replaceable>n</>. But members added later might be given
3058 negative or fractional values of <structfield>enumsortorder</structfield>.
3059 The only requirement on these values is that they be correctly
3060 ordered and unique within each enum type.
3065 <sect1 id="catalog-pg-event-trigger">
3066 <title><structname>pg_event_trigger</structname></title>
3068 <indexterm zone="catalog-pg-event-trigger">
3069 <primary>pg_event_trigger</primary>
3073 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3074 See <xref linkend="event-triggers"> for more information.
3078 <title><structname>pg_event_trigger</> Columns</title>
3085 <entry>References</entry>
3086 <entry>Description</entry>
3092 <entry><structfield>evtname</structfield></entry>
3093 <entry><type>name</type></entry>
3095 <entry>Trigger name (must be unique)</entry>
3099 <entry><structfield>evtevent</structfield></entry>
3100 <entry><type>name</type></entry>
3102 <entry>Identifies the event for which this trigger fires</entry>
3106 <entry><structfield>evtowner</structfield></entry>
3107 <entry><type>oid</type></entry>
3108 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3109 <entry>Owner of the event trigger</entry>
3113 <entry><structfield>evtfoid</structfield></entry>
3114 <entry><type>oid</type></entry>
3115 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3116 <entry>The function to be called</entry>
3120 <entry><structfield>evtenabled</structfield></entry>
3121 <entry><type>char</type></entry>
3124 Controls in which <xref linkend="guc-session-replication-role"> modes
3125 the event trigger fires.
3126 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3127 <literal>D</> = trigger is disabled,
3128 <literal>R</> = trigger fires in <quote>replica</> mode,
3129 <literal>A</> = trigger fires always.
3134 <entry><structfield>evttags</structfield></entry>
3135 <entry><type>text[]</type></entry>
3138 Command tags for which this trigger will fire. If NULL, the firing
3139 of this trigger is not restricted on the basis of the command tag.
3148 <sect1 id="catalog-pg-extension">
3149 <title><structname>pg_extension</structname></title>
3151 <indexterm zone="catalog-pg-extension">
3152 <primary>pg_extension</primary>
3156 The catalog <structname>pg_extension</structname> stores information
3157 about the installed extensions. See <xref linkend="extend-extensions">
3158 for details about extensions.
3162 <title><structname>pg_extension</> Columns</title>
3169 <entry>References</entry>
3170 <entry>Description</entry>
3176 <entry><structfield>oid</structfield></entry>
3177 <entry><type>oid</type></entry>
3179 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3183 <entry><structfield>extname</structfield></entry>
3184 <entry><type>name</type></entry>
3186 <entry>Name of the extension</entry>
3190 <entry><structfield>extowner</structfield></entry>
3191 <entry><type>oid</type></entry>
3192 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3193 <entry>Owner of the extension</entry>
3197 <entry><structfield>extnamespace</structfield></entry>
3198 <entry><type>oid</type></entry>
3199 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3200 <entry>Schema containing the extension's exported objects</entry>
3204 <entry><structfield>extrelocatable</structfield></entry>
3205 <entry><type>bool</type></entry>
3207 <entry>True if extension can be relocated to another schema</entry>
3211 <entry><structfield>extversion</structfield></entry>
3212 <entry><type>text</type></entry>
3214 <entry>Version name for the extension</entry>
3218 <entry><structfield>extconfig</structfield></entry>
3219 <entry><type>oid[]</type></entry>
3220 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3221 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3222 table(s), or <literal>NULL</> if none</entry>
3226 <entry><structfield>extcondition</structfield></entry>
3227 <entry><type>text[]</type></entry>
3229 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3230 extension's configuration table(s), or <literal>NULL</> if none</entry>
3238 Note that unlike most catalogs with a <quote>namespace</> column,
3239 <structfield>extnamespace</structfield> is not meant to imply
3240 that the extension belongs to that schema. Extension names are never
3241 schema-qualified. Rather, <structfield>extnamespace</structfield>
3242 indicates the schema that contains most or all of the extension's
3243 objects. If <structfield>extrelocatable</structfield> is true, then
3244 this schema must in fact contain all schema-qualifiable objects
3245 belonging to the extension.
3250 <sect1 id="catalog-pg-foreign-data-wrapper">
3251 <title><structname>pg_foreign_data_wrapper</structname></title>
3253 <indexterm zone="catalog-pg-foreign-data-wrapper">
3254 <primary>pg_foreign_data_wrapper</primary>
3258 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3259 foreign-data wrapper definitions. A foreign-data wrapper is the
3260 mechanism by which external data, residing on foreign servers, is
3265 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3272 <entry>References</entry>
3273 <entry>Description</entry>
3279 <entry><structfield>oid</structfield></entry>
3280 <entry><type>oid</type></entry>
3282 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3286 <entry><structfield>fdwname</structfield></entry>
3287 <entry><type>name</type></entry>
3289 <entry>Name of the foreign-data wrapper</entry>
3293 <entry><structfield>fdwowner</structfield></entry>
3294 <entry><type>oid</type></entry>
3295 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3296 <entry>Owner of the foreign-data wrapper</entry>
3300 <entry><structfield>fdwhandler</structfield></entry>
3301 <entry><type>oid</type></entry>
3302 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3304 References a handler function that is responsible for
3305 supplying execution routines for the foreign-data wrapper.
3306 Zero if no handler is provided
3311 <entry><structfield>fdwvalidator</structfield></entry>
3312 <entry><type>oid</type></entry>
3313 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3315 References a validator function that is responsible for
3316 checking the validity of the options given to the
3317 foreign-data wrapper, as well as options for foreign servers and user
3318 mappings using the foreign-data wrapper. Zero if no validator
3324 <entry><structfield>fdwacl</structfield></entry>
3325 <entry><type>aclitem[]</type></entry>
3328 Access privileges; see
3329 <xref linkend="sql-grant"> and
3330 <xref linkend="sql-revoke">
3336 <entry><structfield>fdwoptions</structfield></entry>
3337 <entry><type>text[]</type></entry>
3340 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3349 <sect1 id="catalog-pg-foreign-server">
3350 <title><structname>pg_foreign_server</structname></title>
3352 <indexterm zone="catalog-pg-foreign-server">
3353 <primary>pg_foreign_server</primary>
3357 The catalog <structname>pg_foreign_server</structname> stores
3358 foreign server definitions. A foreign server describes a source
3359 of external data, such as a remote server. Foreign
3360 servers are accessed via foreign-data wrappers.
3364 <title><structname>pg_foreign_server</> Columns</title>
3371 <entry>References</entry>
3372 <entry>Description</entry>
3378 <entry><structfield>oid</structfield></entry>
3379 <entry><type>oid</type></entry>
3381 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3385 <entry><structfield>srvname</structfield></entry>
3386 <entry><type>name</type></entry>
3388 <entry>Name of the foreign server</entry>
3392 <entry><structfield>srvowner</structfield></entry>
3393 <entry><type>oid</type></entry>
3394 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3395 <entry>Owner of the foreign server</entry>
3399 <entry><structfield>srvfdw</structfield></entry>
3400 <entry><type>oid</type></entry>
3401 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3402 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3406 <entry><structfield>srvtype</structfield></entry>
3407 <entry><type>text</type></entry>
3409 <entry>Type of the server (optional)</entry>
3413 <entry><structfield>srvversion</structfield></entry>
3414 <entry><type>text</type></entry>
3416 <entry>Version of the server (optional)</entry>
3420 <entry><structfield>srvacl</structfield></entry>
3421 <entry><type>aclitem[]</type></entry>
3424 Access privileges; see
3425 <xref linkend="sql-grant"> and
3426 <xref linkend="sql-revoke">
3432 <entry><structfield>srvoptions</structfield></entry>
3433 <entry><type>text[]</type></entry>
3436 Foreign server specific options, as <quote>keyword=value</> strings
3445 <sect1 id="catalog-pg-foreign-table">
3446 <title><structname>pg_foreign_table</structname></title>
3448 <indexterm zone="catalog-pg-foreign-table">
3449 <primary>pg_foreign_table</primary>
3453 The catalog <structname>pg_foreign_table</structname> contains
3454 auxiliary information about foreign tables. A foreign table is
3455 primarily represented by a <structname>pg_class</structname> entry,
3456 just like a regular table. Its <structname>pg_foreign_table</structname>
3457 entry contains the information that is pertinent only to foreign tables
3458 and not any other kind of relation.
3462 <title><structname>pg_foreign_table</> Columns</title>
3469 <entry>References</entry>
3470 <entry>Description</entry>
3476 <entry><structfield>ftrelid</structfield></entry>
3477 <entry><type>oid</type></entry>
3478 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3479 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3483 <entry><structfield>ftserver</structfield></entry>
3484 <entry><type>oid</type></entry>
3485 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3486 <entry>OID of the foreign server for this foreign table</entry>
3490 <entry><structfield>ftoptions</structfield></entry>
3491 <entry><type>text[]</type></entry>
3494 Foreign table options, as <quote>keyword=value</> strings
3503 <sect1 id="catalog-pg-index">
3504 <title><structname>pg_index</structname></title>
3506 <indexterm zone="catalog-pg-index">
3507 <primary>pg_index</primary>
3511 The catalog <structname>pg_index</structname> contains part of the information
3512 about indexes. The rest is mostly in
3513 <structname>pg_class</structname>.
3517 <title><structname>pg_index</> Columns</title>
3524 <entry>References</entry>
3525 <entry>Description</entry>
3531 <entry><structfield>indexrelid</structfield></entry>
3532 <entry><type>oid</type></entry>
3533 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3534 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3538 <entry><structfield>indrelid</structfield></entry>
3539 <entry><type>oid</type></entry>
3540 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3541 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3545 <entry><structfield>indnatts</structfield></entry>
3546 <entry><type>int2</type></entry>
3548 <entry>The number of columns in the index (duplicates
3549 <literal>pg_class.relnatts</literal>)</entry>
3553 <entry><structfield>indisunique</structfield></entry>
3554 <entry><type>bool</type></entry>
3556 <entry>If true, this is a unique index</entry>
3560 <entry><structfield>indisprimary</structfield></entry>
3561 <entry><type>bool</type></entry>
3563 <entry>If true, this index represents the primary key of the table
3564 (<structfield>indisunique</> should always be true when this is true)</entry>
3568 <entry><structfield>indisexclusion</structfield></entry>
3569 <entry><type>bool</type></entry>
3571 <entry>If true, this index supports an exclusion constraint</entry>
3575 <entry><structfield>indimmediate</structfield></entry>
3576 <entry><type>bool</type></entry>
3578 <entry>If true, the uniqueness check is enforced immediately on
3580 (irrelevant if <structfield>indisunique</> is not true)</entry>
3584 <entry><structfield>indisclustered</structfield></entry>
3585 <entry><type>bool</type></entry>
3587 <entry>If true, the table was last clustered on this index</entry>
3591 <entry><structfield>indisvalid</structfield></entry>
3592 <entry><type>bool</type></entry>
3595 If true, the index is currently valid for queries. False means the
3596 index is possibly incomplete: it must still be modified by
3597 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3598 be used for queries. If it is unique, the uniqueness property is not
3599 guaranteed true either.
3604 <entry><structfield>indcheckxmin</structfield></entry>
3605 <entry><type>bool</type></entry>
3608 If true, queries must not use the index until the <structfield>xmin</>
3609 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3610 event horizon, because the table may contain broken HOT chains with
3611 incompatible rows that they can see
3616 <entry><structfield>indisready</structfield></entry>
3617 <entry><type>bool</type></entry>
3620 If true, the index is currently ready for inserts. False means the
3621 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3627 <entry><structfield>indislive</structfield></entry>
3628 <entry><type>bool</type></entry>
3631 If false, the index is in process of being dropped, and should be
3632 ignored for all purposes (including HOT-safety decisions)
3637 <entry><structfield>indisreplident</structfield></entry>
3638 <entry><type>bool</type></entry>
3641 If true this index has been chosen as <quote>replica identity</>
3642 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3648 <entry><structfield>indkey</structfield></entry>
3649 <entry><type>int2vector</type></entry>
3650 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3652 This is an array of <structfield>indnatts</structfield> values that
3653 indicate which table columns this index indexes. For example a value
3654 of <literal>1 3</literal> would mean that the first and the third table
3655 columns make up the index key. A zero in this array indicates that the
3656 corresponding index attribute is an expression over the table columns,
3657 rather than a simple column reference.
3662 <entry><structfield>indcollation</structfield></entry>
3663 <entry><type>oidvector</type></entry>
3664 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3666 For each column in the index key, this contains the OID of the
3667 collation to use for the index.
3672 <entry><structfield>indclass</structfield></entry>
3673 <entry><type>oidvector</type></entry>
3674 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3676 For each column in the index key, this contains the OID of
3677 the operator class to use. See
3678 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3683 <entry><structfield>indoption</structfield></entry>
3684 <entry><type>int2vector</type></entry>
3687 This is an array of <structfield>indnatts</structfield> values that
3688 store per-column flag bits. The meaning of the bits is defined by
3689 the index's access method.
3694 <entry><structfield>indexprs</structfield></entry>
3695 <entry><type>pg_node_tree</type></entry>
3698 Expression trees (in <function>nodeToString()</function>
3699 representation) for index attributes that are not simple column
3700 references. This is a list with one element for each zero
3701 entry in <structfield>indkey</>. Null if all index attributes
3702 are simple references.
3707 <entry><structfield>indpred</structfield></entry>
3708 <entry><type>pg_node_tree</type></entry>
3711 Expression tree (in <function>nodeToString()</function>
3712 representation) for partial index predicate. Null if not a
3723 <sect1 id="catalog-pg-inherits">
3724 <title><structname>pg_inherits</structname></title>
3726 <indexterm zone="catalog-pg-inherits">
3727 <primary>pg_inherits</primary>
3731 The catalog <structname>pg_inherits</> records information about
3732 table inheritance hierarchies. There is one entry for each direct
3733 child table in the database. (Indirect inheritance can be determined
3734 by following chains of entries.)
3738 <title><structname>pg_inherits</> Columns</title>
3745 <entry>References</entry>
3746 <entry>Description</entry>
3752 <entry><structfield>inhrelid</structfield></entry>
3753 <entry><type>oid</type></entry>
3754 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3756 The OID of the child table
3761 <entry><structfield>inhparent</structfield></entry>
3762 <entry><type>oid</type></entry>
3763 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3765 The OID of the parent table
3770 <entry><structfield>inhseqno</structfield></entry>
3771 <entry><type>int4</type></entry>
3774 If there is more than one direct parent for a child table (multiple
3775 inheritance), this number tells the order in which the
3776 inherited columns are to be arranged. The count starts at 1.
3785 <sect1 id="catalog-pg-init-privs">
3786 <title><structname>pg_init_privs</structname></title>
3788 <indexterm zone="catalog-pg-init-privs">
3789 <primary>pg_init_privs</primary>
3793 The catalog <structname>pg_init_privs</> records information about
3794 the initial privileges of objects in the system. There is one entry
3795 for each object in the database which has a non-default (non-NULL)
3796 initial set of privileges.
3800 Objects can have initial privileges either by having those privileges set
3801 when the system is initialized (by <application>initdb</>) or when the
3802 object is created during a <command>CREATE EXTENSION</command> and the
3803 extension script sets initial privileges using the <command>GRANT</command>
3804 system. Note that the system will automatically handle recording of the
3805 privileges during the extension script and that extension authors need
3806 only use the <command>GRANT</command> and <command>REVOKE</command>
3807 statements in their script to have the privileges recorded. The
3808 <literal>privtype</literal> column indicates if the initial privilege was
3809 set by <application>initdb</> or during a
3810 <command>CREATE EXTENSION</command> command.
3814 Objects which have initial privileges set by <application>initdb</> will
3815 have entries where <literal>privtype</literal> is
3816 <literal>'i'</literal>, while objects which have initial privileges set
3817 by <command>CREATE EXTENSION</command> will have entries where
3818 <literal>privtype</literal> is <literal>'e'</literal>.
3822 <title><structname>pg_init_privs</> Columns</title>
3829 <entry>References</entry>
3830 <entry>Description</entry>
3836 <entry><structfield>objoid</structfield></entry>
3837 <entry><type>oid</type></entry>
3838 <entry>any OID column</entry>
3839 <entry>The OID of the specific object</entry>
3843 <entry><structfield>classoid</structfield></entry>
3844 <entry><type>oid</type></entry>
3845 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3846 <entry>The OID of the system catalog the object is in</entry>
3850 <entry><structfield>objsubid</structfield></entry>
3851 <entry><type>int4</type></entry>
3854 For a table column, this is the column number (the
3855 <structfield>objoid</> and <structfield>classoid</> refer to the
3856 table itself). For all other object types, this column is
3862 <entry><structfield>privtype</structfield></entry>
3863 <entry><type>char</type></entry>
3866 A code defining the type of initial privilege of this object; see text
3871 <entry><structfield>initprivs</structfield></entry>
3872 <entry><type>aclitem[]</type></entry>
3875 The initial access privileges; see
3876 <xref linkend="sql-grant"> and
3877 <xref linkend="sql-revoke">
3889 <sect1 id="catalog-pg-language">
3890 <title><structname>pg_language</structname></title>
3892 <indexterm zone="catalog-pg-language">
3893 <primary>pg_language</primary>
3897 The catalog <structname>pg_language</structname> registers
3898 languages in which you can write functions or stored procedures.
3899 See <xref linkend="sql-createlanguage">
3900 and <xref linkend="xplang"> for more information about language handlers.
3904 <title><structname>pg_language</> Columns</title>
3911 <entry>References</entry>
3912 <entry>Description</entry>
3918 <entry><structfield>oid</structfield></entry>
3919 <entry><type>oid</type></entry>
3921 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3925 <entry><structfield>lanname</structfield></entry>
3926 <entry><type>name</type></entry>
3928 <entry>Name of the language</entry>
3932 <entry><structfield>lanowner</structfield></entry>
3933 <entry><type>oid</type></entry>
3934 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3935 <entry>Owner of the language</entry>
3939 <entry><structfield>lanispl</structfield></entry>
3940 <entry><type>bool</type></entry>
3943 This is false for internal languages (such as
3944 <acronym>SQL</acronym>) and true for user-defined languages.
3945 Currently, <application>pg_dump</application> still uses this
3946 to determine which languages need to be dumped, but this might be
3947 replaced by a different mechanism in the future.
3952 <entry><structfield>lanpltrusted</structfield></entry>
3953 <entry><type>bool</type></entry>
3956 True if this is a trusted language, which means that it is believed
3957 not to grant access to anything outside the normal SQL execution
3958 environment. Only superusers can create functions in untrusted
3964 <entry><structfield>lanplcallfoid</structfield></entry>
3965 <entry><type>oid</type></entry>
3966 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3968 For noninternal languages this references the language
3969 handler, which is a special function that is responsible for
3970 executing all functions that are written in the particular
3976 <entry><structfield>laninline</structfield></entry>
3977 <entry><type>oid</type></entry>
3978 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3980 This references a function that is responsible for executing
3981 <quote>inline</> anonymous code blocks
3982 (<xref linkend="sql-do"> blocks).
3983 Zero if inline blocks are not supported.
3988 <entry><structfield>lanvalidator</structfield></entry>
3989 <entry><type>oid</type></entry>
3990 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3992 This references a language validator function that is responsible
3993 for checking the syntax and validity of new functions when they
3994 are created. Zero if no validator is provided.
3999 <entry><structfield>lanacl</structfield></entry>
4000 <entry><type>aclitem[]</type></entry>
4003 Access privileges; see
4004 <xref linkend="sql-grant"> and
4005 <xref linkend="sql-revoke">
4016 <sect1 id="catalog-pg-largeobject">
4017 <title><structname>pg_largeobject</structname></title>
4019 <indexterm zone="catalog-pg-largeobject">
4020 <primary>pg_largeobject</primary>
4024 The catalog <structname>pg_largeobject</structname> holds the data making up
4025 <quote>large objects</quote>. A large object is identified by an OID
4026 assigned when it is created. Each large object is broken into
4027 segments or <quote>pages</> small enough to be conveniently stored as rows
4028 in <structname>pg_largeobject</structname>.
4029 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4030 <literal>BLCKSZ/4</>, or typically 2 kB).
4034 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4035 associated with large objects. As a result,
4036 <structname>pg_largeobject</structname> was publicly readable and could be
4037 used to obtain the OIDs (and contents) of all large objects in the system.
4038 This is no longer the case; use
4039 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4040 to obtain a list of large object OIDs.
4044 <title><structname>pg_largeobject</> Columns</title>
4051 <entry>References</entry>
4052 <entry>Description</entry>
4058 <entry><structfield>loid</structfield></entry>
4059 <entry><type>oid</type></entry>
4060 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4061 <entry>Identifier of the large object that includes this page</entry>
4065 <entry><structfield>pageno</structfield></entry>
4066 <entry><type>int4</type></entry>
4068 <entry>Page number of this page within its large object
4069 (counting from zero)</entry>
4073 <entry><structfield>data</structfield></entry>
4074 <entry><type>bytea</type></entry>
4077 Actual data stored in the large object.
4078 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4086 Each row of <structname>pg_largeobject</structname> holds data
4087 for one page of a large object, beginning at
4088 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4089 allows sparse storage: pages might be missing, and might be shorter than
4090 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4091 Missing regions within a large object read as zeroes.
4096 <sect1 id="catalog-pg-largeobject-metadata">
4097 <title><structname>pg_largeobject_metadata</structname></title>
4099 <indexterm zone="catalog-pg-largeobject-metadata">
4100 <primary>pg_largeobject_metadata</primary>
4104 The catalog <structname>pg_largeobject_metadata</structname>
4105 holds metadata associated with large objects. The actual large object
4107 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4111 <title><structname>pg_largeobject_metadata</> Columns</title>
4118 <entry>References</entry>
4119 <entry>Description</entry>
4125 <entry><structfield>oid</structfield></entry>
4126 <entry><type>oid</type></entry>
4128 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4132 <entry><structfield>lomowner</structfield></entry>
4133 <entry><type>oid</type></entry>
4134 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4135 <entry>Owner of the large object</entry>
4139 <entry><structfield>lomacl</structfield></entry>
4140 <entry><type>aclitem[]</type></entry>
4143 Access privileges; see
4144 <xref linkend="sql-grant"> and
4145 <xref linkend="sql-revoke">
4155 <sect1 id="catalog-pg-namespace">
4156 <title><structname>pg_namespace</structname></title>
4158 <indexterm zone="catalog-pg-namespace">
4159 <primary>pg_namespace</primary>
4163 The catalog <structname>pg_namespace</> stores namespaces.
4164 A namespace is the structure underlying SQL schemas: each namespace
4165 can have a separate collection of relations, types, etc. without name
4170 <title><structname>pg_namespace</> Columns</title>
4177 <entry>References</entry>
4178 <entry>Description</entry>
4184 <entry><structfield>oid</structfield></entry>
4185 <entry><type>oid</type></entry>
4187 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4191 <entry><structfield>nspname</structfield></entry>
4192 <entry><type>name</type></entry>
4194 <entry>Name of the namespace</entry>
4198 <entry><structfield>nspowner</structfield></entry>
4199 <entry><type>oid</type></entry>
4200 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4201 <entry>Owner of the namespace</entry>
4205 <entry><structfield>nspacl</structfield></entry>
4206 <entry><type>aclitem[]</type></entry>
4209 Access privileges; see
4210 <xref linkend="sql-grant"> and
4211 <xref linkend="sql-revoke">
4222 <sect1 id="catalog-pg-opclass">
4223 <title><structname>pg_opclass</structname></title>
4225 <indexterm zone="catalog-pg-opclass">
4226 <primary>pg_opclass</primary>
4230 The catalog <structname>pg_opclass</structname> defines
4231 index access method operator classes. Each operator class defines
4232 semantics for index columns of a particular data type and a particular
4233 index access method. An operator class essentially specifies that a
4234 particular operator family is applicable to a particular indexable column
4235 data type. The set of operators from the family that are actually usable
4236 with the indexed column are whichever ones accept the column's data type
4237 as their left-hand input.
4241 Operator classes are described at length in <xref linkend="xindex">.
4245 <title><structname>pg_opclass</> Columns</title>
4252 <entry>References</entry>
4253 <entry>Description</entry>
4259 <entry><structfield>oid</structfield></entry>
4260 <entry><type>oid</type></entry>
4262 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4266 <entry><structfield>opcmethod</structfield></entry>
4267 <entry><type>oid</type></entry>
4268 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4269 <entry>Index access method operator class is for</entry>
4273 <entry><structfield>opcname</structfield></entry>
4274 <entry><type>name</type></entry>
4276 <entry>Name of this operator class</entry>
4280 <entry><structfield>opcnamespace</structfield></entry>
4281 <entry><type>oid</type></entry>
4282 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4283 <entry>Namespace of this operator class</entry>
4287 <entry><structfield>opcowner</structfield></entry>
4288 <entry><type>oid</type></entry>
4289 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4290 <entry>Owner of the operator class</entry>
4294 <entry><structfield>opcfamily</structfield></entry>
4295 <entry><type>oid</type></entry>
4296 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4297 <entry>Operator family containing the operator class</entry>
4301 <entry><structfield>opcintype</structfield></entry>
4302 <entry><type>oid</type></entry>
4303 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4304 <entry>Data type that the operator class indexes</entry>
4308 <entry><structfield>opcdefault</structfield></entry>
4309 <entry><type>bool</type></entry>
4311 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4315 <entry><structfield>opckeytype</structfield></entry>
4316 <entry><type>oid</type></entry>
4317 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4318 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4326 An operator class's <structfield>opcmethod</> must match the
4327 <structname>opfmethod</> of its containing operator family.
4328 Also, there must be no more than one <structname>pg_opclass</structname>
4329 row having <structname>opcdefault</> true for any given combination of
4330 <structname>opcmethod</> and <structname>opcintype</>.
4336 <sect1 id="catalog-pg-operator">
4337 <title><structname>pg_operator</structname></title>
4339 <indexterm zone="catalog-pg-operator">
4340 <primary>pg_operator</primary>
4344 The catalog <structname>pg_operator</> stores information about operators.
4345 See <xref linkend="sql-createoperator">
4346 and <xref linkend="xoper"> for more information.
4350 <title><structname>pg_operator</> Columns</title>
4357 <entry>References</entry>
4358 <entry>Description</entry>
4364 <entry><structfield>oid</structfield></entry>
4365 <entry><type>oid</type></entry>
4367 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4371 <entry><structfield>oprname</structfield></entry>
4372 <entry><type>name</type></entry>
4374 <entry>Name of the operator</entry>
4378 <entry><structfield>oprnamespace</structfield></entry>
4379 <entry><type>oid</type></entry>
4380 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4382 The OID of the namespace that contains this operator
4387 <entry><structfield>oprowner</structfield></entry>
4388 <entry><type>oid</type></entry>
4389 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4390 <entry>Owner of the operator</entry>
4394 <entry><structfield>oprkind</structfield></entry>
4395 <entry><type>char</type></entry>
4398 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4399 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4404 <entry><structfield>oprcanmerge</structfield></entry>
4405 <entry><type>bool</type></entry>
4407 <entry>This operator supports merge joins</entry>
4411 <entry><structfield>oprcanhash</structfield></entry>
4412 <entry><type>bool</type></entry>
4414 <entry>This operator supports hash joins</entry>
4418 <entry><structfield>oprleft</structfield></entry>
4419 <entry><type>oid</type></entry>
4420 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4421 <entry>Type of the left operand</entry>
4425 <entry><structfield>oprright</structfield></entry>
4426 <entry><type>oid</type></entry>
4427 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4428 <entry>Type of the right operand</entry>
4432 <entry><structfield>oprresult</structfield></entry>
4433 <entry><type>oid</type></entry>
4434 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4435 <entry>Type of the result</entry>
4439 <entry><structfield>oprcom</structfield></entry>
4440 <entry><type>oid</type></entry>
4441 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4442 <entry>Commutator of this operator, if any</entry>
4446 <entry><structfield>oprnegate</structfield></entry>
4447 <entry><type>oid</type></entry>
4448 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4449 <entry>Negator of this operator, if any</entry>
4453 <entry><structfield>oprcode</structfield></entry>
4454 <entry><type>regproc</type></entry>
4455 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4456 <entry>Function that implements this operator</entry>
4460 <entry><structfield>oprrest</structfield></entry>
4461 <entry><type>regproc</type></entry>
4462 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4463 <entry>Restriction selectivity estimation function for this operator</entry>
4467 <entry><structfield>oprjoin</structfield></entry>
4468 <entry><type>regproc</type></entry>
4469 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4470 <entry>Join selectivity estimation function for this operator</entry>
4477 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4478 is zero for a prefix operator.
4484 <sect1 id="catalog-pg-opfamily">
4485 <title><structname>pg_opfamily</structname></title>
4487 <indexterm zone="catalog-pg-opfamily">
4488 <primary>pg_opfamily</primary>
4492 The catalog <structname>pg_opfamily</structname> defines operator families.
4493 Each operator family is a collection of operators and associated
4494 support routines that implement the semantics specified for a particular
4495 index access method. Furthermore, the operators in a family are all
4496 <quote>compatible</>, in a way that is specified by the access method.
4497 The operator family concept allows cross-data-type operators to be used
4498 with indexes and to be reasoned about using knowledge of access method
4503 Operator families are described at length in <xref linkend="xindex">.
4507 <title><structname>pg_opfamily</> Columns</title>
4514 <entry>References</entry>
4515 <entry>Description</entry>
4521 <entry><structfield>oid</structfield></entry>
4522 <entry><type>oid</type></entry>
4524 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4528 <entry><structfield>opfmethod</structfield></entry>
4529 <entry><type>oid</type></entry>
4530 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4531 <entry>Index access method operator family is for</entry>
4535 <entry><structfield>opfname</structfield></entry>
4536 <entry><type>name</type></entry>
4538 <entry>Name of this operator family</entry>
4542 <entry><structfield>opfnamespace</structfield></entry>
4543 <entry><type>oid</type></entry>
4544 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4545 <entry>Namespace of this operator family</entry>
4549 <entry><structfield>opfowner</structfield></entry>
4550 <entry><type>oid</type></entry>
4551 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4552 <entry>Owner of the operator family</entry>
4560 The majority of the information defining an operator family is not in its
4561 <structname>pg_opfamily</structname> row, but in the associated rows in
4562 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4563 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4565 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4571 <sect1 id="catalog-pg-pltemplate">
4572 <title><structname>pg_pltemplate</structname></title>
4574 <indexterm zone="catalog-pg-pltemplate">
4575 <primary>pg_pltemplate</primary>
4579 The catalog <structname>pg_pltemplate</structname> stores
4580 <quote>template</> information for procedural languages.
4581 A template for a language allows the language to be created in a
4582 particular database by a simple <command>CREATE LANGUAGE</> command,
4583 with no need to specify implementation details.
4587 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4588 is shared across all databases of a cluster: there is only one
4589 copy of <structname>pg_pltemplate</structname> per cluster, not
4590 one per database. This allows the information to be accessible in
4591 each database as it is needed.
4595 <title><structname>pg_pltemplate</> Columns</title>
4602 <entry>Description</entry>
4608 <entry><structfield>tmplname</structfield></entry>
4609 <entry><type>name</type></entry>
4610 <entry>Name of the language this template is for</entry>
4614 <entry><structfield>tmpltrusted</structfield></entry>
4615 <entry><type>boolean</type></entry>
4616 <entry>True if language is considered trusted</entry>
4620 <entry><structfield>tmpldbacreate</structfield></entry>
4621 <entry><type>boolean</type></entry>
4622 <entry>True if language may be created by a database owner</entry>
4626 <entry><structfield>tmplhandler</structfield></entry>
4627 <entry><type>text</type></entry>
4628 <entry>Name of call handler function</entry>
4632 <entry><structfield>tmplinline</structfield></entry>
4633 <entry><type>text</type></entry>
4634 <entry>Name of anonymous-block handler function, or null if none</entry>
4638 <entry><structfield>tmplvalidator</structfield></entry>
4639 <entry><type>text</type></entry>
4640 <entry>Name of validator function, or null if none</entry>
4644 <entry><structfield>tmpllibrary</structfield></entry>
4645 <entry><type>text</type></entry>
4646 <entry>Path of shared library that implements language</entry>
4650 <entry><structfield>tmplacl</structfield></entry>
4651 <entry><type>aclitem[]</type></entry>
4652 <entry>Access privileges for template (not actually used)</entry>
4660 There are not currently any commands that manipulate procedural language
4661 templates; to change the built-in information, a superuser must modify
4662 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4663 or <command>UPDATE</command> commands.
4668 It is likely that <structname>pg_pltemplate</> will be removed in some
4669 future release of <productname>PostgreSQL</productname>, in favor of
4670 keeping this knowledge about procedural languages in their respective
4671 extension installation scripts.
4677 <sect1 id="catalog-pg-policy">
4678 <title><structname>pg_policy</structname></title>
4680 <indexterm zone="catalog-pg-policy">
4681 <primary>pg_policy</primary>
4685 The catalog <structname>pg_policy</structname> stores row level
4686 security policies for tables. A policy includes the kind of
4687 command that it applies to (possibly all commands), the roles that it
4688 applies to, the expression to be added as a security-barrier
4689 qualification to queries that include the table, and the expression
4690 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4691 add new records to the table.
4696 <title><structname>pg_policy</structname> Columns</title>
4703 <entry>References</entry>
4704 <entry>Description</entry>
4710 <entry><structfield>polname</structfield></entry>
4711 <entry><type>name</type></entry>
4713 <entry>The name of the policy</entry>
4717 <entry><structfield>polrelid</structfield></entry>
4718 <entry><type>oid</type></entry>
4719 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4720 <entry>The table to which the policy applies</entry>
4724 <entry><structfield>polcmd</structfield></entry>
4725 <entry><type>char</type></entry>
4727 <entry>The command type to which the policy is applied:
4728 <literal>r</> for <command>SELECT</>,
4729 <literal>a</> for <command>INSERT</>,
4730 <literal>w</> for <command>UPDATE</>,
4731 <literal>d</> for <command>DELETE</>,
4732 or <literal>*</> for all</entry>
4736 <entry><structfield>polroles</structfield></entry>
4737 <entry><type>oid[]</type></entry>
4738 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4739 <entry>The roles to which the policy is applied</entry>
4743 <entry><structfield>polqual</structfield></entry>
4744 <entry><type>pg_node_tree</type></entry>
4746 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4750 <entry><structfield>polwithcheck</structfield></entry>
4751 <entry><type>pg_node_tree</type></entry>
4753 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4762 Policies stored in <structname>pg_policy</> are applied only when
4763 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4770 <sect1 id="catalog-pg-proc">
4771 <title><structname>pg_proc</structname></title>
4773 <indexterm zone="catalog-pg-proc">
4774 <primary>pg_proc</primary>
4778 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4779 See <xref linkend="sql-createfunction">
4780 and <xref linkend="xfunc"> for more information.
4784 The table contains data for aggregate functions as well as plain functions.
4785 If <structfield>proisagg</structfield> is true, there should be a matching
4786 row in <structfield>pg_aggregate</structfield>.
4790 <title><structname>pg_proc</> Columns</title>
4797 <entry>References</entry>
4798 <entry>Description</entry>
4804 <entry><structfield>oid</structfield></entry>
4805 <entry><type>oid</type></entry>
4807 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4811 <entry><structfield>proname</structfield></entry>
4812 <entry><type>name</type></entry>
4814 <entry>Name of the function</entry>
4818 <entry><structfield>pronamespace</structfield></entry>
4819 <entry><type>oid</type></entry>
4820 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4822 The OID of the namespace that contains this function
4827 <entry><structfield>proowner</structfield></entry>
4828 <entry><type>oid</type></entry>
4829 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4830 <entry>Owner of the function</entry>
4834 <entry><structfield>prolang</structfield></entry>
4835 <entry><type>oid</type></entry>
4836 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4837 <entry>Implementation language or call interface of this function</entry>
4841 <entry><structfield>procost</structfield></entry>
4842 <entry><type>float4</type></entry>
4844 <entry>Estimated execution cost (in units of
4845 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4846 this is cost per row returned</entry>
4850 <entry><structfield>prorows</structfield></entry>
4851 <entry><type>float4</type></entry>
4853 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4857 <entry><structfield>provariadic</structfield></entry>
4858 <entry><type>oid</type></entry>
4859 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4860 <entry>Data type of the variadic array parameter's elements,
4861 or zero if the function does not have a variadic parameter</entry>
4865 <entry><structfield>protransform</structfield></entry>
4866 <entry><type>regproc</type></entry>
4867 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4868 <entry>Calls to this function can be simplified by this other function
4869 (see <xref linkend="xfunc-transform-functions">)</entry>
4873 <entry><structfield>proisagg</structfield></entry>
4874 <entry><type>bool</type></entry>
4876 <entry>Function is an aggregate function</entry>
4880 <entry><structfield>proiswindow</structfield></entry>
4881 <entry><type>bool</type></entry>
4883 <entry>Function is a window function</entry>
4887 <entry><structfield>prosecdef</structfield></entry>
4888 <entry><type>bool</type></entry>
4890 <entry>Function is a security definer (i.e., a <quote>setuid</>
4895 <entry><structfield>proleakproof</structfield></entry>
4896 <entry><type>bool</type></entry>
4899 The function has no side effects. No information about the
4900 arguments is conveyed except via the return value. Any function
4901 that might throw an error depending on the values of its arguments
4907 <entry><structfield>proisstrict</structfield></entry>
4908 <entry><type>bool</type></entry>
4911 Function returns null if any call argument is null. In that
4912 case the function won't actually be called at all. Functions
4913 that are not <quote>strict</quote> must be prepared to handle
4919 <entry><structfield>proretset</structfield></entry>
4920 <entry><type>bool</type></entry>
4922 <entry>Function returns a set (i.e., multiple values of the specified
4927 <entry><structfield>provolatile</structfield></entry>
4928 <entry><type>char</type></entry>
4931 <structfield>provolatile</structfield> tells whether the function's
4932 result depends only on its input arguments, or is affected by outside
4934 It is <literal>i</literal> for <quote>immutable</> functions,
4935 which always deliver the same result for the same inputs.
4936 It is <literal>s</literal> for <quote>stable</> functions,
4937 whose results (for fixed inputs) do not change within a scan.
4938 It is <literal>v</literal> for <quote>volatile</> functions,
4939 whose results might change at any time. (Use <literal>v</literal> also
4940 for functions with side-effects, so that calls to them cannot get
4946 <entry><structfield>proparallel</structfield></entry>
4947 <entry><type>char</type></entry>
4950 <structfield>proparallel</structfield> tells whether the function
4951 can be safely run in parallel mode.
4952 It is <literal>s</literal> for functions which are safe to run in
4953 parallel mode without restriction.
4954 It is <literal>r</literal> for functions which can be run in parallel
4955 mode, but their execution is restricted to the parallel group leader;
4956 parallel worker processes cannot invoke these functions.
4957 It is <literal>u</literal> for functions which are unsafe in parallel
4958 mode; the presence of such a function forces a serial execution plan.
4963 <entry><structfield>pronargs</structfield></entry>
4964 <entry><type>int2</type></entry>
4966 <entry>Number of input arguments</entry>
4970 <entry><structfield>pronargdefaults</structfield></entry>
4971 <entry><type>int2</type></entry>
4973 <entry>Number of arguments that have defaults</entry>
4977 <entry><structfield>prorettype</structfield></entry>
4978 <entry><type>oid</type></entry>
4979 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4980 <entry>Data type of the return value</entry>
4984 <entry><structfield>proargtypes</structfield></entry>
4985 <entry><type>oidvector</type></entry>
4986 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4988 An array with the data types of the function arguments. This includes
4989 only input arguments (including <literal>INOUT</literal> and
4990 <literal>VARIADIC</> arguments), and thus represents
4991 the call signature of the function.
4996 <entry><structfield>proallargtypes</structfield></entry>
4997 <entry><type>oid[]</type></entry>
4998 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5000 An array with the data types of the function arguments. This includes
5001 all arguments (including <literal>OUT</literal> and
5002 <literal>INOUT</literal> arguments); however, if all the
5003 arguments are <literal>IN</literal> arguments, this field will be null.
5004 Note that subscripting is 1-based, whereas for historical reasons
5005 <structfield>proargtypes</> is subscripted from 0.
5010 <entry><structfield>proargmodes</structfield></entry>
5011 <entry><type>char[]</type></entry>
5014 An array with the modes of the function arguments, encoded as
5015 <literal>i</literal> for <literal>IN</> arguments,
5016 <literal>o</literal> for <literal>OUT</> arguments,
5017 <literal>b</literal> for <literal>INOUT</> arguments,
5018 <literal>v</literal> for <literal>VARIADIC</> arguments,
5019 <literal>t</literal> for <literal>TABLE</> arguments.
5020 If all the arguments are <literal>IN</literal> arguments,
5021 this field will be null.
5022 Note that subscripts correspond to positions of
5023 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5028 <entry><structfield>proargnames</structfield></entry>
5029 <entry><type>text[]</type></entry>
5032 An array with the names of the function arguments.
5033 Arguments without a name are set to empty strings in the array.
5034 If none of the arguments have a name, this field will be null.
5035 Note that subscripts correspond to positions of
5036 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5041 <entry><structfield>proargdefaults</structfield></entry>
5042 <entry><type>pg_node_tree</type></entry>
5045 Expression trees (in <function>nodeToString()</function> representation)
5046 for default values. This is a list with
5047 <structfield>pronargdefaults</> elements, corresponding to the last
5048 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5049 <replaceable>N</> <structfield>proargtypes</> positions).
5050 If none of the arguments have defaults, this field will be null.
5055 <entry><structfield>protrftypes</structfield></entry>
5056 <entry><type>oid[]</type></entry>
5059 Data type OIDs for which to apply transforms.
5064 <entry><structfield>prosrc</structfield></entry>
5065 <entry><type>text</type></entry>
5068 This tells the function handler how to invoke the function. It
5069 might be the actual source code of the function for interpreted
5070 languages, a link symbol, a file name, or just about anything
5071 else, depending on the implementation language/call convention.
5076 <entry><structfield>probin</structfield></entry>
5077 <entry><type>text</type></entry>
5080 Additional information about how to invoke the function.
5081 Again, the interpretation is language-specific.
5086 <entry><structfield>proconfig</structfield></entry>
5087 <entry><type>text[]</type></entry>
5089 <entry>Function's local settings for run-time configuration variables</entry>
5093 <entry><structfield>proacl</structfield></entry>
5094 <entry><type>aclitem[]</type></entry>
5097 Access privileges; see
5098 <xref linkend="sql-grant"> and
5099 <xref linkend="sql-revoke">
5108 For compiled functions, both built-in and dynamically loaded,
5109 <structfield>prosrc</structfield> contains the function's C-language
5110 name (link symbol). For all other currently-known language types,
5111 <structfield>prosrc</structfield> contains the function's source
5112 text. <structfield>probin</structfield> is unused except for
5113 dynamically-loaded C functions, for which it gives the name of the
5114 shared library file containing the function.
5119 <sect1 id="catalog-pg-range">
5120 <title><structname>pg_range</structname></title>
5122 <indexterm zone="catalog-pg-range">
5123 <primary>pg_range</primary>
5127 The catalog <structname>pg_range</structname> stores information about
5128 range types. This is in addition to the types' entries in
5129 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5133 <title><structname>pg_range</> Columns</title>
5140 <entry>References</entry>
5141 <entry>Description</entry>
5147 <entry><structfield>rngtypid</structfield></entry>
5148 <entry><type>oid</type></entry>
5149 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5150 <entry>OID of the range type</entry>
5154 <entry><structfield>rngsubtype</structfield></entry>
5155 <entry><type>oid</type></entry>
5156 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5157 <entry>OID of the element type (subtype) of this range type</entry>
5161 <entry><structfield>rngcollation</structfield></entry>
5162 <entry><type>oid</type></entry>
5163 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5164 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5168 <entry><structfield>rngsubopc</structfield></entry>
5169 <entry><type>oid</type></entry>
5170 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5171 <entry>OID of the subtype's operator class used for range comparisons</entry>
5175 <entry><structfield>rngcanonical</structfield></entry>
5176 <entry><type>regproc</type></entry>
5177 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5178 <entry>OID of the function to convert a range value into canonical form,
5179 or 0 if none</entry>
5183 <entry><structfield>rngsubdiff</structfield></entry>
5184 <entry><type>regproc</type></entry>
5185 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5186 <entry>OID of the function to return the difference between two element
5187 values as <type>double precision</type>, or 0 if none</entry>
5194 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5195 element type is collatable) determines the sort ordering used by the range
5196 type. <structfield>rngcanonical</> is used when the element type is
5197 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5198 improve performance of GiST indexes on the range type.
5203 <sect1 id="catalog-pg-replication-origin">
5204 <title><structname>pg_replication_origin</structname></title>
5206 <indexterm zone="catalog-pg-replication-origin">
5207 <primary>pg_replication_origin</primary>
5211 The <structname>pg_replication_origin</structname> catalog contains
5212 all replication origins created. For more on replication origins
5213 see <xref linkend="replication-origins">.
5218 <title><structname>pg_replication_origin</structname> Columns</title>
5225 <entry>References</entry>
5226 <entry>Description</entry>
5232 <entry><structfield>roident</structfield></entry>
5233 <entry><type>Oid</type></entry>
5235 <entry>A unique, cluster-wide identifier for the replication
5236 origin. Should never leave the system.</entry>
5240 <entry><structfield>roname</structfield></entry>
5241 <entry><type>text</type></entry>
5243 <entry>The external, user defined, name of a replication
5251 <sect1 id="catalog-pg-rewrite">
5252 <title><structname>pg_rewrite</structname></title>
5254 <indexterm zone="catalog-pg-rewrite">
5255 <primary>pg_rewrite</primary>
5259 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5263 <title><structname>pg_rewrite</> Columns</title>
5270 <entry>References</entry>
5271 <entry>Description</entry>
5277 <entry><structfield>oid</structfield></entry>
5278 <entry><type>oid</type></entry>
5280 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5284 <entry><structfield>rulename</structfield></entry>
5285 <entry><type>name</type></entry>
5287 <entry>Rule name</entry>
5291 <entry><structfield>ev_class</structfield></entry>
5292 <entry><type>oid</type></entry>
5293 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5294 <entry>The table this rule is for</entry>
5298 <entry><structfield>ev_type</structfield></entry>
5299 <entry><type>char</type></entry>
5302 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5303 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5309 <entry><structfield>ev_enabled</structfield></entry>
5310 <entry><type>char</type></entry>
5313 Controls in which <xref linkend="guc-session-replication-role"> modes
5315 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5316 <literal>D</> = rule is disabled,
5317 <literal>R</> = rule fires in <quote>replica</> mode,
5318 <literal>A</> = rule fires always.
5323 <entry><structfield>is_instead</structfield></entry>
5324 <entry><type>bool</type></entry>
5326 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5330 <entry><structfield>ev_qual</structfield></entry>
5331 <entry><type>pg_node_tree</type></entry>
5334 Expression tree (in the form of a
5335 <function>nodeToString()</function> representation) for the
5336 rule's qualifying condition
5341 <entry><structfield>ev_action</structfield></entry>
5342 <entry><type>pg_node_tree</type></entry>
5345 Query tree (in the form of a
5346 <function>nodeToString()</function> representation) for the
5356 <literal>pg_class.relhasrules</literal>
5357 must be true if a table has any rules in this catalog.
5363 <sect1 id="catalog-pg-seclabel">
5364 <title><structname>pg_seclabel</structname></title>
5366 <indexterm zone="catalog-pg-seclabel">
5367 <primary>pg_seclabel</primary>
5371 The catalog <structname>pg_seclabel</structname> stores security
5372 labels on database objects. Security labels can be manipulated
5373 with the <xref linkend="sql-security-label"> command. For an easier
5374 way to view security labels, see <xref linkend="view-pg-seclabels">.
5378 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5379 which performs a similar function for security labels of database objects
5380 that are shared across a database cluster.
5384 <title><structname>pg_seclabel</structname> Columns</title>
5391 <entry>References</entry>
5392 <entry>Description</entry>
5398 <entry><structfield>objoid</structfield></entry>
5399 <entry><type>oid</type></entry>
5400 <entry>any OID column</entry>
5401 <entry>The OID of the object this security label pertains to</entry>
5405 <entry><structfield>classoid</structfield></entry>
5406 <entry><type>oid</type></entry>
5407 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5408 <entry>The OID of the system catalog this object appears in</entry>
5412 <entry><structfield>objsubid</structfield></entry>
5413 <entry><type>int4</type></entry>
5416 For a security label on a table column, this is the column number (the
5417 <structfield>objoid</> and <structfield>classoid</> refer to
5418 the table itself). For all other object types, this column is
5424 <entry><structfield>provider</structfield></entry>
5425 <entry><type>text</type></entry>
5427 <entry>The label provider associated with this label.</entry>
5431 <entry><structfield>label</structfield></entry>
5432 <entry><type>text</type></entry>
5434 <entry>The security label applied to this object.</entry>
5441 <sect1 id="catalog-pg-shdepend">
5442 <title><structname>pg_shdepend</structname></title>
5444 <indexterm zone="catalog-pg-shdepend">
5445 <primary>pg_shdepend</primary>
5449 The catalog <structname>pg_shdepend</structname> records the
5450 dependency relationships between database objects and shared objects,
5451 such as roles. This information allows
5452 <productname>PostgreSQL</productname> to ensure that those objects are
5453 unreferenced before attempting to delete them.
5457 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5458 which performs a similar function for dependencies involving objects
5459 within a single database.
5463 Unlike most system catalogs, <structname>pg_shdepend</structname>
5464 is shared across all databases of a cluster: there is only one
5465 copy of <structname>pg_shdepend</structname> per cluster, not
5470 <title><structname>pg_shdepend</> Columns</title>
5477 <entry>References</entry>
5478 <entry>Description</entry>
5484 <entry><structfield>dbid</structfield></entry>
5485 <entry><type>oid</type></entry>
5486 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5487 <entry>The OID of the database the dependent object is in,
5488 or zero for a shared object</entry>
5492 <entry><structfield>classid</structfield></entry>
5493 <entry><type>oid</type></entry>
5494 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5495 <entry>The OID of the system catalog the dependent object is in</entry>
5499 <entry><structfield>objid</structfield></entry>
5500 <entry><type>oid</type></entry>
5501 <entry>any OID column</entry>
5502 <entry>The OID of the specific dependent object</entry>
5506 <entry><structfield>objsubid</structfield></entry>
5507 <entry><type>int4</type></entry>
5510 For a table column, this is the column number (the
5511 <structfield>objid</> and <structfield>classid</> refer to the
5512 table itself). For all other object types, this column is zero.
5517 <entry><structfield>refclassid</structfield></entry>
5518 <entry><type>oid</type></entry>
5519 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5520 <entry>The OID of the system catalog the referenced object is in
5521 (must be a shared catalog)</entry>
5525 <entry><structfield>refobjid</structfield></entry>
5526 <entry><type>oid</type></entry>
5527 <entry>any OID column</entry>
5528 <entry>The OID of the specific referenced object</entry>
5532 <entry><structfield>deptype</structfield></entry>
5533 <entry><type>char</type></entry>
5536 A code defining the specific semantics of this dependency relationship; see text
5545 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5546 the referenced object cannot be dropped without also dropping the dependent
5547 object. However, there are several subflavors identified by
5548 <structfield>deptype</>:
5552 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5555 The referenced object (which must be a role) is the owner of the
5562 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5565 The referenced object (which must be a role) is mentioned in the
5566 ACL (access control list, i.e., privileges list) of the
5567 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5568 not made for the owner of the object, since the owner will have
5569 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5575 <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
5578 The referenced object (which must be a role) is mentioned as the
5579 target of a dependent policy object.
5585 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5588 There is no dependent object; this type of entry is a signal
5589 that the system itself depends on the referenced object, and so
5590 that object must never be deleted. Entries of this type are
5591 created only by <command>initdb</command>. The columns for the
5592 dependent object contain zeroes.
5598 Other dependency flavors might be needed in future. Note in particular
5599 that the current definition only supports roles as referenced objects.
5604 <sect1 id="catalog-pg-shdescription">
5605 <title><structname>pg_shdescription</structname></title>
5607 <indexterm zone="catalog-pg-shdescription">
5608 <primary>pg_shdescription</primary>
5612 The catalog <structname>pg_shdescription</structname> stores optional
5613 descriptions (comments) for shared database objects. Descriptions can be
5614 manipulated with the <xref linkend="sql-comment"> command and viewed with
5615 <application>psql</application>'s <literal>\d</literal> commands.
5619 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5620 which performs a similar function for descriptions involving objects
5621 within a single database.
5625 Unlike most system catalogs, <structname>pg_shdescription</structname>
5626 is shared across all databases of a cluster: there is only one
5627 copy of <structname>pg_shdescription</structname> per cluster, not
5632 <title><structname>pg_shdescription</> Columns</title>
5639 <entry>References</entry>
5640 <entry>Description</entry>
5646 <entry><structfield>objoid</structfield></entry>
5647 <entry><type>oid</type></entry>
5648 <entry>any OID column</entry>
5649 <entry>The OID of the object this description pertains to</entry>
5653 <entry><structfield>classoid</structfield></entry>
5654 <entry><type>oid</type></entry>
5655 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5656 <entry>The OID of the system catalog this object appears in</entry>
5660 <entry><structfield>description</structfield></entry>
5661 <entry><type>text</type></entry>
5663 <entry>Arbitrary text that serves as the description of this object</entry>
5671 <sect1 id="catalog-pg-shseclabel">
5672 <title><structname>pg_shseclabel</structname></title>
5674 <indexterm zone="catalog-pg-shseclabel">
5675 <primary>pg_shseclabel</primary>
5679 The catalog <structname>pg_shseclabel</structname> stores security
5680 labels on shared database objects. Security labels can be manipulated
5681 with the <xref linkend="sql-security-label"> command. For an easier
5682 way to view security labels, see <xref linkend="view-pg-seclabels">.
5686 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5687 which performs a similar function for security labels involving objects
5688 within a single database.
5692 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5693 is shared across all databases of a cluster: there is only one
5694 copy of <structname>pg_shseclabel</structname> per cluster, not
5699 <title><structname>pg_shseclabel</structname> Columns</title>
5705 <entry>References</entry>
5706 <entry>Description</entry>
5711 <entry><structfield>objoid</structfield></entry>
5712 <entry><type>oid</type></entry>
5713 <entry>any OID column</entry>
5714 <entry>The OID of the object this security label pertains to</entry>
5717 <entry><structfield>classoid</structfield></entry>
5718 <entry><type>oid</type></entry>
5719 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5720 <entry>The OID of the system catalog this object appears in</entry>
5723 <entry><structfield>provider</structfield></entry>
5724 <entry><type>text</type></entry>
5726 <entry>The label provider associated with this label.</entry>
5729 <entry><structfield>label</structfield></entry>
5730 <entry><type>text</type></entry>
5732 <entry>The security label applied to this object.</entry>
5739 <sect1 id="catalog-pg-statistic">
5740 <title><structname>pg_statistic</structname></title>
5742 <indexterm zone="catalog-pg-statistic">
5743 <primary>pg_statistic</primary>
5747 The catalog <structname>pg_statistic</structname> stores
5748 statistical data about the contents of the database. Entries are
5749 created by <xref linkend="sql-analyze">
5750 and subsequently used by the query planner. Note that all the
5751 statistical data is inherently approximate, even assuming that it
5756 Normally there is one entry, with <structfield>stainherit</> =
5757 <literal>false</>, for each table column that has been analyzed.
5758 If the table has inheritance children, a second entry with
5759 <structfield>stainherit</> = <literal>true</> is also created. This row
5760 represents the column's statistics over the inheritance tree, i.e.,
5761 statistics for the data you'd see with
5762 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5763 whereas the <structfield>stainherit</> = <literal>false</> row represents
5765 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5769 <structname>pg_statistic</structname> also stores statistical data about
5770 the values of index expressions. These are described as if they were
5771 actual data columns; in particular, <structfield>starelid</structfield>
5772 references the index. No entry is made for an ordinary non-expression
5773 index column, however, since it would be redundant with the entry
5774 for the underlying table column. Currently, entries for index expressions
5775 always have <structfield>stainherit</> = <literal>false</>.
5779 Since different kinds of statistics might be appropriate for different
5780 kinds of data, <structname>pg_statistic</structname> is designed not
5781 to assume very much about what sort of statistics it stores. Only
5782 extremely general statistics (such as nullness) are given dedicated
5783 columns in <structname>pg_statistic</structname>. Everything else
5784 is stored in <quote>slots</quote>, which are groups of associated columns
5785 whose content is identified by a code number in one of the slot's columns.
5786 For more information see
5787 <filename>src/include/catalog/pg_statistic.h</filename>.
5791 <structname>pg_statistic</structname> should not be readable by the
5792 public, since even statistical information about a table's contents
5793 might be considered sensitive. (Example: minimum and maximum values
5794 of a salary column might be quite interesting.)
5795 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
5796 is a publicly readable view on
5797 <structname>pg_statistic</structname> that only exposes information
5798 about those tables that are readable by the current user.
5802 <title><structname>pg_statistic</> Columns</title>
5809 <entry>References</entry>
5810 <entry>Description</entry>
5816 <entry><structfield>starelid</structfield></entry>
5817 <entry><type>oid</type></entry>
5818 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5819 <entry>The table or index that the described column belongs to</entry>
5823 <entry><structfield>staattnum</structfield></entry>
5824 <entry><type>int2</type></entry>
5825 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5826 <entry>The number of the described column</entry>
5830 <entry><structfield>stainherit</structfield></entry>
5831 <entry><type>bool</type></entry>
5833 <entry>If true, the stats include inheritance child columns, not just the
5834 values in the specified relation</entry>
5838 <entry><structfield>stanullfrac</structfield></entry>
5839 <entry><type>float4</type></entry>
5841 <entry>The fraction of the column's entries that are null</entry>
5845 <entry><structfield>stawidth</structfield></entry>
5846 <entry><type>int4</type></entry>
5848 <entry>The average stored width, in bytes, of nonnull entries</entry>
5852 <entry><structfield>stadistinct</structfield></entry>
5853 <entry><type>float4</type></entry>
5855 <entry>The number of distinct nonnull data values in the column.
5856 A value greater than zero is the actual number of distinct values.
5857 A value less than zero is the negative of a multiplier for the number
5858 of rows in the table; for example, a column in which values appear about
5859 twice on the average could be represented by
5860 <structfield>stadistinct</> = -0.5.
5861 A zero value means the number of distinct values is unknown.
5866 <entry><structfield>stakind<replaceable>N</></structfield></entry>
5867 <entry><type>int2</type></entry>
5870 A code number indicating the kind of statistics stored in the
5871 <replaceable>N</>th <quote>slot</quote> of the
5872 <structname>pg_statistic</structname> row.
5877 <entry><structfield>staop<replaceable>N</></structfield></entry>
5878 <entry><type>oid</type></entry>
5879 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
5881 An operator used to derive the statistics stored in the
5882 <replaceable>N</>th <quote>slot</quote>. For example, a
5883 histogram slot would show the <literal><</literal> operator
5884 that defines the sort order of the data.
5889 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
5890 <entry><type>float4[]</type></entry>
5893 Numerical statistics of the appropriate kind for the
5894 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5895 kind does not involve numerical values
5900 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
5901 <entry><type>anyarray</type></entry>
5904 Column data values of the appropriate kind for the
5905 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5906 kind does not store any data values. Each array's element
5907 values are actually of the specific column's data type, or a related
5908 type such as an array's element type, so there is no way to define
5909 these columns' type more specifically than <type>anyarray</>.
5919 <sect1 id="catalog-pg-tablespace">
5920 <title><structname>pg_tablespace</structname></title>
5922 <indexterm zone="catalog-pg-tablespace">
5923 <primary>pg_tablespace</primary>
5927 The catalog <structname>pg_tablespace</structname> stores information
5928 about the available tablespaces. Tables can be placed in particular
5929 tablespaces to aid administration of disk layout.
5933 Unlike most system catalogs, <structname>pg_tablespace</structname>
5934 is shared across all databases of a cluster: there is only one
5935 copy of <structname>pg_tablespace</structname> per cluster, not
5940 <title><structname>pg_tablespace</> Columns</title>
5947 <entry>References</entry>
5948 <entry>Description</entry>
5954 <entry><structfield>oid</structfield></entry>
5955 <entry><type>oid</type></entry>
5957 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5961 <entry><structfield>spcname</structfield></entry>
5962 <entry><type>name</type></entry>
5964 <entry>Tablespace name</entry>
5968 <entry><structfield>spcowner</structfield></entry>
5969 <entry><type>oid</type></entry>
5970 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5971 <entry>Owner of the tablespace, usually the user who created it</entry>
5975 <entry><structfield>spcacl</structfield></entry>
5976 <entry><type>aclitem[]</type></entry>
5979 Access privileges; see
5980 <xref linkend="sql-grant"> and
5981 <xref linkend="sql-revoke">
5987 <entry><structfield>spcoptions</structfield></entry>
5988 <entry><type>text[]</type></entry>
5991 Tablespace-level options, as <quote>keyword=value</> strings
6000 <sect1 id="catalog-pg-transform">
6001 <title><structname>pg_transform</structname></title>
6003 <indexterm zone="catalog-pg-transform">
6004 <primary>pg_transform</primary>
6008 The catalog <structname>pg_transform</structname> stores information about
6009 transforms, which are a mechanism to adapt data types to procedural
6010 languages. See <xref linkend="sql-createtransform"> for more information.
6014 <title><structname>pg_transform</> Columns</title>
6021 <entry>References</entry>
6022 <entry>Description</entry>
6028 <entry><structfield>trftype</structfield></entry>
6029 <entry><type>oid</type></entry>
6030 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6031 <entry>OID of the data type this transform is for</entry>
6035 <entry><structfield>trflang</structfield></entry>
6036 <entry><type>oid</type></entry>
6037 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6038 <entry>OID of the language this transform is for</entry>
6042 <entry><structfield>trffromsql</structfield></entry>
6043 <entry><type>regproc</type></entry>
6044 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6046 The OID of the function to use when converting the data type for input
6047 to the procedural language (e.g., function parameters). Zero is stored
6048 if this operation is not supported.
6053 <entry><structfield>trftosql</structfield></entry>
6054 <entry><type>regproc</type></entry>
6055 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6057 The OID of the function to use when converting output from the
6058 procedural language (e.g., return values) to the data type. Zero is
6059 stored if this operation is not supported.
6068 <sect1 id="catalog-pg-trigger">
6069 <title><structname>pg_trigger</structname></title>
6071 <indexterm zone="catalog-pg-trigger">
6072 <primary>pg_trigger</primary>
6076 The catalog <structname>pg_trigger</structname> stores triggers on tables
6078 See <xref linkend="sql-createtrigger">
6079 for more information.
6083 <title><structname>pg_trigger</> Columns</title>
6090 <entry>References</entry>
6091 <entry>Description</entry>
6097 <entry><structfield>oid</structfield></entry>
6098 <entry><type>oid</type></entry>
6100 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6104 <entry><structfield>tgrelid</structfield></entry>
6105 <entry><type>oid</type></entry>
6106 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6107 <entry>The table this trigger is on</entry>
6111 <entry><structfield>tgname</structfield></entry>
6112 <entry><type>name</type></entry>
6114 <entry>Trigger name (must be unique among triggers of same table)</entry>
6118 <entry><structfield>tgfoid</structfield></entry>
6119 <entry><type>oid</type></entry>
6120 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6121 <entry>The function to be called</entry>
6125 <entry><structfield>tgtype</structfield></entry>
6126 <entry><type>int2</type></entry>
6128 <entry>Bit mask identifying trigger firing conditions</entry>
6132 <entry><structfield>tgenabled</structfield></entry>
6133 <entry><type>char</type></entry>
6136 Controls in which <xref linkend="guc-session-replication-role"> modes
6138 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6139 <literal>D</> = trigger is disabled,
6140 <literal>R</> = trigger fires in <quote>replica</> mode,
6141 <literal>A</> = trigger fires always.
6146 <entry><structfield>tgisinternal</structfield></entry>
6147 <entry><type>bool</type></entry>
6149 <entry>True if trigger is internally generated (usually, to enforce
6150 the constraint identified by <structfield>tgconstraint</>)</entry>
6154 <entry><structfield>tgconstrrelid</structfield></entry>
6155 <entry><type>oid</type></entry>
6156 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6157 <entry>The table referenced by a referential integrity constraint</entry>
6161 <entry><structfield>tgconstrindid</structfield></entry>
6162 <entry><type>oid</type></entry>
6163 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6164 <entry>The index supporting a unique, primary key, referential integrity,
6165 or exclusion constraint</entry>
6169 <entry><structfield>tgconstraint</structfield></entry>
6170 <entry><type>oid</type></entry>
6171 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6172 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6176 <entry><structfield>tgdeferrable</structfield></entry>
6177 <entry><type>bool</type></entry>
6179 <entry>True if constraint trigger is deferrable</entry>
6183 <entry><structfield>tginitdeferred</structfield></entry>
6184 <entry><type>bool</type></entry>
6186 <entry>True if constraint trigger is initially deferred</entry>
6190 <entry><structfield>tgnargs</structfield></entry>
6191 <entry><type>int2</type></entry>
6193 <entry>Number of argument strings passed to trigger function</entry>
6197 <entry><structfield>tgattr</structfield></entry>
6198 <entry><type>int2vector</type></entry>
6199 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6200 <entry>Column numbers, if trigger is column-specific; otherwise an
6205 <entry><structfield>tgargs</structfield></entry>
6206 <entry><type>bytea</type></entry>
6208 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6212 <entry><structfield>tgqual</structfield></entry>
6213 <entry><type>pg_node_tree</type></entry>
6215 <entry>Expression tree (in <function>nodeToString()</function>
6216 representation) for the trigger's <literal>WHEN</> condition, or null
6224 Currently, column-specific triggering is supported only for
6225 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6226 only for that event type. <structfield>tgtype</structfield> might
6227 contain bits for other event types as well, but those are presumed
6228 to be table-wide regardless of what is in <structfield>tgattr</>.
6233 When <structfield>tgconstraint</> is nonzero,
6234 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6235 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6236 largely redundant with the referenced <structname>pg_constraint</> entry.
6237 However, it is possible for a non-deferrable trigger to be associated
6238 with a deferrable constraint: foreign key constraints can have some
6239 deferrable and some non-deferrable triggers.
6245 <literal>pg_class.relhastriggers</literal>
6246 must be true if a relation has any triggers in this catalog.
6253 <sect1 id="catalog-pg-ts-config">
6254 <title><structname>pg_ts_config</structname></title>
6256 <indexterm zone="catalog-pg-ts-config">
6257 <primary>pg_ts_config</primary>
6261 The <structname>pg_ts_config</structname> catalog contains entries
6262 representing text search configurations. A configuration specifies
6263 a particular text search parser and a list of dictionaries to use
6264 for each of the parser's output token types. The parser is shown
6265 in the <structname>pg_ts_config</structname> entry, but the
6266 token-to-dictionary mapping is defined by subsidiary entries in <link
6267 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6271 <productname>PostgreSQL</productname>'s text search features are
6272 described at length in <xref linkend="textsearch">.
6276 <title><structname>pg_ts_config</> Columns</title>
6283 <entry>References</entry>
6284 <entry>Description</entry>
6290 <entry><structfield>oid</structfield></entry>
6291 <entry><type>oid</type></entry>
6293 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6297 <entry><structfield>cfgname</structfield></entry>
6298 <entry><type>name</type></entry>
6300 <entry>Text search configuration name</entry>
6304 <entry><structfield>cfgnamespace</structfield></entry>
6305 <entry><type>oid</type></entry>
6306 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6308 The OID of the namespace that contains this configuration
6313 <entry><structfield>cfgowner</structfield></entry>
6314 <entry><type>oid</type></entry>
6315 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6316 <entry>Owner of the configuration</entry>
6320 <entry><structfield>cfgparser</structfield></entry>
6321 <entry><type>oid</type></entry>
6322 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6323 <entry>The OID of the text search parser for this configuration</entry>
6331 <sect1 id="catalog-pg-ts-config-map">
6332 <title><structname>pg_ts_config_map</structname></title>
6334 <indexterm zone="catalog-pg-ts-config-map">
6335 <primary>pg_ts_config_map</primary>
6339 The <structname>pg_ts_config_map</structname> catalog contains entries
6340 showing which text search dictionaries should be consulted, and in
6341 what order, for each output token type of each text search configuration's
6346 <productname>PostgreSQL</productname>'s text search features are
6347 described at length in <xref linkend="textsearch">.
6351 <title><structname>pg_ts_config_map</> Columns</title>
6358 <entry>References</entry>
6359 <entry>Description</entry>
6365 <entry><structfield>mapcfg</structfield></entry>
6366 <entry><type>oid</type></entry>
6367 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6368 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6372 <entry><structfield>maptokentype</structfield></entry>
6373 <entry><type>integer</type></entry>
6375 <entry>A token type emitted by the configuration's parser</entry>
6379 <entry><structfield>mapseqno</structfield></entry>
6380 <entry><type>integer</type></entry>
6382 <entry>Order in which to consult this entry (lower
6383 <structfield>mapseqno</>s first)</entry>
6387 <entry><structfield>mapdict</structfield></entry>
6388 <entry><type>oid</type></entry>
6389 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6390 <entry>The OID of the text search dictionary to consult</entry>
6398 <sect1 id="catalog-pg-ts-dict">
6399 <title><structname>pg_ts_dict</structname></title>
6401 <indexterm zone="catalog-pg-ts-dict">
6402 <primary>pg_ts_dict</primary>
6406 The <structname>pg_ts_dict</structname> catalog contains entries
6407 defining text search dictionaries. A dictionary depends on a text
6408 search template, which specifies all the implementation functions
6409 needed; the dictionary itself provides values for the user-settable
6410 parameters supported by the template. This division of labor allows
6411 dictionaries to be created by unprivileged users. The parameters
6412 are specified by a text string <structfield>dictinitoption</>,
6413 whose format and meaning vary depending on the template.
6417 <productname>PostgreSQL</productname>'s text search features are
6418 described at length in <xref linkend="textsearch">.
6422 <title><structname>pg_ts_dict</> Columns</title>
6429 <entry>References</entry>
6430 <entry>Description</entry>
6436 <entry><structfield>oid</structfield></entry>
6437 <entry><type>oid</type></entry>
6439 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6443 <entry><structfield>dictname</structfield></entry>
6444 <entry><type>name</type></entry>
6446 <entry>Text search dictionary name</entry>
6450 <entry><structfield>dictnamespace</structfield></entry>
6451 <entry><type>oid</type></entry>
6452 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6454 The OID of the namespace that contains this dictionary
6459 <entry><structfield>dictowner</structfield></entry>
6460 <entry><type>oid</type></entry>
6461 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6462 <entry>Owner of the dictionary</entry>
6466 <entry><structfield>dicttemplate</structfield></entry>
6467 <entry><type>oid</type></entry>
6468 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6469 <entry>The OID of the text search template for this dictionary</entry>
6473 <entry><structfield>dictinitoption</structfield></entry>
6474 <entry><type>text</type></entry>
6476 <entry>Initialization option string for the template</entry>
6484 <sect1 id="catalog-pg-ts-parser">
6485 <title><structname>pg_ts_parser</structname></title>
6487 <indexterm zone="catalog-pg-ts-parser">
6488 <primary>pg_ts_parser</primary>
6492 The <structname>pg_ts_parser</structname> catalog contains entries
6493 defining text search parsers. A parser is responsible for splitting
6494 input text into lexemes and assigning a token type to each lexeme.
6495 Since a parser must be implemented by C-language-level functions,
6496 creation of new parsers is restricted to database superusers.
6500 <productname>PostgreSQL</productname>'s text search features are
6501 described at length in <xref linkend="textsearch">.
6505 <title><structname>pg_ts_parser</> Columns</title>
6512 <entry>References</entry>
6513 <entry>Description</entry>
6519 <entry><structfield>oid</structfield></entry>
6520 <entry><type>oid</type></entry>
6522 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6526 <entry><structfield>prsname</structfield></entry>
6527 <entry><type>name</type></entry>
6529 <entry>Text search parser name</entry>
6533 <entry><structfield>prsnamespace</structfield></entry>
6534 <entry><type>oid</type></entry>
6535 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6537 The OID of the namespace that contains this parser
6542 <entry><structfield>prsstart</structfield></entry>
6543 <entry><type>regproc</type></entry>
6544 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6545 <entry>OID of the parser's startup function</entry>
6549 <entry><structfield>prstoken</structfield></entry>
6550 <entry><type>regproc</type></entry>
6551 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6552 <entry>OID of the parser's next-token function</entry>
6556 <entry><structfield>prsend</structfield></entry>
6557 <entry><type>regproc</type></entry>
6558 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6559 <entry>OID of the parser's shutdown function</entry>
6563 <entry><structfield>prsheadline</structfield></entry>
6564 <entry><type>regproc</type></entry>
6565 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6566 <entry>OID of the parser's headline function</entry>
6570 <entry><structfield>prslextype</structfield></entry>
6571 <entry><type>regproc</type></entry>
6572 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6573 <entry>OID of the parser's lextype function</entry>
6581 <sect1 id="catalog-pg-ts-template">
6582 <title><structname>pg_ts_template</structname></title>
6584 <indexterm zone="catalog-pg-ts-template">
6585 <primary>pg_ts_template</primary>
6589 The <structname>pg_ts_template</structname> catalog contains entries
6590 defining text search templates. A template is the implementation
6591 skeleton for a class of text search dictionaries.
6592 Since a template must be implemented by C-language-level functions,
6593 creation of new templates is restricted to database superusers.
6597 <productname>PostgreSQL</productname>'s text search features are
6598 described at length in <xref linkend="textsearch">.
6602 <title><structname>pg_ts_template</> Columns</title>
6609 <entry>References</entry>
6610 <entry>Description</entry>
6616 <entry><structfield>oid</structfield></entry>
6617 <entry><type>oid</type></entry>
6619 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6623 <entry><structfield>tmplname</structfield></entry>
6624 <entry><type>name</type></entry>
6626 <entry>Text search template name</entry>
6630 <entry><structfield>tmplnamespace</structfield></entry>
6631 <entry><type>oid</type></entry>
6632 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6634 The OID of the namespace that contains this template
6639 <entry><structfield>tmplinit</structfield></entry>
6640 <entry><type>regproc</type></entry>
6641 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6642 <entry>OID of the template's initialization function</entry>
6646 <entry><structfield>tmpllexize</structfield></entry>
6647 <entry><type>regproc</type></entry>
6648 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6649 <entry>OID of the template's lexize function</entry>
6657 <sect1 id="catalog-pg-type">
6658 <title><structname>pg_type</structname></title>
6660 <indexterm zone="catalog-pg-type">
6661 <primary>pg_type</primary>
6665 The catalog <structname>pg_type</structname> stores information about data
6666 types. Base types and enum types (scalar types) are created with
6667 <xref linkend="sql-createtype">, and
6669 <xref linkend="sql-createdomain">.
6670 A composite type is automatically created for each table in the database, to
6671 represent the row structure of the table. It is also possible to create
6672 composite types with <command>CREATE TYPE AS</command>.
6676 <title><structname>pg_type</> Columns</title>
6683 <entry>References</entry>
6684 <entry>Description</entry>
6690 <entry><structfield>oid</structfield></entry>
6691 <entry><type>oid</type></entry>
6693 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6697 <entry><structfield>typname</structfield></entry>
6698 <entry><type>name</type></entry>
6700 <entry>Data type name</entry>
6704 <entry><structfield>typnamespace</structfield></entry>
6705 <entry><type>oid</type></entry>
6706 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6708 The OID of the namespace that contains this type
6713 <entry><structfield>typowner</structfield></entry>
6714 <entry><type>oid</type></entry>
6715 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6716 <entry>Owner of the type</entry>
6720 <entry><structfield>typlen</structfield></entry>
6721 <entry><type>int2</type></entry>
6724 For a fixed-size type, <structfield>typlen</structfield> is the number
6725 of bytes in the internal representation of the type. But for a
6726 variable-length type, <structfield>typlen</structfield> is negative.
6727 -1 indicates a <quote>varlena</> type (one that has a length word),
6728 -2 indicates a null-terminated C string.
6733 <entry><structfield>typbyval</structfield></entry>
6734 <entry><type>bool</type></entry>
6737 <structfield>typbyval</structfield> determines whether internal
6738 routines pass a value of this type by value or by reference.
6739 <structfield>typbyval</structfield> had better be false if
6740 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6741 where Datum is 8 bytes).
6742 Variable-length types are always passed by reference. Note that
6743 <structfield>typbyval</structfield> can be false even if the
6744 length would allow pass-by-value.
6749 <entry><structfield>typtype</structfield></entry>
6750 <entry><type>char</type></entry>
6753 <structfield>typtype</structfield> is
6754 <literal>b</literal> for a base type,
6755 <literal>c</literal> for a composite type (e.g., a table's row type),
6756 <literal>d</literal> for a domain,
6757 <literal>e</literal> for an enum type,
6758 <literal>p</literal> for a pseudo-type, or
6759 <literal>r</literal> for a range type.
6760 See also <structfield>typrelid</structfield> and
6761 <structfield>typbasetype</structfield>.
6766 <entry><structfield>typcategory</structfield></entry>
6767 <entry><type>char</type></entry>
6770 <structfield>typcategory</structfield> is an arbitrary classification
6771 of data types that is used by the parser to determine which implicit
6772 casts should be <quote>preferred</>.
6773 See <xref linkend="catalog-typcategory-table">.
6778 <entry><structfield>typispreferred</structfield></entry>
6779 <entry><type>bool</type></entry>
6782 True if the type is a preferred cast target within its
6783 <structfield>typcategory</structfield>
6788 <entry><structfield>typisdefined</structfield></entry>
6789 <entry><type>bool</type></entry>
6792 True if the type is defined, false if this is a placeholder
6793 entry for a not-yet-defined type. When
6794 <structfield>typisdefined</structfield> is false, nothing
6795 except the type name, namespace, and OID can be relied on.
6800 <entry><structfield>typdelim</structfield></entry>
6801 <entry><type>char</type></entry>
6804 Character that separates two values of this type when parsing
6805 array input. Note that the delimiter is associated with the array
6806 element data type, not the array data type.
6811 <entry><structfield>typrelid</structfield></entry>
6812 <entry><type>oid</type></entry>
6813 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6815 If this is a composite type (see
6816 <structfield>typtype</structfield>), then this column points to
6817 the <structname>pg_class</structname> entry that defines the
6818 corresponding table. (For a free-standing composite type, the
6819 <structname>pg_class</structname> entry doesn't really represent
6820 a table, but it is needed anyway for the type's
6821 <structname>pg_attribute</structname> entries to link to.)
6822 Zero for non-composite types.
6827 <entry><structfield>typelem</structfield></entry>
6828 <entry><type>oid</type></entry>
6829 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6831 If <structfield>typelem</structfield> is not 0 then it
6832 identifies another row in <structname>pg_type</structname>.
6833 The current type can then be subscripted like an array yielding
6834 values of type <structfield>typelem</structfield>. A
6835 <quote>true</quote> array type is variable length
6836 (<structfield>typlen</structfield> = -1),
6837 but some fixed-length (<structfield>typlen</structfield> > 0) types
6838 also have nonzero <structfield>typelem</structfield>, for example
6839 <type>name</type> and <type>point</type>.
6840 If a fixed-length type has a <structfield>typelem</structfield> then
6841 its internal representation must be some number of values of the
6842 <structfield>typelem</structfield> data type with no other data.
6843 Variable-length array types have a header defined by the array
6849 <entry><structfield>typarray</structfield></entry>
6850 <entry><type>oid</type></entry>
6851 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6853 If <structfield>typarray</structfield> is not 0 then it
6854 identifies another row in <structname>pg_type</structname>, which
6855 is the <quote>true</quote> array type having this type as element
6860 <entry><structfield>typinput</structfield></entry>
6861 <entry><type>regproc</type></entry>
6862 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6863 <entry>Input conversion function (text format)</entry>
6867 <entry><structfield>typoutput</structfield></entry>
6868 <entry><type>regproc</type></entry>
6869 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6870 <entry>Output conversion function (text format)</entry>
6874 <entry><structfield>typreceive</structfield></entry>
6875 <entry><type>regproc</type></entry>
6876 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6877 <entry>Input conversion function (binary format), or 0 if none</entry>
6881 <entry><structfield>typsend</structfield></entry>
6882 <entry><type>regproc</type></entry>
6883 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6884 <entry>Output conversion function (binary format), or 0 if none</entry>
6888 <entry><structfield>typmodin</structfield></entry>
6889 <entry><type>regproc</type></entry>
6890 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6891 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
6895 <entry><structfield>typmodout</structfield></entry>
6896 <entry><type>regproc</type></entry>
6897 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6898 <entry>Type modifier output function, or 0 to use the standard format</entry>
6902 <entry><structfield>typanalyze</structfield></entry>
6903 <entry><type>regproc</type></entry>
6904 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6905 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
6909 <entry><structfield>typalign</structfield></entry>
6910 <entry><type>char</type></entry>
6914 <structfield>typalign</structfield> is the alignment required
6915 when storing a value of this type. It applies to storage on
6916 disk as well as most representations of the value inside
6917 <productname>PostgreSQL</>.
6918 When multiple values are stored consecutively, such
6919 as in the representation of a complete row on disk, padding is
6920 inserted before a datum of this type so that it begins on the
6921 specified boundary. The alignment reference is the beginning
6922 of the first datum in the sequence.
6926 Possible values are:
6929 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
6932 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
6935 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
6938 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
6943 For types used in system tables, it is critical that the size
6944 and alignment defined in <structname>pg_type</structname>
6945 agree with the way that the compiler will lay out the column in
6946 a structure representing a table row.
6952 <entry><structfield>typstorage</structfield></entry>
6953 <entry><type>char</type></entry>
6956 <structfield>typstorage</structfield> tells for varlena
6957 types (those with <structfield>typlen</structfield> = -1) if
6958 the type is prepared for toasting and what the default strategy
6959 for attributes of this type should be.
6963 <para><literal>p</>: Value must always be stored plain.</para>
6967 <literal>e</>: Value can be stored in a <quote>secondary</quote>
6968 relation (if relation has one, see
6969 <literal>pg_class.reltoastrelid</literal>).
6973 <para><literal>m</>: Value can be stored compressed inline.</para>
6976 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
6979 Note that <literal>m</> columns can also be moved out to secondary
6980 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
6986 <entry><structfield>typnotnull</structfield></entry>
6987 <entry><type>bool</type></entry>
6990 <structfield>typnotnull</structfield> represents a not-null
6991 constraint on a type. Used for domains only.
6996 <entry><structfield>typbasetype</structfield></entry>
6997 <entry><type>oid</type></entry>
6998 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7000 If this is a domain (see <structfield>typtype</structfield>), then
7001 <structfield>typbasetype</structfield> identifies the type that this
7002 one is based on. Zero if this type is not a domain.
7007 <entry><structfield>typtypmod</structfield></entry>
7008 <entry><type>int4</type></entry>
7011 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7012 to be applied to their base type (-1 if base type does not use a
7013 <literal>typmod</>). -1 if this type is not a domain.
7018 <entry><structfield>typndims</structfield></entry>
7019 <entry><type>int4</type></entry>
7022 <structfield>typndims</structfield> is the number of array dimensions
7023 for a domain over an array (that is, <structfield>typbasetype</> is
7025 Zero for types other than domains over array types.
7030 <entry><structfield>typcollation</structfield></entry>
7031 <entry><type>oid</type></entry>
7032 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7034 <structfield>typcollation</structfield> specifies the collation
7035 of the type. If the type does not support collations, this will
7036 be zero. A base type that supports collations will have
7037 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7038 collatable type can have some other collation OID, if one was
7039 specified for the domain.
7044 <entry><structfield>typdefaultbin</structfield></entry>
7045 <entry><type>pg_node_tree</type></entry>
7048 If <structfield>typdefaultbin</> is not null, it is the
7049 <function>nodeToString()</function>
7050 representation of a default expression for the type. This is
7051 only used for domains.
7056 <entry><structfield>typdefault</structfield></entry>
7057 <entry><type>text</type></entry>
7060 <structfield>typdefault</> is null if the type has no associated
7061 default value. If <structfield>typdefaultbin</> is not null,
7062 <structfield>typdefault</> must contain a human-readable version of the
7063 default expression represented by <structfield>typdefaultbin</>. If
7064 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7065 not, then <structfield>typdefault</> is the external representation of
7066 the type's default value, which can be fed to the type's input
7067 converter to produce a constant.
7072 <entry><structfield>typacl</structfield></entry>
7073 <entry><type>aclitem[]</type></entry>
7076 Access privileges; see
7077 <xref linkend="sql-grant"> and
7078 <xref linkend="sql-revoke">
7087 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7088 of <structfield>typcategory</>. Any future additions to this list will
7089 also be upper-case ASCII letters. All other ASCII characters are reserved
7090 for user-defined categories.
7093 <table id="catalog-typcategory-table">
7094 <title><structfield>typcategory</> Codes</title>
7100 <entry>Category</entry>
7106 <entry><literal>A</literal></entry>
7107 <entry>Array types</entry>
7110 <entry><literal>B</literal></entry>
7111 <entry>Boolean types</entry>
7114 <entry><literal>C</literal></entry>
7115 <entry>Composite types</entry>
7118 <entry><literal>D</literal></entry>
7119 <entry>Date/time types</entry>
7122 <entry><literal>E</literal></entry>
7123 <entry>Enum types</entry>
7126 <entry><literal>G</literal></entry>
7127 <entry>Geometric types</entry>
7130 <entry><literal>I</literal></entry>
7131 <entry>Network address types</entry>
7134 <entry><literal>N</literal></entry>
7135 <entry>Numeric types</entry>
7138 <entry><literal>P</literal></entry>
7139 <entry>Pseudo-types</entry>
7142 <entry><literal>R</literal></entry>
7143 <entry>Range types</entry>
7146 <entry><literal>S</literal></entry>
7147 <entry>String types</entry>
7150 <entry><literal>T</literal></entry>
7151 <entry>Timespan types</entry>
7154 <entry><literal>U</literal></entry>
7155 <entry>User-defined types</entry>
7158 <entry><literal>V</literal></entry>
7159 <entry>Bit-string types</entry>
7162 <entry><literal>X</literal></entry>
7163 <entry><type>unknown</> type</entry>
7172 <sect1 id="catalog-pg-user-mapping">
7173 <title><structname>pg_user_mapping</structname></title>
7175 <indexterm zone="catalog-pg-user-mapping">
7176 <primary>pg_user_mapping</primary>
7180 The catalog <structname>pg_user_mapping</structname> stores
7181 the mappings from local user to remote. Access to this catalog is
7182 restricted from normal users, use the view
7183 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7188 <title><structname>pg_user_mapping</> Columns</title>
7195 <entry>References</entry>
7196 <entry>Description</entry>
7202 <entry><structfield>oid</structfield></entry>
7203 <entry><type>oid</type></entry>
7205 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7209 <entry><structfield>umuser</structfield></entry>
7210 <entry><type>oid</type></entry>
7211 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7212 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7216 <entry><structfield>umserver</structfield></entry>
7217 <entry><type>oid</type></entry>
7218 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7220 The OID of the foreign server that contains this mapping
7225 <entry><structfield>umoptions</structfield></entry>
7226 <entry><type>text[]</type></entry>
7229 User mapping specific options, as <quote>keyword=value</> strings
7238 <sect1 id="views-overview">
7239 <title>System Views</title>
7242 In addition to the system catalogs, <productname>PostgreSQL</productname>
7243 provides a number of built-in views. Some system views provide convenient
7244 access to some commonly used queries on the system catalogs. Other views
7245 provide access to internal server state.
7249 The information schema (<xref linkend="information-schema">) provides
7250 an alternative set of views which overlap the functionality of the system
7251 views. Since the information schema is SQL-standard whereas the views
7252 described here are <productname>PostgreSQL</productname>-specific,
7253 it's usually better to use the information schema if it provides all
7254 the information you need.
7258 <xref linkend="view-table"> lists the system views described here.
7259 More detailed documentation of each view follows below.
7260 There are some additional views that provide access to the results of
7261 the statistics collector; they are described in <xref
7262 linkend="monitoring-stats-views-table">.
7266 Except where noted, all the views described here are read-only.
7269 <table id="view-table">
7270 <title>System Views</title>
7275 <entry>View Name</entry>
7276 <entry>Purpose</entry>
7282 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7283 <entry>available extensions</entry>
7287 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7288 <entry>available versions of extensions</entry>
7292 <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
7293 <entry>compile-time configuration parameters</entry>
7297 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7298 <entry>open cursors</entry>
7302 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
7303 <entry>summary of configuration file contents</entry>
7307 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7308 <entry>groups of database users</entry>
7312 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7313 <entry>indexes</entry>
7317 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7318 <entry>locks currently held or awaited</entry>
7322 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7323 <entry>materialized views</entry>
7327 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7328 <entry>policies</entry>
7332 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7333 <entry>prepared statements</entry>
7337 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7338 <entry>prepared transactions</entry>
7342 <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
7343 <entry>information about replication origins, including replication progress</entry>
7347 <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
7348 <entry>replication slot information</entry>
7352 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7353 <entry>database roles</entry>
7357 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7358 <entry>rules</entry>
7362 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7363 <entry>security labels</entry>
7367 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7368 <entry>parameter settings</entry>
7372 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7373 <entry>database users</entry>
7377 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7378 <entry>planner statistics</entry>
7382 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7383 <entry>tables</entry>
7387 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7388 <entry>time zone abbreviations</entry>
7392 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7393 <entry>time zone names</entry>
7397 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7398 <entry>database users</entry>
7402 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7403 <entry>user mappings</entry>
7407 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7408 <entry>views</entry>
7416 <sect1 id="view-pg-available-extensions">
7417 <title><structname>pg_available_extensions</structname></title>
7419 <indexterm zone="view-pg-available-extensions">
7420 <primary>pg_available_extensions</primary>
7424 The <structname>pg_available_extensions</structname> view lists the
7425 extensions that are available for installation.
7427 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7428 catalog, which shows the extensions currently installed.
7432 <title><structname>pg_available_extensions</> Columns</title>
7439 <entry>Description</entry>
7445 <entry><structfield>name</structfield></entry>
7446 <entry><type>name</type></entry>
7447 <entry>Extension name</entry>
7451 <entry><structfield>default_version</structfield></entry>
7452 <entry><type>text</type></entry>
7453 <entry>Name of default version, or <literal>NULL</literal> if none is
7458 <entry><structfield>installed_version</structfield></entry>
7459 <entry><type>text</type></entry>
7460 <entry>Currently installed version of the extension,
7461 or <literal>NULL</literal> if not installed</entry>
7465 <entry><structfield>comment</structfield></entry>
7466 <entry><type>text</type></entry>
7467 <entry>Comment string from the extension's control file</entry>
7474 The <structname>pg_available_extensions</structname> view is read only.
7478 <sect1 id="view-pg-available-extension-versions">
7479 <title><structname>pg_available_extension_versions</structname></title>
7481 <indexterm zone="view-pg-available-extension-versions">
7482 <primary>pg_available_extension_versions</primary>
7486 The <structname>pg_available_extension_versions</structname> view lists the
7487 specific extension versions that are available for installation.
7489 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7490 catalog, which shows the extensions currently installed.
7494 <title><structname>pg_available_extension_versions</> Columns</title>
7501 <entry>Description</entry>
7507 <entry><structfield>name</structfield></entry>
7508 <entry><type>name</type></entry>
7509 <entry>Extension name</entry>
7513 <entry><structfield>version</structfield></entry>
7514 <entry><type>text</type></entry>
7515 <entry>Version name</entry>
7519 <entry><structfield>installed</structfield></entry>
7520 <entry><type>bool</type></entry>
7521 <entry>True if this version of this extension is currently
7526 <entry><structfield>superuser</structfield></entry>
7527 <entry><type>bool</type></entry>
7528 <entry>True if only superusers are allowed to install this extension</entry>
7532 <entry><structfield>relocatable</structfield></entry>
7533 <entry><type>bool</type></entry>
7534 <entry>True if extension can be relocated to another schema</entry>
7538 <entry><structfield>schema</structfield></entry>
7539 <entry><type>name</type></entry>
7540 <entry>Name of the schema that the extension must be installed into,
7541 or <literal>NULL</literal> if partially or fully relocatable</entry>
7545 <entry><structfield>requires</structfield></entry>
7546 <entry><type>name[]</type></entry>
7547 <entry>Names of prerequisite extensions,
7548 or <literal>NULL</literal> if none</entry>
7552 <entry><structfield>comment</structfield></entry>
7553 <entry><type>text</type></entry>
7554 <entry>Comment string from the extension's control file</entry>
7561 The <structname>pg_available_extension_versions</structname> view is read
7566 <sect1 id="view-pg-config">
7567 <title><structname>pg_config</structname></title>
7569 <indexterm zone="view-pg-config">
7570 <primary>pg_config</primary>
7574 The view <structname>pg_config</structname> describes the
7575 compile-time configuration parameters of the currently installed
7576 version of <productname>PostgreSQL</>. It is intended, for example, to
7577 be used by software packages that want to interface to
7578 <productname>PostgreSQL</> to facilitate finding the required header
7579 files and libraries. It provides the same basic information as the
7580 <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
7585 <title><structname>pg_config</> Columns</title>
7591 <entry>Description</entry>
7597 <entry><structfield>name</structfield></entry>
7598 <entry><type>text</type></entry>
7599 <entry>The parameter name</entry>
7603 <entry><structfield>setting</structfield></entry>
7604 <entry><type>text</type></entry>
7605 <entry>The parameter value</entry>
7613 <sect1 id="view-pg-cursors">
7614 <title><structname>pg_cursors</structname></title>
7616 <indexterm zone="view-pg-cursors">
7617 <primary>pg_cursors</primary>
7621 The <structname>pg_cursors</structname> view lists the cursors that
7622 are currently available. Cursors can be defined in several ways:
7626 via the <xref linkend="sql-declare">
7633 via the Bind message in the frontend/backend protocol, as
7634 described in <xref linkend="protocol-flow-ext-query">
7640 via the Server Programming Interface (SPI), as described in
7641 <xref linkend="spi-interface">
7646 The <structname>pg_cursors</structname> view displays cursors
7647 created by any of these means. Cursors only exist for the duration
7648 of the transaction that defines them, unless they have been
7649 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7650 cursors are only present in the view until the end of their
7651 creating transaction.
7655 Cursors are used internally to implement some of the components
7656 of <productname>PostgreSQL</>, such as procedural languages.
7657 Therefore, the <structname>pg_cursors</> view might include cursors
7658 that have not been explicitly created by the user.
7664 <title><structname>pg_cursors</> Columns</title>
7671 <entry>Description</entry>
7677 <entry><structfield>name</structfield></entry>
7678 <entry><type>text</type></entry>
7679 <entry>The name of the cursor</entry>
7683 <entry><structfield>statement</structfield></entry>
7684 <entry><type>text</type></entry>
7685 <entry>The verbatim query string submitted to declare this cursor</entry>
7689 <entry><structfield>is_holdable</structfield></entry>
7690 <entry><type>boolean</type></entry>
7692 <literal>true</literal> if the cursor is holdable (that is, it
7693 can be accessed after the transaction that declared the cursor
7694 has committed); <literal>false</literal> otherwise
7699 <entry><structfield>is_binary</structfield></entry>
7700 <entry><type>boolean</type></entry>
7702 <literal>true</literal> if the cursor was declared
7703 <literal>BINARY</literal>; <literal>false</literal>
7709 <entry><structfield>is_scrollable</structfield></entry>
7710 <entry><type>boolean</type></entry>
7712 <literal>true</> if the cursor is scrollable (that is, it
7713 allows rows to be retrieved in a nonsequential manner);
7714 <literal>false</literal> otherwise
7719 <entry><structfield>creation_time</structfield></entry>
7720 <entry><type>timestamptz</type></entry>
7721 <entry>The time at which the cursor was declared</entry>
7728 The <structname>pg_cursors</structname> view is read only.
7733 <sect1 id="view-pg-file-settings">
7734 <title><structname>pg_file_settings</structname></title>
7736 <indexterm zone="view-pg-file-settings">
7737 <primary>pg_file_settings</primary>
7741 The view <structname>pg_file_settings</structname> provides a summary of
7742 the contents of the server's configuration file(s). A row appears in
7743 this view for each <quote>name = value</> entry appearing in the files,
7744 with annotations indicating whether the value could be applied
7745 successfully. Additional row(s) may appear for problems not linked to
7746 a <quote>name = value</> entry, such as syntax errors in the files.
7750 This view is helpful for checking whether planned changes in the
7751 configuration files will work, or for diagnosing a previous failure.
7752 Note that this view reports on the <emphasis>current</> contents of the
7753 files, not on what was last applied by the server. (The
7754 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
7755 view is usually sufficient to determine that.)
7759 The <structname>pg_file_settings</structname> view can be read only by
7764 <title><structname>pg_file_settings</> Columns</title>
7771 <entry>Description</entry>
7776 <entry><structfield>sourcefile</structfield></entry>
7777 <entry><structfield>text</structfield></entry>
7778 <entry>Full path name of the configuration file</entry>
7781 <entry><structfield>sourceline</structfield></entry>
7782 <entry><structfield>integer</structfield></entry>
7784 Line number within the configuration file where the entry appears
7788 <entry><structfield>seqno</structfield></entry>
7789 <entry><structfield>integer</structfield></entry>
7790 <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
7793 <entry><structfield>name</structfield></entry>
7794 <entry><structfield>text</structfield></entry>
7795 <entry>Configuration parameter name</entry>
7798 <entry><structfield>setting</structfield></entry>
7799 <entry><structfield>text</structfield></entry>
7800 <entry>Value to be assigned to the parameter</entry>
7803 <entry><structfield>applied</structfield></entry>
7804 <entry><structfield>boolean</structfield></entry>
7805 <entry>True if the value can be applied successfully</entry>
7808 <entry><structfield>error</structfield></entry>
7809 <entry><structfield>text</structfield></entry>
7810 <entry>If not null, an error message indicating why this entry could
7811 not be applied</entry>
7818 If the configuration file contains syntax errors or invalid parameter
7819 names, the server will not attempt to apply any settings from it, and
7820 therefore all the <structfield>applied</> fields will read as false.
7821 In such a case there will be one or more rows with
7822 non-null <structfield>error</structfield> fields indicating the
7823 problem(s). Otherwise, individual settings will be applied if possible.
7824 If an individual setting cannot be applied (e.g., invalid value, or the
7825 setting cannot be changed after server start) it will have an appropriate
7826 message in the <structfield>error</structfield> field. Another way that
7827 an entry might have <structfield>applied</> = false is that it is
7828 overridden by a later entry for the same parameter name; this case is not
7829 considered an error so nothing appears in
7830 the <structfield>error</structfield> field.
7834 See <xref linkend="config-setting"> for more information about the various
7835 ways to change run-time parameters.
7840 <sect1 id="view-pg-group">
7841 <title><structname>pg_group</structname></title>
7843 <indexterm zone="view-pg-group">
7844 <primary>pg_group</primary>
7848 The view <structname>pg_group</structname> exists for backwards
7849 compatibility: it emulates a catalog that existed in
7850 <productname>PostgreSQL</productname> before version 8.1.
7851 It shows the names and members of all roles that are marked as not
7852 <structfield>rolcanlogin</>, which is an approximation to the set
7853 of roles that are being used as groups.
7857 <title><structname>pg_group</> Columns</title>
7864 <entry>References</entry>
7865 <entry>Description</entry>
7871 <entry><structfield>groname</structfield></entry>
7872 <entry><type>name</type></entry>
7873 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7874 <entry>Name of the group</entry>
7878 <entry><structfield>grosysid</structfield></entry>
7879 <entry><type>oid</type></entry>
7880 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7881 <entry>ID of this group</entry>
7885 <entry><structfield>grolist</structfield></entry>
7886 <entry><type>oid[]</type></entry>
7887 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7888 <entry>An array containing the IDs of the roles in this group</entry>
7896 <sect1 id="view-pg-indexes">
7897 <title><structname>pg_indexes</structname></title>
7899 <indexterm zone="view-pg-indexes">
7900 <primary>pg_indexes</primary>
7904 The view <structname>pg_indexes</structname> provides access to
7905 useful information about each index in the database.
7909 <title><structname>pg_indexes</> Columns</title>
7916 <entry>References</entry>
7917 <entry>Description</entry>
7922 <entry><structfield>schemaname</structfield></entry>
7923 <entry><type>name</type></entry>
7924 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7925 <entry>Name of schema containing table and index</entry>
7928 <entry><structfield>tablename</structfield></entry>
7929 <entry><type>name</type></entry>
7930 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7931 <entry>Name of table the index is for</entry>
7934 <entry><structfield>indexname</structfield></entry>
7935 <entry><type>name</type></entry>
7936 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7937 <entry>Name of index</entry>
7940 <entry><structfield>tablespace</structfield></entry>
7941 <entry><type>name</type></entry>
7942 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7943 <entry>Name of tablespace containing index (null if default for database)</entry>
7946 <entry><structfield>indexdef</structfield></entry>
7947 <entry><type>text</type></entry>
7949 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
7958 <sect1 id="view-pg-locks">
7959 <title><structname>pg_locks</structname></title>
7961 <indexterm zone="view-pg-locks">
7962 <primary>pg_locks</primary>
7966 The view <structname>pg_locks</structname> provides access to
7967 information about the locks held by active processes within the
7968 database server. See <xref linkend="mvcc"> for more discussion
7973 <structname>pg_locks</structname> contains one row per active lockable
7974 object, requested lock mode, and relevant process. Thus, the same
7975 lockable object might
7976 appear many times, if multiple processes are holding or waiting
7977 for locks on it. However, an object that currently has no locks on it
7978 will not appear at all.
7982 There are several distinct types of lockable objects:
7983 whole relations (e.g., tables), individual pages of relations,
7984 individual tuples of relations,
7985 transaction IDs (both virtual and permanent IDs),
7986 and general database objects (identified by class OID and object OID,
7987 in the same way as in <structname>pg_description</structname> or
7988 <structname>pg_depend</structname>). Also, the right to extend a
7989 relation is represented as a separate lockable object.
7990 Also, <quote>advisory</> locks can be taken on numbers that have
7991 user-defined meanings.
7995 <title><structname>pg_locks</> Columns</title>
8002 <entry>References</entry>
8003 <entry>Description</entry>
8008 <entry><structfield>locktype</structfield></entry>
8009 <entry><type>text</type></entry>
8012 Type of the lockable object:
8013 <literal>relation</>,
8017 <literal>transactionid</>,
8018 <literal>virtualxid</>,
8020 <literal>userlock</>, or
8021 <literal>advisory</>
8025 <entry><structfield>database</structfield></entry>
8026 <entry><type>oid</type></entry>
8027 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8029 OID of the database in which the lock target exists, or
8030 zero if the target is a shared object, or
8031 null if the target is a transaction ID
8035 <entry><structfield>relation</structfield></entry>
8036 <entry><type>oid</type></entry>
8037 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8039 OID of the relation targeted by the lock, or null if the target is not
8040 a relation or part of a relation
8044 <entry><structfield>page</structfield></entry>
8045 <entry><type>integer</type></entry>
8048 Page number targeted by the lock within the relation,
8049 or null if the target is not a relation page or tuple
8053 <entry><structfield>tuple</structfield></entry>
8054 <entry><type>smallint</type></entry>
8057 Tuple number targeted by the lock within the page,
8058 or null if the target is not a tuple
8062 <entry><structfield>virtualxid</structfield></entry>
8063 <entry><type>text</type></entry>
8066 Virtual ID of the transaction targeted by the lock,
8067 or null if the target is not a virtual transaction ID
8071 <entry><structfield>transactionid</structfield></entry>
8072 <entry><type>xid</type></entry>
8075 ID of the transaction targeted by the lock,
8076 or null if the target is not a transaction ID
8080 <entry><structfield>classid</structfield></entry>
8081 <entry><type>oid</type></entry>
8082 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8084 OID of the system catalog containing the lock target, or null if the
8085 target is not a general database object
8089 <entry><structfield>objid</structfield></entry>
8090 <entry><type>oid</type></entry>
8091 <entry>any OID column</entry>
8093 OID of the lock target within its system catalog, or null if the
8094 target is not a general database object
8098 <entry><structfield>objsubid</structfield></entry>
8099 <entry><type>smallint</type></entry>
8102 Column number targeted by the lock (the
8103 <structfield>classid</> and <structfield>objid</> refer to the
8105 or zero if the target is some other general database object,
8106 or null if the target is not a general database object
8110 <entry><structfield>virtualtransaction</structfield></entry>
8111 <entry><type>text</type></entry>
8114 Virtual ID of the transaction that is holding or awaiting this lock
8118 <entry><structfield>pid</structfield></entry>
8119 <entry><type>integer</type></entry>
8122 Process ID of the server process holding or awaiting this
8123 lock, or null if the lock is held by a prepared transaction
8127 <entry><structfield>mode</structfield></entry>
8128 <entry><type>text</type></entry>
8130 <entry>Name of the lock mode held or desired by this process (see <xref
8131 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8134 <entry><structfield>granted</structfield></entry>
8135 <entry><type>boolean</type></entry>
8137 <entry>True if lock is held, false if lock is awaited</entry>
8140 <entry><structfield>fastpath</structfield></entry>
8141 <entry><type>boolean</type></entry>
8143 <entry>True if lock was taken via fast path, false if taken via main
8151 <structfield>granted</structfield> is true in a row representing a lock
8152 held by the indicated process. False indicates that this process is
8153 currently waiting to acquire this lock, which implies that at least one
8154 other process is holding or waiting for a conflicting lock mode on the same
8155 lockable object. The waiting process will sleep until the other lock is
8156 released (or a deadlock situation is detected). A single process can be
8157 waiting to acquire at most one lock at a time.
8161 Throughout running a transaction, a server process holds an exclusive lock
8162 on the transaction's virtual transaction ID. If a permanent ID is assigned
8163 to the transaction (which normally happens only if the transaction changes
8164 the state of the database), it also holds an exclusive lock on the
8165 transaction's permanent transaction ID until it ends. When a process finds
8166 it necessary to wait specifically for another transaction to end, it does
8167 so by attempting to acquire share lock on the other transaction's ID
8168 (either virtual or permanent ID depending on the situation). That will
8169 succeed only when the other transaction terminates and releases its locks.
8173 Although tuples are a lockable type of object,
8174 information about row-level locks is stored on disk, not in memory,
8175 and therefore row-level locks normally do not appear in this view.
8176 If a process is waiting for a
8177 row-level lock, it will usually appear in the view as waiting for the
8178 permanent transaction ID of the current holder of that row lock.
8182 Advisory locks can be acquired on keys consisting of either a single
8183 <type>bigint</type> value or two integer values.
8184 A <type>bigint</type> key is displayed with its
8185 high-order half in the <structfield>classid</> column, its low-order half
8186 in the <structfield>objid</> column, and <structfield>objsubid</> equal
8187 to 1. The original <type>bigint</type> value can be reassembled with the
8188 expression <literal>(classid::bigint << 32) |
8189 objid::bigint</literal>. Integer keys are displayed with the
8191 <structfield>classid</> column, the second key in the <structfield>objid</>
8192 column, and <structfield>objsubid</> equal to 2. The actual meaning of
8193 the keys is up to the user. Advisory locks are local to each database,
8194 so the <structfield>database</> column is meaningful for an advisory lock.
8198 <structname>pg_locks</structname> provides a global view of all locks
8199 in the database cluster, not only those relevant to the current database.
8200 Although its <structfield>relation</structfield> column can be joined
8201 against <structname>pg_class</>.<structfield>oid</> to identify locked
8202 relations, this will only work correctly for relations in the current
8203 database (those for which the <structfield>database</structfield> column
8204 is either the current database's OID or zero).
8208 The <structfield>pid</structfield> column can be joined to the
8209 <structfield>pid</structfield> column of the <link
8210 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8212 information on the session holding or awaiting each lock,
8215 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8216 ON pl.pid = psa.pid;
8218 Also, if you are using prepared transactions, the
8219 <structfield>virtualtransaction</> column can be joined to the
8220 <structfield>transaction</structfield> column of the <link
8221 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8222 view to get more information on prepared transactions that hold locks.
8223 (A prepared transaction can never be waiting for a lock,
8224 but it continues to hold the locks it acquired while running.)
8227 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8228 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8233 While it is possible to obtain information about which processes block
8234 which other processes by joining <structname>pg_locks</structname> against
8235 itself, this is very difficult to get right in detail. Such a query would
8236 have to encode knowledge about which lock modes conflict with which
8237 others. Worse, the <structname>pg_locks</structname> view does not expose
8238 information about which processes are ahead of which others in lock wait
8239 queues, nor information about which processes are parallel workers running
8240 on behalf of which other client sessions. It is better to use
8241 the <function>pg_blocking_pids()</> function
8242 (see <xref linkend="functions-info-session-table">) to identify which
8243 process(es) a waiting process is blocked behind.
8247 The <structname>pg_locks</structname> view displays data from both the
8248 regular lock manager and the predicate lock manager, which are
8249 separate systems; in addition, the regular lock manager subdivides its
8250 locks into regular and <firstterm>fast-path</> locks.
8251 This data is not guaranteed to be entirely consistent.
8252 When the view is queried,
8253 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8254 is gathered from each backend one at a time, without freezing the state of
8255 the entire lock manager, so it is possible for locks to be taken or
8256 released while information is gathered. Note, however, that these locks are
8257 known not to conflict with any other lock currently in place. After
8258 all backends have been queried for fast-path locks, the remainder of the
8259 regular lock manager is locked as a unit, and a consistent snapshot of all
8260 remaining locks is collected as an atomic action. After unlocking the
8261 regular lock manager, the predicate lock manager is similarly locked and all
8262 predicate locks are collected as an atomic action. Thus, with the exception
8263 of fast-path locks, each lock manager will deliver a consistent set of
8264 results, but as we do not lock both lock managers simultaneously, it is
8265 possible for locks to be taken or released after we interrogate the regular
8266 lock manager and before we interrogate the predicate lock manager.
8270 Locking the regular and/or predicate lock manager could have some
8271 impact on database performance if this view is very frequently accessed.
8272 The locks are held only for the minimum amount of time necessary to
8273 obtain data from the lock managers, but this does not completely eliminate
8274 the possibility of a performance impact.
8279 <sect1 id="view-pg-matviews">
8280 <title><structname>pg_matviews</structname></title>
8282 <indexterm zone="view-pg-matviews">
8283 <primary>pg_matviews</primary>
8286 <indexterm zone="view-pg-matviews">
8287 <primary>materialized views</primary>
8291 The view <structname>pg_matviews</structname> provides access to
8292 useful information about each materialized view in the database.
8296 <title><structname>pg_matviews</> Columns</title>
8303 <entry>References</entry>
8304 <entry>Description</entry>
8309 <entry><structfield>schemaname</structfield></entry>
8310 <entry><type>name</type></entry>
8311 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8312 <entry>Name of schema containing materialized view</entry>
8315 <entry><structfield>matviewname</structfield></entry>
8316 <entry><type>name</type></entry>
8317 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8318 <entry>Name of materialized view</entry>
8321 <entry><structfield>matviewowner</structfield></entry>
8322 <entry><type>name</type></entry>
8323 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8324 <entry>Name of materialized view's owner</entry>
8327 <entry><structfield>tablespace</structfield></entry>
8328 <entry><type>name</type></entry>
8329 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8330 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8333 <entry><structfield>hasindexes</structfield></entry>
8334 <entry><type>boolean</type></entry>
8336 <entry>True if materialized view has (or recently had) any indexes</entry>
8339 <entry><structfield>ispopulated</structfield></entry>
8340 <entry><type>boolean</type></entry>
8342 <entry>True if materialized view is currently populated</entry>
8345 <entry><structfield>definition</structfield></entry>
8346 <entry><type>text</type></entry>
8348 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8356 <sect1 id="view-pg-policies">
8357 <title><structname>pg_policies</structname></title>
8359 <indexterm zone="view-pg-policies">
8360 <primary>pg_policies</primary>
8364 The view <structname>pg_policies</structname> provides access to
8365 useful information about each row-level security policy in the database.
8369 <title><structname>pg_policies</> Columns</title>
8376 <entry>References</entry>
8377 <entry>Description</entry>
8382 <entry><structfield>schemaname</structfield></entry>
8383 <entry><type>name</type></entry>
8384 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8385 <entry>Name of schema containing table policy is on</entry>
8388 <entry><structfield>tablename</structfield></entry>
8389 <entry><type>name</type></entry>
8390 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8391 <entry>Name of table policy is on</entry>
8394 <entry><structfield>policyname</structfield></entry>
8395 <entry><type>name</type></entry>
8396 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
8397 <entry>Name of policy</entry>
8400 <entry><structfield>roles</structfield></entry>
8401 <entry><type>name[]</type></entry>
8403 <entry>The roles to which this policy applies</entry>
8406 <entry><structfield>cmd</structfield></entry>
8407 <entry><type>text</type></entry>
8409 <entry>The command type to which the policy is applied</entry>
8412 <entry><structfield>qual</structfield></entry>
8413 <entry><type>text</type></entry>
8415 <entry>The expression added to the security barrier qualifications for
8416 queries that this policy applies to</entry>
8419 <entry><structfield>with_check</structfield></entry>
8420 <entry><type>text</type></entry>
8422 <entry>The expression added to the WITH CHECK qualifications for
8423 queries that attempt to add rows to this table</entry>
8431 <sect1 id="view-pg-prepared-statements">
8432 <title><structname>pg_prepared_statements</structname></title>
8434 <indexterm zone="view-pg-prepared-statements">
8435 <primary>pg_prepared_statements</primary>
8439 The <structname>pg_prepared_statements</structname> view displays
8440 all the prepared statements that are available in the current
8441 session. See <xref linkend="sql-prepare"> for more information about prepared
8446 <structname>pg_prepared_statements</structname> contains one row
8447 for each prepared statement. Rows are added to the view when a new
8448 prepared statement is created and removed when a prepared statement
8449 is released (for example, via the <xref linkend="sql-deallocate"> command).
8453 <title><structname>pg_prepared_statements</> Columns</title>
8460 <entry>Description</entry>
8465 <entry><structfield>name</structfield></entry>
8466 <entry><type>text</type></entry>
8468 The identifier of the prepared statement
8472 <entry><structfield>statement</structfield></entry>
8473 <entry><type>text</type></entry>
8475 The query string submitted by the client to create this
8476 prepared statement. For prepared statements created via SQL,
8477 this is the <command>PREPARE</command> statement submitted by
8478 the client. For prepared statements created via the
8479 frontend/backend protocol, this is the text of the prepared
8484 <entry><structfield>prepare_time</structfield></entry>
8485 <entry><type>timestamptz</type></entry>
8487 The time at which the prepared statement was created
8491 <entry><structfield>parameter_types</structfield></entry>
8492 <entry><type>regtype[]</type></entry>
8494 The expected parameter types for the prepared statement in the
8495 form of an array of <type>regtype</type>. The OID corresponding
8496 to an element of this array can be obtained by casting the
8497 <type>regtype</type> value to <type>oid</type>.
8501 <entry><structfield>from_sql</structfield></entry>
8502 <entry><type>boolean</type></entry>
8504 <literal>true</literal> if the prepared statement was created
8505 via the <command>PREPARE</command> SQL statement;
8506 <literal>false</literal> if the statement was prepared via the
8507 frontend/backend protocol
8515 The <structname>pg_prepared_statements</structname> view is read only.
8519 <sect1 id="view-pg-prepared-xacts">
8520 <title><structname>pg_prepared_xacts</structname></title>
8522 <indexterm zone="view-pg-prepared-xacts">
8523 <primary>pg_prepared_xacts</primary>
8527 The view <structname>pg_prepared_xacts</structname> displays
8528 information about transactions that are currently prepared for two-phase
8529 commit (see <xref linkend="sql-prepare-transaction"> for details).
8533 <structname>pg_prepared_xacts</structname> contains one row per prepared
8534 transaction. An entry is removed when the transaction is committed or
8539 <title><structname>pg_prepared_xacts</> Columns</title>
8546 <entry>References</entry>
8547 <entry>Description</entry>
8552 <entry><structfield>transaction</structfield></entry>
8553 <entry><type>xid</type></entry>
8556 Numeric transaction identifier of the prepared transaction
8560 <entry><structfield>gid</structfield></entry>
8561 <entry><type>text</type></entry>
8564 Global transaction identifier that was assigned to the transaction
8568 <entry><structfield>prepared</structfield></entry>
8569 <entry><type>timestamp with time zone</type></entry>
8572 Time at which the transaction was prepared for commit
8576 <entry><structfield>owner</structfield></entry>
8577 <entry><type>name</type></entry>
8578 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8580 Name of the user that executed the transaction
8584 <entry><structfield>database</structfield></entry>
8585 <entry><type>name</type></entry>
8586 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8588 Name of the database in which the transaction was executed
8596 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8597 internal transaction manager data structures are momentarily locked, and
8598 a copy is made for the view to display. This ensures that the
8599 view produces a consistent set of results, while not blocking
8600 normal operations longer than necessary. Nonetheless
8601 there could be some impact on database performance if this view is
8602 frequently accessed.
8607 <sect1 id="view-pg-replication-origin-status">
8608 <title><structname>pg_replication_origin_status</structname></title>
8610 <indexterm zone="view-pg-replication-origin-status">
8611 <primary>pg_replication_origin_status</primary>
8615 The <structname>pg_replication_origin_status</structname> view
8616 contains information about how far replay for a certain origin has
8617 progressed. For more on replication origins
8618 see <xref linkend="replication-origins">.
8623 <title><structname>pg_replication_origin_status</structname> Columns</title>
8630 <entry>References</entry>
8631 <entry>Description</entry>
8637 <entry><structfield>local_id</structfield></entry>
8638 <entry><type>Oid</type></entry>
8639 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
8640 <entry>internal node identifier</entry>
8644 <entry><structfield>external_id</structfield></entry>
8645 <entry><type>text</type></entry>
8646 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
8647 <entry>external node identifier</entry>
8651 <entry><structfield>remote_lsn</structfield></entry>
8652 <entry><type>pg_lsn</type></entry>
8654 <entry>The origin node's LSN up to which data has been replicated.</entry>
8658 <entry><structfield>local_lsn</structfield></entry>
8659 <entry><type>pg_lsn</type></entry>
8662 This node's LSN at which <literal>remote_lsn</literal> has
8663 been replicated. Used to flush commit records before persisting
8664 data to disk when using asynchronous commits.
8672 <sect1 id="view-pg-replication-slots">
8673 <title><structname>pg_replication_slots</structname></title>
8675 <indexterm zone="view-pg-replication-slots">
8676 <primary>pg_replication_slots</primary>
8680 The <structname>pg_replication_slots</structname> view provides a listing
8681 of all replication slots that currently exist on the database cluster,
8682 along with their current state.
8686 For more on replication slots,
8687 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
8692 <title><structname>pg_replication_slots</structname> Columns</title>
8699 <entry>References</entry>
8700 <entry>Description</entry>
8706 <entry><structfield>slot_name</structfield></entry>
8707 <entry><type>name</type></entry>
8709 <entry>A unique, cluster-wide identifier for the replication slot</entry>
8713 <entry><structfield>plugin</structfield></entry>
8714 <entry><type>name</type></entry>
8716 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
8720 <entry><structfield>slot_type</structfield></entry>
8721 <entry><type>text</type></entry>
8723 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
8727 <entry><structfield>datoid</structfield></entry>
8728 <entry><type>oid</type></entry>
8729 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8730 <entry>The OID of the database this slot is associated with, or
8731 null. Only logical slots have an associated database.</entry>
8735 <entry><structfield>database</structfield></entry>
8736 <entry><type>text</type></entry>
8737 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8738 <entry>The name of the database this slot is associated with, or
8739 null. Only logical slots have an associated database.</entry>
8743 <entry><structfield>active</structfield></entry>
8744 <entry><type>boolean</type></entry>
8746 <entry>True if this slot is currently actively being used</entry>
8750 <entry><structfield>active_pid</structfield></entry>
8751 <entry><type>integer</type></entry>
8753 <entry>The process ID of the session using this slot if the slot
8754 is currently actively being used. <literal>NULL</literal> if
8760 <entry><structfield>xmin</structfield></entry>
8761 <entry><type>xid</type></entry>
8763 <entry>The oldest transaction that this slot needs the database to
8764 retain. <literal>VACUUM</literal> cannot remove tuples deleted
8765 by any later transaction.
8770 <entry><structfield>catalog_xmin</structfield></entry>
8771 <entry><type>xid</type></entry>
8773 <entry>The oldest transaction affecting the system catalogs that this
8774 slot needs the database to retain. <literal>VACUUM</literal> cannot
8775 remove catalog tuples deleted by any later transaction.
8780 <entry><structfield>restart_lsn</structfield></entry>
8781 <entry><type>pg_lsn</type></entry>
8783 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
8784 might be required by the consumer of this slot and thus won't be
8785 automatically removed during checkpoints.
8790 <entry><structfield>confirmed_flush_lsn</structfield></entry>
8791 <entry><type>pg_lsn</type></entry>
8793 <entry>The address (<literal>LSN</literal>) up to which the logical
8794 slot's consumer has confirmed receiving data. Data older than this is
8795 not available anymore. <literal>NULL</> for physical slots.
8804 <sect1 id="view-pg-roles">
8805 <title><structname>pg_roles</structname></title>
8807 <indexterm zone="view-pg-roles">
8808 <primary>pg_roles</primary>
8812 The view <structname>pg_roles</structname> provides access to
8813 information about database roles. This is simply a publicly
8815 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8816 that blanks out the password field.
8820 This view explicitly exposes the OID column of the underlying table,
8821 since that is needed to do joins to other catalogs.
8825 <title><structname>pg_roles</> Columns</title>
8832 <entry>References</entry>
8833 <entry>Description</entry>
8839 <entry><structfield>rolname</structfield></entry>
8840 <entry><type>name</type></entry>
8842 <entry>Role name</entry>
8846 <entry><structfield>rolsuper</structfield></entry>
8847 <entry><type>bool</type></entry>
8849 <entry>Role has superuser privileges</entry>
8853 <entry><structfield>rolinherit</structfield></entry>
8854 <entry><type>bool</type></entry>
8856 <entry>Role automatically inherits privileges of roles it is a
8861 <entry><structfield>rolcreaterole</structfield></entry>
8862 <entry><type>bool</type></entry>
8864 <entry>Role can create more roles</entry>
8868 <entry><structfield>rolcreatedb</structfield></entry>
8869 <entry><type>bool</type></entry>
8871 <entry>Role can create databases</entry>
8875 <entry><structfield>rolcanlogin</structfield></entry>
8876 <entry><type>bool</type></entry>
8879 Role can log in. That is, this role can be given as the initial
8880 session authorization identifier
8885 <entry><structfield>rolreplication</structfield></entry>
8886 <entry><type>bool</type></entry>
8889 Role is a replication role. That is, this role can initiate streaming
8890 replication (see <xref linkend="streaming-replication">) and set/unset
8891 the system backup mode using <function>pg_start_backup</> and
8892 <function>pg_stop_backup</>
8897 <entry><structfield>rolconnlimit</structfield></entry>
8898 <entry><type>int4</type></entry>
8901 For roles that can log in, this sets maximum number of concurrent
8902 connections this role can make. -1 means no limit.
8907 <entry><structfield>rolpassword</structfield></entry>
8908 <entry><type>text</type></entry>
8910 <entry>Not the password (always reads as <literal>********</>)</entry>
8914 <entry><structfield>rolvaliduntil</structfield></entry>
8915 <entry><type>timestamptz</type></entry>
8917 <entry>Password expiry time (only used for password authentication);
8918 null if no expiration</entry>
8922 <entry><structfield>rolconfig</structfield></entry>
8923 <entry><type>text[]</type></entry>
8925 <entry>Role-specific defaults for run-time configuration variables</entry>
8929 <entry><structfield>oid</structfield></entry>
8930 <entry><type>oid</type></entry>
8931 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8932 <entry>ID of role</entry>
8940 <sect1 id="view-pg-rules">
8941 <title><structname>pg_rules</structname></title>
8943 <indexterm zone="view-pg-rules">
8944 <primary>pg_rules</primary>
8948 The view <structname>pg_rules</structname> provides access to
8949 useful information about query rewrite rules.
8953 <title><structname>pg_rules</> Columns</title>
8960 <entry>References</entry>
8961 <entry>Description</entry>
8966 <entry><structfield>schemaname</structfield></entry>
8967 <entry><type>name</type></entry>
8968 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8969 <entry>Name of schema containing table</entry>
8972 <entry><structfield>tablename</structfield></entry>
8973 <entry><type>name</type></entry>
8974 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8975 <entry>Name of table the rule is for</entry>
8978 <entry><structfield>rulename</structfield></entry>
8979 <entry><type>name</type></entry>
8980 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8981 <entry>Name of rule</entry>
8984 <entry><structfield>definition</structfield></entry>
8985 <entry><type>text</type></entry>
8987 <entry>Rule definition (a reconstructed creation command)</entry>
8994 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8995 of views and materialized views; those can be seen in
8996 <structname>pg_views</> and <structname>pg_matviews</>.
9001 <sect1 id="view-pg-seclabels">
9002 <title><structname>pg_seclabels</structname></title>
9004 <indexterm zone="view-pg-seclabels">
9005 <primary>pg_seclabels</primary>
9009 The view <structname>pg_seclabels</structname> provides information about
9010 security labels. It as an easier-to-query version of the
9011 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9015 <title><structname>pg_seclabels</> Columns</title>
9022 <entry>References</entry>
9023 <entry>Description</entry>
9028 <entry><structfield>objoid</structfield></entry>
9029 <entry><type>oid</type></entry>
9030 <entry>any OID column</entry>
9031 <entry>The OID of the object this security label pertains to</entry>
9034 <entry><structfield>classoid</structfield></entry>
9035 <entry><type>oid</type></entry>
9036 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9037 <entry>The OID of the system catalog this object appears in</entry>
9040 <entry><structfield>objsubid</structfield></entry>
9041 <entry><type>int4</type></entry>
9044 For a security label on a table column, this is the column number (the
9045 <structfield>objoid</> and <structfield>classoid</> refer to
9046 the table itself). For all other object types, this column is
9051 <entry><structfield>objtype</structfield></entry>
9052 <entry><type>text</type></entry>
9055 The type of object to which this label applies, as text.
9059 <entry><structfield>objnamespace</structfield></entry>
9060 <entry><type>oid</type></entry>
9061 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9063 The OID of the namespace for this object, if applicable;
9068 <entry><structfield>objname</structfield></entry>
9069 <entry><type>text</type></entry>
9072 The name of the object to which this label applies, as text.
9076 <entry><structfield>provider</structfield></entry>
9077 <entry><type>text</type></entry>
9078 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9079 <entry>The label provider associated with this label.</entry>
9082 <entry><structfield>label</structfield></entry>
9083 <entry><type>text</type></entry>
9084 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
9085 <entry>The security label applied to this object.</entry>
9092 <sect1 id="view-pg-settings">
9093 <title><structname>pg_settings</structname></title>
9095 <indexterm zone="view-pg-settings">
9096 <primary>pg_settings</primary>
9100 The view <structname>pg_settings</structname> provides access to
9101 run-time parameters of the server. It is essentially an alternative
9102 interface to the <xref linkend="sql-show">
9103 and <xref linkend="sql-set"> commands.
9104 It also provides access to some facts about each parameter that are
9105 not directly available from <command>SHOW</>, such as minimum and
9110 <title><structname>pg_settings</> Columns</title>
9117 <entry>Description</entry>
9122 <entry><structfield>name</structfield></entry>
9123 <entry><type>text</type></entry>
9124 <entry>Run-time configuration parameter name</entry>
9127 <entry><structfield>setting</structfield></entry>
9128 <entry><type>text</type></entry>
9129 <entry>Current value of the parameter</entry>
9132 <entry><structfield>unit</structfield></entry>
9133 <entry><type>text</type></entry>
9134 <entry>Implicit unit of the parameter</entry>
9137 <entry><structfield>category</structfield></entry>
9138 <entry><type>text</type></entry>
9139 <entry>Logical group of the parameter</entry>
9142 <entry><structfield>short_desc</structfield></entry>
9143 <entry><type>text</type></entry>
9144 <entry>A brief description of the parameter</entry>
9147 <entry><structfield>extra_desc</structfield></entry>
9148 <entry><type>text</type></entry>
9149 <entry>Additional, more detailed, description of the parameter</entry>
9152 <entry><structfield>context</structfield></entry>
9153 <entry><type>text</type></entry>
9154 <entry>Context required to set the parameter's value (see below)</entry>
9157 <entry><structfield>vartype</structfield></entry>
9158 <entry><type>text</type></entry>
9159 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
9160 <literal>integer</>, <literal>real</>, or <literal>string</>)
9164 <entry><structfield>source</structfield></entry>
9165 <entry><type>text</type></entry>
9166 <entry>Source of the current parameter value</entry>
9169 <entry><structfield>min_val</structfield></entry>
9170 <entry><type>text</type></entry>
9171 <entry>Minimum allowed value of the parameter (null for non-numeric
9175 <entry><structfield>max_val</structfield></entry>
9176 <entry><type>text</type></entry>
9177 <entry>Maximum allowed value of the parameter (null for non-numeric
9181 <entry><structfield>enumvals</structfield></entry>
9182 <entry><type>text[]</type></entry>
9183 <entry>Allowed values of an enum parameter (null for non-enum
9187 <entry><structfield>boot_val</structfield></entry>
9188 <entry><type>text</type></entry>
9189 <entry>Parameter value assumed at server startup if the parameter is
9190 not otherwise set</entry>
9193 <entry><structfield>reset_val</structfield></entry>
9194 <entry><type>text</type></entry>
9195 <entry>Value that <command>RESET</command> would reset the parameter to
9196 in the current session</entry>
9199 <entry><structfield>sourcefile</structfield></entry>
9200 <entry><type>text</type></entry>
9201 <entry>Configuration file the current value was set in (null for
9202 values set from sources other than configuration files, or when
9203 examined by a non-superuser);
9204 helpful when using <literal>include</> directives in configuration files</entry>
9207 <entry><structfield>sourceline</structfield></entry>
9208 <entry><type>integer</type></entry>
9209 <entry>Line number within the configuration file the current value was
9210 set at (null for values set from sources other than configuration files,
9211 or when examined by a non-superuser)
9215 <entry><structfield>pending_restart</structfield></entry>
9216 <entry><type>boolean</type></entry>
9217 <entry><literal>true</literal> if the value has been changed in the
9218 configuration file but needs a restart; or <literal>false</literal>
9227 There are several possible values of <structfield>context</structfield>.
9228 In order of decreasing difficulty of changing the setting, they are:
9233 <!-- PGC_INTERNAL -->
9234 <term><literal>internal</literal></term>
9237 These settings cannot be changed directly; they reflect internally
9238 determined values. Some of them may be adjustable by rebuilding the
9239 server with different configuration options, or by changing options
9240 supplied to <command>initdb</command>.
9245 <!-- PGC_POSTMASTER -->
9246 <term><literal>postmaster</literal></term>
9249 These settings can only be applied when the server starts, so any change
9250 requires restarting the server. Values for these settings are typically
9251 stored in the <filename>postgresql.conf</filename> file, or passed on
9252 the command line when starting the server. Of course, settings with any
9253 of the lower <structfield>context</structfield> types can also be
9254 set at server start time.
9260 <term><literal>sighup</literal></term>
9263 Changes to these settings can be made in
9264 <filename>postgresql.conf</filename> without restarting the server.
9265 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
9266 cause it to re-read <filename>postgresql.conf</filename> and apply
9267 the changes. The postmaster will also forward the
9268 <systemitem>SIGHUP</systemitem> signal to its child processes so that
9269 they all pick up the new value.
9274 <!-- PGC_SU_BACKEND -->
9275 <term><literal>superuser-backend</literal></term>
9278 Changes to these settings can be made in
9279 <filename>postgresql.conf</filename> without restarting the server.
9280 They can also be set for a particular session in the connection request
9281 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9282 environment variable), but only if the connecting user is a superuser.
9283 However, these settings never change in a session after it is started.
9284 If you change them in <filename>postgresql.conf</filename>, send a
9285 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9286 re-read <filename>postgresql.conf</filename>. The new values will only
9287 affect subsequently-launched sessions.
9292 <!-- PGC_BACKEND -->
9293 <term><literal>backend</literal></term>
9296 Changes to these settings can be made in
9297 <filename>postgresql.conf</filename> without restarting the server.
9298 They can also be set for a particular session in the connection request
9299 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9300 environment variable); any user can make such a change for their session.
9301 However, these settings never change in a session after it is started.
9302 If you change them in <filename>postgresql.conf</filename>, send a
9303 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9304 re-read <filename>postgresql.conf</filename>. The new values will only
9305 affect subsequently-launched sessions.
9311 <term><literal>superuser</literal></term>
9314 These settings can be set from <filename>postgresql.conf</filename>,
9315 or within a session via the <command>SET</> command; but only superusers
9316 can change them via <command>SET</>. Changes in
9317 <filename>postgresql.conf</filename> will affect existing sessions
9318 only if no session-local value has been established with <command>SET</>.
9323 <!-- PGC_USERSET -->
9324 <term><literal>user</literal></term>
9327 These settings can be set from <filename>postgresql.conf</filename>,
9328 or within a session via the <command>SET</> command. Any user is
9329 allowed to change their session-local value. Changes in
9330 <filename>postgresql.conf</filename> will affect existing sessions
9331 only if no session-local value has been established with <command>SET</>.
9338 See <xref linkend="config-setting"> for more information about the various
9339 ways to change these parameters.
9343 The <structname>pg_settings</structname> view cannot be inserted into or
9344 deleted from, but it can be updated. An <command>UPDATE</command> applied
9345 to a row of <structname>pg_settings</structname> is equivalent to executing
9346 the <xref linkend="sql-set"> command on that named
9347 parameter. The change only affects the value used by the current
9348 session. If an <command>UPDATE</command> is issued within a transaction
9349 that is later aborted, the effects of the <command>UPDATE</command> command
9350 disappear when the transaction is rolled back. Once the surrounding
9351 transaction is committed, the effects will persist until the end of the
9352 session, unless overridden by another <command>UPDATE</command> or
9353 <command>SET</command>.
9358 <sect1 id="view-pg-shadow">
9359 <title><structname>pg_shadow</structname></title>
9361 <indexterm zone="view-pg-shadow">
9362 <primary>pg_shadow</primary>
9366 The view <structname>pg_shadow</structname> exists for backwards
9367 compatibility: it emulates a catalog that existed in
9368 <productname>PostgreSQL</productname> before version 8.1.
9369 It shows properties of all roles that are marked as
9370 <structfield>rolcanlogin</> in
9371 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
9375 The name stems from the fact that this table
9376 should not be readable by the public since it contains passwords.
9377 <link linkend="view-pg-user"><structname>pg_user</structname></link>
9378 is a publicly readable view on
9379 <structname>pg_shadow</structname> that blanks out the password field.
9383 <title><structname>pg_shadow</> Columns</title>
9390 <entry>References</entry>
9391 <entry>Description</entry>
9397 <entry><structfield>usename</structfield></entry>
9398 <entry><type>name</type></entry>
9399 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9400 <entry>User name</entry>
9404 <entry><structfield>usesysid</structfield></entry>
9405 <entry><type>oid</type></entry>
9406 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9407 <entry>ID of this user</entry>
9411 <entry><structfield>usecreatedb</structfield></entry>
9412 <entry><type>bool</type></entry>
9414 <entry>User can create databases</entry>
9418 <entry><structfield>usesuper</structfield></entry>
9419 <entry><type>bool</type></entry>
9421 <entry>User is a superuser</entry>
9425 <entry><structfield>userepl</structfield></entry>
9426 <entry><type>bool</type></entry>
9429 User can initiate streaming replication and put the system in and
9435 <entry><structfield>usebypassrls</structfield></entry>
9436 <entry><type>bool</type></entry>
9439 User bypasses every row level security policy, see
9440 <xref linkend="ddl-rowsecurity"> for more information.
9445 <entry><structfield>passwd</structfield></entry>
9446 <entry><type>text</type></entry>
9448 <entry>Password (possibly encrypted); null if none. See
9449 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9450 for details of how encrypted passwords are stored.</entry>
9454 <entry><structfield>valuntil</structfield></entry>
9455 <entry><type>abstime</type></entry>
9457 <entry>Password expiry time (only used for password authentication)</entry>
9461 <entry><structfield>useconfig</structfield></entry>
9462 <entry><type>text[]</type></entry>
9464 <entry>Session defaults for run-time configuration variables</entry>
9472 <sect1 id="view-pg-stats">
9473 <title><structname>pg_stats</structname></title>
9475 <indexterm zone="view-pg-stats">
9476 <primary>pg_stats</primary>
9480 The view <structname>pg_stats</structname> provides access to
9481 the information stored in the <link
9482 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
9483 catalog. This view allows access only to rows of
9484 <structname>pg_statistic</structname> that correspond to tables the
9485 user has permission to read, and therefore it is safe to allow public
9486 read access to this view.
9490 <structname>pg_stats</structname> is also designed to present the
9491 information in a more readable format than the underlying catalog
9492 — at the cost that its schema must be extended whenever new slot types
9493 are defined for <structname>pg_statistic</structname>.
9497 <title><structname>pg_stats</> Columns</title>
9504 <entry>References</entry>
9505 <entry>Description</entry>
9510 <entry><structfield>schemaname</structfield></entry>
9511 <entry><type>name</type></entry>
9512 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9513 <entry>Name of schema containing table</entry>
9517 <entry><structfield>tablename</structfield></entry>
9518 <entry><type>name</type></entry>
9519 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9520 <entry>Name of table</entry>
9524 <entry><structfield>attname</structfield></entry>
9525 <entry><type>name</type></entry>
9526 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9527 <entry>Name of the column described by this row</entry>
9531 <entry><structfield>inherited</structfield></entry>
9532 <entry><type>bool</type></entry>
9534 <entry>If true, this row includes inheritance child columns, not just the
9535 values in the specified table</entry>
9539 <entry><structfield>null_frac</structfield></entry>
9540 <entry><type>real</type></entry>
9542 <entry>Fraction of column entries that are null</entry>
9546 <entry><structfield>avg_width</structfield></entry>
9547 <entry><type>integer</type></entry>
9549 <entry>Average width in bytes of column's entries</entry>
9553 <entry><structfield>n_distinct</structfield></entry>
9554 <entry><type>real</type></entry>
9557 If greater than zero, the estimated number of distinct values in the
9558 column. If less than zero, the negative of the number of distinct
9559 values divided by the number of rows. (The negated form is used when
9560 <command>ANALYZE</> believes that the number of distinct values is
9561 likely to increase as the table grows; the positive form is used when
9562 the column seems to have a fixed number of possible values.) For
9563 example, -1 indicates a unique column in which the number of distinct
9564 values is the same as the number of rows.
9569 <entry><structfield>most_common_vals</structfield></entry>
9570 <entry><type>anyarray</type></entry>
9573 A list of the most common values in the column. (Null if
9574 no values seem to be more common than any others.)
9579 <entry><structfield>most_common_freqs</structfield></entry>
9580 <entry><type>real[]</type></entry>
9583 A list of the frequencies of the most common values,
9584 i.e., number of occurrences of each divided by total number of rows.
9585 (Null when <structfield>most_common_vals</structfield> is.)
9590 <entry><structfield>histogram_bounds</structfield></entry>
9591 <entry><type>anyarray</type></entry>
9594 A list of values that divide the column's values into groups of
9595 approximately equal population. The values in
9596 <structfield>most_common_vals</>, if present, are omitted from this
9597 histogram calculation. (This column is null if the column data type
9598 does not have a <literal><</> operator or if the
9599 <structfield>most_common_vals</> list accounts for the entire
9605 <entry><structfield>correlation</structfield></entry>
9606 <entry><type>real</type></entry>
9609 Statistical correlation between physical row ordering and
9610 logical ordering of the column values. This ranges from -1 to +1.
9611 When the value is near -1 or +1, an index scan on the column will
9612 be estimated to be cheaper than when it is near zero, due to reduction
9613 of random access to the disk. (This column is null if the column data
9614 type does not have a <literal><</> operator.)
9619 <entry><structfield>most_common_elems</structfield></entry>
9620 <entry><type>anyarray</type></entry>
9623 A list of non-null element values most often appearing within values of
9624 the column. (Null for scalar types.)
9629 <entry><structfield>most_common_elem_freqs</structfield></entry>
9630 <entry><type>real[]</type></entry>
9633 A list of the frequencies of the most common element values, i.e., the
9634 fraction of rows containing at least one instance of the given value.
9635 Two or three additional values follow the per-element frequencies;
9636 these are the minimum and maximum of the preceding per-element
9637 frequencies, and optionally the frequency of null elements.
9638 (Null when <structfield>most_common_elems</structfield> is.)
9643 <entry><structfield>elem_count_histogram</structfield></entry>
9644 <entry><type>real[]</type></entry>
9647 A histogram of the counts of distinct non-null element values within the
9648 values of the column, followed by the average number of distinct
9649 non-null elements. (Null for scalar types.)
9657 The maximum number of entries in the array fields can be controlled on a
9658 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9659 command, or globally by setting the
9660 <xref linkend="guc-default-statistics-target"> run-time parameter.
9665 <sect1 id="view-pg-tables">
9666 <title><structname>pg_tables</structname></title>
9668 <indexterm zone="view-pg-tables">
9669 <primary>pg_tables</primary>
9673 The view <structname>pg_tables</structname> provides access to
9674 useful information about each table in the database.
9678 <title><structname>pg_tables</> Columns</title>
9685 <entry>References</entry>
9686 <entry>Description</entry>
9691 <entry><structfield>schemaname</structfield></entry>
9692 <entry><type>name</type></entry>
9693 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9694 <entry>Name of schema containing table</entry>
9697 <entry><structfield>tablename</structfield></entry>
9698 <entry><type>name</type></entry>
9699 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9700 <entry>Name of table</entry>
9703 <entry><structfield>tableowner</structfield></entry>
9704 <entry><type>name</type></entry>
9705 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9706 <entry>Name of table's owner</entry>
9709 <entry><structfield>tablespace</structfield></entry>
9710 <entry><type>name</type></entry>
9711 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9712 <entry>Name of tablespace containing table (null if default for database)</entry>
9715 <entry><structfield>hasindexes</structfield></entry>
9716 <entry><type>boolean</type></entry>
9717 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9718 <entry>True if table has (or recently had) any indexes</entry>
9721 <entry><structfield>hasrules</structfield></entry>
9722 <entry><type>boolean</type></entry>
9723 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9724 <entry>True if table has (or once had) rules</entry>
9727 <entry><structfield>hastriggers</structfield></entry>
9728 <entry><type>boolean</type></entry>
9729 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9730 <entry>True if table has (or once had) triggers</entry>
9733 <entry><structfield>rowsecurity</structfield></entry>
9734 <entry><type>boolean</type></entry>
9735 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
9736 <entry>True if row security is enabled on the table</entry>
9744 <sect1 id="view-pg-timezone-abbrevs">
9745 <title><structname>pg_timezone_abbrevs</structname></title>
9747 <indexterm zone="view-pg-timezone-abbrevs">
9748 <primary>pg_timezone_abbrevs</primary>
9752 The view <structname>pg_timezone_abbrevs</structname> provides a list
9753 of time zone abbreviations that are currently recognized by the datetime
9754 input routines. The contents of this view change when the
9755 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9759 <title><structname>pg_timezone_abbrevs</> Columns</title>
9766 <entry>Description</entry>
9771 <entry><structfield>abbrev</structfield></entry>
9772 <entry><type>text</type></entry>
9773 <entry>Time zone abbreviation</entry>
9776 <entry><structfield>utc_offset</structfield></entry>
9777 <entry><type>interval</type></entry>
9778 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9781 <entry><structfield>is_dst</structfield></entry>
9782 <entry><type>boolean</type></entry>
9783 <entry>True if this is a daylight-savings abbreviation</entry>
9791 <sect1 id="view-pg-timezone-names">
9792 <title><structname>pg_timezone_names</structname></title>
9794 <indexterm zone="view-pg-timezone-names">
9795 <primary>pg_timezone_names</primary>
9799 The view <structname>pg_timezone_names</structname> provides a list
9800 of time zone names that are recognized by <command>SET TIMEZONE</>,
9801 along with their associated abbreviations, UTC offsets,
9802 and daylight-savings status. (Technically,
9803 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9804 than UTC because leap seconds are not handled.)
9805 Unlike the abbreviations shown in <link
9806 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9807 date rules. Therefore, the associated information changes across local DST
9808 boundaries. The displayed information is computed based on the current
9809 value of <function>CURRENT_TIMESTAMP</>.
9813 <title><structname>pg_timezone_names</> Columns</title>
9820 <entry>Description</entry>
9825 <entry><structfield>name</structfield></entry>
9826 <entry><type>text</type></entry>
9827 <entry>Time zone name</entry>
9830 <entry><structfield>abbrev</structfield></entry>
9831 <entry><type>text</type></entry>
9832 <entry>Time zone abbreviation</entry>
9835 <entry><structfield>utc_offset</structfield></entry>
9836 <entry><type>interval</type></entry>
9837 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9840 <entry><structfield>is_dst</structfield></entry>
9841 <entry><type>boolean</type></entry>
9842 <entry>True if currently observing daylight savings</entry>
9850 <sect1 id="view-pg-user">
9851 <title><structname>pg_user</structname></title>
9853 <indexterm zone="view-pg-user">
9854 <primary>pg_user</primary>
9858 The view <structname>pg_user</structname> provides access to
9859 information about database users. This is simply a publicly
9861 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9862 that blanks out the password field.
9866 <title><structname>pg_user</> Columns</title>
9873 <entry>Description</entry>
9878 <entry><structfield>usename</structfield></entry>
9879 <entry><type>name</type></entry>
9880 <entry>User name</entry>
9884 <entry><structfield>usesysid</structfield></entry>
9885 <entry><type>oid</type></entry>
9886 <entry>ID of this user</entry>
9890 <entry><structfield>usecreatedb</structfield></entry>
9891 <entry><type>bool</type></entry>
9892 <entry>User can create databases</entry>
9896 <entry><structfield>usesuper</structfield></entry>
9897 <entry><type>bool</type></entry>
9898 <entry>User is a superuser</entry>
9902 <entry><structfield>userepl</structfield></entry>
9903 <entry><type>bool</type></entry>
9905 User can initiate streaming replication and put the system in and
9911 <entry><structfield>usebypassrls</structfield></entry>
9912 <entry><type>bool</type></entry>
9914 User bypasses every row level security policy, see
9915 <xref linkend="ddl-rowsecurity"> for more information.
9920 <entry><structfield>passwd</structfield></entry>
9921 <entry><type>text</type></entry>
9922 <entry>Not the password (always reads as <literal>********</>)</entry>
9926 <entry><structfield>valuntil</structfield></entry>
9927 <entry><type>abstime</type></entry>
9928 <entry>Password expiry time (only used for password authentication)</entry>
9932 <entry><structfield>useconfig</structfield></entry>
9933 <entry><type>text[]</type></entry>
9934 <entry>Session defaults for run-time configuration variables</entry>
9942 <sect1 id="view-pg-user-mappings">
9943 <title><structname>pg_user_mappings</structname></title>
9945 <indexterm zone="view-pg-user-mappings">
9946 <primary>pg_user_mappings</primary>
9950 The view <structname>pg_user_mappings</structname> provides access
9951 to information about user mappings. This is essentially a publicly
9953 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9954 that leaves out the options field if the user has no rights to use
9959 <title><structname>pg_user_mappings</> Columns</title>
9966 <entry>References</entry>
9967 <entry>Description</entry>
9973 <entry><structfield>umid</structfield></entry>
9974 <entry><type>oid</type></entry>
9975 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
9976 <entry>OID of the user mapping</entry>
9980 <entry><structfield>srvid</structfield></entry>
9981 <entry><type>oid</type></entry>
9982 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
9984 The OID of the foreign server that contains this mapping
9989 <entry><structfield>srvname</structfield></entry>
9990 <entry><type>name</type></entry>
9991 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
9993 Name of the foreign server
9998 <entry><structfield>umuser</structfield></entry>
9999 <entry><type>oid</type></entry>
10000 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10001 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
10005 <entry><structfield>usename</structfield></entry>
10006 <entry><type>name</type></entry>
10008 <entry>Name of the local user to be mapped</entry>
10012 <entry><structfield>umoptions</structfield></entry>
10013 <entry><type>text[]</type></entry>
10016 User mapping specific options, as <quote>keyword=value</>
10017 strings, if the current user is the owner of the foreign
10027 <sect1 id="view-pg-views">
10028 <title><structname>pg_views</structname></title>
10030 <indexterm zone="view-pg-views">
10031 <primary>pg_views</primary>
10035 The view <structname>pg_views</structname> provides access to
10036 useful information about each view in the database.
10040 <title><structname>pg_views</> Columns</title>
10045 <entry>Name</entry>
10046 <entry>Type</entry>
10047 <entry>References</entry>
10048 <entry>Description</entry>
10053 <entry><structfield>schemaname</structfield></entry>
10054 <entry><type>name</type></entry>
10055 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10056 <entry>Name of schema containing view</entry>
10059 <entry><structfield>viewname</structfield></entry>
10060 <entry><type>name</type></entry>
10061 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10062 <entry>Name of view</entry>
10065 <entry><structfield>viewowner</structfield></entry>
10066 <entry><type>name</type></entry>
10067 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10068 <entry>Name of view's owner</entry>
10071 <entry><structfield>definition</structfield></entry>
10072 <entry><type>text</type></entry>
10074 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>