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 always 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, such as adding index access methods.
24 <sect1 id="catalogs-overview">
25 <title>Overview</title>
28 <xref linkend="catalog-table"> lists the system catalogs.
29 More detailed documentation of each catalog follows below.
33 Most system catalogs are copied from the template database during
34 database creation and are thereafter database-specific. A few
35 catalogs are physically shared across all databases in a cluster;
36 these are noted in the descriptions of the individual catalogs.
39 <table id="catalog-table">
40 <title>System Catalogs</title>
45 <entry>Catalog Name</entry>
46 <entry>Purpose</entry>
52 <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
53 <entry>aggregate functions</entry>
57 <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
58 <entry>index access methods</entry>
62 <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
63 <entry>access method operators</entry>
67 <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
68 <entry>access method support procedures</entry>
72 <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
73 <entry>column default values</entry>
77 <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
78 <entry>table columns (<quote>attributes</quote>)</entry>
82 <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
83 <entry>authorization identifiers (roles)</entry>
87 <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
88 <entry>authorization identifier membership relationships</entry>
92 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
93 <entry>casts (data type conversions)</entry>
97 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
98 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
102 <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
103 <entry>collations (locale information)</entry>
107 <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
108 <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
112 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
113 <entry>encoding conversion information</entry>
117 <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
118 <entry>databases within this database cluster</entry>
122 <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
123 <entry>per-role and per-database settings</entry>
127 <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
128 <entry>default privileges for object types</entry>
132 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
133 <entry>dependencies between database objects</entry>
137 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
138 <entry>descriptions or comments on database objects</entry>
142 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
143 <entry>enum label and value definitions</entry>
147 <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
148 <entry>event triggers</entry>
152 <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
153 <entry>installed extensions</entry>
157 <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
158 <entry>foreign-data wrapper definitions</entry>
162 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
163 <entry>foreign server definitions</entry>
167 <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
168 <entry>additional foreign table information</entry>
172 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
173 <entry>additional index information</entry>
177 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
178 <entry>table inheritance hierarchy</entry>
182 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
183 <entry>languages for writing functions</entry>
187 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
188 <entry>data pages for large objects</entry>
192 <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
193 <entry>metadata for large objects</entry>
197 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
198 <entry>schemas</entry>
202 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
203 <entry>access method operator classes</entry>
207 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
208 <entry>operators</entry>
212 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
213 <entry>access method operator families</entry>
217 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
218 <entry>template data for procedural languages</entry>
222 <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
223 <entry>row-security policies</entry>
227 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
228 <entry>functions and procedures</entry>
232 <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
233 <entry>information about range types</entry>
237 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
238 <entry>query rewrite rules</entry>
242 <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
243 <entry>registered replication origins</entry>
247 <entry><link linkend="catalog-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
248 <entry>information about replication origins, including replication progress</entry>
252 <entry><link linkend="catalog-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
253 <entry>replication slot information</entry>
257 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
258 <entry>security labels on database objects</entry>
262 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
263 <entry>dependencies on shared objects</entry>
267 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
268 <entry>comments on shared objects</entry>
272 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
273 <entry>security labels on shared database objects</entry>
277 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
278 <entry>planner statistics</entry>
282 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
283 <entry>tablespaces within this database cluster</entry>
287 <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
288 <entry>transforms (data type to procedural language conversions)</entry>
292 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
293 <entry>triggers</entry>
297 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
298 <entry>text search configurations</entry>
302 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
303 <entry>text search configurations' token mappings</entry>
307 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
308 <entry>text search dictionaries</entry>
312 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
313 <entry>text search parsers</entry>
317 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
318 <entry>text search templates</entry>
322 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
323 <entry>data types</entry>
327 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
328 <entry>mappings of users to foreign servers</entry>
336 <sect1 id="catalog-pg-aggregate">
337 <title><structname>pg_aggregate</structname></title>
339 <indexterm zone="catalog-pg-aggregate">
340 <primary>pg_aggregate</primary>
344 The catalog <structname>pg_aggregate</structname> stores information about
345 aggregate functions. An aggregate function is a function that
346 operates on a set of values (typically one column from each row
347 that matches a query condition) and returns a single value computed
348 from all these values. Typical aggregate functions are
349 <function>sum</function>, <function>count</function>, and
350 <function>max</function>. Each entry in
351 <structname>pg_aggregate</structname> is an extension of an entry
352 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
353 entry carries the aggregate's name, input and output data types, and
354 other information that is similar to ordinary functions.
358 <title><structname>pg_aggregate</> Columns</title>
365 <entry>References</entry>
366 <entry>Description</entry>
371 <entry><structfield>aggfnoid</structfield></entry>
372 <entry><type>regproc</type></entry>
373 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
374 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
377 <entry><structfield>aggkind</structfield></entry>
378 <entry><type>char</type></entry>
380 <entry>Aggregate kind:
381 <literal>n</literal> for <quote>normal</> aggregates,
382 <literal>o</literal> for <quote>ordered-set</> aggregates, or
383 <literal>h</literal> for <quote>hypothetical-set</> aggregates
387 <entry><structfield>aggnumdirectargs</structfield></entry>
388 <entry><type>int2</type></entry>
390 <entry>Number of direct (non-aggregated) arguments of an ordered-set or
391 hypothetical-set aggregate, counting a variadic array as one argument.
392 If equal to <structfield>pronargs</>, the aggregate must be variadic
393 and the variadic array describes the aggregated arguments as well as
394 the final direct arguments.
395 Always zero for normal aggregates.</entry>
398 <entry><structfield>aggtransfn</structfield></entry>
399 <entry><type>regproc</type></entry>
400 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
401 <entry>Transition function</entry>
404 <entry><structfield>aggfinalfn</structfield></entry>
405 <entry><type>regproc</type></entry>
406 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
407 <entry>Final function (zero if none)</entry>
410 <entry><structfield>aggmtransfn</structfield></entry>
411 <entry><type>regproc</type></entry>
412 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
413 <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
416 <entry><structfield>aggminvtransfn</structfield></entry>
417 <entry><type>regproc</type></entry>
418 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
419 <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
422 <entry><structfield>aggmfinalfn</structfield></entry>
423 <entry><type>regproc</type></entry>
424 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
425 <entry>Final function for moving-aggregate mode (zero if none)</entry>
428 <entry><structfield>aggfinalextra</structfield></entry>
429 <entry><type>bool</type></entry>
431 <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
434 <entry><structfield>aggmfinalextra</structfield></entry>
435 <entry><type>bool</type></entry>
437 <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
440 <entry><structfield>aggsortop</structfield></entry>
441 <entry><type>oid</type></entry>
442 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
443 <entry>Associated sort operator (zero if none)</entry>
446 <entry><structfield>aggtranstype</structfield></entry>
447 <entry><type>oid</type></entry>
448 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
449 <entry>Data type of the aggregate function's internal transition (state) data</entry>
452 <entry><structfield>aggtransspace</structfield></entry>
453 <entry><type>int4</type></entry>
455 <entry>Approximate average size (in bytes) of the transition state
456 data, or zero to use a default estimate</entry>
459 <entry><structfield>aggmtranstype</structfield></entry>
460 <entry><type>oid</type></entry>
461 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
462 <entry>Data type of the aggregate function's internal transition (state)
463 data for moving-aggregate mode (zero if none)</entry>
466 <entry><structfield>aggmtransspace</structfield></entry>
467 <entry><type>int4</type></entry>
469 <entry>Approximate average size (in bytes) of the transition state data
470 for moving-aggregate mode, or zero to use a default estimate</entry>
473 <entry><structfield>agginitval</structfield></entry>
474 <entry><type>text</type></entry>
477 The initial value of the transition state. This is a text
478 field containing the initial value in its external string
479 representation. If this field is null, the transition state
480 value starts out null.
484 <entry><structfield>aggminitval</structfield></entry>
485 <entry><type>text</type></entry>
488 The initial value of the transition state for moving-aggregate mode.
489 This is a text field containing the initial value in its external
490 string representation. If this field is null, the transition state
491 value starts out null.
499 New aggregate functions are registered with the <xref
500 linkend="sql-createaggregate">
501 command. See <xref linkend="xaggr"> for more information about
502 writing aggregate functions and the meaning of the transition
509 <sect1 id="catalog-pg-am">
510 <title><structname>pg_am</structname></title>
512 <indexterm zone="catalog-pg-am">
513 <primary>pg_am</primary>
517 The catalog <structname>pg_am</structname> stores information about index
518 access methods. There is one row for each index access method supported by
519 the system. The contents of this catalog are discussed in detail in
520 <xref linkend="indexam">.
524 <title><structname>pg_am</> Columns</title>
531 <entry>References</entry>
532 <entry>Description</entry>
538 <entry><structfield>oid</structfield></entry>
539 <entry><type>oid</type></entry>
541 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
545 <entry><structfield>amname</structfield></entry>
546 <entry><type>name</type></entry>
548 <entry>Name of the access method</entry>
552 <entry><structfield>amstrategies</structfield></entry>
553 <entry><type>int2</type></entry>
555 <entry>Number of operator strategies for this access method,
556 or zero if access method does not have a fixed set of operator
561 <entry><structfield>amsupport</structfield></entry>
562 <entry><type>int2</type></entry>
564 <entry>Number of support routines for this access method</entry>
568 <entry><structfield>amcanorder</structfield></entry>
569 <entry><type>bool</type></entry>
571 <entry>Does the access method support ordered scans sorted by the
572 indexed column's value?</entry>
576 <entry><structfield>amcanorderbyop</structfield></entry>
577 <entry><type>bool</type></entry>
579 <entry>Does the access method support ordered scans sorted by the result
580 of an operator on the indexed column?</entry>
584 <entry><structfield>amcanbackward</structfield></entry>
585 <entry><type>bool</type></entry>
587 <entry>Does the access method support backward scanning?</entry>
591 <entry><structfield>amcanunique</structfield></entry>
592 <entry><type>bool</type></entry>
594 <entry>Does the access method support unique indexes?</entry>
598 <entry><structfield>amcanmulticol</structfield></entry>
599 <entry><type>bool</type></entry>
601 <entry>Does the access method support multicolumn indexes?</entry>
605 <entry><structfield>amoptionalkey</structfield></entry>
606 <entry><type>bool</type></entry>
608 <entry>Does the access method support a scan without any constraint
609 for the first index column?</entry>
613 <entry><structfield>amsearcharray</structfield></entry>
614 <entry><type>bool</type></entry>
616 <entry>Does the access method support <literal>ScalarArrayOpExpr</> searches?</entry>
620 <entry><structfield>amsearchnulls</structfield></entry>
621 <entry><type>bool</type></entry>
623 <entry>Does the access method support <literal>IS NULL</>/<literal>NOT NULL</> searches?</entry>
627 <entry><structfield>amstorage</structfield></entry>
628 <entry><type>bool</type></entry>
630 <entry>Can index storage data type differ from column data type?</entry>
634 <entry><structfield>amclusterable</structfield></entry>
635 <entry><type>bool</type></entry>
637 <entry>Can an index of this type be clustered on?</entry>
641 <entry><structfield>ampredlocks</structfield></entry>
642 <entry><type>bool</type></entry>
644 <entry>Does an index of this type manage fine-grained predicate locks?</entry>
648 <entry><structfield>amkeytype</structfield></entry>
649 <entry><type>oid</type></entry>
650 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
651 <entry>Type of data stored in index, or zero if not a fixed type</entry>
655 <entry><structfield>aminsert</structfield></entry>
656 <entry><type>regproc</type></entry>
657 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
658 <entry><quote>Insert this tuple</quote> function</entry>
662 <entry><structfield>ambeginscan</structfield></entry>
663 <entry><type>regproc</type></entry>
664 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
665 <entry><quote>Prepare for index scan</quote> function</entry>
669 <entry><structfield>amgettuple</structfield></entry>
670 <entry><type>regproc</type></entry>
671 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
672 <entry><quote>Next valid tuple</quote> function, or zero if none</entry>
676 <entry><structfield>amgetbitmap</structfield></entry>
677 <entry><type>regproc</type></entry>
678 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
679 <entry><quote>Fetch all valid tuples</quote> function, or zero if none</entry>
683 <entry><structfield>amrescan</structfield></entry>
684 <entry><type>regproc</type></entry>
685 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
686 <entry><quote>(Re)start index scan</quote> function</entry>
690 <entry><structfield>amendscan</structfield></entry>
691 <entry><type>regproc</type></entry>
692 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
693 <entry><quote>Clean up after index scan</quote> function</entry>
697 <entry><structfield>ammarkpos</structfield></entry>
698 <entry><type>regproc</type></entry>
699 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
700 <entry><quote>Mark current scan position</quote> function</entry>
704 <entry><structfield>amrestrpos</structfield></entry>
705 <entry><type>regproc</type></entry>
706 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
707 <entry><quote>Restore marked scan position</quote> function</entry>
711 <entry><structfield>ambuild</structfield></entry>
712 <entry><type>regproc</type></entry>
713 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
714 <entry><quote>Build new index</quote> function</entry>
718 <entry><structfield>ambuildempty</structfield></entry>
719 <entry><type>regproc</type></entry>
720 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
721 <entry><quote>Build empty index</quote> function</entry>
725 <entry><structfield>ambulkdelete</structfield></entry>
726 <entry><type>regproc</type></entry>
727 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
728 <entry>Bulk-delete function</entry>
732 <entry><structfield>amvacuumcleanup</structfield></entry>
733 <entry><type>regproc</type></entry>
734 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
735 <entry>Post-<command>VACUUM</command> cleanup function</entry>
739 <entry><structfield>amcanreturn</structfield></entry>
740 <entry><type>regproc</type></entry>
741 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
742 <entry>Function to check whether an index column supports index-only
743 scans. Can be zero if index-only scans are never supported.</entry>
747 <entry><structfield>amcostestimate</structfield></entry>
748 <entry><type>regproc</type></entry>
749 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
750 <entry>Function to estimate cost of an index scan</entry>
754 <entry><structfield>amoptions</structfield></entry>
755 <entry><type>regproc</type></entry>
756 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
757 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
767 <sect1 id="catalog-pg-amop">
768 <title><structname>pg_amop</structname></title>
770 <indexterm zone="catalog-pg-amop">
771 <primary>pg_amop</primary>
775 The catalog <structname>pg_amop</structname> stores information about
776 operators associated with access method operator families. There is one
777 row for each operator that is a member of an operator family. A family
778 member can be either a <firstterm>search</> operator or an
779 <firstterm>ordering</> operator. An operator
780 can appear in more than one family, but cannot appear in more than one
781 search position nor more than one ordering position within a family.
782 (It is allowed, though unlikely, for an operator to be used for both
783 search and ordering purposes.)
787 <title><structname>pg_amop</> Columns</title>
794 <entry>References</entry>
795 <entry>Description</entry>
801 <entry><structfield>oid</structfield></entry>
802 <entry><type>oid</type></entry>
804 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
808 <entry><structfield>amopfamily</structfield></entry>
809 <entry><type>oid</type></entry>
810 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
811 <entry>The operator family this entry is for</entry>
815 <entry><structfield>amoplefttype</structfield></entry>
816 <entry><type>oid</type></entry>
817 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
818 <entry>Left-hand input data type of operator</entry>
822 <entry><structfield>amoprighttype</structfield></entry>
823 <entry><type>oid</type></entry>
824 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
825 <entry>Right-hand input data type of operator</entry>
829 <entry><structfield>amopstrategy</structfield></entry>
830 <entry><type>int2</type></entry>
832 <entry>Operator strategy number</entry>
836 <entry><structfield>amoppurpose</structfield></entry>
837 <entry><type>char</type></entry>
839 <entry>Operator purpose, either <literal>s</> for search or
840 <literal>o</> for ordering</entry>
844 <entry><structfield>amopopr</structfield></entry>
845 <entry><type>oid</type></entry>
846 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
847 <entry>OID of the operator</entry>
851 <entry><structfield>amopmethod</structfield></entry>
852 <entry><type>oid</type></entry>
853 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
854 <entry>Index access method operator family is for</entry>
858 <entry><structfield>amopsortfamily</structfield></entry>
859 <entry><type>oid</type></entry>
860 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
861 <entry>The B-tree operator family this entry sorts according to, if an
862 ordering operator; zero if a search operator</entry>
870 A <quote>search</> operator entry indicates that an index of this operator
871 family can be searched to find all rows satisfying
873 <replaceable>indexed_column</>
874 <replaceable>operator</>
875 <replaceable>constant</>.
876 Obviously, such an operator must return <type>boolean</type>, and its left-hand input
877 type must match the index's column data type.
881 An <quote>ordering</> operator entry indicates that an index of this
882 operator family can be scanned to return rows in the order represented by
884 <replaceable>indexed_column</>
885 <replaceable>operator</>
886 <replaceable>constant</>.
887 Such an operator could return any sortable data type, though again
888 its left-hand input type must match the index's column data type.
889 The exact semantics of the <literal>ORDER BY</> are specified by the
890 <structfield>amopsortfamily</structfield> column, which must reference
891 a B-tree operator family for the operator's result type.
896 At present, it's assumed that the sort order for an ordering operator
897 is the default for the referenced operator family, i.e., <literal>ASC NULLS
898 LAST</>. This might someday be relaxed by adding additional columns
899 to specify sort options explicitly.
904 An entry's <structfield>amopmethod</> must match the
905 <structname>opfmethod</> of its containing operator family (including
906 <structfield>amopmethod</> here is an intentional denormalization of the
907 catalog structure for performance reasons). Also,
908 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
909 the <structfield>oprleft</> and <structfield>oprright</> fields of the
910 referenced <structname>pg_operator</> entry.
916 <sect1 id="catalog-pg-amproc">
917 <title><structname>pg_amproc</structname></title>
919 <indexterm zone="catalog-pg-amproc">
920 <primary>pg_amproc</primary>
924 The catalog <structname>pg_amproc</structname> stores information about
925 support procedures associated with access method operator families. There
926 is one row for each support procedure belonging to an operator family.
930 <title><structname>pg_amproc</structname> Columns</title>
937 <entry>References</entry>
938 <entry>Description</entry>
944 <entry><structfield>oid</structfield></entry>
945 <entry><type>oid</type></entry>
947 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
951 <entry><structfield>amprocfamily</structfield></entry>
952 <entry><type>oid</type></entry>
953 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
954 <entry>The operator family this entry is for</entry>
958 <entry><structfield>amproclefttype</structfield></entry>
959 <entry><type>oid</type></entry>
960 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
961 <entry>Left-hand input data type of associated operator</entry>
965 <entry><structfield>amprocrighttype</structfield></entry>
966 <entry><type>oid</type></entry>
967 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
968 <entry>Right-hand input data type of associated operator</entry>
972 <entry><structfield>amprocnum</structfield></entry>
973 <entry><type>int2</type></entry>
975 <entry>Support procedure number</entry>
979 <entry><structfield>amproc</structfield></entry>
980 <entry><type>regproc</type></entry>
981 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
982 <entry>OID of the procedure</entry>
990 The usual interpretation of the
991 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
992 is that they identify the left and right input types of the operator(s)
993 that a particular support procedure supports. For some access methods
994 these match the input data type(s) of the support procedure itself, for
995 others not. There is a notion of <quote>default</> support procedures for
996 an index, which are those with <structfield>amproclefttype</> and
997 <structfield>amprocrighttype</> both equal to the index operator class's
998 <structfield>opcintype</>.
1004 <sect1 id="catalog-pg-attrdef">
1005 <title><structname>pg_attrdef</structname></title>
1007 <indexterm zone="catalog-pg-attrdef">
1008 <primary>pg_attrdef</primary>
1012 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
1013 about columns is stored in <structname>pg_attribute</structname>
1014 (see below). Only columns that explicitly specify a default value
1015 (when the table is created or the column is added) will have an
1020 <title><structname>pg_attrdef</> Columns</title>
1027 <entry>References</entry>
1028 <entry>Description</entry>
1034 <entry><structfield>oid</structfield></entry>
1035 <entry><type>oid</type></entry>
1037 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1041 <entry><structfield>adrelid</structfield></entry>
1042 <entry><type>oid</type></entry>
1043 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1044 <entry>The table this column belongs to</entry>
1048 <entry><structfield>adnum</structfield></entry>
1049 <entry><type>int2</type></entry>
1050 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
1051 <entry>The number of the column</entry>
1055 <entry><structfield>adbin</structfield></entry>
1056 <entry><type>pg_node_tree</type></entry>
1058 <entry>The internal representation of the column default value</entry>
1062 <entry><structfield>adsrc</structfield></entry>
1063 <entry><type>text</type></entry>
1065 <entry>A human-readable representation of the default value</entry>
1072 The <structfield>adsrc</structfield> field is historical, and is best
1073 not used, because it does not track outside changes that might affect
1074 the representation of the default value. Reverse-compiling the
1075 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
1076 example) is a better way to display the default value.
1082 <sect1 id="catalog-pg-attribute">
1083 <title><structname>pg_attribute</structname></title>
1085 <indexterm zone="catalog-pg-attribute">
1086 <primary>pg_attribute</primary>
1090 The catalog <structname>pg_attribute</structname> stores information about
1091 table columns. There will be exactly one
1092 <structname>pg_attribute</structname> row for every column in every
1093 table in the database. (There will also be attribute entries for
1094 indexes, and indeed all objects that have <structname>pg_class</structname>
1099 The term attribute is equivalent to column and is used for
1104 <title><structname>pg_attribute</> Columns</title>
1111 <entry>References</entry>
1112 <entry>Description</entry>
1118 <entry><structfield>attrelid</structfield></entry>
1119 <entry><type>oid</type></entry>
1120 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1121 <entry>The table this column belongs to</entry>
1125 <entry><structfield>attname</structfield></entry>
1126 <entry><type>name</type></entry>
1128 <entry>The column name</entry>
1132 <entry><structfield>atttypid</structfield></entry>
1133 <entry><type>oid</type></entry>
1134 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1135 <entry>The data type of this column</entry>
1139 <entry><structfield>attstattarget</structfield></entry>
1140 <entry><type>int4</type></entry>
1143 <structfield>attstattarget</structfield> controls the level of detail
1144 of statistics accumulated for this column by
1145 <xref linkend="sql-analyze">.
1146 A zero value indicates that no statistics should be collected.
1147 A negative value says to use the system default statistics target.
1148 The exact meaning of positive values is data type-dependent.
1149 For scalar data types, <structfield>attstattarget</structfield>
1150 is both the target number of <quote>most common values</quote>
1151 to collect, and the target number of histogram bins to create.
1156 <entry><structfield>attlen</structfield></entry>
1157 <entry><type>int2</type></entry>
1160 A copy of <literal>pg_type.typlen</literal> of this column's
1166 <entry><structfield>attnum</structfield></entry>
1167 <entry><type>int2</type></entry>
1170 The number of the column. Ordinary columns are numbered from 1
1171 up. System columns, such as <structfield>oid</structfield>,
1172 have (arbitrary) negative numbers.
1177 <entry><structfield>attndims</structfield></entry>
1178 <entry><type>int4</type></entry>
1181 Number of dimensions, if the column is an array type; otherwise 0.
1182 (Presently, the number of dimensions of an array is not enforced,
1183 so any nonzero value effectively means <quote>it's an array</>.)
1188 <entry><structfield>attcacheoff</structfield></entry>
1189 <entry><type>int4</type></entry>
1192 Always -1 in storage, but when loaded into a row descriptor
1193 in memory this might be updated to cache the offset of the attribute
1199 <entry><structfield>atttypmod</structfield></entry>
1200 <entry><type>int4</type></entry>
1203 <structfield>atttypmod</structfield> records type-specific data
1204 supplied at table creation time (for example, the maximum
1205 length of a <type>varchar</type> column). It is passed to
1206 type-specific input functions and length coercion functions.
1207 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1212 <entry><structfield>attbyval</structfield></entry>
1213 <entry><type>bool</type></entry>
1216 A copy of <literal>pg_type.typbyval</> of this column's type
1221 <entry><structfield>attstorage</structfield></entry>
1222 <entry><type>char</type></entry>
1225 Normally a copy of <literal>pg_type.typstorage</> of this
1226 column's type. For TOAST-able data types, this can be altered
1227 after column creation to control storage policy.
1232 <entry><structfield>attalign</structfield></entry>
1233 <entry><type>char</type></entry>
1236 A copy of <literal>pg_type.typalign</> of this column's type
1241 <entry><structfield>attnotnull</structfield></entry>
1242 <entry><type>bool</type></entry>
1245 This represents a not-null constraint.
1250 <entry><structfield>atthasdef</structfield></entry>
1251 <entry><type>bool</type></entry>
1254 This column has a default value, in which case there will be a
1255 corresponding entry in the <structname>pg_attrdef</structname>
1256 catalog that actually defines the value.
1261 <entry><structfield>attisdropped</structfield></entry>
1262 <entry><type>bool</type></entry>
1265 This column has been dropped and is no longer valid. A dropped
1266 column is still physically present in the table, but is
1267 ignored by the parser and so cannot be accessed via SQL.
1272 <entry><structfield>attislocal</structfield></entry>
1273 <entry><type>bool</type></entry>
1276 This column is defined locally in the relation. Note that a column can
1277 be locally defined and inherited simultaneously.
1282 <entry><structfield>attinhcount</structfield></entry>
1283 <entry><type>int4</type></entry>
1286 The number of direct ancestors this column has. A column with a
1287 nonzero number of ancestors cannot be dropped nor renamed.
1292 <entry><structfield>attcollation</structfield></entry>
1293 <entry><type>oid</type></entry>
1294 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1296 The defined collation of the column, or zero if the column is
1297 not of a collatable data type.
1302 <entry><structfield>attacl</structfield></entry>
1303 <entry><type>aclitem[]</type></entry>
1306 Column-level access privileges, if any have been granted specifically
1312 <entry><structfield>attoptions</structfield></entry>
1313 <entry><type>text[]</type></entry>
1316 Attribute-level options, as <quote>keyword=value</> strings
1321 <entry><structfield>attfdwoptions</structfield></entry>
1322 <entry><type>text[]</type></entry>
1325 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1334 In a dropped column's <structname>pg_attribute</structname> entry,
1335 <structfield>atttypid</structfield> is reset to zero, but
1336 <structfield>attlen</structfield> and the other fields copied from
1337 <structname>pg_type</> are still valid. This arrangement is needed
1338 to cope with the situation where the dropped column's data type was
1339 later dropped, and so there is no <structname>pg_type</> row anymore.
1340 <structfield>attlen</structfield> and the other fields can be used
1341 to interpret the contents of a row of the table.
1346 <sect1 id="catalog-pg-authid">
1347 <title><structname>pg_authid</structname></title>
1349 <indexterm zone="catalog-pg-authid">
1350 <primary>pg_authid</primary>
1354 The catalog <structname>pg_authid</structname> contains information about
1355 database authorization identifiers (roles). A role subsumes the concepts
1356 of <quote>users</> and <quote>groups</>. A user is essentially just a
1357 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1358 without <structfield>rolcanlogin</>) can have other roles as members; see
1359 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1363 Since this catalog contains passwords, it must not be publicly readable.
1364 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1365 is a publicly readable view on
1366 <structname>pg_authid</structname> that blanks out the password field.
1370 <xref linkend="user-manag"> contains detailed information about user and
1371 privilege management.
1375 Because user identities are cluster-wide,
1376 <structname>pg_authid</structname>
1377 is shared across all databases of a cluster: there is only one
1378 copy of <structname>pg_authid</structname> per cluster, not
1383 <title><structname>pg_authid</> Columns</title>
1390 <entry>Description</entry>
1397 <entry><structfield>oid</structfield></entry>
1398 <entry><type>oid</type></entry>
1399 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1403 <entry><structfield>rolname</structfield></entry>
1404 <entry><type>name</type></entry>
1405 <entry>Role name</entry>
1409 <entry><structfield>rolsuper</structfield></entry>
1410 <entry><type>bool</type></entry>
1411 <entry>Role has superuser privileges</entry>
1415 <entry><structfield>rolinherit</structfield></entry>
1416 <entry><type>bool</type></entry>
1417 <entry>Role automatically inherits privileges of roles it is a
1422 <entry><structfield>rolcreaterole</structfield></entry>
1423 <entry><type>bool</type></entry>
1424 <entry>Role can create more roles</entry>
1428 <entry><structfield>rolcreatedb</structfield></entry>
1429 <entry><type>bool</type></entry>
1430 <entry>Role can create databases</entry>
1434 <entry><structfield>rolcanlogin</structfield></entry>
1435 <entry><type>bool</type></entry>
1437 Role can log in. That is, this role can be given as the initial
1438 session authorization identifier
1443 <entry><structfield>rolreplication</structfield></entry>
1444 <entry><type>bool</type></entry>
1446 Role is a replication role. That is, this role can initiate streaming
1447 replication (see <xref linkend="streaming-replication">) and set/unset
1448 the system backup mode using <function>pg_start_backup</> and
1449 <function>pg_stop_backup</>
1454 <entry><structfield>rolbypassrls</structfield></entry>
1455 <entry><type>bool</type></entry>
1457 Role bypasses every row level security policy, see
1458 <xref linkend="ddl-rowsecurity"> for more information.
1463 <entry><structfield>rolconnlimit</structfield></entry>
1464 <entry><type>int4</type></entry>
1466 For roles that can log in, this sets maximum number of concurrent
1467 connections this role can make. -1 means no limit.
1472 <entry><structfield>rolpassword</structfield></entry>
1473 <entry><type>text</type></entry>
1475 Password (possibly encrypted); null if none. If the password
1476 is encrypted, this column will begin with the string <literal>md5</>
1477 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1478 will be of the user's password concatenated to their user name.
1479 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1480 <productname>PostgreSQL</> will store the md5 hash of
1481 <literal>xyzzyjoe</>. A password that does not follow that
1482 format is assumed to be unencrypted.
1487 <entry><structfield>rolvaliduntil</structfield></entry>
1488 <entry><type>timestamptz</type></entry>
1489 <entry>Password expiry time (only used for password authentication);
1490 null if no expiration</entry>
1499 <sect1 id="catalog-pg-auth-members">
1500 <title><structname>pg_auth_members</structname></title>
1502 <indexterm zone="catalog-pg-auth-members">
1503 <primary>pg_auth_members</primary>
1507 The catalog <structname>pg_auth_members</structname> shows the membership
1508 relations between roles. Any non-circular set of relationships is allowed.
1512 Because user identities are cluster-wide,
1513 <structname>pg_auth_members</structname>
1514 is shared across all databases of a cluster: there is only one
1515 copy of <structname>pg_auth_members</structname> per cluster, not
1520 <title><structname>pg_auth_members</> Columns</title>
1527 <entry>References</entry>
1528 <entry>Description</entry>
1534 <entry><structfield>roleid</structfield></entry>
1535 <entry><type>oid</type></entry>
1536 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1537 <entry>ID of a role that has a member</entry>
1541 <entry><structfield>member</structfield></entry>
1542 <entry><type>oid</type></entry>
1543 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1544 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1548 <entry><structfield>grantor</structfield></entry>
1549 <entry><type>oid</type></entry>
1550 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1551 <entry>ID of the role that granted this membership</entry>
1555 <entry><structfield>admin_option</structfield></entry>
1556 <entry><type>bool</type></entry>
1558 <entry>True if <structfield>member</> can grant membership in
1559 <structfield>roleid</> to others</entry>
1568 <sect1 id="catalog-pg-cast">
1569 <title><structname>pg_cast</structname></title>
1571 <indexterm zone="catalog-pg-cast">
1572 <primary>pg_cast</primary>
1576 The catalog <structname>pg_cast</structname> stores data type conversion
1577 paths, both built-in and user-defined.
1581 It should be noted that <structname>pg_cast</structname> does not represent
1582 every type conversion that the system knows how to perform; only those that
1583 cannot be deduced from some generic rule. For example, casting between a
1584 domain and its base type is not explicitly represented in
1585 <structname>pg_cast</structname>. Another important exception is that
1586 <quote>automatic I/O conversion casts</>, those performed using a data
1587 type's own I/O functions to convert to or from <type>text</> or other
1588 string types, are not explicitly represented in
1589 <structname>pg_cast</structname>.
1593 <title><structname>pg_cast</> Columns</title>
1600 <entry>References</entry>
1601 <entry>Description</entry>
1607 <entry><structfield>oid</structfield></entry>
1608 <entry><type>oid</type></entry>
1610 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1614 <entry><structfield>castsource</structfield></entry>
1615 <entry><type>oid</type></entry>
1616 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1617 <entry>OID of the source data type</entry>
1621 <entry><structfield>casttarget</structfield></entry>
1622 <entry><type>oid</type></entry>
1623 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1624 <entry>OID of the target data type</entry>
1628 <entry><structfield>castfunc</structfield></entry>
1629 <entry><type>oid</type></entry>
1630 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1632 The OID of the function to use to perform this cast. Zero is
1633 stored if the cast method doesn't require a function.
1638 <entry><structfield>castcontext</structfield></entry>
1639 <entry><type>char</type></entry>
1642 Indicates what contexts the cast can be invoked in.
1643 <literal>e</> means only as an explicit cast (using
1644 <literal>CAST</> or <literal>::</> syntax).
1645 <literal>a</> means implicitly in assignment
1646 to a target column, as well as explicitly.
1647 <literal>i</> means implicitly in expressions, as well as the
1652 <entry><structfield>castmethod</structfield></entry>
1653 <entry><type>char</type></entry>
1656 Indicates how the cast is performed.
1657 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1658 <literal>i</> means that the input/output functions are used.
1659 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1667 The cast functions listed in <structname>pg_cast</structname> must
1668 always take the cast source type as their first argument type, and
1669 return the cast destination type as their result type. A cast
1670 function can have up to three arguments. The second argument,
1671 if present, must be type <type>integer</>; it receives the type
1672 modifier associated with the destination type, or -1
1673 if there is none. The third argument,
1674 if present, must be type <type>boolean</>; it receives <literal>true</>
1675 if the cast is an explicit cast, <literal>false</> otherwise.
1679 It is legitimate to create a <structname>pg_cast</structname> entry
1680 in which the source and target types are the same, if the associated
1681 function takes more than one argument. Such entries represent
1682 <quote>length coercion functions</> that coerce values of the type
1683 to be legal for a particular type modifier value.
1687 When a <structname>pg_cast</structname> entry has different source and
1688 target types and a function that takes more than one argument, it
1689 represents converting from one type to another and applying a length
1690 coercion in a single step. When no such entry is available, coercion
1691 to a type that uses a type modifier involves two steps, one to
1692 convert between data types and a second to apply the modifier.
1696 <sect1 id="catalog-pg-class">
1697 <title><structname>pg_class</structname></title>
1699 <indexterm zone="catalog-pg-class">
1700 <primary>pg_class</primary>
1704 The catalog <structname>pg_class</structname> catalogs tables and most
1705 everything else that has columns or is otherwise similar to a
1706 table. This includes indexes (but see also
1707 <structname>pg_index</structname>), sequences, views, materialized
1708 views, composite types, and TOAST tables; see <structfield>relkind</>.
1709 Below, when we mean all of these
1710 kinds of objects we speak of <quote>relations</quote>. Not all
1711 columns are meaningful for all relation types.
1715 <title><structname>pg_class</> Columns</title>
1722 <entry>References</entry>
1723 <entry>Description</entry>
1729 <entry><structfield>oid</structfield></entry>
1730 <entry><type>oid</type></entry>
1732 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1736 <entry><structfield>relname</structfield></entry>
1737 <entry><type>name</type></entry>
1739 <entry>Name of the table, index, view, etc.</entry>
1743 <entry><structfield>relnamespace</structfield></entry>
1744 <entry><type>oid</type></entry>
1745 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1747 The OID of the namespace that contains this relation
1752 <entry><structfield>reltype</structfield></entry>
1753 <entry><type>oid</type></entry>
1754 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1756 The OID of the data type that corresponds to this table's row type,
1757 if any (zero for indexes, which have no <structname>pg_type</> entry)
1762 <entry><structfield>reloftype</structfield></entry>
1763 <entry><type>oid</type></entry>
1764 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1766 For typed tables, the OID of the underlying composite type,
1767 zero for all other relations
1772 <entry><structfield>relowner</structfield></entry>
1773 <entry><type>oid</type></entry>
1774 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1775 <entry>Owner of the relation</entry>
1779 <entry><structfield>relam</structfield></entry>
1780 <entry><type>oid</type></entry>
1781 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1782 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1786 <entry><structfield>relfilenode</structfield></entry>
1787 <entry><type>oid</type></entry>
1789 <entry>Name of the on-disk file of this relation; zero means this
1790 is a <quote>mapped</> relation whose disk file name is determined
1791 by low-level state</entry>
1795 <entry><structfield>reltablespace</structfield></entry>
1796 <entry><type>oid</type></entry>
1797 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1799 The tablespace in which this relation is stored. If zero,
1800 the database's default tablespace is implied. (Not meaningful
1801 if the relation has no on-disk file.)
1806 <entry><structfield>relpages</structfield></entry>
1807 <entry><type>int4</type></entry>
1810 Size of the on-disk representation of this table in pages (of size
1811 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1812 planner. It is updated by <command>VACUUM</command>,
1813 <command>ANALYZE</command>, and a few DDL commands such as
1814 <command>CREATE INDEX</command>.
1819 <entry><structfield>reltuples</structfield></entry>
1820 <entry><type>float4</type></entry>
1823 Number of rows in the table. This is only an estimate used by the
1824 planner. It is updated by <command>VACUUM</command>,
1825 <command>ANALYZE</command>, and a few DDL commands such as
1826 <command>CREATE INDEX</command>.
1831 <entry><structfield>relallvisible</structfield></entry>
1832 <entry><type>int4</type></entry>
1835 Number of pages that are marked all-visible in the table's
1836 visibility map. This is only an estimate used by the
1837 planner. It is updated by <command>VACUUM</command>,
1838 <command>ANALYZE</command>, and a few DDL commands such as
1839 <command>CREATE INDEX</command>.
1844 <entry><structfield>reltoastrelid</structfield></entry>
1845 <entry><type>oid</type></entry>
1846 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1848 OID of the TOAST table associated with this table, 0 if none. The
1849 TOAST table stores large attributes <quote>out of line</quote> in a
1855 <entry><structfield>relhasindex</structfield></entry>
1856 <entry><type>bool</type></entry>
1859 True if this is a table and it has (or recently had) any indexes
1864 <entry><structfield>relisshared</structfield></entry>
1865 <entry><type>bool</type></entry>
1868 True if this table is shared across all databases in the cluster. Only
1869 certain system catalogs (such as <structname>pg_database</structname>)
1875 <entry><structfield>relpersistence</structfield></entry>
1876 <entry><type>char</type></entry>
1879 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1880 <literal>t</> = temporary table
1885 <entry><structfield>relkind</structfield></entry>
1886 <entry><type>char</type></entry>
1889 <literal>r</> = ordinary table, <literal>i</> = index,
1890 <literal>S</> = sequence, <literal>v</> = view,
1891 <literal>m</> = materialized view,
1892 <literal>c</> = composite type, <literal>t</> = TOAST table,
1893 <literal>f</> = foreign table
1898 <entry><structfield>relnatts</structfield></entry>
1899 <entry><type>int2</type></entry>
1902 Number of user columns in the relation (system columns not
1903 counted). There must be this many corresponding entries in
1904 <structname>pg_attribute</structname>. See also
1905 <literal>pg_attribute.attnum</literal>.
1910 <entry><structfield>relchecks</structfield></entry>
1911 <entry><type>int2</type></entry>
1914 Number of <literal>CHECK</> constraints on the table; see
1915 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1920 <entry><structfield>relhasoids</structfield></entry>
1921 <entry><type>bool</type></entry>
1924 True if we generate an OID for each row of the relation
1929 <entry><structfield>relhaspkey</structfield></entry>
1930 <entry><type>bool</type></entry>
1933 True if the table has (or once had) a primary key
1938 <entry><structfield>relhasrules</structfield></entry>
1939 <entry><type>bool</type></entry>
1942 True if table has (or once had) rules; see
1943 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1948 <entry><structfield>relhastriggers</structfield></entry>
1949 <entry><type>bool</type></entry>
1952 True if table has (or once had) triggers; see
1953 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1958 <entry><structfield>relhassubclass</structfield></entry>
1959 <entry><type>bool</type></entry>
1961 <entry>True if table has (or once had) any inheritance children</entry>
1965 <entry><structfield>relrowsecurity</structfield></entry>
1966 <entry><type>bool</type></entry>
1969 True if table has row level security enabled; see
1970 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1975 <entry><structfield>relforcerowsecurity</structfield></entry>
1976 <entry><type>bool</type></entry>
1979 True if row level security (when enabled) will also apply to table owner; see
1980 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1985 <entry><structfield>relispopulated</structfield></entry>
1986 <entry><type>bool</type></entry>
1988 <entry>True if relation is populated (this is true for all
1989 relations other than some materialized views)</entry>
1993 <entry><structfield>relreplident</structfield></entry>
1994 <entry><type>char</type></entry>
1997 Columns used to form <quote>replica identity</> for rows:
1998 <literal>d</> = default (primary key, if any),
1999 <literal>n</> = nothing,
2000 <literal>f</> = all columns
2001 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
2006 <entry><structfield>relfrozenxid</structfield></entry>
2007 <entry><type>xid</type></entry>
2010 All transaction IDs before this one have been replaced with a permanent
2011 (<quote>frozen</>) transaction ID in this table. This is used to track
2012 whether the table needs to be vacuumed in order to prevent transaction
2013 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
2014 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2019 <entry><structfield>relminmxid</structfield></entry>
2020 <entry><type>xid</type></entry>
2023 All multixact IDs before this one have been replaced by a
2024 transaction ID in this table. This is used to track
2025 whether the table needs to be vacuumed in order to prevent multixact ID
2026 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
2027 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
2032 <entry><structfield>relacl</structfield></entry>
2033 <entry><type>aclitem[]</type></entry>
2036 Access privileges; see
2037 <xref linkend="sql-grant"> and
2038 <xref linkend="sql-revoke">
2044 <entry><structfield>reloptions</structfield></entry>
2045 <entry><type>text[]</type></entry>
2048 Access-method-specific options, as <quote>keyword=value</> strings
2056 Several of the Boolean flags in <structname>pg_class</> are maintained
2057 lazily: they are guaranteed to be true if that's the correct state, but
2058 may not be reset to false immediately when the condition is no longer
2059 true. For example, <structfield>relhasindex</> is set by
2060 <command>CREATE INDEX</command>, but it is never cleared by
2061 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
2062 <structfield>relhasindex</> if it finds the table has no indexes. This
2063 arrangement avoids race conditions and improves concurrency.
2067 <sect1 id="catalog-pg-collation">
2068 <title><structname>pg_collation</structname></title>
2070 <indexterm zone="catalog-pg-collation">
2071 <primary>pg_collation</primary>
2075 The catalog <structname>pg_collation</structname> describes the
2076 available collations, which are essentially mappings from an SQL
2077 name to operating system locale categories.
2078 See <xref linkend="collation"> for more information.
2082 <title><structname>pg_collation</> Columns</title>
2089 <entry>References</entry>
2090 <entry>Description</entry>
2096 <entry><structfield>oid</structfield></entry>
2097 <entry><type>oid</type></entry>
2099 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2103 <entry><structfield>collname</structfield></entry>
2104 <entry><type>name</type></entry>
2106 <entry>Collation name (unique per namespace and encoding)</entry>
2110 <entry><structfield>collnamespace</structfield></entry>
2111 <entry><type>oid</type></entry>
2112 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2114 The OID of the namespace that contains this collation
2119 <entry><structfield>collowner</structfield></entry>
2120 <entry><type>oid</type></entry>
2121 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2122 <entry>Owner of the collation</entry>
2126 <entry><structfield>collencoding</structfield></entry>
2127 <entry><type>int4</type></entry>
2129 <entry>Encoding in which the collation is applicable, or -1 if it
2130 works for any encoding</entry>
2134 <entry><structfield>collcollate</structfield></entry>
2135 <entry><type>name</type></entry>
2137 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2141 <entry><structfield>collctype</structfield></entry>
2142 <entry><type>name</type></entry>
2144 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2151 Note that the unique key on this catalog is (<structfield>collname</>,
2152 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2153 (<structfield>collname</>, <structfield>collnamespace</>).
2154 <productname>PostgreSQL</productname> generally ignores all
2155 collations that do not have <structfield>collencoding</> equal to
2156 either the current database's encoding or -1, and creation of new entries
2157 with the same name as an entry with <structfield>collencoding</> = -1
2158 is forbidden. Therefore it is sufficient to use a qualified SQL name
2159 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2160 even though this is not unique according to the catalog definition.
2161 The reason for defining the catalog this way is that
2162 <application>initdb</> fills it in at cluster initialization time with
2163 entries for all locales available on the system, so it must be able to
2164 hold entries for all encodings that might ever be used in the cluster.
2168 In the <literal>template0</> database, it could be useful to create
2169 collations whose encoding does not match the database encoding,
2170 since they could match the encodings of databases later cloned from
2171 <literal>template0</>. This would currently have to be done manually.
2175 <sect1 id="catalog-pg-constraint">
2176 <title><structname>pg_constraint</structname></title>
2178 <indexterm zone="catalog-pg-constraint">
2179 <primary>pg_constraint</primary>
2183 The catalog <structname>pg_constraint</structname> stores check, primary
2184 key, unique, foreign key, and exclusion constraints on tables.
2185 (Column constraints are not treated specially. Every column constraint is
2186 equivalent to some table constraint.)
2187 Not-null constraints are represented in the <structname>pg_attribute</>
2192 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2193 TRIGGER</>) also give rise to an entry in this table.
2197 Check constraints on domains are stored here, too.
2201 <title><structname>pg_constraint</> Columns</title>
2208 <entry>References</entry>
2209 <entry>Description</entry>
2215 <entry><structfield>oid</structfield></entry>
2216 <entry><type>oid</type></entry>
2218 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2222 <entry><structfield>conname</structfield></entry>
2223 <entry><type>name</type></entry>
2225 <entry>Constraint name (not necessarily unique!)</entry>
2229 <entry><structfield>connamespace</structfield></entry>
2230 <entry><type>oid</type></entry>
2231 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2233 The OID of the namespace that contains this constraint
2238 <entry><structfield>contype</structfield></entry>
2239 <entry><type>char</type></entry>
2242 <literal>c</> = check constraint,
2243 <literal>f</> = foreign key constraint,
2244 <literal>p</> = primary key constraint,
2245 <literal>u</> = unique constraint,
2246 <literal>t</> = constraint trigger,
2247 <literal>x</> = exclusion constraint
2252 <entry><structfield>condeferrable</structfield></entry>
2253 <entry><type>bool</type></entry>
2255 <entry>Is the constraint deferrable?</entry>
2259 <entry><structfield>condeferred</structfield></entry>
2260 <entry><type>bool</type></entry>
2262 <entry>Is the constraint deferred by default?</entry>
2266 <entry><structfield>convalidated</structfield></entry>
2267 <entry><type>bool</type></entry>
2269 <entry>Has the constraint been validated?
2270 Currently, can only be false for foreign keys and CHECK constraints</entry>
2274 <entry><structfield>conrelid</structfield></entry>
2275 <entry><type>oid</type></entry>
2276 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2277 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2281 <entry><structfield>contypid</structfield></entry>
2282 <entry><type>oid</type></entry>
2283 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2284 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2288 <entry><structfield>conindid</structfield></entry>
2289 <entry><type>oid</type></entry>
2290 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2291 <entry>The index supporting this constraint, if it's a unique, primary
2292 key, foreign key, or exclusion constraint; else 0</entry>
2296 <entry><structfield>confrelid</structfield></entry>
2297 <entry><type>oid</type></entry>
2298 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2299 <entry>If a foreign key, the referenced table; else 0</entry>
2303 <entry><structfield>confupdtype</structfield></entry>
2304 <entry><type>char</type></entry>
2306 <entry>Foreign key update action code:
2307 <literal>a</> = no action,
2308 <literal>r</> = restrict,
2309 <literal>c</> = cascade,
2310 <literal>n</> = set null,
2311 <literal>d</> = set default
2316 <entry><structfield>confdeltype</structfield></entry>
2317 <entry><type>char</type></entry>
2319 <entry>Foreign key deletion action code:
2320 <literal>a</> = no action,
2321 <literal>r</> = restrict,
2322 <literal>c</> = cascade,
2323 <literal>n</> = set null,
2324 <literal>d</> = set default
2329 <entry><structfield>confmatchtype</structfield></entry>
2330 <entry><type>char</type></entry>
2332 <entry>Foreign key match type:
2333 <literal>f</> = full,
2334 <literal>p</> = partial,
2335 <literal>s</> = simple
2340 <entry><structfield>conislocal</structfield></entry>
2341 <entry><type>bool</type></entry>
2344 This constraint is defined locally for the relation. Note that a
2345 constraint can be locally defined and inherited simultaneously.
2350 <entry><structfield>coninhcount</structfield></entry>
2351 <entry><type>int4</type></entry>
2354 The number of direct inheritance ancestors this constraint has.
2356 a nonzero number of ancestors cannot be dropped nor renamed.
2361 <entry><structfield>connoinherit</structfield></entry>
2362 <entry><type>bool</type></entry>
2365 This constraint is defined locally for the relation. It is a
2366 non-inheritable constraint.
2371 <entry><structfield>conkey</structfield></entry>
2372 <entry><type>int2[]</type></entry>
2373 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2374 <entry>If a table constraint (including foreign keys, but not constraint
2375 triggers), list of the constrained columns</entry>
2379 <entry><structfield>confkey</structfield></entry>
2380 <entry><type>int2[]</type></entry>
2381 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2382 <entry>If a foreign key, list of the referenced columns</entry>
2386 <entry><structfield>conpfeqop</structfield></entry>
2387 <entry><type>oid[]</type></entry>
2388 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2389 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2393 <entry><structfield>conppeqop</structfield></entry>
2394 <entry><type>oid[]</type></entry>
2395 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2396 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2400 <entry><structfield>conffeqop</structfield></entry>
2401 <entry><type>oid[]</type></entry>
2402 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2403 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2407 <entry><structfield>conexclop</structfield></entry>
2408 <entry><type>oid[]</type></entry>
2409 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2410 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2414 <entry><structfield>conbin</structfield></entry>
2415 <entry><type>pg_node_tree</type></entry>
2417 <entry>If a check constraint, an internal representation of the expression</entry>
2421 <entry><structfield>consrc</structfield></entry>
2422 <entry><type>text</type></entry>
2424 <entry>If a check constraint, a human-readable representation of the expression</entry>
2431 In the case of an exclusion constraint, <structfield>conkey</structfield>
2432 is only useful for constraint elements that are simple column references.
2433 For other cases, a zero appears in <structfield>conkey</structfield>
2434 and the associated index must be consulted to discover the expression
2435 that is constrained. (<structfield>conkey</structfield> thus has the
2436 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2442 <structfield>consrc</structfield> is not updated when referenced objects
2443 change; for example, it won't track renaming of columns. Rather than
2444 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2445 to extract the definition of a check constraint.
2451 <literal>pg_class.relchecks</literal> needs to agree with the
2452 number of check-constraint entries found in this table for each
2459 <sect1 id="catalog-pg-conversion">
2460 <title><structname>pg_conversion</structname></title>
2462 <indexterm zone="catalog-pg-conversion">
2463 <primary>pg_conversion</primary>
2467 The catalog <structname>pg_conversion</structname> describes
2468 encoding conversion procedures. See <xref linkend="sql-createconversion">
2469 for more information.
2473 <title><structname>pg_conversion</> Columns</title>
2480 <entry>References</entry>
2481 <entry>Description</entry>
2487 <entry><structfield>oid</structfield></entry>
2488 <entry><type>oid</type></entry>
2490 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2494 <entry><structfield>conname</structfield></entry>
2495 <entry><type>name</type></entry>
2497 <entry>Conversion name (unique within a namespace)</entry>
2501 <entry><structfield>connamespace</structfield></entry>
2502 <entry><type>oid</type></entry>
2503 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2505 The OID of the namespace that contains this conversion
2510 <entry><structfield>conowner</structfield></entry>
2511 <entry><type>oid</type></entry>
2512 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2513 <entry>Owner of the conversion</entry>
2517 <entry><structfield>conforencoding</structfield></entry>
2518 <entry><type>int4</type></entry>
2520 <entry>Source encoding ID</entry>
2524 <entry><structfield>contoencoding</structfield></entry>
2525 <entry><type>int4</type></entry>
2527 <entry>Destination encoding ID</entry>
2531 <entry><structfield>conproc</structfield></entry>
2532 <entry><type>regproc</type></entry>
2533 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2534 <entry>Conversion procedure</entry>
2538 <entry><structfield>condefault</structfield></entry>
2539 <entry><type>bool</type></entry>
2541 <entry>True if this is the default conversion</entry>
2550 <sect1 id="catalog-pg-database">
2551 <title><structname>pg_database</structname></title>
2553 <indexterm zone="catalog-pg-database">
2554 <primary>pg_database</primary>
2558 The catalog <structname>pg_database</structname> stores information about
2559 the available databases. Databases are created with the <xref
2560 linkend="sql-createdatabase"> command.
2561 Consult <xref linkend="managing-databases"> for details about the meaning
2562 of some of the parameters.
2566 Unlike most system catalogs, <structname>pg_database</structname>
2567 is shared across all databases of a cluster: there is only one
2568 copy of <structname>pg_database</structname> per cluster, not
2573 <title><structname>pg_database</> Columns</title>
2580 <entry>References</entry>
2581 <entry>Description</entry>
2587 <entry><structfield>oid</structfield></entry>
2588 <entry><type>oid</type></entry>
2590 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2594 <entry><structfield>datname</structfield></entry>
2595 <entry><type>name</type></entry>
2597 <entry>Database name</entry>
2601 <entry><structfield>datdba</structfield></entry>
2602 <entry><type>oid</type></entry>
2603 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2604 <entry>Owner of the database, usually the user who created it</entry>
2608 <entry><structfield>encoding</structfield></entry>
2609 <entry><type>int4</type></entry>
2611 <entry>Character encoding for this database
2612 (<function>pg_encoding_to_char()</function> can translate
2613 this number to the encoding name)</entry>
2617 <entry><structfield>datcollate</structfield></entry>
2618 <entry><type>name</type></entry>
2620 <entry>LC_COLLATE for this database</entry>
2624 <entry><structfield>datctype</structfield></entry>
2625 <entry><type>name</type></entry>
2627 <entry>LC_CTYPE for this database</entry>
2631 <entry><structfield>datistemplate</structfield></entry>
2632 <entry><type>bool</type></entry>
2635 If true, then this database can be cloned by
2636 any user with <literal>CREATEDB</> privileges;
2637 if false, then only superusers or the owner of
2638 the database can clone it.
2643 <entry><structfield>datallowconn</structfield></entry>
2644 <entry><type>bool</type></entry>
2647 If false then no one can connect to this database. This is
2648 used to protect the <literal>template0</> database from being altered.
2653 <entry><structfield>datconnlimit</structfield></entry>
2654 <entry><type>int4</type></entry>
2657 Sets maximum number of concurrent connections that can be made
2658 to this database. -1 means no limit.
2663 <entry><structfield>datlastsysoid</structfield></entry>
2664 <entry><type>oid</type></entry>
2667 Last system OID in the database; useful
2668 particularly to <application>pg_dump</application>
2673 <entry><structfield>datfrozenxid</structfield></entry>
2674 <entry><type>xid</type></entry>
2677 All transaction IDs before this one have been replaced with a permanent
2678 (<quote>frozen</>) transaction ID in this database. This is used to
2679 track whether the database needs to be vacuumed in order to prevent
2680 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2681 It is the minimum of the per-table
2682 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2687 <entry><structfield>datminmxid</structfield></entry>
2688 <entry><type>xid</type></entry>
2691 All multixact IDs before this one have been replaced with a
2692 transaction ID in this database. This is used to
2693 track whether the database needs to be vacuumed in order to prevent
2694 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2695 It is the minimum of the per-table
2696 <structname>pg_class</>.<structfield>relminmxid</> values.
2701 <entry><structfield>dattablespace</structfield></entry>
2702 <entry><type>oid</type></entry>
2703 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2705 The default tablespace for the database.
2706 Within this database, all tables for which
2707 <structname>pg_class</>.<structfield>reltablespace</> is zero
2708 will be stored in this tablespace; in particular, all the non-shared
2709 system catalogs will be there.
2714 <entry><structfield>datacl</structfield></entry>
2715 <entry><type>aclitem[]</type></entry>
2718 Access privileges; see
2719 <xref linkend="sql-grant"> and
2720 <xref linkend="sql-revoke">
2730 <sect1 id="catalog-pg-db-role-setting">
2731 <title><structname>pg_db_role_setting</structname></title>
2733 <indexterm zone="catalog-pg-db-role-setting">
2734 <primary>pg_db_role_setting</primary>
2738 The catalog <structname>pg_db_role_setting</structname> records the default
2739 values that have been set for run-time configuration variables,
2740 for each role and database combination.
2744 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2745 is shared across all databases of a cluster: there is only one
2746 copy of <structname>pg_db_role_setting</structname> per cluster, not
2751 <title><structname>pg_db_role_setting</> Columns</title>
2758 <entry>References</entry>
2759 <entry>Description</entry>
2765 <entry><structfield>setdatabase</structfield></entry>
2766 <entry><type>oid</type></entry>
2767 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2768 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2772 <entry><structfield>setrole</structfield></entry>
2773 <entry><type>oid</type></entry>
2774 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2775 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2779 <entry><structfield>setconfig</structfield></entry>
2780 <entry><type>text[]</type></entry>
2782 <entry>Defaults for run-time configuration variables</entry>
2790 <sect1 id="catalog-pg-default-acl">
2791 <title><structname>pg_default_acl</structname></title>
2793 <indexterm zone="catalog-pg-default-acl">
2794 <primary>pg_default_acl</primary>
2798 The catalog <structname>pg_default_acl</> stores initial
2799 privileges to be assigned to newly created objects.
2803 <title><structname>pg_default_acl</> Columns</title>
2810 <entry>References</entry>
2811 <entry>Description</entry>
2817 <entry><structfield>oid</structfield></entry>
2818 <entry><type>oid</type></entry>
2820 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2824 <entry><structfield>defaclrole</structfield></entry>
2825 <entry><type>oid</type></entry>
2826 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2827 <entry>The OID of the role associated with this entry</entry>
2831 <entry><structfield>defaclnamespace</structfield></entry>
2832 <entry><type>oid</type></entry>
2833 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2834 <entry>The OID of the namespace associated with this entry,
2835 or 0 if none</entry>
2839 <entry><structfield>defaclobjtype</structfield></entry>
2840 <entry><type>char</type></entry>
2843 Type of object this entry is for:
2844 <literal>r</> = relation (table, view),
2845 <literal>S</> = sequence,
2846 <literal>f</> = function,
2847 <literal>T</> = type
2852 <entry><structfield>defaclacl</structfield></entry>
2853 <entry><type>aclitem[]</type></entry>
2856 Access privileges that this type of object should have on creation
2864 A <structname>pg_default_acl</> entry shows the initial privileges to
2865 be assigned to an object belonging to the indicated user. There are
2866 currently two types of entry: <quote>global</> entries with
2867 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2868 that reference a particular schema. If a global entry is present then
2869 it <emphasis>overrides</> the normal hard-wired default privileges
2870 for the object type. A per-schema entry, if present, represents privileges
2871 to be <emphasis>added to</> the global or hard-wired default privileges.
2875 Note that when an ACL entry in another catalog is null, it is taken
2876 to represent the hard-wired default privileges for its object,
2877 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2878 at the moment. <structname>pg_default_acl</> is only consulted during
2885 <sect1 id="catalog-pg-depend">
2886 <title><structname>pg_depend</structname></title>
2888 <indexterm zone="catalog-pg-depend">
2889 <primary>pg_depend</primary>
2893 The catalog <structname>pg_depend</structname> records the dependency
2894 relationships between database objects. This information allows
2895 <command>DROP</> commands to find which other objects must be dropped
2896 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2901 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2902 which performs a similar function for dependencies involving objects
2903 that are shared across a database cluster.
2907 <title><structname>pg_depend</> Columns</title>
2914 <entry>References</entry>
2915 <entry>Description</entry>
2921 <entry><structfield>classid</structfield></entry>
2922 <entry><type>oid</type></entry>
2923 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2924 <entry>The OID of the system catalog the dependent object is in</entry>
2928 <entry><structfield>objid</structfield></entry>
2929 <entry><type>oid</type></entry>
2930 <entry>any OID column</entry>
2931 <entry>The OID of the specific dependent object</entry>
2935 <entry><structfield>objsubid</structfield></entry>
2936 <entry><type>int4</type></entry>
2939 For a table column, this is the column number (the
2940 <structfield>objid</> and <structfield>classid</> refer to the
2941 table itself). For all other object types, this column is
2947 <entry><structfield>refclassid</structfield></entry>
2948 <entry><type>oid</type></entry>
2949 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2950 <entry>The OID of the system catalog the referenced object is in</entry>
2954 <entry><structfield>refobjid</structfield></entry>
2955 <entry><type>oid</type></entry>
2956 <entry>any OID column</entry>
2957 <entry>The OID of the specific referenced object</entry>
2961 <entry><structfield>refobjsubid</structfield></entry>
2962 <entry><type>int4</type></entry>
2965 For a table column, this is the column number (the
2966 <structfield>refobjid</> and <structfield>refclassid</> refer
2967 to the table itself). For all other object types, this column
2973 <entry><structfield>deptype</structfield></entry>
2974 <entry><type>char</type></entry>
2977 A code defining the specific semantics of this dependency relationship; see text
2986 In all cases, a <structname>pg_depend</structname> entry indicates that the
2987 referenced object cannot be dropped without also dropping the dependent
2988 object. However, there are several subflavors identified by
2989 <structfield>deptype</>:
2993 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2996 A normal relationship between separately-created objects. The
2997 dependent object can be dropped without affecting the
2998 referenced object. The referenced object can only be dropped
2999 by specifying <literal>CASCADE</>, in which case the dependent
3000 object is dropped, too. Example: a table column has a normal
3001 dependency on its data type.
3007 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
3010 The dependent object can be dropped separately from the
3011 referenced object, and should be automatically dropped
3012 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
3013 mode) if the referenced object is dropped. Example: a named
3014 constraint on a table is made autodependent on the table, so
3015 that it will go away if the table is dropped.
3021 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
3024 The dependent object was created as part of creation of the
3025 referenced object, and is really just a part of its internal
3026 implementation. A <command>DROP</> of the dependent object
3027 will be disallowed outright (we'll tell the user to issue a
3028 <command>DROP</> against the referenced object, instead). A
3029 <command>DROP</> of the referenced object will be propagated
3030 through to drop the dependent object whether
3031 <command>CASCADE</> is specified or not. Example: a trigger
3032 that's created to enforce a foreign-key constraint is made
3033 internally dependent on the constraint's
3034 <structname>pg_constraint</> entry.
3040 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
3043 The dependent object is a member of the <firstterm>extension</> that is
3044 the referenced object (see
3045 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3046 The dependent object can be dropped only via
3047 <command>DROP EXTENSION</> on the referenced object. Functionally
3048 this dependency type acts the same as an internal dependency, but
3049 it's kept separate for clarity and to simplify <application>pg_dump</>.
3055 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3058 There is no dependent object; this type of entry is a signal
3059 that the system itself depends on the referenced object, and so
3060 that object must never be deleted. Entries of this type are
3061 created only by <command>initdb</command>. The columns for the
3062 dependent object contain zeroes.
3068 Other dependency flavors might be needed in future.
3074 <sect1 id="catalog-pg-description">
3075 <title><structname>pg_description</structname></title>
3077 <indexterm zone="catalog-pg-description">
3078 <primary>pg_description</primary>
3082 The catalog <structname>pg_description</> stores optional descriptions
3083 (comments) for each database object. Descriptions can be manipulated
3084 with the <xref linkend="sql-comment"> command and viewed with
3085 <application>psql</application>'s <literal>\d</literal> commands.
3086 Descriptions of many built-in system objects are provided in the initial
3087 contents of <structname>pg_description</structname>.
3091 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3092 which performs a similar function for descriptions involving objects that
3093 are shared across a database cluster.
3097 <title><structname>pg_description</> Columns</title>
3104 <entry>References</entry>
3105 <entry>Description</entry>
3111 <entry><structfield>objoid</structfield></entry>
3112 <entry><type>oid</type></entry>
3113 <entry>any OID column</entry>
3114 <entry>The OID of the object this description pertains to</entry>
3118 <entry><structfield>classoid</structfield></entry>
3119 <entry><type>oid</type></entry>
3120 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3121 <entry>The OID of the system catalog this object appears in</entry>
3125 <entry><structfield>objsubid</structfield></entry>
3126 <entry><type>int4</type></entry>
3129 For a comment on a table column, this is the column number (the
3130 <structfield>objoid</> and <structfield>classoid</> refer to
3131 the table itself). For all other object types, this column is
3137 <entry><structfield>description</structfield></entry>
3138 <entry><type>text</type></entry>
3140 <entry>Arbitrary text that serves as the description of this object</entry>
3149 <sect1 id="catalog-pg-enum">
3150 <title><structname>pg_enum</structname></title>
3152 <indexterm zone="catalog-pg-enum">
3153 <primary>pg_enum</primary>
3157 The <structname>pg_enum</structname> catalog contains entries
3158 showing the values and labels for each enum type. The
3159 internal representation of a given enum value is actually the OID
3160 of its associated row in <structname>pg_enum</structname>.
3164 <title><structname>pg_enum</> Columns</title>
3171 <entry>References</entry>
3172 <entry>Description</entry>
3178 <entry><structfield>oid</structfield></entry>
3179 <entry><type>oid</type></entry>
3181 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3185 <entry><structfield>enumtypid</structfield></entry>
3186 <entry><type>oid</type></entry>
3187 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3188 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3192 <entry><structfield>enumsortorder</structfield></entry>
3193 <entry><type>float4</type></entry>
3195 <entry>The sort position of this enum value within its enum type</entry>
3199 <entry><structfield>enumlabel</structfield></entry>
3200 <entry><type>name</type></entry>
3202 <entry>The textual label for this enum value</entry>
3209 The OIDs for <structname>pg_enum</structname> rows follow a special
3210 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3211 as the sort ordering of their enum type. That is, if two even OIDs
3212 belong to the same enum type, the smaller OID must have the smaller
3213 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3214 need bear no relationship to the sort order. This rule allows the
3215 enum comparison routines to avoid catalog lookups in many common cases.
3216 The routines that create and alter enum types attempt to assign even
3217 OIDs to enum values whenever possible.
3221 When an enum type is created, its members are assigned sort-order
3222 positions 1..<replaceable>n</>. But members added later might be given
3223 negative or fractional values of <structfield>enumsortorder</structfield>.
3224 The only requirement on these values is that they be correctly
3225 ordered and unique within each enum type.
3230 <sect1 id="catalog-pg-event-trigger">
3231 <title><structname>pg_event_trigger</structname></title>
3233 <indexterm zone="catalog-pg-event-trigger">
3234 <primary>pg_event_trigger</primary>
3238 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3239 See <xref linkend="event-triggers"> for more information.
3243 <title><structname>pg_event_trigger</> Columns</title>
3250 <entry>References</entry>
3251 <entry>Description</entry>
3257 <entry><structfield>evtname</structfield></entry>
3258 <entry><type>name</type></entry>
3260 <entry>Trigger name (must be unique)</entry>
3264 <entry><structfield>evtevent</structfield></entry>
3265 <entry><type>name</type></entry>
3267 <entry>Identifies the event for which this trigger fires</entry>
3271 <entry><structfield>evtowner</structfield></entry>
3272 <entry><type>oid</type></entry>
3273 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3274 <entry>Owner of the event trigger</entry>
3278 <entry><structfield>evtfoid</structfield></entry>
3279 <entry><type>oid</type></entry>
3280 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3281 <entry>The function to be called</entry>
3285 <entry><structfield>evtenabled</structfield></entry>
3286 <entry><type>char</type></entry>
3289 Controls in which <xref linkend="guc-session-replication-role"> modes
3290 the event trigger fires.
3291 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3292 <literal>D</> = trigger is disabled,
3293 <literal>R</> = trigger fires in <quote>replica</> mode,
3294 <literal>A</> = trigger fires always.
3299 <entry><structfield>evttags</structfield></entry>
3300 <entry><type>text[]</type></entry>
3303 Command tags for which this trigger will fire. If NULL, the firing
3304 of this trigger is not restricted on the basis of the command tag.
3313 <sect1 id="catalog-pg-extension">
3314 <title><structname>pg_extension</structname></title>
3316 <indexterm zone="catalog-pg-extension">
3317 <primary>pg_extension</primary>
3321 The catalog <structname>pg_extension</structname> stores information
3322 about the installed extensions. See <xref linkend="extend-extensions">
3323 for details about extensions.
3327 <title><structname>pg_extension</> Columns</title>
3334 <entry>References</entry>
3335 <entry>Description</entry>
3341 <entry><structfield>oid</structfield></entry>
3342 <entry><type>oid</type></entry>
3344 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3348 <entry><structfield>extname</structfield></entry>
3349 <entry><type>name</type></entry>
3351 <entry>Name of the extension</entry>
3355 <entry><structfield>extowner</structfield></entry>
3356 <entry><type>oid</type></entry>
3357 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3358 <entry>Owner of the extension</entry>
3362 <entry><structfield>extnamespace</structfield></entry>
3363 <entry><type>oid</type></entry>
3364 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3365 <entry>Schema containing the extension's exported objects</entry>
3369 <entry><structfield>extrelocatable</structfield></entry>
3370 <entry><type>bool</type></entry>
3372 <entry>True if extension can be relocated to another schema</entry>
3376 <entry><structfield>extversion</structfield></entry>
3377 <entry><type>text</type></entry>
3379 <entry>Version name for the extension</entry>
3383 <entry><structfield>extconfig</structfield></entry>
3384 <entry><type>oid[]</type></entry>
3385 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3386 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3387 table(s), or <literal>NULL</> if none</entry>
3391 <entry><structfield>extcondition</structfield></entry>
3392 <entry><type>text[]</type></entry>
3394 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3395 extension's configuration table(s), or <literal>NULL</> if none</entry>
3403 Note that unlike most catalogs with a <quote>namespace</> column,
3404 <structfield>extnamespace</structfield> is not meant to imply
3405 that the extension belongs to that schema. Extension names are never
3406 schema-qualified. Rather, <structfield>extnamespace</structfield>
3407 indicates the schema that contains most or all of the extension's
3408 objects. If <structfield>extrelocatable</structfield> is true, then
3409 this schema must in fact contain all schema-qualifiable objects
3410 belonging to the extension.
3415 <sect1 id="catalog-pg-foreign-data-wrapper">
3416 <title><structname>pg_foreign_data_wrapper</structname></title>
3418 <indexterm zone="catalog-pg-foreign-data-wrapper">
3419 <primary>pg_foreign_data_wrapper</primary>
3423 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3424 foreign-data wrapper definitions. A foreign-data wrapper is the
3425 mechanism by which external data, residing on foreign servers, is
3430 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3437 <entry>References</entry>
3438 <entry>Description</entry>
3444 <entry><structfield>oid</structfield></entry>
3445 <entry><type>oid</type></entry>
3447 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3451 <entry><structfield>fdwname</structfield></entry>
3452 <entry><type>name</type></entry>
3454 <entry>Name of the foreign-data wrapper</entry>
3458 <entry><structfield>fdwowner</structfield></entry>
3459 <entry><type>oid</type></entry>
3460 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3461 <entry>Owner of the foreign-data wrapper</entry>
3465 <entry><structfield>fdwhandler</structfield></entry>
3466 <entry><type>oid</type></entry>
3467 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3469 References a handler function that is responsible for
3470 supplying execution routines for the foreign-data wrapper.
3471 Zero if no handler is provided
3476 <entry><structfield>fdwvalidator</structfield></entry>
3477 <entry><type>oid</type></entry>
3478 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3480 References a validator function that is responsible for
3481 checking the validity of the options given to the
3482 foreign-data wrapper, as well as options for foreign servers and user
3483 mappings using the foreign-data wrapper. Zero if no validator
3489 <entry><structfield>fdwacl</structfield></entry>
3490 <entry><type>aclitem[]</type></entry>
3493 Access privileges; see
3494 <xref linkend="sql-grant"> and
3495 <xref linkend="sql-revoke">
3501 <entry><structfield>fdwoptions</structfield></entry>
3502 <entry><type>text[]</type></entry>
3505 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3514 <sect1 id="catalog-pg-foreign-server">
3515 <title><structname>pg_foreign_server</structname></title>
3517 <indexterm zone="catalog-pg-foreign-server">
3518 <primary>pg_foreign_server</primary>
3522 The catalog <structname>pg_foreign_server</structname> stores
3523 foreign server definitions. A foreign server describes a source
3524 of external data, such as a remote server. Foreign
3525 servers are accessed via foreign-data wrappers.
3529 <title><structname>pg_foreign_server</> Columns</title>
3536 <entry>References</entry>
3537 <entry>Description</entry>
3543 <entry><structfield>oid</structfield></entry>
3544 <entry><type>oid</type></entry>
3546 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3550 <entry><structfield>srvname</structfield></entry>
3551 <entry><type>name</type></entry>
3553 <entry>Name of the foreign server</entry>
3557 <entry><structfield>srvowner</structfield></entry>
3558 <entry><type>oid</type></entry>
3559 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3560 <entry>Owner of the foreign server</entry>
3564 <entry><structfield>srvfdw</structfield></entry>
3565 <entry><type>oid</type></entry>
3566 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3567 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3571 <entry><structfield>srvtype</structfield></entry>
3572 <entry><type>text</type></entry>
3574 <entry>Type of the server (optional)</entry>
3578 <entry><structfield>srvversion</structfield></entry>
3579 <entry><type>text</type></entry>
3581 <entry>Version of the server (optional)</entry>
3585 <entry><structfield>srvacl</structfield></entry>
3586 <entry><type>aclitem[]</type></entry>
3589 Access privileges; see
3590 <xref linkend="sql-grant"> and
3591 <xref linkend="sql-revoke">
3597 <entry><structfield>srvoptions</structfield></entry>
3598 <entry><type>text[]</type></entry>
3601 Foreign server specific options, as <quote>keyword=value</> strings
3610 <sect1 id="catalog-pg-foreign-table">
3611 <title><structname>pg_foreign_table</structname></title>
3613 <indexterm zone="catalog-pg-foreign-table">
3614 <primary>pg_foreign_table</primary>
3618 The catalog <structname>pg_foreign_table</structname> contains
3619 auxiliary information about foreign tables. A foreign table is
3620 primarily represented by a <structname>pg_class</structname> entry,
3621 just like a regular table. Its <structname>pg_foreign_table</structname>
3622 entry contains the information that is pertinent only to foreign tables
3623 and not any other kind of relation.
3627 <title><structname>pg_foreign_table</> Columns</title>
3634 <entry>References</entry>
3635 <entry>Description</entry>
3641 <entry><structfield>ftrelid</structfield></entry>
3642 <entry><type>oid</type></entry>
3643 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3644 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3648 <entry><structfield>ftserver</structfield></entry>
3649 <entry><type>oid</type></entry>
3650 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3651 <entry>OID of the foreign server for this foreign table</entry>
3655 <entry><structfield>ftoptions</structfield></entry>
3656 <entry><type>text[]</type></entry>
3659 Foreign table options, as <quote>keyword=value</> strings
3668 <sect1 id="catalog-pg-index">
3669 <title><structname>pg_index</structname></title>
3671 <indexterm zone="catalog-pg-index">
3672 <primary>pg_index</primary>
3676 The catalog <structname>pg_index</structname> contains part of the information
3677 about indexes. The rest is mostly in
3678 <structname>pg_class</structname>.
3682 <title><structname>pg_index</> Columns</title>
3689 <entry>References</entry>
3690 <entry>Description</entry>
3696 <entry><structfield>indexrelid</structfield></entry>
3697 <entry><type>oid</type></entry>
3698 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3699 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3703 <entry><structfield>indrelid</structfield></entry>
3704 <entry><type>oid</type></entry>
3705 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3706 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3710 <entry><structfield>indnatts</structfield></entry>
3711 <entry><type>int2</type></entry>
3713 <entry>The number of columns in the index (duplicates
3714 <literal>pg_class.relnatts</literal>)</entry>
3718 <entry><structfield>indisunique</structfield></entry>
3719 <entry><type>bool</type></entry>
3721 <entry>If true, this is a unique index</entry>
3725 <entry><structfield>indisprimary</structfield></entry>
3726 <entry><type>bool</type></entry>
3728 <entry>If true, this index represents the primary key of the table
3729 (<structfield>indisunique</> should always be true when this is true)</entry>
3733 <entry><structfield>indisexclusion</structfield></entry>
3734 <entry><type>bool</type></entry>
3736 <entry>If true, this index supports an exclusion constraint</entry>
3740 <entry><structfield>indimmediate</structfield></entry>
3741 <entry><type>bool</type></entry>
3743 <entry>If true, the uniqueness check is enforced immediately on
3745 (irrelevant if <structfield>indisunique</> is not true)</entry>
3749 <entry><structfield>indisclustered</structfield></entry>
3750 <entry><type>bool</type></entry>
3752 <entry>If true, the table was last clustered on this index</entry>
3756 <entry><structfield>indisvalid</structfield></entry>
3757 <entry><type>bool</type></entry>
3760 If true, the index is currently valid for queries. False means the
3761 index is possibly incomplete: it must still be modified by
3762 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3763 be used for queries. If it is unique, the uniqueness property is not
3764 guaranteed true either.
3769 <entry><structfield>indcheckxmin</structfield></entry>
3770 <entry><type>bool</type></entry>
3773 If true, queries must not use the index until the <structfield>xmin</>
3774 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3775 event horizon, because the table may contain broken HOT chains with
3776 incompatible rows that they can see
3781 <entry><structfield>indisready</structfield></entry>
3782 <entry><type>bool</type></entry>
3785 If true, the index is currently ready for inserts. False means the
3786 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3792 <entry><structfield>indislive</structfield></entry>
3793 <entry><type>bool</type></entry>
3796 If false, the index is in process of being dropped, and should be
3797 ignored for all purposes (including HOT-safety decisions)
3802 <entry><structfield>indisreplident</structfield></entry>
3803 <entry><type>bool</type></entry>
3806 If true this index has been chosen as <quote>replica identity</>
3807 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3813 <entry><structfield>indkey</structfield></entry>
3814 <entry><type>int2vector</type></entry>
3815 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3817 This is an array of <structfield>indnatts</structfield> values that
3818 indicate which table columns this index indexes. For example a value
3819 of <literal>1 3</literal> would mean that the first and the third table
3820 columns make up the index key. A zero in this array indicates that the
3821 corresponding index attribute is an expression over the table columns,
3822 rather than a simple column reference.
3827 <entry><structfield>indcollation</structfield></entry>
3828 <entry><type>oidvector</type></entry>
3829 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3831 For each column in the index key, this contains the OID of the
3832 collation to use for the index.
3837 <entry><structfield>indclass</structfield></entry>
3838 <entry><type>oidvector</type></entry>
3839 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3841 For each column in the index key, this contains the OID of
3842 the operator class to use. See
3843 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3848 <entry><structfield>indoption</structfield></entry>
3849 <entry><type>int2vector</type></entry>
3852 This is an array of <structfield>indnatts</structfield> values that
3853 store per-column flag bits. The meaning of the bits is defined by
3854 the index's access method.
3859 <entry><structfield>indexprs</structfield></entry>
3860 <entry><type>pg_node_tree</type></entry>
3863 Expression trees (in <function>nodeToString()</function>
3864 representation) for index attributes that are not simple column
3865 references. This is a list with one element for each zero
3866 entry in <structfield>indkey</>. Null if all index attributes
3867 are simple references.
3872 <entry><structfield>indpred</structfield></entry>
3873 <entry><type>pg_node_tree</type></entry>
3876 Expression tree (in <function>nodeToString()</function>
3877 representation) for partial index predicate. Null if not a
3888 <sect1 id="catalog-pg-inherits">
3889 <title><structname>pg_inherits</structname></title>
3891 <indexterm zone="catalog-pg-inherits">
3892 <primary>pg_inherits</primary>
3896 The catalog <structname>pg_inherits</> records information about
3897 table inheritance hierarchies. There is one entry for each direct
3898 child table in the database. (Indirect inheritance can be determined
3899 by following chains of entries.)
3903 <title><structname>pg_inherits</> Columns</title>
3910 <entry>References</entry>
3911 <entry>Description</entry>
3917 <entry><structfield>inhrelid</structfield></entry>
3918 <entry><type>oid</type></entry>
3919 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3921 The OID of the child table
3926 <entry><structfield>inhparent</structfield></entry>
3927 <entry><type>oid</type></entry>
3928 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3930 The OID of the parent table
3935 <entry><structfield>inhseqno</structfield></entry>
3936 <entry><type>int4</type></entry>
3939 If there is more than one direct parent for a child table (multiple
3940 inheritance), this number tells the order in which the
3941 inherited columns are to be arranged. The count starts at 1.
3951 <sect1 id="catalog-pg-language">
3952 <title><structname>pg_language</structname></title>
3954 <indexterm zone="catalog-pg-language">
3955 <primary>pg_language</primary>
3959 The catalog <structname>pg_language</structname> registers
3960 languages in which you can write functions or stored procedures.
3961 See <xref linkend="sql-createlanguage">
3962 and <xref linkend="xplang"> for more information about language handlers.
3966 <title><structname>pg_language</> Columns</title>
3973 <entry>References</entry>
3974 <entry>Description</entry>
3980 <entry><structfield>oid</structfield></entry>
3981 <entry><type>oid</type></entry>
3983 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3987 <entry><structfield>lanname</structfield></entry>
3988 <entry><type>name</type></entry>
3990 <entry>Name of the language</entry>
3994 <entry><structfield>lanowner</structfield></entry>
3995 <entry><type>oid</type></entry>
3996 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3997 <entry>Owner of the language</entry>
4001 <entry><structfield>lanispl</structfield></entry>
4002 <entry><type>bool</type></entry>
4005 This is false for internal languages (such as
4006 <acronym>SQL</acronym>) and true for user-defined languages.
4007 Currently, <application>pg_dump</application> still uses this
4008 to determine which languages need to be dumped, but this might be
4009 replaced by a different mechanism in the future.
4014 <entry><structfield>lanpltrusted</structfield></entry>
4015 <entry><type>bool</type></entry>
4018 True if this is a trusted language, which means that it is believed
4019 not to grant access to anything outside the normal SQL execution
4020 environment. Only superusers can create functions in untrusted
4026 <entry><structfield>lanplcallfoid</structfield></entry>
4027 <entry><type>oid</type></entry>
4028 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4030 For noninternal languages this references the language
4031 handler, which is a special function that is responsible for
4032 executing all functions that are written in the particular
4038 <entry><structfield>laninline</structfield></entry>
4039 <entry><type>oid</type></entry>
4040 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4042 This references a function that is responsible for executing
4043 <quote>inline</> anonymous code blocks
4044 (<xref linkend="sql-do"> blocks).
4045 Zero if inline blocks are not supported.
4050 <entry><structfield>lanvalidator</structfield></entry>
4051 <entry><type>oid</type></entry>
4052 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4054 This references a language validator function that is responsible
4055 for checking the syntax and validity of new functions when they
4056 are created. Zero if no validator is provided.
4061 <entry><structfield>lanacl</structfield></entry>
4062 <entry><type>aclitem[]</type></entry>
4065 Access privileges; see
4066 <xref linkend="sql-grant"> and
4067 <xref linkend="sql-revoke">
4078 <sect1 id="catalog-pg-largeobject">
4079 <title><structname>pg_largeobject</structname></title>
4081 <indexterm zone="catalog-pg-largeobject">
4082 <primary>pg_largeobject</primary>
4086 The catalog <structname>pg_largeobject</structname> holds the data making up
4087 <quote>large objects</quote>. A large object is identified by an OID
4088 assigned when it is created. Each large object is broken into
4089 segments or <quote>pages</> small enough to be conveniently stored as rows
4090 in <structname>pg_largeobject</structname>.
4091 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4092 <literal>BLCKSZ/4</>, or typically 2 kB).
4096 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4097 associated with large objects. As a result,
4098 <structname>pg_largeobject</structname> was publicly readable and could be
4099 used to obtain the OIDs (and contents) of all large objects in the system.
4100 This is no longer the case; use
4101 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4102 to obtain a list of large object OIDs.
4106 <title><structname>pg_largeobject</> Columns</title>
4113 <entry>References</entry>
4114 <entry>Description</entry>
4120 <entry><structfield>loid</structfield></entry>
4121 <entry><type>oid</type></entry>
4122 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4123 <entry>Identifier of the large object that includes this page</entry>
4127 <entry><structfield>pageno</structfield></entry>
4128 <entry><type>int4</type></entry>
4130 <entry>Page number of this page within its large object
4131 (counting from zero)</entry>
4135 <entry><structfield>data</structfield></entry>
4136 <entry><type>bytea</type></entry>
4139 Actual data stored in the large object.
4140 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4148 Each row of <structname>pg_largeobject</structname> holds data
4149 for one page of a large object, beginning at
4150 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4151 allows sparse storage: pages might be missing, and might be shorter than
4152 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4153 Missing regions within a large object read as zeroes.
4158 <sect1 id="catalog-pg-largeobject-metadata">
4159 <title><structname>pg_largeobject_metadata</structname></title>
4161 <indexterm zone="catalog-pg-largeobject-metadata">
4162 <primary>pg_largeobject_metadata</primary>
4166 The catalog <structname>pg_largeobject_metadata</structname>
4167 holds metadata associated with large objects. The actual large object
4169 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4173 <title><structname>pg_largeobject_metadata</> Columns</title>
4180 <entry>References</entry>
4181 <entry>Description</entry>
4187 <entry><structfield>oid</structfield></entry>
4188 <entry><type>oid</type></entry>
4190 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4194 <entry><structfield>lomowner</structfield></entry>
4195 <entry><type>oid</type></entry>
4196 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4197 <entry>Owner of the large object</entry>
4201 <entry><structfield>lomacl</structfield></entry>
4202 <entry><type>aclitem[]</type></entry>
4205 Access privileges; see
4206 <xref linkend="sql-grant"> and
4207 <xref linkend="sql-revoke">
4217 <sect1 id="catalog-pg-namespace">
4218 <title><structname>pg_namespace</structname></title>
4220 <indexterm zone="catalog-pg-namespace">
4221 <primary>pg_namespace</primary>
4225 The catalog <structname>pg_namespace</> stores namespaces.
4226 A namespace is the structure underlying SQL schemas: each namespace
4227 can have a separate collection of relations, types, etc. without name
4232 <title><structname>pg_namespace</> Columns</title>
4239 <entry>References</entry>
4240 <entry>Description</entry>
4246 <entry><structfield>oid</structfield></entry>
4247 <entry><type>oid</type></entry>
4249 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4253 <entry><structfield>nspname</structfield></entry>
4254 <entry><type>name</type></entry>
4256 <entry>Name of the namespace</entry>
4260 <entry><structfield>nspowner</structfield></entry>
4261 <entry><type>oid</type></entry>
4262 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4263 <entry>Owner of the namespace</entry>
4267 <entry><structfield>nspacl</structfield></entry>
4268 <entry><type>aclitem[]</type></entry>
4271 Access privileges; see
4272 <xref linkend="sql-grant"> and
4273 <xref linkend="sql-revoke">
4284 <sect1 id="catalog-pg-opclass">
4285 <title><structname>pg_opclass</structname></title>
4287 <indexterm zone="catalog-pg-opclass">
4288 <primary>pg_opclass</primary>
4292 The catalog <structname>pg_opclass</structname> defines
4293 index access method operator classes. Each operator class defines
4294 semantics for index columns of a particular data type and a particular
4295 index access method. An operator class essentially specifies that a
4296 particular operator family is applicable to a particular indexable column
4297 data type. The set of operators from the family that are actually usable
4298 with the indexed column are whichever ones accept the column's data type
4299 as their left-hand input.
4303 Operator classes are described at length in <xref linkend="xindex">.
4307 <title><structname>pg_opclass</> Columns</title>
4314 <entry>References</entry>
4315 <entry>Description</entry>
4321 <entry><structfield>oid</structfield></entry>
4322 <entry><type>oid</type></entry>
4324 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4328 <entry><structfield>opcmethod</structfield></entry>
4329 <entry><type>oid</type></entry>
4330 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4331 <entry>Index access method operator class is for</entry>
4335 <entry><structfield>opcname</structfield></entry>
4336 <entry><type>name</type></entry>
4338 <entry>Name of this operator class</entry>
4342 <entry><structfield>opcnamespace</structfield></entry>
4343 <entry><type>oid</type></entry>
4344 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4345 <entry>Namespace of this operator class</entry>
4349 <entry><structfield>opcowner</structfield></entry>
4350 <entry><type>oid</type></entry>
4351 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4352 <entry>Owner of the operator class</entry>
4356 <entry><structfield>opcfamily</structfield></entry>
4357 <entry><type>oid</type></entry>
4358 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4359 <entry>Operator family containing the operator class</entry>
4363 <entry><structfield>opcintype</structfield></entry>
4364 <entry><type>oid</type></entry>
4365 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4366 <entry>Data type that the operator class indexes</entry>
4370 <entry><structfield>opcdefault</structfield></entry>
4371 <entry><type>bool</type></entry>
4373 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4377 <entry><structfield>opckeytype</structfield></entry>
4378 <entry><type>oid</type></entry>
4379 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4380 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4388 An operator class's <structfield>opcmethod</> must match the
4389 <structname>opfmethod</> of its containing operator family.
4390 Also, there must be no more than one <structname>pg_opclass</structname>
4391 row having <structname>opcdefault</> true for any given combination of
4392 <structname>opcmethod</> and <structname>opcintype</>.
4398 <sect1 id="catalog-pg-operator">
4399 <title><structname>pg_operator</structname></title>
4401 <indexterm zone="catalog-pg-operator">
4402 <primary>pg_operator</primary>
4406 The catalog <structname>pg_operator</> stores information about operators.
4407 See <xref linkend="sql-createoperator">
4408 and <xref linkend="xoper"> for more information.
4412 <title><structname>pg_operator</> Columns</title>
4419 <entry>References</entry>
4420 <entry>Description</entry>
4426 <entry><structfield>oid</structfield></entry>
4427 <entry><type>oid</type></entry>
4429 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4433 <entry><structfield>oprname</structfield></entry>
4434 <entry><type>name</type></entry>
4436 <entry>Name of the operator</entry>
4440 <entry><structfield>oprnamespace</structfield></entry>
4441 <entry><type>oid</type></entry>
4442 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4444 The OID of the namespace that contains this operator
4449 <entry><structfield>oprowner</structfield></entry>
4450 <entry><type>oid</type></entry>
4451 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4452 <entry>Owner of the operator</entry>
4456 <entry><structfield>oprkind</structfield></entry>
4457 <entry><type>char</type></entry>
4460 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4461 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4466 <entry><structfield>oprcanmerge</structfield></entry>
4467 <entry><type>bool</type></entry>
4469 <entry>This operator supports merge joins</entry>
4473 <entry><structfield>oprcanhash</structfield></entry>
4474 <entry><type>bool</type></entry>
4476 <entry>This operator supports hash joins</entry>
4480 <entry><structfield>oprleft</structfield></entry>
4481 <entry><type>oid</type></entry>
4482 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4483 <entry>Type of the left operand</entry>
4487 <entry><structfield>oprright</structfield></entry>
4488 <entry><type>oid</type></entry>
4489 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4490 <entry>Type of the right operand</entry>
4494 <entry><structfield>oprresult</structfield></entry>
4495 <entry><type>oid</type></entry>
4496 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4497 <entry>Type of the result</entry>
4501 <entry><structfield>oprcom</structfield></entry>
4502 <entry><type>oid</type></entry>
4503 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4504 <entry>Commutator of this operator, if any</entry>
4508 <entry><structfield>oprnegate</structfield></entry>
4509 <entry><type>oid</type></entry>
4510 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4511 <entry>Negator of this operator, if any</entry>
4515 <entry><structfield>oprcode</structfield></entry>
4516 <entry><type>regproc</type></entry>
4517 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4518 <entry>Function that implements this operator</entry>
4522 <entry><structfield>oprrest</structfield></entry>
4523 <entry><type>regproc</type></entry>
4524 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4525 <entry>Restriction selectivity estimation function for this operator</entry>
4529 <entry><structfield>oprjoin</structfield></entry>
4530 <entry><type>regproc</type></entry>
4531 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4532 <entry>Join selectivity estimation function for this operator</entry>
4539 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4540 is zero for a prefix operator.
4546 <sect1 id="catalog-pg-opfamily">
4547 <title><structname>pg_opfamily</structname></title>
4549 <indexterm zone="catalog-pg-opfamily">
4550 <primary>pg_opfamily</primary>
4554 The catalog <structname>pg_opfamily</structname> defines operator families.
4555 Each operator family is a collection of operators and associated
4556 support routines that implement the semantics specified for a particular
4557 index access method. Furthermore, the operators in a family are all
4558 <quote>compatible</>, in a way that is specified by the access method.
4559 The operator family concept allows cross-data-type operators to be used
4560 with indexes and to be reasoned about using knowledge of access method
4565 Operator families are described at length in <xref linkend="xindex">.
4569 <title><structname>pg_opfamily</> Columns</title>
4576 <entry>References</entry>
4577 <entry>Description</entry>
4583 <entry><structfield>oid</structfield></entry>
4584 <entry><type>oid</type></entry>
4586 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4590 <entry><structfield>opfmethod</structfield></entry>
4591 <entry><type>oid</type></entry>
4592 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4593 <entry>Index access method operator family is for</entry>
4597 <entry><structfield>opfname</structfield></entry>
4598 <entry><type>name</type></entry>
4600 <entry>Name of this operator family</entry>
4604 <entry><structfield>opfnamespace</structfield></entry>
4605 <entry><type>oid</type></entry>
4606 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4607 <entry>Namespace of this operator family</entry>
4611 <entry><structfield>opfowner</structfield></entry>
4612 <entry><type>oid</type></entry>
4613 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4614 <entry>Owner of the operator family</entry>
4622 The majority of the information defining an operator family is not in its
4623 <structname>pg_opfamily</structname> row, but in the associated rows in
4624 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4625 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4627 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4633 <sect1 id="catalog-pg-pltemplate">
4634 <title><structname>pg_pltemplate</structname></title>
4636 <indexterm zone="catalog-pg-pltemplate">
4637 <primary>pg_pltemplate</primary>
4641 The catalog <structname>pg_pltemplate</structname> stores
4642 <quote>template</> information for procedural languages.
4643 A template for a language allows the language to be created in a
4644 particular database by a simple <command>CREATE LANGUAGE</> command,
4645 with no need to specify implementation details.
4649 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4650 is shared across all databases of a cluster: there is only one
4651 copy of <structname>pg_pltemplate</structname> per cluster, not
4652 one per database. This allows the information to be accessible in
4653 each database as it is needed.
4657 <title><structname>pg_pltemplate</> Columns</title>
4664 <entry>Description</entry>
4670 <entry><structfield>tmplname</structfield></entry>
4671 <entry><type>name</type></entry>
4672 <entry>Name of the language this template is for</entry>
4676 <entry><structfield>tmpltrusted</structfield></entry>
4677 <entry><type>boolean</type></entry>
4678 <entry>True if language is considered trusted</entry>
4682 <entry><structfield>tmpldbacreate</structfield></entry>
4683 <entry><type>boolean</type></entry>
4684 <entry>True if language may be created by a database owner</entry>
4688 <entry><structfield>tmplhandler</structfield></entry>
4689 <entry><type>text</type></entry>
4690 <entry>Name of call handler function</entry>
4694 <entry><structfield>tmplinline</structfield></entry>
4695 <entry><type>text</type></entry>
4696 <entry>Name of anonymous-block handler function, or null if none</entry>
4700 <entry><structfield>tmplvalidator</structfield></entry>
4701 <entry><type>text</type></entry>
4702 <entry>Name of validator function, or null if none</entry>
4706 <entry><structfield>tmpllibrary</structfield></entry>
4707 <entry><type>text</type></entry>
4708 <entry>Path of shared library that implements language</entry>
4712 <entry><structfield>tmplacl</structfield></entry>
4713 <entry><type>aclitem[]</type></entry>
4714 <entry>Access privileges for template (not actually used)</entry>
4722 There are not currently any commands that manipulate procedural language
4723 templates; to change the built-in information, a superuser must modify
4724 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4725 or <command>UPDATE</command> commands.
4730 It is likely that <structname>pg_pltemplate</> will be removed in some
4731 future release of <productname>PostgreSQL</productname>, in favor of
4732 keeping this knowledge about procedural languages in their respective
4733 extension installation scripts.
4739 <sect1 id="catalog-pg-policy">
4740 <title><structname>pg_policy</structname></title>
4742 <indexterm zone="catalog-pg-policy">
4743 <primary>pg_policy</primary>
4747 The catalog <structname>pg_policy</structname> stores row level
4748 security policies for tables. A policy includes the kind of
4749 command that it applies to (possibly all commands), the roles that it
4750 applies to, the expression to be added as a security-barrier
4751 qualification to queries that include the table, and the expression
4752 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4753 add new records to the table.
4758 <title><structname>pg_policy</structname> Columns</title>
4765 <entry>References</entry>
4766 <entry>Description</entry>
4772 <entry><structfield>polname</structfield></entry>
4773 <entry><type>name</type></entry>
4775 <entry>The name of the policy</entry>
4779 <entry><structfield>polrelid</structfield></entry>
4780 <entry><type>oid</type></entry>
4781 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4782 <entry>The table to which the policy applies</entry>
4786 <entry><structfield>polcmd</structfield></entry>
4787 <entry><type>char</type></entry>
4789 <entry>The command type to which the policy is applied:
4790 <literal>r</> for <command>SELECT</>,
4791 <literal>a</> for <command>INSERT</>,
4792 <literal>w</> for <command>UPDATE</>,
4793 <literal>d</> for <command>DELETE</>,
4794 or <literal>*</> for all</entry>
4798 <entry><structfield>polroles</structfield></entry>
4799 <entry><type>oid[]</type></entry>
4800 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4801 <entry>The roles to which the policy is applied</entry>
4805 <entry><structfield>polqual</structfield></entry>
4806 <entry><type>pg_node_tree</type></entry>
4808 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4812 <entry><structfield>polwithcheck</structfield></entry>
4813 <entry><type>pg_node_tree</type></entry>
4815 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4824 Policies stored in <structname>pg_policy</> are applied only when
4825 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4832 <sect1 id="catalog-pg-proc">
4833 <title><structname>pg_proc</structname></title>
4835 <indexterm zone="catalog-pg-proc">
4836 <primary>pg_proc</primary>
4840 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4841 See <xref linkend="sql-createfunction">
4842 and <xref linkend="xfunc"> for more information.
4846 The table contains data for aggregate functions as well as plain functions.
4847 If <structfield>proisagg</structfield> is true, there should be a matching
4848 row in <structfield>pg_aggregate</structfield>.
4852 <title><structname>pg_proc</> Columns</title>
4859 <entry>References</entry>
4860 <entry>Description</entry>
4866 <entry><structfield>oid</structfield></entry>
4867 <entry><type>oid</type></entry>
4869 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4873 <entry><structfield>proname</structfield></entry>
4874 <entry><type>name</type></entry>
4876 <entry>Name of the function</entry>
4880 <entry><structfield>pronamespace</structfield></entry>
4881 <entry><type>oid</type></entry>
4882 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4884 The OID of the namespace that contains this function
4889 <entry><structfield>proowner</structfield></entry>
4890 <entry><type>oid</type></entry>
4891 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4892 <entry>Owner of the function</entry>
4896 <entry><structfield>prolang</structfield></entry>
4897 <entry><type>oid</type></entry>
4898 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4899 <entry>Implementation language or call interface of this function</entry>
4903 <entry><structfield>procost</structfield></entry>
4904 <entry><type>float4</type></entry>
4906 <entry>Estimated execution cost (in units of
4907 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4908 this is cost per row returned</entry>
4912 <entry><structfield>prorows</structfield></entry>
4913 <entry><type>float4</type></entry>
4915 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4919 <entry><structfield>provariadic</structfield></entry>
4920 <entry><type>oid</type></entry>
4921 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4922 <entry>Data type of the variadic array parameter's elements,
4923 or zero if the function does not have a variadic parameter</entry>
4927 <entry><structfield>protransform</structfield></entry>
4928 <entry><type>regproc</type></entry>
4929 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4930 <entry>Calls to this function can be simplified by this other function
4931 (see <xref linkend="xfunc-transform-functions">)</entry>
4935 <entry><structfield>proisagg</structfield></entry>
4936 <entry><type>bool</type></entry>
4938 <entry>Function is an aggregate function</entry>
4942 <entry><structfield>proiswindow</structfield></entry>
4943 <entry><type>bool</type></entry>
4945 <entry>Function is a window function</entry>
4949 <entry><structfield>prosecdef</structfield></entry>
4950 <entry><type>bool</type></entry>
4952 <entry>Function is a security definer (i.e., a <quote>setuid</>
4957 <entry><structfield>proleakproof</structfield></entry>
4958 <entry><type>bool</type></entry>
4961 The function has no side effects. No information about the
4962 arguments is conveyed except via the return value. Any function
4963 that might throw an error depending on the values of its arguments
4969 <entry><structfield>proisstrict</structfield></entry>
4970 <entry><type>bool</type></entry>
4973 Function returns null if any call argument is null. In that
4974 case the function won't actually be called at all. Functions
4975 that are not <quote>strict</quote> must be prepared to handle
4981 <entry><structfield>proretset</structfield></entry>
4982 <entry><type>bool</type></entry>
4984 <entry>Function returns a set (i.e., multiple values of the specified
4989 <entry><structfield>provolatile</structfield></entry>
4990 <entry><type>char</type></entry>
4993 <structfield>provolatile</structfield> tells whether the function's
4994 result depends only on its input arguments, or is affected by outside
4996 It is <literal>i</literal> for <quote>immutable</> functions,
4997 which always deliver the same result for the same inputs.
4998 It is <literal>s</literal> for <quote>stable</> functions,
4999 whose results (for fixed inputs) do not change within a scan.
5000 It is <literal>v</literal> for <quote>volatile</> functions,
5001 whose results might change at any time. (Use <literal>v</literal> also
5002 for functions with side-effects, so that calls to them cannot get
5008 <entry><structfield>proparallel</structfield></entry>
5009 <entry><type>char</type></entry>
5012 <structfield>proparallel</structfield> tells whether the function
5013 can be safely run in parallel mode.
5014 It is <literal>s</literal> for functions which are safe to run in
5015 parallel mode without restriction.
5016 It is <literal>r</literal> for functions which can be run in parallel
5017 mode, but their execution is restricted to the parallel group leader;
5018 parallel worker processes cannot invoke these functions.
5019 It is <literal>u</literal> for functions which are unsafe in parallel
5020 mode; the presence of such a function forces a serial execution plan.
5025 <entry><structfield>pronargs</structfield></entry>
5026 <entry><type>int2</type></entry>
5028 <entry>Number of input arguments</entry>
5032 <entry><structfield>pronargdefaults</structfield></entry>
5033 <entry><type>int2</type></entry>
5035 <entry>Number of arguments that have defaults</entry>
5039 <entry><structfield>prorettype</structfield></entry>
5040 <entry><type>oid</type></entry>
5041 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5042 <entry>Data type of the return value</entry>
5046 <entry><structfield>proargtypes</structfield></entry>
5047 <entry><type>oidvector</type></entry>
5048 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5050 An array with the data types of the function arguments. This includes
5051 only input arguments (including <literal>INOUT</literal> and
5052 <literal>VARIADIC</> arguments), and thus represents
5053 the call signature of the function.
5058 <entry><structfield>proallargtypes</structfield></entry>
5059 <entry><type>oid[]</type></entry>
5060 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5062 An array with the data types of the function arguments. This includes
5063 all arguments (including <literal>OUT</literal> and
5064 <literal>INOUT</literal> arguments); however, if all the
5065 arguments are <literal>IN</literal> arguments, this field will be null.
5066 Note that subscripting is 1-based, whereas for historical reasons
5067 <structfield>proargtypes</> is subscripted from 0.
5072 <entry><structfield>proargmodes</structfield></entry>
5073 <entry><type>char[]</type></entry>
5076 An array with the modes of the function arguments, encoded as
5077 <literal>i</literal> for <literal>IN</> arguments,
5078 <literal>o</literal> for <literal>OUT</> arguments,
5079 <literal>b</literal> for <literal>INOUT</> arguments,
5080 <literal>v</literal> for <literal>VARIADIC</> arguments,
5081 <literal>t</literal> for <literal>TABLE</> arguments.
5082 If all the arguments are <literal>IN</literal> arguments,
5083 this field will be null.
5084 Note that subscripts correspond to positions of
5085 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5090 <entry><structfield>proargnames</structfield></entry>
5091 <entry><type>text[]</type></entry>
5094 An array with the names of the function arguments.
5095 Arguments without a name are set to empty strings in the array.
5096 If none of the arguments have a name, this field will be null.
5097 Note that subscripts correspond to positions of
5098 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5103 <entry><structfield>proargdefaults</structfield></entry>
5104 <entry><type>pg_node_tree</type></entry>
5107 Expression trees (in <function>nodeToString()</function> representation)
5108 for default values. This is a list with
5109 <structfield>pronargdefaults</> elements, corresponding to the last
5110 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5111 <replaceable>N</> <structfield>proargtypes</> positions).
5112 If none of the arguments have defaults, this field will be null.
5117 <entry><structfield>protrftypes</structfield></entry>
5118 <entry><type>oid[]</type></entry>
5121 Data type OIDs for which to apply transforms.
5126 <entry><structfield>prosrc</structfield></entry>
5127 <entry><type>text</type></entry>
5130 This tells the function handler how to invoke the function. It
5131 might be the actual source code of the function for interpreted
5132 languages, a link symbol, a file name, or just about anything
5133 else, depending on the implementation language/call convention.
5138 <entry><structfield>probin</structfield></entry>
5139 <entry><type>text</type></entry>
5142 Additional information about how to invoke the function.
5143 Again, the interpretation is language-specific.
5148 <entry><structfield>proconfig</structfield></entry>
5149 <entry><type>text[]</type></entry>
5151 <entry>Function's local settings for run-time configuration variables</entry>
5155 <entry><structfield>proacl</structfield></entry>
5156 <entry><type>aclitem[]</type></entry>
5159 Access privileges; see
5160 <xref linkend="sql-grant"> and
5161 <xref linkend="sql-revoke">
5170 For compiled functions, both built-in and dynamically loaded,
5171 <structfield>prosrc</structfield> contains the function's C-language
5172 name (link symbol). For all other currently-known language types,
5173 <structfield>prosrc</structfield> contains the function's source
5174 text. <structfield>probin</structfield> is unused except for
5175 dynamically-loaded C functions, for which it gives the name of the
5176 shared library file containing the function.
5181 <sect1 id="catalog-pg-range">
5182 <title><structname>pg_range</structname></title>
5184 <indexterm zone="catalog-pg-range">
5185 <primary>pg_range</primary>
5189 The catalog <structname>pg_range</structname> stores information about
5190 range types. This is in addition to the types' entries in
5191 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5195 <title><structname>pg_range</> Columns</title>
5202 <entry>References</entry>
5203 <entry>Description</entry>
5209 <entry><structfield>rngtypid</structfield></entry>
5210 <entry><type>oid</type></entry>
5211 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5212 <entry>OID of the range type</entry>
5216 <entry><structfield>rngsubtype</structfield></entry>
5217 <entry><type>oid</type></entry>
5218 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5219 <entry>OID of the element type (subtype) of this range type</entry>
5223 <entry><structfield>rngcollation</structfield></entry>
5224 <entry><type>oid</type></entry>
5225 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5226 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5230 <entry><structfield>rngsubopc</structfield></entry>
5231 <entry><type>oid</type></entry>
5232 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5233 <entry>OID of the subtype's operator class used for range comparisons</entry>
5237 <entry><structfield>rngcanonical</structfield></entry>
5238 <entry><type>regproc</type></entry>
5239 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5240 <entry>OID of the function to convert a range value into canonical form,
5241 or 0 if none</entry>
5245 <entry><structfield>rngsubdiff</structfield></entry>
5246 <entry><type>regproc</type></entry>
5247 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5248 <entry>OID of the function to return the difference between two element
5249 values as <type>double precision</type>, or 0 if none</entry>
5256 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5257 element type is collatable) determines the sort ordering used by the range
5258 type. <structfield>rngcanonical</> is used when the element type is
5259 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5260 improve performance of GiST indexes on the range type.
5265 <sect1 id="catalog-pg-rewrite">
5266 <title><structname>pg_rewrite</structname></title>
5268 <indexterm zone="catalog-pg-rewrite">
5269 <primary>pg_rewrite</primary>
5273 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5277 <title><structname>pg_rewrite</> Columns</title>
5284 <entry>References</entry>
5285 <entry>Description</entry>
5291 <entry><structfield>oid</structfield></entry>
5292 <entry><type>oid</type></entry>
5294 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5298 <entry><structfield>rulename</structfield></entry>
5299 <entry><type>name</type></entry>
5301 <entry>Rule name</entry>
5305 <entry><structfield>ev_class</structfield></entry>
5306 <entry><type>oid</type></entry>
5307 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5308 <entry>The table this rule is for</entry>
5312 <entry><structfield>ev_type</structfield></entry>
5313 <entry><type>char</type></entry>
5316 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5317 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5323 <entry><structfield>ev_enabled</structfield></entry>
5324 <entry><type>char</type></entry>
5327 Controls in which <xref linkend="guc-session-replication-role"> modes
5329 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5330 <literal>D</> = rule is disabled,
5331 <literal>R</> = rule fires in <quote>replica</> mode,
5332 <literal>A</> = rule fires always.
5337 <entry><structfield>is_instead</structfield></entry>
5338 <entry><type>bool</type></entry>
5340 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5344 <entry><structfield>ev_qual</structfield></entry>
5345 <entry><type>pg_node_tree</type></entry>
5348 Expression tree (in the form of a
5349 <function>nodeToString()</function> representation) for the
5350 rule's qualifying condition
5355 <entry><structfield>ev_action</structfield></entry>
5356 <entry><type>pg_node_tree</type></entry>
5359 Query tree (in the form of a
5360 <function>nodeToString()</function> representation) for the
5370 <literal>pg_class.relhasrules</literal>
5371 must be true if a table has any rules in this catalog.
5377 <sect1 id="catalog-pg-replication-origin">
5378 <title><structname>pg_replication_origin</structname></title>
5380 <indexterm zone="catalog-pg-replication-origin">
5381 <primary>pg_replication_origin</primary>
5385 The <structname>pg_replication_origin</structname> catalog contains
5386 all replication origins created. For more on replication origins
5387 see <xref linkend="replication-origins">.
5392 <title><structname>pg_replication_origin</structname> Columns</title>
5399 <entry>References</entry>
5400 <entry>Description</entry>
5406 <entry><structfield>roident</structfield></entry>
5407 <entry><type>Oid</type></entry>
5409 <entry>A unique, cluster-wide identifier for the replication
5410 origin. Should never leave the system.</entry>
5414 <entry><structfield>roname</structfield></entry>
5415 <entry><type>text</type></entry>
5417 <entry>The external, user defined, name of a replication
5425 <sect1 id="catalog-pg-replication-origin-status">
5426 <title><structname>pg_replication_origin_status</structname></title>
5428 <indexterm zone="catalog-pg-replication-origin-status">
5429 <primary>pg_replication_origin_status</primary>
5433 The <structname>pg_replication_origin_status</structname> view
5434 contains information about how far replay for a certain origin has
5435 progressed. For more on replication origins
5436 see <xref linkend="replication-origins">.
5441 <title><structname>pg_replication_origin_status</structname> Columns</title>
5448 <entry>References</entry>
5449 <entry>Description</entry>
5455 <entry><structfield>local_id</structfield></entry>
5456 <entry><type>Oid</type></entry>
5457 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
5458 <entry>internal node identifier</entry>
5462 <entry><structfield>external_id</structfield></entry>
5463 <entry><type>text</type></entry>
5464 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
5465 <entry>external node identifier</entry>
5469 <entry><structfield>remote_lsn</structfield></entry>
5470 <entry><type>pg_lsn</type></entry>
5472 <entry>The origin node's LSN up to which data has been replicated.</entry>
5477 <entry><structfield>local_lsn</structfield></entry>
5478 <entry><type>pg_lsn</type></entry>
5481 This node's LSN at which <literal>remote_lsn</literal> has
5482 been replicated. Used to flush commit records before persisting
5483 data to disk when using asynchronous commits.
5491 <sect1 id="catalog-pg-replication-slots">
5492 <title><structname>pg_replication_slots</structname></title>
5494 <indexterm zone="catalog-pg-replication-slots">
5495 <primary>pg_replication_slots</primary>
5499 The <structname>pg_replication_slots</structname> view provides a listing
5500 of all replication slots that currently exist on the database cluster,
5501 along with their current state.
5505 For more on replication slots,
5506 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
5511 <title><structname>pg_replication_slots</structname> Columns</title>
5518 <entry>References</entry>
5519 <entry>Description</entry>
5525 <entry><structfield>slot_name</structfield></entry>
5526 <entry><type>name</type></entry>
5528 <entry>A unique, cluster-wide identifier for the replication slot</entry>
5532 <entry><structfield>plugin</structfield></entry>
5533 <entry><type>name</type></entry>
5535 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
5539 <entry><structfield>slot_type</structfield></entry>
5540 <entry><type>text</type></entry>
5542 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
5546 <entry><structfield>datoid</structfield></entry>
5547 <entry><type>oid</type></entry>
5548 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5549 <entry>The OID of the database this slot is associated with, or
5550 null. Only logical slots have an associated database.</entry>
5554 <entry><structfield>database</structfield></entry>
5555 <entry><type>text</type></entry>
5556 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5557 <entry>The name of the database this slot is associated with, or
5558 null. Only logical slots have an associated database.</entry>
5562 <entry><structfield>active</structfield></entry>
5563 <entry><type>boolean</type></entry>
5565 <entry>True if this slot is currently actively being used</entry>
5569 <entry><structfield>active_pid</structfield></entry>
5570 <entry><type>integer</type></entry>
5572 <entry>The process ID of the session using this slot if the slot
5573 is currently actively being used. <literal>NULL</literal> if
5579 <entry><structfield>xmin</structfield></entry>
5580 <entry><type>xid</type></entry>
5582 <entry>The oldest transaction that this slot needs the database to
5583 retain. <literal>VACUUM</literal> cannot remove tuples deleted
5584 by any later transaction.
5589 <entry><structfield>catalog_xmin</structfield></entry>
5590 <entry><type>xid</type></entry>
5592 <entry>The oldest transaction affecting the system catalogs that this
5593 slot needs the database to retain. <literal>VACUUM</literal> cannot
5594 remove catalog tuples deleted by any later transaction.
5599 <entry><structfield>restart_lsn</structfield></entry>
5600 <entry><type>pg_lsn</type></entry>
5602 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
5603 might be required by the consumer of this slot and thus won't be
5604 automatically removed during checkpoints.
5609 <entry><structfield>confirmed_flush_lsn</structfield></entry>
5610 <entry><type>pg_lsn</type></entry>
5612 <entry>The address (<literal>LSN</literal>) up to which the logical
5613 slot's consumer has confirmed receiving data. Data older than this is
5614 not available anymore. <literal>NULL</> for physical slots.
5623 <sect1 id="catalog-pg-seclabel">
5624 <title><structname>pg_seclabel</structname></title>
5626 <indexterm zone="catalog-pg-seclabel">
5627 <primary>pg_seclabel</primary>
5631 The catalog <structname>pg_seclabel</structname> stores security
5632 labels on database objects. Security labels can be manipulated
5633 with the <xref linkend="sql-security-label"> command. For an easier
5634 way to view security labels, see <xref linkend="view-pg-seclabels">.
5638 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5639 which performs a similar function for security labels of database objects
5640 that are shared across a database cluster.
5644 <title><structname>pg_seclabel</structname> Columns</title>
5651 <entry>References</entry>
5652 <entry>Description</entry>
5658 <entry><structfield>objoid</structfield></entry>
5659 <entry><type>oid</type></entry>
5660 <entry>any OID column</entry>
5661 <entry>The OID of the object this security label pertains to</entry>
5665 <entry><structfield>classoid</structfield></entry>
5666 <entry><type>oid</type></entry>
5667 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5668 <entry>The OID of the system catalog this object appears in</entry>
5672 <entry><structfield>objsubid</structfield></entry>
5673 <entry><type>int4</type></entry>
5676 For a security label on a table column, this is the column number (the
5677 <structfield>objoid</> and <structfield>classoid</> refer to
5678 the table itself). For all other object types, this column is
5684 <entry><structfield>provider</structfield></entry>
5685 <entry><type>text</type></entry>
5687 <entry>The label provider associated with this label.</entry>
5691 <entry><structfield>label</structfield></entry>
5692 <entry><type>text</type></entry>
5694 <entry>The security label applied to this object.</entry>
5701 <sect1 id="catalog-pg-shdepend">
5702 <title><structname>pg_shdepend</structname></title>
5704 <indexterm zone="catalog-pg-shdepend">
5705 <primary>pg_shdepend</primary>
5709 The catalog <structname>pg_shdepend</structname> records the
5710 dependency relationships between database objects and shared objects,
5711 such as roles. This information allows
5712 <productname>PostgreSQL</productname> to ensure that those objects are
5713 unreferenced before attempting to delete them.
5717 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5718 which performs a similar function for dependencies involving objects
5719 within a single database.
5723 Unlike most system catalogs, <structname>pg_shdepend</structname>
5724 is shared across all databases of a cluster: there is only one
5725 copy of <structname>pg_shdepend</structname> per cluster, not
5730 <title><structname>pg_shdepend</> Columns</title>
5737 <entry>References</entry>
5738 <entry>Description</entry>
5744 <entry><structfield>dbid</structfield></entry>
5745 <entry><type>oid</type></entry>
5746 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5747 <entry>The OID of the database the dependent object is in,
5748 or zero for a shared object</entry>
5752 <entry><structfield>classid</structfield></entry>
5753 <entry><type>oid</type></entry>
5754 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5755 <entry>The OID of the system catalog the dependent object is in</entry>
5759 <entry><structfield>objid</structfield></entry>
5760 <entry><type>oid</type></entry>
5761 <entry>any OID column</entry>
5762 <entry>The OID of the specific dependent object</entry>
5766 <entry><structfield>objsubid</structfield></entry>
5767 <entry><type>int4</type></entry>
5770 For a table column, this is the column number (the
5771 <structfield>objid</> and <structfield>classid</> refer to the
5772 table itself). For all other object types, this column is zero.
5777 <entry><structfield>refclassid</structfield></entry>
5778 <entry><type>oid</type></entry>
5779 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5780 <entry>The OID of the system catalog the referenced object is in
5781 (must be a shared catalog)</entry>
5785 <entry><structfield>refobjid</structfield></entry>
5786 <entry><type>oid</type></entry>
5787 <entry>any OID column</entry>
5788 <entry>The OID of the specific referenced object</entry>
5792 <entry><structfield>deptype</structfield></entry>
5793 <entry><type>char</type></entry>
5796 A code defining the specific semantics of this dependency relationship; see text
5805 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5806 the referenced object cannot be dropped without also dropping the dependent
5807 object. However, there are several subflavors identified by
5808 <structfield>deptype</>:
5812 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5815 The referenced object (which must be a role) is the owner of the
5822 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5825 The referenced object (which must be a role) is mentioned in the
5826 ACL (access control list, i.e., privileges list) of the
5827 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5828 not made for the owner of the object, since the owner will have
5829 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5835 <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
5838 The referenced object (which must be a role) is mentioned as the
5839 target of a dependent policy object.
5845 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5848 There is no dependent object; this type of entry is a signal
5849 that the system itself depends on the referenced object, and so
5850 that object must never be deleted. Entries of this type are
5851 created only by <command>initdb</command>. The columns for the
5852 dependent object contain zeroes.
5858 Other dependency flavors might be needed in future. Note in particular
5859 that the current definition only supports roles as referenced objects.
5864 <sect1 id="catalog-pg-shdescription">
5865 <title><structname>pg_shdescription</structname></title>
5867 <indexterm zone="catalog-pg-shdescription">
5868 <primary>pg_shdescription</primary>
5872 The catalog <structname>pg_shdescription</structname> stores optional
5873 descriptions (comments) for shared database objects. Descriptions can be
5874 manipulated with the <xref linkend="sql-comment"> command and viewed with
5875 <application>psql</application>'s <literal>\d</literal> commands.
5879 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5880 which performs a similar function for descriptions involving objects
5881 within a single database.
5885 Unlike most system catalogs, <structname>pg_shdescription</structname>
5886 is shared across all databases of a cluster: there is only one
5887 copy of <structname>pg_shdescription</structname> per cluster, not
5892 <title><structname>pg_shdescription</> Columns</title>
5899 <entry>References</entry>
5900 <entry>Description</entry>
5906 <entry><structfield>objoid</structfield></entry>
5907 <entry><type>oid</type></entry>
5908 <entry>any OID column</entry>
5909 <entry>The OID of the object this description pertains to</entry>
5913 <entry><structfield>classoid</structfield></entry>
5914 <entry><type>oid</type></entry>
5915 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5916 <entry>The OID of the system catalog this object appears in</entry>
5920 <entry><structfield>description</structfield></entry>
5921 <entry><type>text</type></entry>
5923 <entry>Arbitrary text that serves as the description of this object</entry>
5931 <sect1 id="catalog-pg-shseclabel">
5932 <title><structname>pg_shseclabel</structname></title>
5934 <indexterm zone="catalog-pg-shseclabel">
5935 <primary>pg_shseclabel</primary>
5939 The catalog <structname>pg_shseclabel</structname> stores security
5940 labels on shared database objects. Security labels can be manipulated
5941 with the <xref linkend="sql-security-label"> command. For an easier
5942 way to view security labels, see <xref linkend="view-pg-seclabels">.
5946 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5947 which performs a similar function for security labels involving objects
5948 within a single database.
5952 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5953 is shared across all databases of a cluster: there is only one
5954 copy of <structname>pg_shseclabel</structname> per cluster, not
5959 <title><structname>pg_shseclabel</structname> Columns</title>
5965 <entry>References</entry>
5966 <entry>Description</entry>
5971 <entry><structfield>objoid</structfield></entry>
5972 <entry><type>oid</type></entry>
5973 <entry>any OID column</entry>
5974 <entry>The OID of the object this security label pertains to</entry>
5977 <entry><structfield>classoid</structfield></entry>
5978 <entry><type>oid</type></entry>
5979 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5980 <entry>The OID of the system catalog this object appears in</entry>
5983 <entry><structfield>provider</structfield></entry>
5984 <entry><type>text</type></entry>
5986 <entry>The label provider associated with this label.</entry>
5989 <entry><structfield>label</structfield></entry>
5990 <entry><type>text</type></entry>
5992 <entry>The security label applied to this object.</entry>
5999 <sect1 id="catalog-pg-statistic">
6000 <title><structname>pg_statistic</structname></title>
6002 <indexterm zone="catalog-pg-statistic">
6003 <primary>pg_statistic</primary>
6007 The catalog <structname>pg_statistic</structname> stores
6008 statistical data about the contents of the database. Entries are
6009 created by <xref linkend="sql-analyze">
6010 and subsequently used by the query planner. Note that all the
6011 statistical data is inherently approximate, even assuming that it
6016 Normally there is one entry, with <structfield>stainherit</> =
6017 <literal>false</>, for each table column that has been analyzed.
6018 If the table has inheritance children, a second entry with
6019 <structfield>stainherit</> = <literal>true</> is also created. This row
6020 represents the column's statistics over the inheritance tree, i.e.,
6021 statistics for the data you'd see with
6022 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
6023 whereas the <structfield>stainherit</> = <literal>false</> row represents
6025 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
6029 <structname>pg_statistic</structname> also stores statistical data about
6030 the values of index expressions. These are described as if they were
6031 actual data columns; in particular, <structfield>starelid</structfield>
6032 references the index. No entry is made for an ordinary non-expression
6033 index column, however, since it would be redundant with the entry
6034 for the underlying table column. Currently, entries for index expressions
6035 always have <structfield>stainherit</> = <literal>false</>.
6039 Since different kinds of statistics might be appropriate for different
6040 kinds of data, <structname>pg_statistic</structname> is designed not
6041 to assume very much about what sort of statistics it stores. Only
6042 extremely general statistics (such as nullness) are given dedicated
6043 columns in <structname>pg_statistic</structname>. Everything else
6044 is stored in <quote>slots</quote>, which are groups of associated columns
6045 whose content is identified by a code number in one of the slot's columns.
6046 For more information see
6047 <filename>src/include/catalog/pg_statistic.h</filename>.
6051 <structname>pg_statistic</structname> should not be readable by the
6052 public, since even statistical information about a table's contents
6053 might be considered sensitive. (Example: minimum and maximum values
6054 of a salary column might be quite interesting.)
6055 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6056 is a publicly readable view on
6057 <structname>pg_statistic</structname> that only exposes information
6058 about those tables that are readable by the current user.
6062 <title><structname>pg_statistic</> Columns</title>
6069 <entry>References</entry>
6070 <entry>Description</entry>
6076 <entry><structfield>starelid</structfield></entry>
6077 <entry><type>oid</type></entry>
6078 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6079 <entry>The table or index that the described column belongs to</entry>
6083 <entry><structfield>staattnum</structfield></entry>
6084 <entry><type>int2</type></entry>
6085 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6086 <entry>The number of the described column</entry>
6090 <entry><structfield>stainherit</structfield></entry>
6091 <entry><type>bool</type></entry>
6093 <entry>If true, the stats include inheritance child columns, not just the
6094 values in the specified relation</entry>
6098 <entry><structfield>stanullfrac</structfield></entry>
6099 <entry><type>float4</type></entry>
6101 <entry>The fraction of the column's entries that are null</entry>
6105 <entry><structfield>stawidth</structfield></entry>
6106 <entry><type>int4</type></entry>
6108 <entry>The average stored width, in bytes, of nonnull entries</entry>
6112 <entry><structfield>stadistinct</structfield></entry>
6113 <entry><type>float4</type></entry>
6115 <entry>The number of distinct nonnull data values in the column.
6116 A value greater than zero is the actual number of distinct values.
6117 A value less than zero is the negative of a multiplier for the number
6118 of rows in the table; for example, a column in which values appear about
6119 twice on the average could be represented by
6120 <structfield>stadistinct</> = -0.5.
6121 A zero value means the number of distinct values is unknown.
6126 <entry><structfield>stakind<replaceable>N</></structfield></entry>
6127 <entry><type>int2</type></entry>
6130 A code number indicating the kind of statistics stored in the
6131 <replaceable>N</>th <quote>slot</quote> of the
6132 <structname>pg_statistic</structname> row.
6137 <entry><structfield>staop<replaceable>N</></structfield></entry>
6138 <entry><type>oid</type></entry>
6139 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6141 An operator used to derive the statistics stored in the
6142 <replaceable>N</>th <quote>slot</quote>. For example, a
6143 histogram slot would show the <literal><</literal> operator
6144 that defines the sort order of the data.
6149 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6150 <entry><type>float4[]</type></entry>
6153 Numerical statistics of the appropriate kind for the
6154 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6155 kind does not involve numerical values
6160 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6161 <entry><type>anyarray</type></entry>
6164 Column data values of the appropriate kind for the
6165 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6166 kind does not store any data values. Each array's element
6167 values are actually of the specific column's data type, or a related
6168 type such as an array's element type, so there is no way to define
6169 these columns' type more specifically than <type>anyarray</>.
6179 <sect1 id="catalog-pg-tablespace">
6180 <title><structname>pg_tablespace</structname></title>
6182 <indexterm zone="catalog-pg-tablespace">
6183 <primary>pg_tablespace</primary>
6187 The catalog <structname>pg_tablespace</structname> stores information
6188 about the available tablespaces. Tables can be placed in particular
6189 tablespaces to aid administration of disk layout.
6193 Unlike most system catalogs, <structname>pg_tablespace</structname>
6194 is shared across all databases of a cluster: there is only one
6195 copy of <structname>pg_tablespace</structname> per cluster, not
6200 <title><structname>pg_tablespace</> Columns</title>
6207 <entry>References</entry>
6208 <entry>Description</entry>
6214 <entry><structfield>oid</structfield></entry>
6215 <entry><type>oid</type></entry>
6217 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6221 <entry><structfield>spcname</structfield></entry>
6222 <entry><type>name</type></entry>
6224 <entry>Tablespace name</entry>
6228 <entry><structfield>spcowner</structfield></entry>
6229 <entry><type>oid</type></entry>
6230 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6231 <entry>Owner of the tablespace, usually the user who created it</entry>
6235 <entry><structfield>spcacl</structfield></entry>
6236 <entry><type>aclitem[]</type></entry>
6239 Access privileges; see
6240 <xref linkend="sql-grant"> and
6241 <xref linkend="sql-revoke">
6247 <entry><structfield>spcoptions</structfield></entry>
6248 <entry><type>text[]</type></entry>
6251 Tablespace-level options, as <quote>keyword=value</> strings
6260 <sect1 id="catalog-pg-transform">
6261 <title><structname>pg_transform</structname></title>
6263 <indexterm zone="catalog-pg-transform">
6264 <primary>pg_transform</primary>
6268 The catalog <structname>pg_transform</structname> stores information about
6269 transforms, which are a mechanism to adapt data types to procedural
6270 languages. See <xref linkend="sql-createtransform"> for more information.
6274 <title><structname>pg_transform</> Columns</title>
6281 <entry>References</entry>
6282 <entry>Description</entry>
6288 <entry><structfield>trftype</structfield></entry>
6289 <entry><type>oid</type></entry>
6290 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6291 <entry>OID of the data type this transform is for</entry>
6295 <entry><structfield>trflang</structfield></entry>
6296 <entry><type>oid</type></entry>
6297 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6298 <entry>OID of the language this transform is for</entry>
6302 <entry><structfield>trffromsql</structfield></entry>
6303 <entry><type>regproc</type></entry>
6304 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6306 The OID of the function to use when converting the data type for input
6307 to the procedural language (e.g., function parameters). Zero is stored
6308 if this operation is not supported.
6313 <entry><structfield>trftosql</structfield></entry>
6314 <entry><type>regproc</type></entry>
6315 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6317 The OID of the function to use when converting output from the
6318 procedural language (e.g., return values) to the data type. Zero is
6319 stored if this operation is not supported.
6328 <sect1 id="catalog-pg-trigger">
6329 <title><structname>pg_trigger</structname></title>
6331 <indexterm zone="catalog-pg-trigger">
6332 <primary>pg_trigger</primary>
6336 The catalog <structname>pg_trigger</structname> stores triggers on tables
6338 See <xref linkend="sql-createtrigger">
6339 for more information.
6343 <title><structname>pg_trigger</> Columns</title>
6350 <entry>References</entry>
6351 <entry>Description</entry>
6357 <entry><structfield>oid</structfield></entry>
6358 <entry><type>oid</type></entry>
6360 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6364 <entry><structfield>tgrelid</structfield></entry>
6365 <entry><type>oid</type></entry>
6366 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6367 <entry>The table this trigger is on</entry>
6371 <entry><structfield>tgname</structfield></entry>
6372 <entry><type>name</type></entry>
6374 <entry>Trigger name (must be unique among triggers of same table)</entry>
6378 <entry><structfield>tgfoid</structfield></entry>
6379 <entry><type>oid</type></entry>
6380 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6381 <entry>The function to be called</entry>
6385 <entry><structfield>tgtype</structfield></entry>
6386 <entry><type>int2</type></entry>
6388 <entry>Bit mask identifying trigger firing conditions</entry>
6392 <entry><structfield>tgenabled</structfield></entry>
6393 <entry><type>char</type></entry>
6396 Controls in which <xref linkend="guc-session-replication-role"> modes
6398 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6399 <literal>D</> = trigger is disabled,
6400 <literal>R</> = trigger fires in <quote>replica</> mode,
6401 <literal>A</> = trigger fires always.
6406 <entry><structfield>tgisinternal</structfield></entry>
6407 <entry><type>bool</type></entry>
6409 <entry>True if trigger is internally generated (usually, to enforce
6410 the constraint identified by <structfield>tgconstraint</>)</entry>
6414 <entry><structfield>tgconstrrelid</structfield></entry>
6415 <entry><type>oid</type></entry>
6416 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6417 <entry>The table referenced by a referential integrity constraint</entry>
6421 <entry><structfield>tgconstrindid</structfield></entry>
6422 <entry><type>oid</type></entry>
6423 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6424 <entry>The index supporting a unique, primary key, referential integrity,
6425 or exclusion constraint</entry>
6429 <entry><structfield>tgconstraint</structfield></entry>
6430 <entry><type>oid</type></entry>
6431 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6432 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6436 <entry><structfield>tgdeferrable</structfield></entry>
6437 <entry><type>bool</type></entry>
6439 <entry>True if constraint trigger is deferrable</entry>
6443 <entry><structfield>tginitdeferred</structfield></entry>
6444 <entry><type>bool</type></entry>
6446 <entry>True if constraint trigger is initially deferred</entry>
6450 <entry><structfield>tgnargs</structfield></entry>
6451 <entry><type>int2</type></entry>
6453 <entry>Number of argument strings passed to trigger function</entry>
6457 <entry><structfield>tgattr</structfield></entry>
6458 <entry><type>int2vector</type></entry>
6459 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6460 <entry>Column numbers, if trigger is column-specific; otherwise an
6465 <entry><structfield>tgargs</structfield></entry>
6466 <entry><type>bytea</type></entry>
6468 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6472 <entry><structfield>tgqual</structfield></entry>
6473 <entry><type>pg_node_tree</type></entry>
6475 <entry>Expression tree (in <function>nodeToString()</function>
6476 representation) for the trigger's <literal>WHEN</> condition, or null
6484 Currently, column-specific triggering is supported only for
6485 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6486 only for that event type. <structfield>tgtype</structfield> might
6487 contain bits for other event types as well, but those are presumed
6488 to be table-wide regardless of what is in <structfield>tgattr</>.
6493 When <structfield>tgconstraint</> is nonzero,
6494 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6495 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6496 largely redundant with the referenced <structname>pg_constraint</> entry.
6497 However, it is possible for a non-deferrable trigger to be associated
6498 with a deferrable constraint: foreign key constraints can have some
6499 deferrable and some non-deferrable triggers.
6505 <literal>pg_class.relhastriggers</literal>
6506 must be true if a relation has any triggers in this catalog.
6513 <sect1 id="catalog-pg-ts-config">
6514 <title><structname>pg_ts_config</structname></title>
6516 <indexterm zone="catalog-pg-ts-config">
6517 <primary>pg_ts_config</primary>
6521 The <structname>pg_ts_config</structname> catalog contains entries
6522 representing text search configurations. A configuration specifies
6523 a particular text search parser and a list of dictionaries to use
6524 for each of the parser's output token types. The parser is shown
6525 in the <structname>pg_ts_config</structname> entry, but the
6526 token-to-dictionary mapping is defined by subsidiary entries in <link
6527 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6531 <productname>PostgreSQL</productname>'s text search features are
6532 described at length in <xref linkend="textsearch">.
6536 <title><structname>pg_ts_config</> Columns</title>
6543 <entry>References</entry>
6544 <entry>Description</entry>
6550 <entry><structfield>oid</structfield></entry>
6551 <entry><type>oid</type></entry>
6553 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6557 <entry><structfield>cfgname</structfield></entry>
6558 <entry><type>name</type></entry>
6560 <entry>Text search configuration name</entry>
6564 <entry><structfield>cfgnamespace</structfield></entry>
6565 <entry><type>oid</type></entry>
6566 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6568 The OID of the namespace that contains this configuration
6573 <entry><structfield>cfgowner</structfield></entry>
6574 <entry><type>oid</type></entry>
6575 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6576 <entry>Owner of the configuration</entry>
6580 <entry><structfield>cfgparser</structfield></entry>
6581 <entry><type>oid</type></entry>
6582 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6583 <entry>The OID of the text search parser for this configuration</entry>
6591 <sect1 id="catalog-pg-ts-config-map">
6592 <title><structname>pg_ts_config_map</structname></title>
6594 <indexterm zone="catalog-pg-ts-config-map">
6595 <primary>pg_ts_config_map</primary>
6599 The <structname>pg_ts_config_map</structname> catalog contains entries
6600 showing which text search dictionaries should be consulted, and in
6601 what order, for each output token type of each text search configuration's
6606 <productname>PostgreSQL</productname>'s text search features are
6607 described at length in <xref linkend="textsearch">.
6611 <title><structname>pg_ts_config_map</> Columns</title>
6618 <entry>References</entry>
6619 <entry>Description</entry>
6625 <entry><structfield>mapcfg</structfield></entry>
6626 <entry><type>oid</type></entry>
6627 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6628 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6632 <entry><structfield>maptokentype</structfield></entry>
6633 <entry><type>integer</type></entry>
6635 <entry>A token type emitted by the configuration's parser</entry>
6639 <entry><structfield>mapseqno</structfield></entry>
6640 <entry><type>integer</type></entry>
6642 <entry>Order in which to consult this entry (lower
6643 <structfield>mapseqno</>s first)</entry>
6647 <entry><structfield>mapdict</structfield></entry>
6648 <entry><type>oid</type></entry>
6649 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6650 <entry>The OID of the text search dictionary to consult</entry>
6658 <sect1 id="catalog-pg-ts-dict">
6659 <title><structname>pg_ts_dict</structname></title>
6661 <indexterm zone="catalog-pg-ts-dict">
6662 <primary>pg_ts_dict</primary>
6666 The <structname>pg_ts_dict</structname> catalog contains entries
6667 defining text search dictionaries. A dictionary depends on a text
6668 search template, which specifies all the implementation functions
6669 needed; the dictionary itself provides values for the user-settable
6670 parameters supported by the template. This division of labor allows
6671 dictionaries to be created by unprivileged users. The parameters
6672 are specified by a text string <structfield>dictinitoption</>,
6673 whose format and meaning vary depending on the template.
6677 <productname>PostgreSQL</productname>'s text search features are
6678 described at length in <xref linkend="textsearch">.
6682 <title><structname>pg_ts_dict</> Columns</title>
6689 <entry>References</entry>
6690 <entry>Description</entry>
6696 <entry><structfield>oid</structfield></entry>
6697 <entry><type>oid</type></entry>
6699 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6703 <entry><structfield>dictname</structfield></entry>
6704 <entry><type>name</type></entry>
6706 <entry>Text search dictionary name</entry>
6710 <entry><structfield>dictnamespace</structfield></entry>
6711 <entry><type>oid</type></entry>
6712 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6714 The OID of the namespace that contains this dictionary
6719 <entry><structfield>dictowner</structfield></entry>
6720 <entry><type>oid</type></entry>
6721 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6722 <entry>Owner of the dictionary</entry>
6726 <entry><structfield>dicttemplate</structfield></entry>
6727 <entry><type>oid</type></entry>
6728 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6729 <entry>The OID of the text search template for this dictionary</entry>
6733 <entry><structfield>dictinitoption</structfield></entry>
6734 <entry><type>text</type></entry>
6736 <entry>Initialization option string for the template</entry>
6744 <sect1 id="catalog-pg-ts-parser">
6745 <title><structname>pg_ts_parser</structname></title>
6747 <indexterm zone="catalog-pg-ts-parser">
6748 <primary>pg_ts_parser</primary>
6752 The <structname>pg_ts_parser</structname> catalog contains entries
6753 defining text search parsers. A parser is responsible for splitting
6754 input text into lexemes and assigning a token type to each lexeme.
6755 Since a parser must be implemented by C-language-level functions,
6756 creation of new parsers is restricted to database superusers.
6760 <productname>PostgreSQL</productname>'s text search features are
6761 described at length in <xref linkend="textsearch">.
6765 <title><structname>pg_ts_parser</> Columns</title>
6772 <entry>References</entry>
6773 <entry>Description</entry>
6779 <entry><structfield>oid</structfield></entry>
6780 <entry><type>oid</type></entry>
6782 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6786 <entry><structfield>prsname</structfield></entry>
6787 <entry><type>name</type></entry>
6789 <entry>Text search parser name</entry>
6793 <entry><structfield>prsnamespace</structfield></entry>
6794 <entry><type>oid</type></entry>
6795 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6797 The OID of the namespace that contains this parser
6802 <entry><structfield>prsstart</structfield></entry>
6803 <entry><type>regproc</type></entry>
6804 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6805 <entry>OID of the parser's startup function</entry>
6809 <entry><structfield>prstoken</structfield></entry>
6810 <entry><type>regproc</type></entry>
6811 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6812 <entry>OID of the parser's next-token function</entry>
6816 <entry><structfield>prsend</structfield></entry>
6817 <entry><type>regproc</type></entry>
6818 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6819 <entry>OID of the parser's shutdown function</entry>
6823 <entry><structfield>prsheadline</structfield></entry>
6824 <entry><type>regproc</type></entry>
6825 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6826 <entry>OID of the parser's headline function</entry>
6830 <entry><structfield>prslextype</structfield></entry>
6831 <entry><type>regproc</type></entry>
6832 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6833 <entry>OID of the parser's lextype function</entry>
6841 <sect1 id="catalog-pg-ts-template">
6842 <title><structname>pg_ts_template</structname></title>
6844 <indexterm zone="catalog-pg-ts-template">
6845 <primary>pg_ts_template</primary>
6849 The <structname>pg_ts_template</structname> catalog contains entries
6850 defining text search templates. A template is the implementation
6851 skeleton for a class of text search dictionaries.
6852 Since a template must be implemented by C-language-level functions,
6853 creation of new templates is restricted to database superusers.
6857 <productname>PostgreSQL</productname>'s text search features are
6858 described at length in <xref linkend="textsearch">.
6862 <title><structname>pg_ts_template</> Columns</title>
6869 <entry>References</entry>
6870 <entry>Description</entry>
6876 <entry><structfield>oid</structfield></entry>
6877 <entry><type>oid</type></entry>
6879 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6883 <entry><structfield>tmplname</structfield></entry>
6884 <entry><type>name</type></entry>
6886 <entry>Text search template name</entry>
6890 <entry><structfield>tmplnamespace</structfield></entry>
6891 <entry><type>oid</type></entry>
6892 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6894 The OID of the namespace that contains this template
6899 <entry><structfield>tmplinit</structfield></entry>
6900 <entry><type>regproc</type></entry>
6901 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6902 <entry>OID of the template's initialization function</entry>
6906 <entry><structfield>tmpllexize</structfield></entry>
6907 <entry><type>regproc</type></entry>
6908 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6909 <entry>OID of the template's lexize function</entry>
6917 <sect1 id="catalog-pg-type">
6918 <title><structname>pg_type</structname></title>
6920 <indexterm zone="catalog-pg-type">
6921 <primary>pg_type</primary>
6925 The catalog <structname>pg_type</structname> stores information about data
6926 types. Base types and enum types (scalar types) are created with
6927 <xref linkend="sql-createtype">, and
6929 <xref linkend="sql-createdomain">.
6930 A composite type is automatically created for each table in the database, to
6931 represent the row structure of the table. It is also possible to create
6932 composite types with <command>CREATE TYPE AS</command>.
6936 <title><structname>pg_type</> Columns</title>
6943 <entry>References</entry>
6944 <entry>Description</entry>
6950 <entry><structfield>oid</structfield></entry>
6951 <entry><type>oid</type></entry>
6953 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6957 <entry><structfield>typname</structfield></entry>
6958 <entry><type>name</type></entry>
6960 <entry>Data type name</entry>
6964 <entry><structfield>typnamespace</structfield></entry>
6965 <entry><type>oid</type></entry>
6966 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6968 The OID of the namespace that contains this type
6973 <entry><structfield>typowner</structfield></entry>
6974 <entry><type>oid</type></entry>
6975 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6976 <entry>Owner of the type</entry>
6980 <entry><structfield>typlen</structfield></entry>
6981 <entry><type>int2</type></entry>
6984 For a fixed-size type, <structfield>typlen</structfield> is the number
6985 of bytes in the internal representation of the type. But for a
6986 variable-length type, <structfield>typlen</structfield> is negative.
6987 -1 indicates a <quote>varlena</> type (one that has a length word),
6988 -2 indicates a null-terminated C string.
6993 <entry><structfield>typbyval</structfield></entry>
6994 <entry><type>bool</type></entry>
6997 <structfield>typbyval</structfield> determines whether internal
6998 routines pass a value of this type by value or by reference.
6999 <structfield>typbyval</structfield> had better be false if
7000 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7001 where Datum is 8 bytes).
7002 Variable-length types are always passed by reference. Note that
7003 <structfield>typbyval</structfield> can be false even if the
7004 length would allow pass-by-value.
7009 <entry><structfield>typtype</structfield></entry>
7010 <entry><type>char</type></entry>
7013 <structfield>typtype</structfield> is
7014 <literal>b</literal> for a base type,
7015 <literal>c</literal> for a composite type (e.g., a table's row type),
7016 <literal>d</literal> for a domain,
7017 <literal>e</literal> for an enum type,
7018 <literal>p</literal> for a pseudo-type, or
7019 <literal>r</literal> for a range type.
7020 See also <structfield>typrelid</structfield> and
7021 <structfield>typbasetype</structfield>.
7026 <entry><structfield>typcategory</structfield></entry>
7027 <entry><type>char</type></entry>
7030 <structfield>typcategory</structfield> is an arbitrary classification
7031 of data types that is used by the parser to determine which implicit
7032 casts should be <quote>preferred</>.
7033 See <xref linkend="catalog-typcategory-table">.
7038 <entry><structfield>typispreferred</structfield></entry>
7039 <entry><type>bool</type></entry>
7042 True if the type is a preferred cast target within its
7043 <structfield>typcategory</structfield>
7048 <entry><structfield>typisdefined</structfield></entry>
7049 <entry><type>bool</type></entry>
7052 True if the type is defined, false if this is a placeholder
7053 entry for a not-yet-defined type. When
7054 <structfield>typisdefined</structfield> is false, nothing
7055 except the type name, namespace, and OID can be relied on.
7060 <entry><structfield>typdelim</structfield></entry>
7061 <entry><type>char</type></entry>
7064 Character that separates two values of this type when parsing
7065 array input. Note that the delimiter is associated with the array
7066 element data type, not the array data type.
7071 <entry><structfield>typrelid</structfield></entry>
7072 <entry><type>oid</type></entry>
7073 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7075 If this is a composite type (see
7076 <structfield>typtype</structfield>), then this column points to
7077 the <structname>pg_class</structname> entry that defines the
7078 corresponding table. (For a free-standing composite type, the
7079 <structname>pg_class</structname> entry doesn't really represent
7080 a table, but it is needed anyway for the type's
7081 <structname>pg_attribute</structname> entries to link to.)
7082 Zero for non-composite types.
7087 <entry><structfield>typelem</structfield></entry>
7088 <entry><type>oid</type></entry>
7089 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7091 If <structfield>typelem</structfield> is not 0 then it
7092 identifies another row in <structname>pg_type</structname>.
7093 The current type can then be subscripted like an array yielding
7094 values of type <structfield>typelem</structfield>. A
7095 <quote>true</quote> array type is variable length
7096 (<structfield>typlen</structfield> = -1),
7097 but some fixed-length (<structfield>typlen</structfield> > 0) types
7098 also have nonzero <structfield>typelem</structfield>, for example
7099 <type>name</type> and <type>point</type>.
7100 If a fixed-length type has a <structfield>typelem</structfield> then
7101 its internal representation must be some number of values of the
7102 <structfield>typelem</structfield> data type with no other data.
7103 Variable-length array types have a header defined by the array
7109 <entry><structfield>typarray</structfield></entry>
7110 <entry><type>oid</type></entry>
7111 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7113 If <structfield>typarray</structfield> is not 0 then it
7114 identifies another row in <structname>pg_type</structname>, which
7115 is the <quote>true</quote> array type having this type as element
7120 <entry><structfield>typinput</structfield></entry>
7121 <entry><type>regproc</type></entry>
7122 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7123 <entry>Input conversion function (text format)</entry>
7127 <entry><structfield>typoutput</structfield></entry>
7128 <entry><type>regproc</type></entry>
7129 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7130 <entry>Output conversion function (text format)</entry>
7134 <entry><structfield>typreceive</structfield></entry>
7135 <entry><type>regproc</type></entry>
7136 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7137 <entry>Input conversion function (binary format), or 0 if none</entry>
7141 <entry><structfield>typsend</structfield></entry>
7142 <entry><type>regproc</type></entry>
7143 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7144 <entry>Output conversion function (binary format), or 0 if none</entry>
7148 <entry><structfield>typmodin</structfield></entry>
7149 <entry><type>regproc</type></entry>
7150 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7151 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7155 <entry><structfield>typmodout</structfield></entry>
7156 <entry><type>regproc</type></entry>
7157 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7158 <entry>Type modifier output function, or 0 to use the standard format</entry>
7162 <entry><structfield>typanalyze</structfield></entry>
7163 <entry><type>regproc</type></entry>
7164 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7165 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7169 <entry><structfield>typalign</structfield></entry>
7170 <entry><type>char</type></entry>
7174 <structfield>typalign</structfield> is the alignment required
7175 when storing a value of this type. It applies to storage on
7176 disk as well as most representations of the value inside
7177 <productname>PostgreSQL</>.
7178 When multiple values are stored consecutively, such
7179 as in the representation of a complete row on disk, padding is
7180 inserted before a datum of this type so that it begins on the
7181 specified boundary. The alignment reference is the beginning
7182 of the first datum in the sequence.
7186 Possible values are:
7189 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7192 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7195 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7198 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7203 For types used in system tables, it is critical that the size
7204 and alignment defined in <structname>pg_type</structname>
7205 agree with the way that the compiler will lay out the column in
7206 a structure representing a table row.
7212 <entry><structfield>typstorage</structfield></entry>
7213 <entry><type>char</type></entry>
7216 <structfield>typstorage</structfield> tells for varlena
7217 types (those with <structfield>typlen</structfield> = -1) if
7218 the type is prepared for toasting and what the default strategy
7219 for attributes of this type should be.
7223 <para><literal>p</>: Value must always be stored plain.</para>
7227 <literal>e</>: Value can be stored in a <quote>secondary</quote>
7228 relation (if relation has one, see
7229 <literal>pg_class.reltoastrelid</literal>).
7233 <para><literal>m</>: Value can be stored compressed inline.</para>
7236 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7239 Note that <literal>m</> columns can also be moved out to secondary
7240 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7246 <entry><structfield>typnotnull</structfield></entry>
7247 <entry><type>bool</type></entry>
7250 <structfield>typnotnull</structfield> represents a not-null
7251 constraint on a type. Used for domains only.
7256 <entry><structfield>typbasetype</structfield></entry>
7257 <entry><type>oid</type></entry>
7258 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7260 If this is a domain (see <structfield>typtype</structfield>), then
7261 <structfield>typbasetype</structfield> identifies the type that this
7262 one is based on. Zero if this type is not a domain.
7267 <entry><structfield>typtypmod</structfield></entry>
7268 <entry><type>int4</type></entry>
7271 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7272 to be applied to their base type (-1 if base type does not use a
7273 <literal>typmod</>). -1 if this type is not a domain.
7278 <entry><structfield>typndims</structfield></entry>
7279 <entry><type>int4</type></entry>
7282 <structfield>typndims</structfield> is the number of array dimensions
7283 for a domain over an array (that is, <structfield>typbasetype</> is
7285 Zero for types other than domains over array types.
7290 <entry><structfield>typcollation</structfield></entry>
7291 <entry><type>oid</type></entry>
7292 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7294 <structfield>typcollation</structfield> specifies the collation
7295 of the type. If the type does not support collations, this will
7296 be zero. A base type that supports collations will have
7297 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7298 collatable type can have some other collation OID, if one was
7299 specified for the domain.
7304 <entry><structfield>typdefaultbin</structfield></entry>
7305 <entry><type>pg_node_tree</type></entry>
7308 If <structfield>typdefaultbin</> is not null, it is the
7309 <function>nodeToString()</function>
7310 representation of a default expression for the type. This is
7311 only used for domains.
7316 <entry><structfield>typdefault</structfield></entry>
7317 <entry><type>text</type></entry>
7320 <structfield>typdefault</> is null if the type has no associated
7321 default value. If <structfield>typdefaultbin</> is not null,
7322 <structfield>typdefault</> must contain a human-readable version of the
7323 default expression represented by <structfield>typdefaultbin</>. If
7324 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7325 not, then <structfield>typdefault</> is the external representation of
7326 the type's default value, which can be fed to the type's input
7327 converter to produce a constant.
7332 <entry><structfield>typacl</structfield></entry>
7333 <entry><type>aclitem[]</type></entry>
7336 Access privileges; see
7337 <xref linkend="sql-grant"> and
7338 <xref linkend="sql-revoke">
7347 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7348 of <structfield>typcategory</>. Any future additions to this list will
7349 also be upper-case ASCII letters. All other ASCII characters are reserved
7350 for user-defined categories.
7353 <table id="catalog-typcategory-table">
7354 <title><structfield>typcategory</> Codes</title>
7360 <entry>Category</entry>
7366 <entry><literal>A</literal></entry>
7367 <entry>Array types</entry>
7370 <entry><literal>B</literal></entry>
7371 <entry>Boolean types</entry>
7374 <entry><literal>C</literal></entry>
7375 <entry>Composite types</entry>
7378 <entry><literal>D</literal></entry>
7379 <entry>Date/time types</entry>
7382 <entry><literal>E</literal></entry>
7383 <entry>Enum types</entry>
7386 <entry><literal>G</literal></entry>
7387 <entry>Geometric types</entry>
7390 <entry><literal>I</literal></entry>
7391 <entry>Network address types</entry>
7394 <entry><literal>N</literal></entry>
7395 <entry>Numeric types</entry>
7398 <entry><literal>P</literal></entry>
7399 <entry>Pseudo-types</entry>
7402 <entry><literal>R</literal></entry>
7403 <entry>Range types</entry>
7406 <entry><literal>S</literal></entry>
7407 <entry>String types</entry>
7410 <entry><literal>T</literal></entry>
7411 <entry>Timespan types</entry>
7414 <entry><literal>U</literal></entry>
7415 <entry>User-defined types</entry>
7418 <entry><literal>V</literal></entry>
7419 <entry>Bit-string types</entry>
7422 <entry><literal>X</literal></entry>
7423 <entry><type>unknown</> type</entry>
7432 <sect1 id="catalog-pg-user-mapping">
7433 <title><structname>pg_user_mapping</structname></title>
7435 <indexterm zone="catalog-pg-user-mapping">
7436 <primary>pg_user_mapping</primary>
7440 The catalog <structname>pg_user_mapping</structname> stores
7441 the mappings from local user to remote. Access to this catalog is
7442 restricted from normal users, use the view
7443 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7448 <title><structname>pg_user_mapping</> Columns</title>
7455 <entry>References</entry>
7456 <entry>Description</entry>
7462 <entry><structfield>oid</structfield></entry>
7463 <entry><type>oid</type></entry>
7465 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7469 <entry><structfield>umuser</structfield></entry>
7470 <entry><type>oid</type></entry>
7471 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7472 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7476 <entry><structfield>umserver</structfield></entry>
7477 <entry><type>oid</type></entry>
7478 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7480 The OID of the foreign server that contains this mapping
7485 <entry><structfield>umoptions</structfield></entry>
7486 <entry><type>text[]</type></entry>
7489 User mapping specific options, as <quote>keyword=value</> strings
7498 <sect1 id="views-overview">
7499 <title>System Views</title>
7502 In addition to the system catalogs, <productname>PostgreSQL</productname>
7503 provides a number of built-in views. Some system views provide convenient
7504 access to some commonly used queries on the system catalogs. Other views
7505 provide access to internal server state.
7509 The information schema (<xref linkend="information-schema">) provides
7510 an alternative set of views which overlap the functionality of the system
7511 views. Since the information schema is SQL-standard whereas the views
7512 described here are <productname>PostgreSQL</productname>-specific,
7513 it's usually better to use the information schema if it provides all
7514 the information you need.
7518 <xref linkend="view-table"> lists the system views described here.
7519 More detailed documentation of each view follows below.
7520 There are some additional views that provide access to the results of
7521 the statistics collector; they are described in <xref
7522 linkend="monitoring-stats-views-table">.
7526 Except where noted, all the views described here are read-only.
7529 <table id="view-table">
7530 <title>System Views</title>
7535 <entry>View Name</entry>
7536 <entry>Purpose</entry>
7542 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7543 <entry>available extensions</entry>
7547 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7548 <entry>available versions of extensions</entry>
7552 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7553 <entry>open cursors</entry>
7557 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
7558 <entry>summary of configuration file contents</entry>
7562 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7563 <entry>groups of database users</entry>
7567 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7568 <entry>indexes</entry>
7572 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7573 <entry>currently held locks</entry>
7577 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7578 <entry>materialized views</entry>
7582 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7583 <entry>policies</entry>
7587 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7588 <entry>prepared statements</entry>
7592 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7593 <entry>prepared transactions</entry>
7597 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7598 <entry>database roles</entry>
7602 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7603 <entry>rules</entry>
7607 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7608 <entry>security labels</entry>
7612 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7613 <entry>parameter settings</entry>
7617 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7618 <entry>database users</entry>
7622 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7623 <entry>planner statistics</entry>
7627 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7628 <entry>tables</entry>
7632 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7633 <entry>time zone abbreviations</entry>
7637 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7638 <entry>time zone names</entry>
7642 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7643 <entry>database users</entry>
7647 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7648 <entry>user mappings</entry>
7652 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7653 <entry>views</entry>
7661 <sect1 id="view-pg-available-extensions">
7662 <title><structname>pg_available_extensions</structname></title>
7664 <indexterm zone="view-pg-available-extensions">
7665 <primary>pg_available_extensions</primary>
7669 The <structname>pg_available_extensions</structname> view lists the
7670 extensions that are available for installation.
7672 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7673 catalog, which shows the extensions currently installed.
7677 <title><structname>pg_available_extensions</> Columns</title>
7684 <entry>Description</entry>
7690 <entry><structfield>name</structfield></entry>
7691 <entry><type>name</type></entry>
7692 <entry>Extension name</entry>
7696 <entry><structfield>default_version</structfield></entry>
7697 <entry><type>text</type></entry>
7698 <entry>Name of default version, or <literal>NULL</literal> if none is
7703 <entry><structfield>installed_version</structfield></entry>
7704 <entry><type>text</type></entry>
7705 <entry>Currently installed version of the extension,
7706 or <literal>NULL</literal> if not installed</entry>
7710 <entry><structfield>comment</structfield></entry>
7711 <entry><type>text</type></entry>
7712 <entry>Comment string from the extension's control file</entry>
7719 The <structname>pg_available_extensions</structname> view is read only.
7723 <sect1 id="view-pg-available-extension-versions">
7724 <title><structname>pg_available_extension_versions</structname></title>
7726 <indexterm zone="view-pg-available-extension-versions">
7727 <primary>pg_available_extension_versions</primary>
7731 The <structname>pg_available_extension_versions</structname> view lists the
7732 specific extension versions that are available for installation.
7734 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7735 catalog, which shows the extensions currently installed.
7739 <title><structname>pg_available_extension_versions</> Columns</title>
7746 <entry>Description</entry>
7752 <entry><structfield>name</structfield></entry>
7753 <entry><type>name</type></entry>
7754 <entry>Extension name</entry>
7758 <entry><structfield>version</structfield></entry>
7759 <entry><type>text</type></entry>
7760 <entry>Version name</entry>
7764 <entry><structfield>installed</structfield></entry>
7765 <entry><type>bool</type></entry>
7766 <entry>True if this version of this extension is currently
7771 <entry><structfield>superuser</structfield></entry>
7772 <entry><type>bool</type></entry>
7773 <entry>True if only superusers are allowed to install this extension</entry>
7777 <entry><structfield>relocatable</structfield></entry>
7778 <entry><type>bool</type></entry>
7779 <entry>True if extension can be relocated to another schema</entry>
7783 <entry><structfield>schema</structfield></entry>
7784 <entry><type>name</type></entry>
7785 <entry>Name of the schema that the extension must be installed into,
7786 or <literal>NULL</literal> if partially or fully relocatable</entry>
7790 <entry><structfield>requires</structfield></entry>
7791 <entry><type>name[]</type></entry>
7792 <entry>Names of prerequisite extensions,
7793 or <literal>NULL</literal> if none</entry>
7797 <entry><structfield>comment</structfield></entry>
7798 <entry><type>text</type></entry>
7799 <entry>Comment string from the extension's control file</entry>
7806 The <structname>pg_available_extension_versions</structname> view is read
7811 <sect1 id="view-pg-cursors">
7812 <title><structname>pg_cursors</structname></title>
7814 <indexterm zone="view-pg-cursors">
7815 <primary>pg_cursors</primary>
7819 The <structname>pg_cursors</structname> view lists the cursors that
7820 are currently available. Cursors can be defined in several ways:
7824 via the <xref linkend="sql-declare">
7831 via the Bind message in the frontend/backend protocol, as
7832 described in <xref linkend="protocol-flow-ext-query">
7838 via the Server Programming Interface (SPI), as described in
7839 <xref linkend="spi-interface">
7844 The <structname>pg_cursors</structname> view displays cursors
7845 created by any of these means. Cursors only exist for the duration
7846 of the transaction that defines them, unless they have been
7847 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7848 cursors are only present in the view until the end of their
7849 creating transaction.
7853 Cursors are used internally to implement some of the components
7854 of <productname>PostgreSQL</>, such as procedural languages.
7855 Therefore, the <structname>pg_cursors</> view might include cursors
7856 that have not been explicitly created by the user.
7862 <title><structname>pg_cursors</> Columns</title>
7869 <entry>Description</entry>
7875 <entry><structfield>name</structfield></entry>
7876 <entry><type>text</type></entry>
7877 <entry>The name of the cursor</entry>
7881 <entry><structfield>statement</structfield></entry>
7882 <entry><type>text</type></entry>
7883 <entry>The verbatim query string submitted to declare this cursor</entry>
7887 <entry><structfield>is_holdable</structfield></entry>
7888 <entry><type>boolean</type></entry>
7890 <literal>true</literal> if the cursor is holdable (that is, it
7891 can be accessed after the transaction that declared the cursor
7892 has committed); <literal>false</literal> otherwise
7897 <entry><structfield>is_binary</structfield></entry>
7898 <entry><type>boolean</type></entry>
7900 <literal>true</literal> if the cursor was declared
7901 <literal>BINARY</literal>; <literal>false</literal>
7907 <entry><structfield>is_scrollable</structfield></entry>
7908 <entry><type>boolean</type></entry>
7910 <literal>true</> if the cursor is scrollable (that is, it
7911 allows rows to be retrieved in a nonsequential manner);
7912 <literal>false</literal> otherwise
7917 <entry><structfield>creation_time</structfield></entry>
7918 <entry><type>timestamptz</type></entry>
7919 <entry>The time at which the cursor was declared</entry>
7926 The <structname>pg_cursors</structname> view is read only.
7931 <sect1 id="view-pg-file-settings">
7932 <title><structname>pg_file_settings</structname></title>
7934 <indexterm zone="view-pg-file-settings">
7935 <primary>pg_file_settings</primary>
7939 The view <structname>pg_file_settings</structname> provides a summary of
7940 the contents of the server's configuration file(s). A row appears in
7941 this view for each <quote>name = value</> entry appearing in the files,
7942 with annotations indicating whether the value could be applied
7943 successfully. Additional row(s) may appear for problems not linked to
7944 a <quote>name = value</> entry, such as syntax errors in the files.
7948 This view is helpful for checking whether planned changes in the
7949 configuration files will work, or for diagnosing a previous failure.
7950 Note that this view reports on the <emphasis>current</> contents of the
7951 files, not on what was last applied by the server. (The
7952 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
7953 view is usually sufficient to determine that.)
7957 The <structname>pg_file_settings</structname> view can be read only by
7962 <title><structname>pg_file_settings</> Columns</title>
7969 <entry>Description</entry>
7974 <entry><structfield>sourcefile</structfield></entry>
7975 <entry><structfield>text</structfield></entry>
7976 <entry>Full path name of the configuration file</entry>
7979 <entry><structfield>sourceline</structfield></entry>
7980 <entry><structfield>integer</structfield></entry>
7982 Line number within the configuration file where the entry appears
7986 <entry><structfield>seqno</structfield></entry>
7987 <entry><structfield>integer</structfield></entry>
7988 <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
7991 <entry><structfield>name</structfield></entry>
7992 <entry><structfield>text</structfield></entry>
7993 <entry>Configuration parameter name</entry>
7996 <entry><structfield>setting</structfield></entry>
7997 <entry><structfield>text</structfield></entry>
7998 <entry>Value to be assigned to the parameter</entry>
8001 <entry><structfield>applied</structfield></entry>
8002 <entry><structfield>boolean</structfield></entry>
8003 <entry>True if the value can be applied successfully</entry>
8006 <entry><structfield>error</structfield></entry>
8007 <entry><structfield>text</structfield></entry>
8008 <entry>If not null, an error message indicating why this entry could
8009 not be applied</entry>
8016 If the configuration file contains syntax errors or invalid parameter
8017 names, the server will not attempt to apply any settings from it, and
8018 therefore all the <structfield>applied</> fields will read as false.
8019 In such a case there will be one or more rows with
8020 non-null <structfield>error</structfield> fields indicating the
8021 problem(s). Otherwise, individual settings will be applied if possible.
8022 If an individual setting cannot be applied (e.g., invalid value, or the
8023 setting cannot be changed after server start) it will have an appropriate
8024 message in the <structfield>error</structfield> field. Another way that
8025 an entry might have <structfield>applied</> = false is that it is
8026 overridden by a later entry for the same parameter name; this case is not
8027 considered an error so nothing appears in
8028 the <structfield>error</structfield> field.
8032 See <xref linkend="config-setting"> for more information about the various
8033 ways to change run-time parameters.
8038 <sect1 id="view-pg-group">
8039 <title><structname>pg_group</structname></title>
8041 <indexterm zone="view-pg-group">
8042 <primary>pg_group</primary>
8046 The view <structname>pg_group</structname> exists for backwards
8047 compatibility: it emulates a catalog that existed in
8048 <productname>PostgreSQL</productname> before version 8.1.
8049 It shows the names and members of all roles that are marked as not
8050 <structfield>rolcanlogin</>, which is an approximation to the set
8051 of roles that are being used as groups.
8055 <title><structname>pg_group</> Columns</title>
8062 <entry>References</entry>
8063 <entry>Description</entry>
8069 <entry><structfield>groname</structfield></entry>
8070 <entry><type>name</type></entry>
8071 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8072 <entry>Name of the group</entry>
8076 <entry><structfield>grosysid</structfield></entry>
8077 <entry><type>oid</type></entry>
8078 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8079 <entry>ID of this group</entry>
8083 <entry><structfield>grolist</structfield></entry>
8084 <entry><type>oid[]</type></entry>
8085 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8086 <entry>An array containing the IDs of the roles in this group</entry>
8094 <sect1 id="view-pg-indexes">
8095 <title><structname>pg_indexes</structname></title>
8097 <indexterm zone="view-pg-indexes">
8098 <primary>pg_indexes</primary>
8102 The view <structname>pg_indexes</structname> provides access to
8103 useful information about each index in the database.
8107 <title><structname>pg_indexes</> Columns</title>
8114 <entry>References</entry>
8115 <entry>Description</entry>
8120 <entry><structfield>schemaname</structfield></entry>
8121 <entry><type>name</type></entry>
8122 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8123 <entry>Name of schema containing table and index</entry>
8126 <entry><structfield>tablename</structfield></entry>
8127 <entry><type>name</type></entry>
8128 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8129 <entry>Name of table the index is for</entry>
8132 <entry><structfield>indexname</structfield></entry>
8133 <entry><type>name</type></entry>
8134 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8135 <entry>Name of index</entry>
8138 <entry><structfield>tablespace</structfield></entry>
8139 <entry><type>name</type></entry>
8140 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8141 <entry>Name of tablespace containing index (null if default for database)</entry>
8144 <entry><structfield>indexdef</structfield></entry>
8145 <entry><type>text</type></entry>
8147 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8156 <sect1 id="view-pg-locks">
8157 <title><structname>pg_locks</structname></title>
8159 <indexterm zone="view-pg-locks">
8160 <primary>pg_locks</primary>
8164 The view <structname>pg_locks</structname> provides access to
8165 information about the locks held by open transactions within the
8166 database server. See <xref linkend="mvcc"> for more discussion
8171 <structname>pg_locks</structname> contains one row per active lockable
8172 object, requested lock mode, and relevant transaction. Thus, the same
8173 lockable object might
8174 appear many times, if multiple transactions are holding or waiting
8175 for locks on it. However, an object that currently has no locks on it
8176 will not appear at all.
8180 There are several distinct types of lockable objects:
8181 whole relations (e.g., tables), individual pages of relations,
8182 individual tuples of relations,
8183 transaction IDs (both virtual and permanent IDs),
8184 and general database objects (identified by class OID and object OID,
8185 in the same way as in <structname>pg_description</structname> or
8186 <structname>pg_depend</structname>). Also, the right to extend a
8187 relation is represented as a separate lockable object.
8188 Also, <quote>advisory</> locks can be taken on numbers that have
8189 user-defined meanings.
8193 <title><structname>pg_locks</> Columns</title>
8200 <entry>References</entry>
8201 <entry>Description</entry>
8206 <entry><structfield>locktype</structfield></entry>
8207 <entry><type>text</type></entry>
8210 Type of the lockable object:
8211 <literal>relation</>,
8215 <literal>transactionid</>,
8216 <literal>virtualxid</>,
8218 <literal>userlock</>, or
8219 <literal>advisory</>
8223 <entry><structfield>database</structfield></entry>
8224 <entry><type>oid</type></entry>
8225 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8227 OID of the database in which the lock target exists, or
8228 zero if the target is a shared object, or
8229 null if the target is a transaction ID
8233 <entry><structfield>relation</structfield></entry>
8234 <entry><type>oid</type></entry>
8235 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8237 OID of the relation targeted by the lock, or null if the target is not
8238 a relation or part of a relation
8242 <entry><structfield>page</structfield></entry>
8243 <entry><type>integer</type></entry>
8246 Page number targeted by the lock within the relation,
8247 or null if the target is not a relation page or tuple
8251 <entry><structfield>tuple</structfield></entry>
8252 <entry><type>smallint</type></entry>
8255 Tuple number targeted by the lock within the page,
8256 or null if the target is not a tuple
8260 <entry><structfield>virtualxid</structfield></entry>
8261 <entry><type>text</type></entry>
8264 Virtual ID of the transaction targeted by the lock,
8265 or null if the target is not a virtual transaction ID
8269 <entry><structfield>transactionid</structfield></entry>
8270 <entry><type>xid</type></entry>
8273 ID of the transaction targeted by the lock,
8274 or null if the target is not a transaction ID
8278 <entry><structfield>classid</structfield></entry>
8279 <entry><type>oid</type></entry>
8280 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8282 OID of the system catalog containing the lock target, or null if the
8283 target is not a general database object
8287 <entry><structfield>objid</structfield></entry>
8288 <entry><type>oid</type></entry>
8289 <entry>any OID column</entry>
8291 OID of the lock target within its system catalog, or null if the
8292 target is not a general database object
8296 <entry><structfield>objsubid</structfield></entry>
8297 <entry><type>smallint</type></entry>
8300 Column number targeted by the lock (the
8301 <structfield>classid</> and <structfield>objid</> refer to the
8303 or zero if the target is some other general database object,
8304 or null if the target is not a general database object
8308 <entry><structfield>virtualtransaction</structfield></entry>
8309 <entry><type>text</type></entry>
8312 Virtual ID of the transaction that is holding or awaiting this lock
8316 <entry><structfield>pid</structfield></entry>
8317 <entry><type>integer</type></entry>
8320 Process ID of the server process holding or awaiting this
8321 lock, or null if the lock is held by a prepared transaction
8325 <entry><structfield>mode</structfield></entry>
8326 <entry><type>text</type></entry>
8328 <entry>Name of the lock mode held or desired by this process (see <xref
8329 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8332 <entry><structfield>granted</structfield></entry>
8333 <entry><type>boolean</type></entry>
8335 <entry>True if lock is held, false if lock is awaited</entry>
8338 <entry><structfield>fastpath</structfield></entry>
8339 <entry><type>boolean</type></entry>
8341 <entry>True if lock was taken via fast path, false if taken via main
8349 <structfield>granted</structfield> is true in a row representing a lock
8350 held by the indicated transaction. False indicates that this transaction is
8351 currently waiting to acquire this lock, which implies that some other
8352 transaction is holding a conflicting lock mode on the same lockable object.
8353 The waiting transaction will sleep until the other lock is released (or a
8354 deadlock situation is detected). A single transaction can be waiting to
8355 acquire at most one lock at a time.
8359 Every transaction holds an exclusive lock on its virtual transaction ID for
8360 its entire duration. If a permanent ID is assigned to the transaction
8361 (which normally happens only if the transaction changes the state of the
8362 database), it also holds an exclusive lock on its permanent transaction ID
8363 until it ends. When one transaction finds it necessary to wait specifically
8364 for another transaction, it does so by attempting to acquire share lock on
8365 the other transaction ID (either virtual or permanent ID depending on the
8366 situation). That will succeed only when the other transaction
8367 terminates and releases its locks.
8371 Although tuples are a lockable type of object,
8372 information about row-level locks is stored on disk, not in memory,
8373 and therefore row-level locks normally do not appear in this view.
8374 If a transaction is waiting for a
8375 row-level lock, it will usually appear in the view as waiting for the
8376 permanent transaction ID of the current holder of that row lock.
8380 Advisory locks can be acquired on keys consisting of either a single
8381 <type>bigint</type> value or two integer values.
8382 A <type>bigint</type> key is displayed with its
8383 high-order half in the <structfield>classid</> column, its low-order half
8384 in the <structfield>objid</> column, and <structfield>objsubid</> equal
8385 to 1. The original <type>bigint</type> value can be reassembled with the
8386 expression <literal>(classid::bigint << 32) |
8387 objid::bigint</literal>. Integer keys are displayed with the
8389 <structfield>classid</> column, the second key in the <structfield>objid</>
8390 column, and <structfield>objsubid</> equal to 2. The actual meaning of
8391 the keys is up to the user. Advisory locks are local to each database,
8392 so the <structfield>database</> column is meaningful for an advisory lock.
8396 <structname>pg_locks</structname> provides a global view of all locks
8397 in the database cluster, not only those relevant to the current database.
8398 Although its <structfield>relation</structfield> column can be joined
8399 against <structname>pg_class</>.<structfield>oid</> to identify locked
8400 relations, this will only work correctly for relations in the current
8401 database (those for which the <structfield>database</structfield> column
8402 is either the current database's OID or zero).
8406 The <structfield>pid</structfield> column can be joined to the
8407 <structfield>pid</structfield> column of the <link
8408 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8410 information on the session holding or waiting to hold each lock,
8413 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8414 ON pl.pid = psa.pid;
8416 Also, if you are using prepared transactions, the
8417 <structfield>virtualtransaction</> column can be joined to the
8418 <structfield>transaction</structfield> column of the <link
8419 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8420 view to get more information on prepared transactions that hold locks.
8421 (A prepared transaction can never be waiting for a lock,
8422 but it continues to hold the locks it acquired while running.)
8425 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8426 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8431 The <structname>pg_locks</structname> view displays data from both the
8432 regular lock manager and the predicate lock manager, which are
8433 separate systems; in addition, the regular lock manager subdivides its
8434 locks into regular and <firstterm>fast-path</> locks.
8435 This data is not guaranteed to be entirely consistent.
8436 When the view is queried,
8437 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8438 is gathered from each backend one at a time, without freezing the state of
8439 the entire lock manager, so it is possible for locks to be taken or
8440 released while information is gathered. Note, however, that these locks are
8441 known not to conflict with any other lock currently in place. After
8442 all backends have been queried for fast-path locks, the remainder of the
8443 regular lock manager is locked as a unit, and a consistent snapshot of all
8444 remaining locks is collected as an atomic action. After unlocking the
8445 regular lock manager, the predicate lock manager is similarly locked and all
8446 predicate locks are collected as an atomic action. Thus, with the exception
8447 of fast-path locks, each lock manager will deliver a consistent set of
8448 results, but as we do not lock both lock managers simultaneously, it is
8449 possible for locks to be taken or released after we interrogate the regular
8450 lock manager and before we interrogate the predicate lock manager.
8454 Locking the regular and/or predicate lock manager could have some
8455 impact on database performance if this view is very frequently accessed.
8456 The locks are held only for the minimum amount of time necessary to
8457 obtain data from the lock managers, but this does not completely eliminate
8458 the possibility of a performance impact.
8463 <sect1 id="view-pg-matviews">
8464 <title><structname>pg_matviews</structname></title>
8466 <indexterm zone="view-pg-matviews">
8467 <primary>pg_matviews</primary>
8470 <indexterm zone="view-pg-matviews">
8471 <primary>materialized views</primary>
8475 The view <structname>pg_matviews</structname> provides access to
8476 useful information about each materialized view in the database.
8480 <title><structname>pg_matviews</> Columns</title>
8487 <entry>References</entry>
8488 <entry>Description</entry>
8493 <entry><structfield>schemaname</structfield></entry>
8494 <entry><type>name</type></entry>
8495 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8496 <entry>Name of schema containing materialized view</entry>
8499 <entry><structfield>matviewname</structfield></entry>
8500 <entry><type>name</type></entry>
8501 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8502 <entry>Name of materialized view</entry>
8505 <entry><structfield>matviewowner</structfield></entry>
8506 <entry><type>name</type></entry>
8507 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8508 <entry>Name of materialized view's owner</entry>
8511 <entry><structfield>tablespace</structfield></entry>
8512 <entry><type>name</type></entry>
8513 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8514 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8517 <entry><structfield>hasindexes</structfield></entry>
8518 <entry><type>boolean</type></entry>
8520 <entry>True if materialized view has (or recently had) any indexes</entry>
8523 <entry><structfield>ispopulated</structfield></entry>
8524 <entry><type>boolean</type></entry>
8526 <entry>True if materialized view is currently populated</entry>
8529 <entry><structfield>definition</structfield></entry>
8530 <entry><type>text</type></entry>
8532 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8540 <sect1 id="view-pg-policies">
8541 <title><structname>pg_policies</structname></title>
8543 <indexterm zone="view-pg-policies">
8544 <primary>pg_policies</primary>
8548 The view <structname>pg_policies</structname> provides access to
8549 useful information about each row-level security policy in the database.
8553 <title><structname>pg_policies</> Columns</title>
8560 <entry>References</entry>
8561 <entry>Description</entry>
8566 <entry><structfield>schemaname</structfield></entry>
8567 <entry><type>name</type></entry>
8568 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8569 <entry>Name of schema containing table policy is on</entry>
8572 <entry><structfield>tablename</structfield></entry>
8573 <entry><type>name</type></entry>
8574 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8575 <entry>Name of table policy is on</entry>
8578 <entry><structfield>policyname</structfield></entry>
8579 <entry><type>name</type></entry>
8580 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
8581 <entry>Name of policy</entry>
8584 <entry><structfield>roles</structfield></entry>
8585 <entry><type>name[]</type></entry>
8587 <entry>The roles to which this policy applies</entry>
8590 <entry><structfield>cmd</structfield></entry>
8591 <entry><type>text</type></entry>
8593 <entry>The command type to which the policy is applied</entry>
8596 <entry><structfield>qual</structfield></entry>
8597 <entry><type>text</type></entry>
8599 <entry>The expression added to the security barrier qualifications for
8600 queries that this policy applies to</entry>
8603 <entry><structfield>with_check</structfield></entry>
8604 <entry><type>text</type></entry>
8606 <entry>The expression added to the WITH CHECK qualifications for
8607 queries that attempt to add rows to this table</entry>
8615 <sect1 id="view-pg-prepared-statements">
8616 <title><structname>pg_prepared_statements</structname></title>
8618 <indexterm zone="view-pg-prepared-statements">
8619 <primary>pg_prepared_statements</primary>
8623 The <structname>pg_prepared_statements</structname> view displays
8624 all the prepared statements that are available in the current
8625 session. See <xref linkend="sql-prepare"> for more information about prepared
8630 <structname>pg_prepared_statements</structname> contains one row
8631 for each prepared statement. Rows are added to the view when a new
8632 prepared statement is created and removed when a prepared statement
8633 is released (for example, via the <xref linkend="sql-deallocate"> command).
8637 <title><structname>pg_prepared_statements</> Columns</title>
8644 <entry>Description</entry>
8649 <entry><structfield>name</structfield></entry>
8650 <entry><type>text</type></entry>
8652 The identifier of the prepared statement
8656 <entry><structfield>statement</structfield></entry>
8657 <entry><type>text</type></entry>
8659 The query string submitted by the client to create this
8660 prepared statement. For prepared statements created via SQL,
8661 this is the <command>PREPARE</command> statement submitted by
8662 the client. For prepared statements created via the
8663 frontend/backend protocol, this is the text of the prepared
8668 <entry><structfield>prepare_time</structfield></entry>
8669 <entry><type>timestamptz</type></entry>
8671 The time at which the prepared statement was created
8675 <entry><structfield>parameter_types</structfield></entry>
8676 <entry><type>regtype[]</type></entry>
8678 The expected parameter types for the prepared statement in the
8679 form of an array of <type>regtype</type>. The OID corresponding
8680 to an element of this array can be obtained by casting the
8681 <type>regtype</type> value to <type>oid</type>.
8685 <entry><structfield>from_sql</structfield></entry>
8686 <entry><type>boolean</type></entry>
8688 <literal>true</literal> if the prepared statement was created
8689 via the <command>PREPARE</command> SQL statement;
8690 <literal>false</literal> if the statement was prepared via the
8691 frontend/backend protocol
8699 The <structname>pg_prepared_statements</structname> view is read only.
8703 <sect1 id="view-pg-prepared-xacts">
8704 <title><structname>pg_prepared_xacts</structname></title>
8706 <indexterm zone="view-pg-prepared-xacts">
8707 <primary>pg_prepared_xacts</primary>
8711 The view <structname>pg_prepared_xacts</structname> displays
8712 information about transactions that are currently prepared for two-phase
8713 commit (see <xref linkend="sql-prepare-transaction"> for details).
8717 <structname>pg_prepared_xacts</structname> contains one row per prepared
8718 transaction. An entry is removed when the transaction is committed or
8723 <title><structname>pg_prepared_xacts</> Columns</title>
8730 <entry>References</entry>
8731 <entry>Description</entry>
8736 <entry><structfield>transaction</structfield></entry>
8737 <entry><type>xid</type></entry>
8740 Numeric transaction identifier of the prepared transaction
8744 <entry><structfield>gid</structfield></entry>
8745 <entry><type>text</type></entry>
8748 Global transaction identifier that was assigned to the transaction
8752 <entry><structfield>prepared</structfield></entry>
8753 <entry><type>timestamp with time zone</type></entry>
8756 Time at which the transaction was prepared for commit
8760 <entry><structfield>owner</structfield></entry>
8761 <entry><type>name</type></entry>
8762 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8764 Name of the user that executed the transaction
8768 <entry><structfield>database</structfield></entry>
8769 <entry><type>name</type></entry>
8770 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8772 Name of the database in which the transaction was executed
8780 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8781 internal transaction manager data structures are momentarily locked, and
8782 a copy is made for the view to display. This ensures that the
8783 view produces a consistent set of results, while not blocking
8784 normal operations longer than necessary. Nonetheless
8785 there could be some impact on database performance if this view is
8786 frequently accessed.
8791 <sect1 id="view-pg-roles">
8792 <title><structname>pg_roles</structname></title>
8794 <indexterm zone="view-pg-roles">
8795 <primary>pg_roles</primary>
8799 The view <structname>pg_roles</structname> provides access to
8800 information about database roles. This is simply a publicly
8802 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8803 that blanks out the password field.
8807 This view explicitly exposes the OID column of the underlying table,
8808 since that is needed to do joins to other catalogs.
8812 <title><structname>pg_roles</> Columns</title>
8819 <entry>References</entry>
8820 <entry>Description</entry>
8826 <entry><structfield>rolname</structfield></entry>
8827 <entry><type>name</type></entry>
8829 <entry>Role name</entry>
8833 <entry><structfield>rolsuper</structfield></entry>
8834 <entry><type>bool</type></entry>
8836 <entry>Role has superuser privileges</entry>
8840 <entry><structfield>rolinherit</structfield></entry>
8841 <entry><type>bool</type></entry>
8843 <entry>Role automatically inherits privileges of roles it is a
8848 <entry><structfield>rolcreaterole</structfield></entry>
8849 <entry><type>bool</type></entry>
8851 <entry>Role can create more roles</entry>
8855 <entry><structfield>rolcreatedb</structfield></entry>
8856 <entry><type>bool</type></entry>
8858 <entry>Role can create databases</entry>
8862 <entry><structfield>rolcanlogin</structfield></entry>
8863 <entry><type>bool</type></entry>
8866 Role can log in. That is, this role can be given as the initial
8867 session authorization identifier
8872 <entry><structfield>rolreplication</structfield></entry>
8873 <entry><type>bool</type></entry>
8876 Role is a replication role. That is, this role can initiate streaming
8877 replication (see <xref linkend="streaming-replication">) and set/unset
8878 the system backup mode using <function>pg_start_backup</> and
8879 <function>pg_stop_backup</>
8884 <entry><structfield>rolconnlimit</structfield></entry>
8885 <entry><type>int4</type></entry>
8888 For roles that can log in, this sets maximum number of concurrent
8889 connections this role can make. -1 means no limit.
8894 <entry><structfield>rolpassword</structfield></entry>
8895 <entry><type>text</type></entry>
8897 <entry>Not the password (always reads as <literal>********</>)</entry>
8901 <entry><structfield>rolvaliduntil</structfield></entry>
8902 <entry><type>timestamptz</type></entry>
8904 <entry>Password expiry time (only used for password authentication);
8905 null if no expiration</entry>
8909 <entry><structfield>rolconfig</structfield></entry>
8910 <entry><type>text[]</type></entry>
8912 <entry>Role-specific defaults for run-time configuration variables</entry>
8916 <entry><structfield>oid</structfield></entry>
8917 <entry><type>oid</type></entry>
8918 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8919 <entry>ID of role</entry>
8927 <sect1 id="view-pg-rules">
8928 <title><structname>pg_rules</structname></title>
8930 <indexterm zone="view-pg-rules">
8931 <primary>pg_rules</primary>
8935 The view <structname>pg_rules</structname> provides access to
8936 useful information about query rewrite rules.
8940 <title><structname>pg_rules</> Columns</title>
8947 <entry>References</entry>
8948 <entry>Description</entry>
8953 <entry><structfield>schemaname</structfield></entry>
8954 <entry><type>name</type></entry>
8955 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8956 <entry>Name of schema containing table</entry>
8959 <entry><structfield>tablename</structfield></entry>
8960 <entry><type>name</type></entry>
8961 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8962 <entry>Name of table the rule is for</entry>
8965 <entry><structfield>rulename</structfield></entry>
8966 <entry><type>name</type></entry>
8967 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8968 <entry>Name of rule</entry>
8971 <entry><structfield>definition</structfield></entry>
8972 <entry><type>text</type></entry>
8974 <entry>Rule definition (a reconstructed creation command)</entry>
8981 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8982 of views and materialized views; those can be seen in
8983 <structname>pg_views</> and <structname>pg_matviews</>.
8988 <sect1 id="view-pg-seclabels">
8989 <title><structname>pg_seclabels</structname></title>
8991 <indexterm zone="view-pg-seclabels">
8992 <primary>pg_seclabels</primary>
8996 The view <structname>pg_seclabels</structname> provides information about
8997 security labels. It as an easier-to-query version of the
8998 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9002 <title><structname>pg_seclabels</> Columns</title>
9009 <entry>References</entry>
9010 <entry>Description</entry>
9015 <entry><structfield>objoid</structfield></entry>
9016 <entry><type>oid</type></entry>
9017 <entry>any OID column</entry>
9018 <entry>The OID of the object this security label pertains to</entry>
9021 <entry><structfield>classoid</structfield></entry>
9022 <entry><type>oid</type></entry>
9023 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9024 <entry>The OID of the system catalog this object appears in</entry>
9027 <entry><structfield>objsubid</structfield></entry>
9028 <entry><type>int4</type></entry>
9031 For a security label on a table column, this is the column number (the
9032 <structfield>objoid</> and <structfield>classoid</> refer to
9033 the table itself). For all other object types, this column is
9038 <entry><structfield>objtype</structfield></entry>
9039 <entry><type>text</type></entry>
9042 The type of object to which this label applies, as text.
9046 <entry><structfield>objnamespace</structfield></entry>
9047 <entry><type>oid</type></entry>
9048 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9050 The OID of the namespace for this object, if applicable;
9055 <entry><structfield>objname</structfield></entry>
9056 <entry><type>text</type></entry>
9059 The name of the object to which this label applies, as text.
9063 <entry><structfield>provider</structfield></entry>
9064 <entry><type>text</type></entry>
9065 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9066 <entry>The label provider associated with this label.</entry>
9069 <entry><structfield>label</structfield></entry>
9070 <entry><type>text</type></entry>
9071 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
9072 <entry>The security label applied to this object.</entry>
9079 <sect1 id="view-pg-settings">
9080 <title><structname>pg_settings</structname></title>
9082 <indexterm zone="view-pg-settings">
9083 <primary>pg_settings</primary>
9087 The view <structname>pg_settings</structname> provides access to
9088 run-time parameters of the server. It is essentially an alternative
9089 interface to the <xref linkend="sql-show">
9090 and <xref linkend="sql-set"> commands.
9091 It also provides access to some facts about each parameter that are
9092 not directly available from <command>SHOW</>, such as minimum and
9097 <title><structname>pg_settings</> Columns</title>
9104 <entry>Description</entry>
9109 <entry><structfield>name</structfield></entry>
9110 <entry><type>text</type></entry>
9111 <entry>Run-time configuration parameter name</entry>
9114 <entry><structfield>setting</structfield></entry>
9115 <entry><type>text</type></entry>
9116 <entry>Current value of the parameter</entry>
9119 <entry><structfield>unit</structfield></entry>
9120 <entry><type>text</type></entry>
9121 <entry>Implicit unit of the parameter</entry>
9124 <entry><structfield>category</structfield></entry>
9125 <entry><type>text</type></entry>
9126 <entry>Logical group of the parameter</entry>
9129 <entry><structfield>short_desc</structfield></entry>
9130 <entry><type>text</type></entry>
9131 <entry>A brief description of the parameter</entry>
9134 <entry><structfield>extra_desc</structfield></entry>
9135 <entry><type>text</type></entry>
9136 <entry>Additional, more detailed, description of the parameter</entry>
9139 <entry><structfield>context</structfield></entry>
9140 <entry><type>text</type></entry>
9141 <entry>Context required to set the parameter's value (see below)</entry>
9144 <entry><structfield>vartype</structfield></entry>
9145 <entry><type>text</type></entry>
9146 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
9147 <literal>integer</>, <literal>real</>, or <literal>string</>)
9151 <entry><structfield>source</structfield></entry>
9152 <entry><type>text</type></entry>
9153 <entry>Source of the current parameter value</entry>
9156 <entry><structfield>min_val</structfield></entry>
9157 <entry><type>text</type></entry>
9158 <entry>Minimum allowed value of the parameter (null for non-numeric
9162 <entry><structfield>max_val</structfield></entry>
9163 <entry><type>text</type></entry>
9164 <entry>Maximum allowed value of the parameter (null for non-numeric
9168 <entry><structfield>enumvals</structfield></entry>
9169 <entry><type>text[]</type></entry>
9170 <entry>Allowed values of an enum parameter (null for non-enum
9174 <entry><structfield>boot_val</structfield></entry>
9175 <entry><type>text</type></entry>
9176 <entry>Parameter value assumed at server startup if the parameter is
9177 not otherwise set</entry>
9180 <entry><structfield>reset_val</structfield></entry>
9181 <entry><type>text</type></entry>
9182 <entry>Value that <command>RESET</command> would reset the parameter to
9183 in the current session</entry>
9186 <entry><structfield>sourcefile</structfield></entry>
9187 <entry><type>text</type></entry>
9188 <entry>Configuration file the current value was set in (null for
9189 values set from sources other than configuration files, or when
9190 examined by a non-superuser);
9191 helpful when using <literal>include</> directives in configuration files</entry>
9194 <entry><structfield>sourceline</structfield></entry>
9195 <entry><type>integer</type></entry>
9196 <entry>Line number within the configuration file the current value was
9197 set at (null for values set from sources other than configuration files,
9198 or when examined by a non-superuser)
9202 <entry><structfield>pending_restart</structfield></entry>
9203 <entry><type>boolean</type></entry>
9204 <entry><literal>true</literal> if the value has been changed in the
9205 configuration file but needs a restart; or <literal>false</literal>
9214 There are several possible values of <structfield>context</structfield>.
9215 In order of decreasing difficulty of changing the setting, they are:
9220 <!-- PGC_INTERNAL -->
9221 <term><literal>internal</literal></term>
9224 These settings cannot be changed directly; they reflect internally
9225 determined values. Some of them may be adjustable by rebuilding the
9226 server with different configuration options, or by changing options
9227 supplied to <command>initdb</command>.
9232 <!-- PGC_POSTMASTER -->
9233 <term><literal>postmaster</literal></term>
9236 These settings can only be applied when the server starts, so any change
9237 requires restarting the server. Values for these settings are typically
9238 stored in the <filename>postgresql.conf</filename> file, or passed on
9239 the command line when starting the server. Of course, settings with any
9240 of the lower <structfield>context</structfield> types can also be
9241 set at server start time.
9247 <term><literal>sighup</literal></term>
9250 Changes to these settings can be made in
9251 <filename>postgresql.conf</filename> without restarting the server.
9252 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
9253 cause it to re-read <filename>postgresql.conf</filename> and apply
9254 the changes. The postmaster will also forward the
9255 <systemitem>SIGHUP</systemitem> signal to its child processes so that
9256 they all pick up the new value.
9261 <!-- PGC_SU_BACKEND -->
9262 <term><literal>superuser-backend</literal></term>
9265 Changes to these settings can be made in
9266 <filename>postgresql.conf</filename> without restarting the server.
9267 They can also be set for a particular session in the connection request
9268 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9269 environment variable), but only if the connecting user is a superuser.
9270 However, these settings never change in a session after it is started.
9271 If you change them in <filename>postgresql.conf</filename>, send a
9272 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9273 re-read <filename>postgresql.conf</filename>. The new values will only
9274 affect subsequently-launched sessions.
9279 <!-- PGC_BACKEND -->
9280 <term><literal>backend</literal></term>
9283 Changes to these settings can be made in
9284 <filename>postgresql.conf</filename> without restarting the server.
9285 They can also be set for a particular session in the connection request
9286 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9287 environment variable); any user can make such a change for their session.
9288 However, these settings never change in a session after it is started.
9289 If you change them in <filename>postgresql.conf</filename>, send a
9290 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9291 re-read <filename>postgresql.conf</filename>. The new values will only
9292 affect subsequently-launched sessions.
9298 <term><literal>superuser</literal></term>
9301 These settings can be set from <filename>postgresql.conf</filename>,
9302 or within a session via the <command>SET</> command; but only superusers
9303 can change them via <command>SET</>. Changes in
9304 <filename>postgresql.conf</filename> will affect existing sessions
9305 only if no session-local value has been established with <command>SET</>.
9310 <!-- PGC_USERSET -->
9311 <term><literal>user</literal></term>
9314 These settings can be set from <filename>postgresql.conf</filename>,
9315 or within a session via the <command>SET</> command. Any user is
9316 allowed to change their session-local value. Changes in
9317 <filename>postgresql.conf</filename> will affect existing sessions
9318 only if no session-local value has been established with <command>SET</>.
9325 See <xref linkend="config-setting"> for more information about the various
9326 ways to change these parameters.
9330 The <structname>pg_settings</structname> view cannot be inserted into or
9331 deleted from, but it can be updated. An <command>UPDATE</command> applied
9332 to a row of <structname>pg_settings</structname> is equivalent to executing
9333 the <xref linkend="sql-set"> command on that named
9334 parameter. The change only affects the value used by the current
9335 session. If an <command>UPDATE</command> is issued within a transaction
9336 that is later aborted, the effects of the <command>UPDATE</command> command
9337 disappear when the transaction is rolled back. Once the surrounding
9338 transaction is committed, the effects will persist until the end of the
9339 session, unless overridden by another <command>UPDATE</command> or
9340 <command>SET</command>.
9345 <sect1 id="view-pg-shadow">
9346 <title><structname>pg_shadow</structname></title>
9348 <indexterm zone="view-pg-shadow">
9349 <primary>pg_shadow</primary>
9353 The view <structname>pg_shadow</structname> exists for backwards
9354 compatibility: it emulates a catalog that existed in
9355 <productname>PostgreSQL</productname> before version 8.1.
9356 It shows properties of all roles that are marked as
9357 <structfield>rolcanlogin</> in
9358 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
9362 The name stems from the fact that this table
9363 should not be readable by the public since it contains passwords.
9364 <link linkend="view-pg-user"><structname>pg_user</structname></link>
9365 is a publicly readable view on
9366 <structname>pg_shadow</structname> that blanks out the password field.
9370 <title><structname>pg_shadow</> Columns</title>
9377 <entry>References</entry>
9378 <entry>Description</entry>
9384 <entry><structfield>usename</structfield></entry>
9385 <entry><type>name</type></entry>
9386 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9387 <entry>User name</entry>
9391 <entry><structfield>usesysid</structfield></entry>
9392 <entry><type>oid</type></entry>
9393 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9394 <entry>ID of this user</entry>
9398 <entry><structfield>usecreatedb</structfield></entry>
9399 <entry><type>bool</type></entry>
9401 <entry>User can create databases</entry>
9405 <entry><structfield>usesuper</structfield></entry>
9406 <entry><type>bool</type></entry>
9408 <entry>User is a superuser</entry>
9412 <entry><structfield>userepl</structfield></entry>
9413 <entry><type>bool</type></entry>
9416 User can initiate streaming replication and put the system in and
9422 <entry><structfield>usebypassrls</structfield></entry>
9423 <entry><type>bool</type></entry>
9426 User bypasses every row level security policy, see
9427 <xref linkend="ddl-rowsecurity"> for more information.
9432 <entry><structfield>passwd</structfield></entry>
9433 <entry><type>text</type></entry>
9435 <entry>Password (possibly encrypted); null if none. See
9436 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9437 for details of how encrypted passwords are stored.</entry>
9441 <entry><structfield>valuntil</structfield></entry>
9442 <entry><type>abstime</type></entry>
9444 <entry>Password expiry time (only used for password authentication)</entry>
9448 <entry><structfield>useconfig</structfield></entry>
9449 <entry><type>text[]</type></entry>
9451 <entry>Session defaults for run-time configuration variables</entry>
9459 <sect1 id="view-pg-stats">
9460 <title><structname>pg_stats</structname></title>
9462 <indexterm zone="view-pg-stats">
9463 <primary>pg_stats</primary>
9467 The view <structname>pg_stats</structname> provides access to
9468 the information stored in the <link
9469 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
9470 catalog. This view allows access only to rows of
9471 <structname>pg_statistic</structname> that correspond to tables the
9472 user has permission to read, and therefore it is safe to allow public
9473 read access to this view.
9477 <structname>pg_stats</structname> is also designed to present the
9478 information in a more readable format than the underlying catalog
9479 — at the cost that its schema must be extended whenever new slot types
9480 are defined for <structname>pg_statistic</structname>.
9484 <title><structname>pg_stats</> Columns</title>
9491 <entry>References</entry>
9492 <entry>Description</entry>
9497 <entry><structfield>schemaname</structfield></entry>
9498 <entry><type>name</type></entry>
9499 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9500 <entry>Name of schema containing table</entry>
9504 <entry><structfield>tablename</structfield></entry>
9505 <entry><type>name</type></entry>
9506 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9507 <entry>Name of table</entry>
9511 <entry><structfield>attname</structfield></entry>
9512 <entry><type>name</type></entry>
9513 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9514 <entry>Name of the column described by this row</entry>
9518 <entry><structfield>inherited</structfield></entry>
9519 <entry><type>bool</type></entry>
9521 <entry>If true, this row includes inheritance child columns, not just the
9522 values in the specified table</entry>
9526 <entry><structfield>null_frac</structfield></entry>
9527 <entry><type>real</type></entry>
9529 <entry>Fraction of column entries that are null</entry>
9533 <entry><structfield>avg_width</structfield></entry>
9534 <entry><type>integer</type></entry>
9536 <entry>Average width in bytes of column's entries</entry>
9540 <entry><structfield>n_distinct</structfield></entry>
9541 <entry><type>real</type></entry>
9544 If greater than zero, the estimated number of distinct values in the
9545 column. If less than zero, the negative of the number of distinct
9546 values divided by the number of rows. (The negated form is used when
9547 <command>ANALYZE</> believes that the number of distinct values is
9548 likely to increase as the table grows; the positive form is used when
9549 the column seems to have a fixed number of possible values.) For
9550 example, -1 indicates a unique column in which the number of distinct
9551 values is the same as the number of rows.
9556 <entry><structfield>most_common_vals</structfield></entry>
9557 <entry><type>anyarray</type></entry>
9560 A list of the most common values in the column. (Null if
9561 no values seem to be more common than any others.)
9566 <entry><structfield>most_common_freqs</structfield></entry>
9567 <entry><type>real[]</type></entry>
9570 A list of the frequencies of the most common values,
9571 i.e., number of occurrences of each divided by total number of rows.
9572 (Null when <structfield>most_common_vals</structfield> is.)
9577 <entry><structfield>histogram_bounds</structfield></entry>
9578 <entry><type>anyarray</type></entry>
9581 A list of values that divide the column's values into groups of
9582 approximately equal population. The values in
9583 <structfield>most_common_vals</>, if present, are omitted from this
9584 histogram calculation. (This column is null if the column data type
9585 does not have a <literal><</> operator or if the
9586 <structfield>most_common_vals</> list accounts for the entire
9592 <entry><structfield>correlation</structfield></entry>
9593 <entry><type>real</type></entry>
9596 Statistical correlation between physical row ordering and
9597 logical ordering of the column values. This ranges from -1 to +1.
9598 When the value is near -1 or +1, an index scan on the column will
9599 be estimated to be cheaper than when it is near zero, due to reduction
9600 of random access to the disk. (This column is null if the column data
9601 type does not have a <literal><</> operator.)
9606 <entry><structfield>most_common_elems</structfield></entry>
9607 <entry><type>anyarray</type></entry>
9610 A list of non-null element values most often appearing within values of
9611 the column. (Null for scalar types.)
9616 <entry><structfield>most_common_elem_freqs</structfield></entry>
9617 <entry><type>real[]</type></entry>
9620 A list of the frequencies of the most common element values, i.e., the
9621 fraction of rows containing at least one instance of the given value.
9622 Two or three additional values follow the per-element frequencies;
9623 these are the minimum and maximum of the preceding per-element
9624 frequencies, and optionally the frequency of null elements.
9625 (Null when <structfield>most_common_elems</structfield> is.)
9630 <entry><structfield>elem_count_histogram</structfield></entry>
9631 <entry><type>real[]</type></entry>
9634 A histogram of the counts of distinct non-null element values within the
9635 values of the column, followed by the average number of distinct
9636 non-null elements. (Null for scalar types.)
9644 The maximum number of entries in the array fields can be controlled on a
9645 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9646 command, or globally by setting the
9647 <xref linkend="guc-default-statistics-target"> run-time parameter.
9652 <sect1 id="view-pg-tables">
9653 <title><structname>pg_tables</structname></title>
9655 <indexterm zone="view-pg-tables">
9656 <primary>pg_tables</primary>
9660 The view <structname>pg_tables</structname> provides access to
9661 useful information about each table in the database.
9665 <title><structname>pg_tables</> Columns</title>
9672 <entry>References</entry>
9673 <entry>Description</entry>
9678 <entry><structfield>schemaname</structfield></entry>
9679 <entry><type>name</type></entry>
9680 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9681 <entry>Name of schema containing table</entry>
9684 <entry><structfield>tablename</structfield></entry>
9685 <entry><type>name</type></entry>
9686 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9687 <entry>Name of table</entry>
9690 <entry><structfield>tableowner</structfield></entry>
9691 <entry><type>name</type></entry>
9692 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9693 <entry>Name of table's owner</entry>
9696 <entry><structfield>tablespace</structfield></entry>
9697 <entry><type>name</type></entry>
9698 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9699 <entry>Name of tablespace containing table (null if default for database)</entry>
9702 <entry><structfield>hasindexes</structfield></entry>
9703 <entry><type>boolean</type></entry>
9704 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9705 <entry>True if table has (or recently had) any indexes</entry>
9708 <entry><structfield>hasrules</structfield></entry>
9709 <entry><type>boolean</type></entry>
9710 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9711 <entry>True if table has (or once had) rules</entry>
9714 <entry><structfield>hastriggers</structfield></entry>
9715 <entry><type>boolean</type></entry>
9716 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9717 <entry>True if table has (or once had) triggers</entry>
9720 <entry><structfield>rowsecurity</structfield></entry>
9721 <entry><type>boolean</type></entry>
9722 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
9723 <entry>True if row security is enabled on the table</entry>
9731 <sect1 id="view-pg-timezone-abbrevs">
9732 <title><structname>pg_timezone_abbrevs</structname></title>
9734 <indexterm zone="view-pg-timezone-abbrevs">
9735 <primary>pg_timezone_abbrevs</primary>
9739 The view <structname>pg_timezone_abbrevs</structname> provides a list
9740 of time zone abbreviations that are currently recognized by the datetime
9741 input routines. The contents of this view change when the
9742 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9746 <title><structname>pg_timezone_abbrevs</> Columns</title>
9753 <entry>Description</entry>
9758 <entry><structfield>abbrev</structfield></entry>
9759 <entry><type>text</type></entry>
9760 <entry>Time zone abbreviation</entry>
9763 <entry><structfield>utc_offset</structfield></entry>
9764 <entry><type>interval</type></entry>
9765 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9768 <entry><structfield>is_dst</structfield></entry>
9769 <entry><type>boolean</type></entry>
9770 <entry>True if this is a daylight-savings abbreviation</entry>
9778 <sect1 id="view-pg-timezone-names">
9779 <title><structname>pg_timezone_names</structname></title>
9781 <indexterm zone="view-pg-timezone-names">
9782 <primary>pg_timezone_names</primary>
9786 The view <structname>pg_timezone_names</structname> provides a list
9787 of time zone names that are recognized by <command>SET TIMEZONE</>,
9788 along with their associated abbreviations, UTC offsets,
9789 and daylight-savings status. (Technically,
9790 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9791 than UTC because leap seconds are not handled.)
9792 Unlike the abbreviations shown in <link
9793 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9794 date rules. Therefore, the associated information changes across local DST
9795 boundaries. The displayed information is computed based on the current
9796 value of <function>CURRENT_TIMESTAMP</>.
9800 <title><structname>pg_timezone_names</> Columns</title>
9807 <entry>Description</entry>
9812 <entry><structfield>name</structfield></entry>
9813 <entry><type>text</type></entry>
9814 <entry>Time zone name</entry>
9817 <entry><structfield>abbrev</structfield></entry>
9818 <entry><type>text</type></entry>
9819 <entry>Time zone abbreviation</entry>
9822 <entry><structfield>utc_offset</structfield></entry>
9823 <entry><type>interval</type></entry>
9824 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9827 <entry><structfield>is_dst</structfield></entry>
9828 <entry><type>boolean</type></entry>
9829 <entry>True if currently observing daylight savings</entry>
9837 <sect1 id="view-pg-user">
9838 <title><structname>pg_user</structname></title>
9840 <indexterm zone="view-pg-user">
9841 <primary>pg_user</primary>
9845 The view <structname>pg_user</structname> provides access to
9846 information about database users. This is simply a publicly
9848 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9849 that blanks out the password field.
9853 <title><structname>pg_user</> Columns</title>
9860 <entry>Description</entry>
9865 <entry><structfield>usename</structfield></entry>
9866 <entry><type>name</type></entry>
9867 <entry>User name</entry>
9871 <entry><structfield>usesysid</structfield></entry>
9872 <entry><type>oid</type></entry>
9873 <entry>ID of this user</entry>
9877 <entry><structfield>usecreatedb</structfield></entry>
9878 <entry><type>bool</type></entry>
9879 <entry>User can create databases</entry>
9883 <entry><structfield>usesuper</structfield></entry>
9884 <entry><type>bool</type></entry>
9885 <entry>User is a superuser</entry>
9889 <entry><structfield>userepl</structfield></entry>
9890 <entry><type>bool</type></entry>
9892 User can initiate streaming replication and put the system in and
9898 <entry><structfield>usebypassrls</structfield></entry>
9899 <entry><type>bool</type></entry>
9901 User bypasses every row level security policy, see
9902 <xref linkend="ddl-rowsecurity"> for more information.
9907 <entry><structfield>passwd</structfield></entry>
9908 <entry><type>text</type></entry>
9909 <entry>Not the password (always reads as <literal>********</>)</entry>
9913 <entry><structfield>valuntil</structfield></entry>
9914 <entry><type>abstime</type></entry>
9915 <entry>Password expiry time (only used for password authentication)</entry>
9919 <entry><structfield>useconfig</structfield></entry>
9920 <entry><type>text[]</type></entry>
9921 <entry>Session defaults for run-time configuration variables</entry>
9929 <sect1 id="view-pg-user-mappings">
9930 <title><structname>pg_user_mappings</structname></title>
9932 <indexterm zone="view-pg-user-mappings">
9933 <primary>pg_user_mappings</primary>
9937 The view <structname>pg_user_mappings</structname> provides access
9938 to information about user mappings. This is essentially a publicly
9940 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9941 that leaves out the options field if the user has no rights to use
9946 <title><structname>pg_user_mappings</> Columns</title>
9953 <entry>References</entry>
9954 <entry>Description</entry>
9960 <entry><structfield>umid</structfield></entry>
9961 <entry><type>oid</type></entry>
9962 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
9963 <entry>OID of the user mapping</entry>
9967 <entry><structfield>srvid</structfield></entry>
9968 <entry><type>oid</type></entry>
9969 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
9971 The OID of the foreign server that contains this mapping
9976 <entry><structfield>srvname</structfield></entry>
9977 <entry><type>name</type></entry>
9978 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
9980 Name of the foreign server
9985 <entry><structfield>umuser</structfield></entry>
9986 <entry><type>oid</type></entry>
9987 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9988 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
9992 <entry><structfield>usename</structfield></entry>
9993 <entry><type>name</type></entry>
9995 <entry>Name of the local user to be mapped</entry>
9999 <entry><structfield>umoptions</structfield></entry>
10000 <entry><type>text[]</type></entry>
10003 User mapping specific options, as <quote>keyword=value</>
10004 strings, if the current user is the owner of the foreign
10014 <sect1 id="view-pg-views">
10015 <title><structname>pg_views</structname></title>
10017 <indexterm zone="view-pg-views">
10018 <primary>pg_views</primary>
10022 The view <structname>pg_views</structname> provides access to
10023 useful information about each view in the database.
10027 <title><structname>pg_views</> Columns</title>
10032 <entry>Name</entry>
10033 <entry>Type</entry>
10034 <entry>References</entry>
10035 <entry>Description</entry>
10040 <entry><structfield>schemaname</structfield></entry>
10041 <entry><type>name</type></entry>
10042 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10043 <entry>Name of schema containing view</entry>
10046 <entry><structfield>viewname</structfield></entry>
10047 <entry><type>name</type></entry>
10048 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10049 <entry>Name of view</entry>
10052 <entry><structfield>viewowner</structfield></entry>
10053 <entry><type>name</type></entry>
10054 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10055 <entry>Name of view's owner</entry>
10058 <entry><structfield>definition</structfield></entry>
10059 <entry><type>text</type></entry>
10061 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>