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 can bypass row level security policies, 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>relispopulated</structfield></entry>
1976 <entry><type>bool</type></entry>
1978 <entry>True if relation is populated (this is true for all
1979 relations other than some materialized views)</entry>
1983 <entry><structfield>relreplident</structfield></entry>
1984 <entry><type>char</type></entry>
1987 Columns used to form <quote>replica identity</> for rows:
1988 <literal>d</> = default (primary key, if any),
1989 <literal>n</> = nothing,
1990 <literal>f</> = all columns
1991 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1996 <entry><structfield>relfrozenxid</structfield></entry>
1997 <entry><type>xid</type></entry>
2000 All transaction IDs before this one have been replaced with a permanent
2001 (<quote>frozen</>) transaction ID in this table. This is used to track
2002 whether the table needs to be vacuumed in order to prevent transaction
2003 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
2004 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2009 <entry><structfield>relminmxid</structfield></entry>
2010 <entry><type>xid</type></entry>
2013 All multixact IDs before this one have been replaced by a
2014 transaction ID in this table. This is used to track
2015 whether the table needs to be vacuumed in order to prevent multixact ID
2016 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
2017 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
2022 <entry><structfield>relacl</structfield></entry>
2023 <entry><type>aclitem[]</type></entry>
2026 Access privileges; see
2027 <xref linkend="sql-grant"> and
2028 <xref linkend="sql-revoke">
2034 <entry><structfield>reloptions</structfield></entry>
2035 <entry><type>text[]</type></entry>
2038 Access-method-specific options, as <quote>keyword=value</> strings
2046 Several of the Boolean flags in <structname>pg_class</> are maintained
2047 lazily: they are guaranteed to be true if that's the correct state, but
2048 may not be reset to false immediately when the condition is no longer
2049 true. For example, <structfield>relhasindex</> is set by
2050 <command>CREATE INDEX</command>, but it is never cleared by
2051 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
2052 <structfield>relhasindex</> if it finds the table has no indexes. This
2053 arrangement avoids race conditions and improves concurrency.
2057 <sect1 id="catalog-pg-collation">
2058 <title><structname>pg_collation</structname></title>
2060 <indexterm zone="catalog-pg-collation">
2061 <primary>pg_collation</primary>
2065 The catalog <structname>pg_collation</structname> describes the
2066 available collations, which are essentially mappings from an SQL
2067 name to operating system locale categories.
2068 See <xref linkend="collation"> for more information.
2072 <title><structname>pg_collation</> Columns</title>
2079 <entry>References</entry>
2080 <entry>Description</entry>
2086 <entry><structfield>oid</structfield></entry>
2087 <entry><type>oid</type></entry>
2089 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2093 <entry><structfield>collname</structfield></entry>
2094 <entry><type>name</type></entry>
2096 <entry>Collation name (unique per namespace and encoding)</entry>
2100 <entry><structfield>collnamespace</structfield></entry>
2101 <entry><type>oid</type></entry>
2102 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2104 The OID of the namespace that contains this collation
2109 <entry><structfield>collowner</structfield></entry>
2110 <entry><type>oid</type></entry>
2111 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2112 <entry>Owner of the collation</entry>
2116 <entry><structfield>collencoding</structfield></entry>
2117 <entry><type>int4</type></entry>
2119 <entry>Encoding in which the collation is applicable, or -1 if it
2120 works for any encoding</entry>
2124 <entry><structfield>collcollate</structfield></entry>
2125 <entry><type>name</type></entry>
2127 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2131 <entry><structfield>collctype</structfield></entry>
2132 <entry><type>name</type></entry>
2134 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2141 Note that the unique key on this catalog is (<structfield>collname</>,
2142 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2143 (<structfield>collname</>, <structfield>collnamespace</>).
2144 <productname>PostgreSQL</productname> generally ignores all
2145 collations that do not have <structfield>collencoding</> equal to
2146 either the current database's encoding or -1, and creation of new entries
2147 with the same name as an entry with <structfield>collencoding</> = -1
2148 is forbidden. Therefore it is sufficient to use a qualified SQL name
2149 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2150 even though this is not unique according to the catalog definition.
2151 The reason for defining the catalog this way is that
2152 <application>initdb</> fills it in at cluster initialization time with
2153 entries for all locales available on the system, so it must be able to
2154 hold entries for all encodings that might ever be used in the cluster.
2158 In the <literal>template0</> database, it could be useful to create
2159 collations whose encoding does not match the database encoding,
2160 since they could match the encodings of databases later cloned from
2161 <literal>template0</>. This would currently have to be done manually.
2165 <sect1 id="catalog-pg-constraint">
2166 <title><structname>pg_constraint</structname></title>
2168 <indexterm zone="catalog-pg-constraint">
2169 <primary>pg_constraint</primary>
2173 The catalog <structname>pg_constraint</structname> stores check, primary
2174 key, unique, foreign key, and exclusion constraints on tables.
2175 (Column constraints are not treated specially. Every column constraint is
2176 equivalent to some table constraint.)
2177 Not-null constraints are represented in the <structname>pg_attribute</>
2182 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2183 TRIGGER</>) also give rise to an entry in this table.
2187 Check constraints on domains are stored here, too.
2191 <title><structname>pg_constraint</> Columns</title>
2198 <entry>References</entry>
2199 <entry>Description</entry>
2205 <entry><structfield>oid</structfield></entry>
2206 <entry><type>oid</type></entry>
2208 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2212 <entry><structfield>conname</structfield></entry>
2213 <entry><type>name</type></entry>
2215 <entry>Constraint name (not necessarily unique!)</entry>
2219 <entry><structfield>connamespace</structfield></entry>
2220 <entry><type>oid</type></entry>
2221 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2223 The OID of the namespace that contains this constraint
2228 <entry><structfield>contype</structfield></entry>
2229 <entry><type>char</type></entry>
2232 <literal>c</> = check constraint,
2233 <literal>f</> = foreign key constraint,
2234 <literal>p</> = primary key constraint,
2235 <literal>u</> = unique constraint,
2236 <literal>t</> = constraint trigger,
2237 <literal>x</> = exclusion constraint
2242 <entry><structfield>condeferrable</structfield></entry>
2243 <entry><type>bool</type></entry>
2245 <entry>Is the constraint deferrable?</entry>
2249 <entry><structfield>condeferred</structfield></entry>
2250 <entry><type>bool</type></entry>
2252 <entry>Is the constraint deferred by default?</entry>
2256 <entry><structfield>convalidated</structfield></entry>
2257 <entry><type>bool</type></entry>
2259 <entry>Has the constraint been validated?
2260 Currently, can only be false for foreign keys and CHECK constraints</entry>
2264 <entry><structfield>conrelid</structfield></entry>
2265 <entry><type>oid</type></entry>
2266 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2267 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2271 <entry><structfield>contypid</structfield></entry>
2272 <entry><type>oid</type></entry>
2273 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2274 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2278 <entry><structfield>conindid</structfield></entry>
2279 <entry><type>oid</type></entry>
2280 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2281 <entry>The index supporting this constraint, if it's a unique, primary
2282 key, foreign key, or exclusion constraint; else 0</entry>
2286 <entry><structfield>confrelid</structfield></entry>
2287 <entry><type>oid</type></entry>
2288 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2289 <entry>If a foreign key, the referenced table; else 0</entry>
2293 <entry><structfield>confupdtype</structfield></entry>
2294 <entry><type>char</type></entry>
2296 <entry>Foreign key update action code:
2297 <literal>a</> = no action,
2298 <literal>r</> = restrict,
2299 <literal>c</> = cascade,
2300 <literal>n</> = set null,
2301 <literal>d</> = set default
2306 <entry><structfield>confdeltype</structfield></entry>
2307 <entry><type>char</type></entry>
2309 <entry>Foreign key deletion action code:
2310 <literal>a</> = no action,
2311 <literal>r</> = restrict,
2312 <literal>c</> = cascade,
2313 <literal>n</> = set null,
2314 <literal>d</> = set default
2319 <entry><structfield>confmatchtype</structfield></entry>
2320 <entry><type>char</type></entry>
2322 <entry>Foreign key match type:
2323 <literal>f</> = full,
2324 <literal>p</> = partial,
2325 <literal>s</> = simple
2330 <entry><structfield>conislocal</structfield></entry>
2331 <entry><type>bool</type></entry>
2334 This constraint is defined locally for the relation. Note that a
2335 constraint can be locally defined and inherited simultaneously.
2340 <entry><structfield>coninhcount</structfield></entry>
2341 <entry><type>int4</type></entry>
2344 The number of direct inheritance ancestors this constraint has.
2346 a nonzero number of ancestors cannot be dropped nor renamed.
2351 <entry><structfield>connoinherit</structfield></entry>
2352 <entry><type>bool</type></entry>
2355 This constraint is defined locally for the relation. It is a
2356 non-inheritable constraint.
2361 <entry><structfield>conkey</structfield></entry>
2362 <entry><type>int2[]</type></entry>
2363 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2364 <entry>If a table constraint (including foreign keys, but not constraint
2365 triggers), list of the constrained columns</entry>
2369 <entry><structfield>confkey</structfield></entry>
2370 <entry><type>int2[]</type></entry>
2371 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2372 <entry>If a foreign key, list of the referenced columns</entry>
2376 <entry><structfield>conpfeqop</structfield></entry>
2377 <entry><type>oid[]</type></entry>
2378 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2379 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2383 <entry><structfield>conppeqop</structfield></entry>
2384 <entry><type>oid[]</type></entry>
2385 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2386 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2390 <entry><structfield>conffeqop</structfield></entry>
2391 <entry><type>oid[]</type></entry>
2392 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2393 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2397 <entry><structfield>conexclop</structfield></entry>
2398 <entry><type>oid[]</type></entry>
2399 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2400 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2404 <entry><structfield>conbin</structfield></entry>
2405 <entry><type>pg_node_tree</type></entry>
2407 <entry>If a check constraint, an internal representation of the expression</entry>
2411 <entry><structfield>consrc</structfield></entry>
2412 <entry><type>text</type></entry>
2414 <entry>If a check constraint, a human-readable representation of the expression</entry>
2421 In the case of an exclusion constraint, <structfield>conkey</structfield>
2422 is only useful for constraint elements that are simple column references.
2423 For other cases, a zero appears in <structfield>conkey</structfield>
2424 and the associated index must be consulted to discover the expression
2425 that is constrained. (<structfield>conkey</structfield> thus has the
2426 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2432 <structfield>consrc</structfield> is not updated when referenced objects
2433 change; for example, it won't track renaming of columns. Rather than
2434 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2435 to extract the definition of a check constraint.
2441 <literal>pg_class.relchecks</literal> needs to agree with the
2442 number of check-constraint entries found in this table for each
2449 <sect1 id="catalog-pg-conversion">
2450 <title><structname>pg_conversion</structname></title>
2452 <indexterm zone="catalog-pg-conversion">
2453 <primary>pg_conversion</primary>
2457 The catalog <structname>pg_conversion</structname> describes
2458 encoding conversion procedures. See <xref linkend="sql-createconversion">
2459 for more information.
2463 <title><structname>pg_conversion</> Columns</title>
2470 <entry>References</entry>
2471 <entry>Description</entry>
2477 <entry><structfield>oid</structfield></entry>
2478 <entry><type>oid</type></entry>
2480 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2484 <entry><structfield>conname</structfield></entry>
2485 <entry><type>name</type></entry>
2487 <entry>Conversion name (unique within a namespace)</entry>
2491 <entry><structfield>connamespace</structfield></entry>
2492 <entry><type>oid</type></entry>
2493 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2495 The OID of the namespace that contains this conversion
2500 <entry><structfield>conowner</structfield></entry>
2501 <entry><type>oid</type></entry>
2502 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2503 <entry>Owner of the conversion</entry>
2507 <entry><structfield>conforencoding</structfield></entry>
2508 <entry><type>int4</type></entry>
2510 <entry>Source encoding ID</entry>
2514 <entry><structfield>contoencoding</structfield></entry>
2515 <entry><type>int4</type></entry>
2517 <entry>Destination encoding ID</entry>
2521 <entry><structfield>conproc</structfield></entry>
2522 <entry><type>regproc</type></entry>
2523 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2524 <entry>Conversion procedure</entry>
2528 <entry><structfield>condefault</structfield></entry>
2529 <entry><type>bool</type></entry>
2531 <entry>True if this is the default conversion</entry>
2540 <sect1 id="catalog-pg-database">
2541 <title><structname>pg_database</structname></title>
2543 <indexterm zone="catalog-pg-database">
2544 <primary>pg_database</primary>
2548 The catalog <structname>pg_database</structname> stores information about
2549 the available databases. Databases are created with the <xref
2550 linkend="sql-createdatabase"> command.
2551 Consult <xref linkend="managing-databases"> for details about the meaning
2552 of some of the parameters.
2556 Unlike most system catalogs, <structname>pg_database</structname>
2557 is shared across all databases of a cluster: there is only one
2558 copy of <structname>pg_database</structname> per cluster, not
2563 <title><structname>pg_database</> Columns</title>
2570 <entry>References</entry>
2571 <entry>Description</entry>
2577 <entry><structfield>oid</structfield></entry>
2578 <entry><type>oid</type></entry>
2580 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2584 <entry><structfield>datname</structfield></entry>
2585 <entry><type>name</type></entry>
2587 <entry>Database name</entry>
2591 <entry><structfield>datdba</structfield></entry>
2592 <entry><type>oid</type></entry>
2593 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2594 <entry>Owner of the database, usually the user who created it</entry>
2598 <entry><structfield>encoding</structfield></entry>
2599 <entry><type>int4</type></entry>
2601 <entry>Character encoding for this database
2602 (<function>pg_encoding_to_char()</function> can translate
2603 this number to the encoding name)</entry>
2607 <entry><structfield>datcollate</structfield></entry>
2608 <entry><type>name</type></entry>
2610 <entry>LC_COLLATE for this database</entry>
2614 <entry><structfield>datctype</structfield></entry>
2615 <entry><type>name</type></entry>
2617 <entry>LC_CTYPE for this database</entry>
2621 <entry><structfield>datistemplate</structfield></entry>
2622 <entry><type>bool</type></entry>
2625 If true, then this database can be cloned by
2626 any user with <literal>CREATEDB</> privileges;
2627 if false, then only superusers or the owner of
2628 the database can clone it.
2633 <entry><structfield>datallowconn</structfield></entry>
2634 <entry><type>bool</type></entry>
2637 If false then no one can connect to this database. This is
2638 used to protect the <literal>template0</> database from being altered.
2643 <entry><structfield>datconnlimit</structfield></entry>
2644 <entry><type>int4</type></entry>
2647 Sets maximum number of concurrent connections that can be made
2648 to this database. -1 means no limit.
2653 <entry><structfield>datlastsysoid</structfield></entry>
2654 <entry><type>oid</type></entry>
2657 Last system OID in the database; useful
2658 particularly to <application>pg_dump</application>
2663 <entry><structfield>datfrozenxid</structfield></entry>
2664 <entry><type>xid</type></entry>
2667 All transaction IDs before this one have been replaced with a permanent
2668 (<quote>frozen</>) transaction ID in this database. This is used to
2669 track whether the database needs to be vacuumed in order to prevent
2670 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2671 It is the minimum of the per-table
2672 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2677 <entry><structfield>datminmxid</structfield></entry>
2678 <entry><type>xid</type></entry>
2681 All multixact IDs before this one have been replaced with a
2682 transaction ID in this database. This is used to
2683 track whether the database needs to be vacuumed in order to prevent
2684 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2685 It is the minimum of the per-table
2686 <structname>pg_class</>.<structfield>relminmxid</> values.
2691 <entry><structfield>dattablespace</structfield></entry>
2692 <entry><type>oid</type></entry>
2693 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2695 The default tablespace for the database.
2696 Within this database, all tables for which
2697 <structname>pg_class</>.<structfield>reltablespace</> is zero
2698 will be stored in this tablespace; in particular, all the non-shared
2699 system catalogs will be there.
2704 <entry><structfield>datacl</structfield></entry>
2705 <entry><type>aclitem[]</type></entry>
2708 Access privileges; see
2709 <xref linkend="sql-grant"> and
2710 <xref linkend="sql-revoke">
2720 <sect1 id="catalog-pg-db-role-setting">
2721 <title><structname>pg_db_role_setting</structname></title>
2723 <indexterm zone="catalog-pg-db-role-setting">
2724 <primary>pg_db_role_setting</primary>
2728 The catalog <structname>pg_db_role_setting</structname> records the default
2729 values that have been set for run-time configuration variables,
2730 for each role and database combination.
2734 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2735 is shared across all databases of a cluster: there is only one
2736 copy of <structname>pg_db_role_setting</structname> per cluster, not
2741 <title><structname>pg_db_role_setting</> Columns</title>
2748 <entry>References</entry>
2749 <entry>Description</entry>
2755 <entry><structfield>setdatabase</structfield></entry>
2756 <entry><type>oid</type></entry>
2757 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2758 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2762 <entry><structfield>setrole</structfield></entry>
2763 <entry><type>oid</type></entry>
2764 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2765 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2769 <entry><structfield>setconfig</structfield></entry>
2770 <entry><type>text[]</type></entry>
2772 <entry>Defaults for run-time configuration variables</entry>
2780 <sect1 id="catalog-pg-default-acl">
2781 <title><structname>pg_default_acl</structname></title>
2783 <indexterm zone="catalog-pg-default-acl">
2784 <primary>pg_default_acl</primary>
2788 The catalog <structname>pg_default_acl</> stores initial
2789 privileges to be assigned to newly created objects.
2793 <title><structname>pg_default_acl</> Columns</title>
2800 <entry>References</entry>
2801 <entry>Description</entry>
2807 <entry><structfield>oid</structfield></entry>
2808 <entry><type>oid</type></entry>
2810 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2814 <entry><structfield>defaclrole</structfield></entry>
2815 <entry><type>oid</type></entry>
2816 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2817 <entry>The OID of the role associated with this entry</entry>
2821 <entry><structfield>defaclnamespace</structfield></entry>
2822 <entry><type>oid</type></entry>
2823 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2824 <entry>The OID of the namespace associated with this entry,
2825 or 0 if none</entry>
2829 <entry><structfield>defaclobjtype</structfield></entry>
2830 <entry><type>char</type></entry>
2833 Type of object this entry is for:
2834 <literal>r</> = relation (table, view),
2835 <literal>S</> = sequence,
2836 <literal>f</> = function,
2837 <literal>T</> = type
2842 <entry><structfield>defaclacl</structfield></entry>
2843 <entry><type>aclitem[]</type></entry>
2846 Access privileges that this type of object should have on creation
2854 A <structname>pg_default_acl</> entry shows the initial privileges to
2855 be assigned to an object belonging to the indicated user. There are
2856 currently two types of entry: <quote>global</> entries with
2857 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2858 that reference a particular schema. If a global entry is present then
2859 it <emphasis>overrides</> the normal hard-wired default privileges
2860 for the object type. A per-schema entry, if present, represents privileges
2861 to be <emphasis>added to</> the global or hard-wired default privileges.
2865 Note that when an ACL entry in another catalog is null, it is taken
2866 to represent the hard-wired default privileges for its object,
2867 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2868 at the moment. <structname>pg_default_acl</> is only consulted during
2875 <sect1 id="catalog-pg-depend">
2876 <title><structname>pg_depend</structname></title>
2878 <indexterm zone="catalog-pg-depend">
2879 <primary>pg_depend</primary>
2883 The catalog <structname>pg_depend</structname> records the dependency
2884 relationships between database objects. This information allows
2885 <command>DROP</> commands to find which other objects must be dropped
2886 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2891 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2892 which performs a similar function for dependencies involving objects
2893 that are shared across a database cluster.
2897 <title><structname>pg_depend</> Columns</title>
2904 <entry>References</entry>
2905 <entry>Description</entry>
2911 <entry><structfield>classid</structfield></entry>
2912 <entry><type>oid</type></entry>
2913 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2914 <entry>The OID of the system catalog the dependent object is in</entry>
2918 <entry><structfield>objid</structfield></entry>
2919 <entry><type>oid</type></entry>
2920 <entry>any OID column</entry>
2921 <entry>The OID of the specific dependent object</entry>
2925 <entry><structfield>objsubid</structfield></entry>
2926 <entry><type>int4</type></entry>
2929 For a table column, this is the column number (the
2930 <structfield>objid</> and <structfield>classid</> refer to the
2931 table itself). For all other object types, this column is
2937 <entry><structfield>refclassid</structfield></entry>
2938 <entry><type>oid</type></entry>
2939 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2940 <entry>The OID of the system catalog the referenced object is in</entry>
2944 <entry><structfield>refobjid</structfield></entry>
2945 <entry><type>oid</type></entry>
2946 <entry>any OID column</entry>
2947 <entry>The OID of the specific referenced object</entry>
2951 <entry><structfield>refobjsubid</structfield></entry>
2952 <entry><type>int4</type></entry>
2955 For a table column, this is the column number (the
2956 <structfield>refobjid</> and <structfield>refclassid</> refer
2957 to the table itself). For all other object types, this column
2963 <entry><structfield>deptype</structfield></entry>
2964 <entry><type>char</type></entry>
2967 A code defining the specific semantics of this dependency relationship; see text
2976 In all cases, a <structname>pg_depend</structname> entry indicates that the
2977 referenced object cannot be dropped without also dropping the dependent
2978 object. However, there are several subflavors identified by
2979 <structfield>deptype</>:
2983 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2986 A normal relationship between separately-created objects. The
2987 dependent object can be dropped without affecting the
2988 referenced object. The referenced object can only be dropped
2989 by specifying <literal>CASCADE</>, in which case the dependent
2990 object is dropped, too. Example: a table column has a normal
2991 dependency on its data type.
2997 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
3000 The dependent object can be dropped separately from the
3001 referenced object, and should be automatically dropped
3002 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
3003 mode) if the referenced object is dropped. Example: a named
3004 constraint on a table is made autodependent on the table, so
3005 that it will go away if the table is dropped.
3011 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
3014 The dependent object was created as part of creation of the
3015 referenced object, and is really just a part of its internal
3016 implementation. A <command>DROP</> of the dependent object
3017 will be disallowed outright (we'll tell the user to issue a
3018 <command>DROP</> against the referenced object, instead). A
3019 <command>DROP</> of the referenced object will be propagated
3020 through to drop the dependent object whether
3021 <command>CASCADE</> is specified or not. Example: a trigger
3022 that's created to enforce a foreign-key constraint is made
3023 internally dependent on the constraint's
3024 <structname>pg_constraint</> entry.
3030 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
3033 The dependent object is a member of the <firstterm>extension</> that is
3034 the referenced object (see
3035 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3036 The dependent object can be dropped only via
3037 <command>DROP EXTENSION</> on the referenced object. Functionally
3038 this dependency type acts the same as an internal dependency, but
3039 it's kept separate for clarity and to simplify <application>pg_dump</>.
3045 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3048 There is no dependent object; this type of entry is a signal
3049 that the system itself depends on the referenced object, and so
3050 that object must never be deleted. Entries of this type are
3051 created only by <command>initdb</command>. The columns for the
3052 dependent object contain zeroes.
3058 Other dependency flavors might be needed in future.
3064 <sect1 id="catalog-pg-description">
3065 <title><structname>pg_description</structname></title>
3067 <indexterm zone="catalog-pg-description">
3068 <primary>pg_description</primary>
3072 The catalog <structname>pg_description</> stores optional descriptions
3073 (comments) for each database object. Descriptions can be manipulated
3074 with the <xref linkend="sql-comment"> command and viewed with
3075 <application>psql</application>'s <literal>\d</literal> commands.
3076 Descriptions of many built-in system objects are provided in the initial
3077 contents of <structname>pg_description</structname>.
3081 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3082 which performs a similar function for descriptions involving objects that
3083 are shared across a database cluster.
3087 <title><structname>pg_description</> Columns</title>
3094 <entry>References</entry>
3095 <entry>Description</entry>
3101 <entry><structfield>objoid</structfield></entry>
3102 <entry><type>oid</type></entry>
3103 <entry>any OID column</entry>
3104 <entry>The OID of the object this description pertains to</entry>
3108 <entry><structfield>classoid</structfield></entry>
3109 <entry><type>oid</type></entry>
3110 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3111 <entry>The OID of the system catalog this object appears in</entry>
3115 <entry><structfield>objsubid</structfield></entry>
3116 <entry><type>int4</type></entry>
3119 For a comment on a table column, this is the column number (the
3120 <structfield>objoid</> and <structfield>classoid</> refer to
3121 the table itself). For all other object types, this column is
3127 <entry><structfield>description</structfield></entry>
3128 <entry><type>text</type></entry>
3130 <entry>Arbitrary text that serves as the description of this object</entry>
3139 <sect1 id="catalog-pg-enum">
3140 <title><structname>pg_enum</structname></title>
3142 <indexterm zone="catalog-pg-enum">
3143 <primary>pg_enum</primary>
3147 The <structname>pg_enum</structname> catalog contains entries
3148 showing the values and labels for each enum type. The
3149 internal representation of a given enum value is actually the OID
3150 of its associated row in <structname>pg_enum</structname>.
3154 <title><structname>pg_enum</> Columns</title>
3161 <entry>References</entry>
3162 <entry>Description</entry>
3168 <entry><structfield>oid</structfield></entry>
3169 <entry><type>oid</type></entry>
3171 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3175 <entry><structfield>enumtypid</structfield></entry>
3176 <entry><type>oid</type></entry>
3177 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3178 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3182 <entry><structfield>enumsortorder</structfield></entry>
3183 <entry><type>float4</type></entry>
3185 <entry>The sort position of this enum value within its enum type</entry>
3189 <entry><structfield>enumlabel</structfield></entry>
3190 <entry><type>name</type></entry>
3192 <entry>The textual label for this enum value</entry>
3199 The OIDs for <structname>pg_enum</structname> rows follow a special
3200 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3201 as the sort ordering of their enum type. That is, if two even OIDs
3202 belong to the same enum type, the smaller OID must have the smaller
3203 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3204 need bear no relationship to the sort order. This rule allows the
3205 enum comparison routines to avoid catalog lookups in many common cases.
3206 The routines that create and alter enum types attempt to assign even
3207 OIDs to enum values whenever possible.
3211 When an enum type is created, its members are assigned sort-order
3212 positions 1..<replaceable>n</>. But members added later might be given
3213 negative or fractional values of <structfield>enumsortorder</structfield>.
3214 The only requirement on these values is that they be correctly
3215 ordered and unique within each enum type.
3220 <sect1 id="catalog-pg-event-trigger">
3221 <title><structname>pg_event_trigger</structname></title>
3223 <indexterm zone="catalog-pg-event-trigger">
3224 <primary>pg_event_trigger</primary>
3228 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3229 See <xref linkend="event-triggers"> for more information.
3233 <title><structname>pg_event_trigger</> Columns</title>
3240 <entry>References</entry>
3241 <entry>Description</entry>
3247 <entry><structfield>evtname</structfield></entry>
3248 <entry><type>name</type></entry>
3250 <entry>Trigger name (must be unique)</entry>
3254 <entry><structfield>evtevent</structfield></entry>
3255 <entry><type>name</type></entry>
3257 <entry>Identifies the event for which this trigger fires</entry>
3261 <entry><structfield>evtowner</structfield></entry>
3262 <entry><type>oid</type></entry>
3263 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3264 <entry>Owner of the event trigger</entry>
3268 <entry><structfield>evtfoid</structfield></entry>
3269 <entry><type>oid</type></entry>
3270 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3271 <entry>The function to be called</entry>
3275 <entry><structfield>evtenabled</structfield></entry>
3276 <entry><type>char</type></entry>
3279 Controls in which <xref linkend="guc-session-replication-role"> modes
3280 the event trigger fires.
3281 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3282 <literal>D</> = trigger is disabled,
3283 <literal>R</> = trigger fires in <quote>replica</> mode,
3284 <literal>A</> = trigger fires always.
3289 <entry><structfield>evttags</structfield></entry>
3290 <entry><type>text[]</type></entry>
3293 Command tags for which this trigger will fire. If NULL, the firing
3294 of this trigger is not restricted on the basis of the command tag.
3303 <sect1 id="catalog-pg-extension">
3304 <title><structname>pg_extension</structname></title>
3306 <indexterm zone="catalog-pg-extension">
3307 <primary>pg_extension</primary>
3311 The catalog <structname>pg_extension</structname> stores information
3312 about the installed extensions. See <xref linkend="extend-extensions">
3313 for details about extensions.
3317 <title><structname>pg_extension</> Columns</title>
3324 <entry>References</entry>
3325 <entry>Description</entry>
3331 <entry><structfield>oid</structfield></entry>
3332 <entry><type>oid</type></entry>
3334 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3338 <entry><structfield>extname</structfield></entry>
3339 <entry><type>name</type></entry>
3341 <entry>Name of the extension</entry>
3345 <entry><structfield>extowner</structfield></entry>
3346 <entry><type>oid</type></entry>
3347 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3348 <entry>Owner of the extension</entry>
3352 <entry><structfield>extnamespace</structfield></entry>
3353 <entry><type>oid</type></entry>
3354 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3355 <entry>Schema containing the extension's exported objects</entry>
3359 <entry><structfield>extrelocatable</structfield></entry>
3360 <entry><type>bool</type></entry>
3362 <entry>True if extension can be relocated to another schema</entry>
3366 <entry><structfield>extversion</structfield></entry>
3367 <entry><type>text</type></entry>
3369 <entry>Version name for the extension</entry>
3373 <entry><structfield>extconfig</structfield></entry>
3374 <entry><type>oid[]</type></entry>
3375 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3376 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3377 table(s), or <literal>NULL</> if none</entry>
3381 <entry><structfield>extcondition</structfield></entry>
3382 <entry><type>text[]</type></entry>
3384 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3385 extension's configuration table(s), or <literal>NULL</> if none</entry>
3393 Note that unlike most catalogs with a <quote>namespace</> column,
3394 <structfield>extnamespace</structfield> is not meant to imply
3395 that the extension belongs to that schema. Extension names are never
3396 schema-qualified. Rather, <structfield>extnamespace</structfield>
3397 indicates the schema that contains most or all of the extension's
3398 objects. If <structfield>extrelocatable</structfield> is true, then
3399 this schema must in fact contain all schema-qualifiable objects
3400 belonging to the extension.
3405 <sect1 id="catalog-pg-foreign-data-wrapper">
3406 <title><structname>pg_foreign_data_wrapper</structname></title>
3408 <indexterm zone="catalog-pg-foreign-data-wrapper">
3409 <primary>pg_foreign_data_wrapper</primary>
3413 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3414 foreign-data wrapper definitions. A foreign-data wrapper is the
3415 mechanism by which external data, residing on foreign servers, is
3420 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3427 <entry>References</entry>
3428 <entry>Description</entry>
3434 <entry><structfield>oid</structfield></entry>
3435 <entry><type>oid</type></entry>
3437 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3441 <entry><structfield>fdwname</structfield></entry>
3442 <entry><type>name</type></entry>
3444 <entry>Name of the foreign-data wrapper</entry>
3448 <entry><structfield>fdwowner</structfield></entry>
3449 <entry><type>oid</type></entry>
3450 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3451 <entry>Owner of the foreign-data wrapper</entry>
3455 <entry><structfield>fdwhandler</structfield></entry>
3456 <entry><type>oid</type></entry>
3457 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3459 References a handler function that is responsible for
3460 supplying execution routines for the foreign-data wrapper.
3461 Zero if no handler is provided
3466 <entry><structfield>fdwvalidator</structfield></entry>
3467 <entry><type>oid</type></entry>
3468 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3470 References a validator function that is responsible for
3471 checking the validity of the options given to the
3472 foreign-data wrapper, as well as options for foreign servers and user
3473 mappings using the foreign-data wrapper. Zero if no validator
3479 <entry><structfield>fdwacl</structfield></entry>
3480 <entry><type>aclitem[]</type></entry>
3483 Access privileges; see
3484 <xref linkend="sql-grant"> and
3485 <xref linkend="sql-revoke">
3491 <entry><structfield>fdwoptions</structfield></entry>
3492 <entry><type>text[]</type></entry>
3495 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3504 <sect1 id="catalog-pg-foreign-server">
3505 <title><structname>pg_foreign_server</structname></title>
3507 <indexterm zone="catalog-pg-foreign-server">
3508 <primary>pg_foreign_server</primary>
3512 The catalog <structname>pg_foreign_server</structname> stores
3513 foreign server definitions. A foreign server describes a source
3514 of external data, such as a remote server. Foreign
3515 servers are accessed via foreign-data wrappers.
3519 <title><structname>pg_foreign_server</> Columns</title>
3526 <entry>References</entry>
3527 <entry>Description</entry>
3533 <entry><structfield>oid</structfield></entry>
3534 <entry><type>oid</type></entry>
3536 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3540 <entry><structfield>srvname</structfield></entry>
3541 <entry><type>name</type></entry>
3543 <entry>Name of the foreign server</entry>
3547 <entry><structfield>srvowner</structfield></entry>
3548 <entry><type>oid</type></entry>
3549 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3550 <entry>Owner of the foreign server</entry>
3554 <entry><structfield>srvfdw</structfield></entry>
3555 <entry><type>oid</type></entry>
3556 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3557 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3561 <entry><structfield>srvtype</structfield></entry>
3562 <entry><type>text</type></entry>
3564 <entry>Type of the server (optional)</entry>
3568 <entry><structfield>srvversion</structfield></entry>
3569 <entry><type>text</type></entry>
3571 <entry>Version of the server (optional)</entry>
3575 <entry><structfield>srvacl</structfield></entry>
3576 <entry><type>aclitem[]</type></entry>
3579 Access privileges; see
3580 <xref linkend="sql-grant"> and
3581 <xref linkend="sql-revoke">
3587 <entry><structfield>srvoptions</structfield></entry>
3588 <entry><type>text[]</type></entry>
3591 Foreign server specific options, as <quote>keyword=value</> strings
3600 <sect1 id="catalog-pg-foreign-table">
3601 <title><structname>pg_foreign_table</structname></title>
3603 <indexterm zone="catalog-pg-foreign-table">
3604 <primary>pg_foreign_table</primary>
3608 The catalog <structname>pg_foreign_table</structname> contains
3609 auxiliary information about foreign tables. A foreign table is
3610 primarily represented by a <structname>pg_class</structname> entry,
3611 just like a regular table. Its <structname>pg_foreign_table</structname>
3612 entry contains the information that is pertinent only to foreign tables
3613 and not any other kind of relation.
3617 <title><structname>pg_foreign_table</> Columns</title>
3624 <entry>References</entry>
3625 <entry>Description</entry>
3631 <entry><structfield>ftrelid</structfield></entry>
3632 <entry><type>oid</type></entry>
3633 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3634 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3638 <entry><structfield>ftserver</structfield></entry>
3639 <entry><type>oid</type></entry>
3640 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3641 <entry>OID of the foreign server for this foreign table</entry>
3645 <entry><structfield>ftoptions</structfield></entry>
3646 <entry><type>text[]</type></entry>
3649 Foreign table options, as <quote>keyword=value</> strings
3658 <sect1 id="catalog-pg-index">
3659 <title><structname>pg_index</structname></title>
3661 <indexterm zone="catalog-pg-index">
3662 <primary>pg_index</primary>
3666 The catalog <structname>pg_index</structname> contains part of the information
3667 about indexes. The rest is mostly in
3668 <structname>pg_class</structname>.
3672 <title><structname>pg_index</> Columns</title>
3679 <entry>References</entry>
3680 <entry>Description</entry>
3686 <entry><structfield>indexrelid</structfield></entry>
3687 <entry><type>oid</type></entry>
3688 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3689 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3693 <entry><structfield>indrelid</structfield></entry>
3694 <entry><type>oid</type></entry>
3695 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3696 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3700 <entry><structfield>indnatts</structfield></entry>
3701 <entry><type>int2</type></entry>
3703 <entry>The number of columns in the index (duplicates
3704 <literal>pg_class.relnatts</literal>)</entry>
3708 <entry><structfield>indisunique</structfield></entry>
3709 <entry><type>bool</type></entry>
3711 <entry>If true, this is a unique index</entry>
3715 <entry><structfield>indisprimary</structfield></entry>
3716 <entry><type>bool</type></entry>
3718 <entry>If true, this index represents the primary key of the table
3719 (<structfield>indisunique</> should always be true when this is true)</entry>
3723 <entry><structfield>indisexclusion</structfield></entry>
3724 <entry><type>bool</type></entry>
3726 <entry>If true, this index supports an exclusion constraint</entry>
3730 <entry><structfield>indimmediate</structfield></entry>
3731 <entry><type>bool</type></entry>
3733 <entry>If true, the uniqueness check is enforced immediately on
3735 (irrelevant if <structfield>indisunique</> is not true)</entry>
3739 <entry><structfield>indisclustered</structfield></entry>
3740 <entry><type>bool</type></entry>
3742 <entry>If true, the table was last clustered on this index</entry>
3746 <entry><structfield>indisvalid</structfield></entry>
3747 <entry><type>bool</type></entry>
3750 If true, the index is currently valid for queries. False means the
3751 index is possibly incomplete: it must still be modified by
3752 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3753 be used for queries. If it is unique, the uniqueness property is not
3754 guaranteed true either.
3759 <entry><structfield>indcheckxmin</structfield></entry>
3760 <entry><type>bool</type></entry>
3763 If true, queries must not use the index until the <structfield>xmin</>
3764 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3765 event horizon, because the table may contain broken HOT chains with
3766 incompatible rows that they can see
3771 <entry><structfield>indisready</structfield></entry>
3772 <entry><type>bool</type></entry>
3775 If true, the index is currently ready for inserts. False means the
3776 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3782 <entry><structfield>indislive</structfield></entry>
3783 <entry><type>bool</type></entry>
3786 If false, the index is in process of being dropped, and should be
3787 ignored for all purposes (including HOT-safety decisions)
3792 <entry><structfield>indisreplident</structfield></entry>
3793 <entry><type>bool</type></entry>
3796 If true this index has been chosen as <quote>replica identity</>
3797 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3803 <entry><structfield>indkey</structfield></entry>
3804 <entry><type>int2vector</type></entry>
3805 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3807 This is an array of <structfield>indnatts</structfield> values that
3808 indicate which table columns this index indexes. For example a value
3809 of <literal>1 3</literal> would mean that the first and the third table
3810 columns make up the index key. A zero in this array indicates that the
3811 corresponding index attribute is an expression over the table columns,
3812 rather than a simple column reference.
3817 <entry><structfield>indcollation</structfield></entry>
3818 <entry><type>oidvector</type></entry>
3819 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3821 For each column in the index key, this contains the OID of the
3822 collation to use for the index.
3827 <entry><structfield>indclass</structfield></entry>
3828 <entry><type>oidvector</type></entry>
3829 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3831 For each column in the index key, this contains the OID of
3832 the operator class to use. See
3833 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3838 <entry><structfield>indoption</structfield></entry>
3839 <entry><type>int2vector</type></entry>
3842 This is an array of <structfield>indnatts</structfield> values that
3843 store per-column flag bits. The meaning of the bits is defined by
3844 the index's access method.
3849 <entry><structfield>indexprs</structfield></entry>
3850 <entry><type>pg_node_tree</type></entry>
3853 Expression trees (in <function>nodeToString()</function>
3854 representation) for index attributes that are not simple column
3855 references. This is a list with one element for each zero
3856 entry in <structfield>indkey</>. Null if all index attributes
3857 are simple references.
3862 <entry><structfield>indpred</structfield></entry>
3863 <entry><type>pg_node_tree</type></entry>
3866 Expression tree (in <function>nodeToString()</function>
3867 representation) for partial index predicate. Null if not a
3878 <sect1 id="catalog-pg-inherits">
3879 <title><structname>pg_inherits</structname></title>
3881 <indexterm zone="catalog-pg-inherits">
3882 <primary>pg_inherits</primary>
3886 The catalog <structname>pg_inherits</> records information about
3887 table inheritance hierarchies. There is one entry for each direct
3888 child table in the database. (Indirect inheritance can be determined
3889 by following chains of entries.)
3893 <title><structname>pg_inherits</> Columns</title>
3900 <entry>References</entry>
3901 <entry>Description</entry>
3907 <entry><structfield>inhrelid</structfield></entry>
3908 <entry><type>oid</type></entry>
3909 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3911 The OID of the child table
3916 <entry><structfield>inhparent</structfield></entry>
3917 <entry><type>oid</type></entry>
3918 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3920 The OID of the parent table
3925 <entry><structfield>inhseqno</structfield></entry>
3926 <entry><type>int4</type></entry>
3929 If there is more than one direct parent for a child table (multiple
3930 inheritance), this number tells the order in which the
3931 inherited columns are to be arranged. The count starts at 1.
3941 <sect1 id="catalog-pg-language">
3942 <title><structname>pg_language</structname></title>
3944 <indexterm zone="catalog-pg-language">
3945 <primary>pg_language</primary>
3949 The catalog <structname>pg_language</structname> registers
3950 languages in which you can write functions or stored procedures.
3951 See <xref linkend="sql-createlanguage">
3952 and <xref linkend="xplang"> for more information about language handlers.
3956 <title><structname>pg_language</> Columns</title>
3963 <entry>References</entry>
3964 <entry>Description</entry>
3970 <entry><structfield>oid</structfield></entry>
3971 <entry><type>oid</type></entry>
3973 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3977 <entry><structfield>lanname</structfield></entry>
3978 <entry><type>name</type></entry>
3980 <entry>Name of the language</entry>
3984 <entry><structfield>lanowner</structfield></entry>
3985 <entry><type>oid</type></entry>
3986 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3987 <entry>Owner of the language</entry>
3991 <entry><structfield>lanispl</structfield></entry>
3992 <entry><type>bool</type></entry>
3995 This is false for internal languages (such as
3996 <acronym>SQL</acronym>) and true for user-defined languages.
3997 Currently, <application>pg_dump</application> still uses this
3998 to determine which languages need to be dumped, but this might be
3999 replaced by a different mechanism in the future.
4004 <entry><structfield>lanpltrusted</structfield></entry>
4005 <entry><type>bool</type></entry>
4008 True if this is a trusted language, which means that it is believed
4009 not to grant access to anything outside the normal SQL execution
4010 environment. Only superusers can create functions in untrusted
4016 <entry><structfield>lanplcallfoid</structfield></entry>
4017 <entry><type>oid</type></entry>
4018 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4020 For noninternal languages this references the language
4021 handler, which is a special function that is responsible for
4022 executing all functions that are written in the particular
4028 <entry><structfield>laninline</structfield></entry>
4029 <entry><type>oid</type></entry>
4030 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4032 This references a function that is responsible for executing
4033 <quote>inline</> anonymous code blocks
4034 (<xref linkend="sql-do"> blocks).
4035 Zero if inline blocks are not supported.
4040 <entry><structfield>lanvalidator</structfield></entry>
4041 <entry><type>oid</type></entry>
4042 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4044 This references a language validator function that is responsible
4045 for checking the syntax and validity of new functions when they
4046 are created. Zero if no validator is provided.
4051 <entry><structfield>lanacl</structfield></entry>
4052 <entry><type>aclitem[]</type></entry>
4055 Access privileges; see
4056 <xref linkend="sql-grant"> and
4057 <xref linkend="sql-revoke">
4068 <sect1 id="catalog-pg-largeobject">
4069 <title><structname>pg_largeobject</structname></title>
4071 <indexterm zone="catalog-pg-largeobject">
4072 <primary>pg_largeobject</primary>
4076 The catalog <structname>pg_largeobject</structname> holds the data making up
4077 <quote>large objects</quote>. A large object is identified by an OID
4078 assigned when it is created. Each large object is broken into
4079 segments or <quote>pages</> small enough to be conveniently stored as rows
4080 in <structname>pg_largeobject</structname>.
4081 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4082 <literal>BLCKSZ/4</>, or typically 2 kB).
4086 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4087 associated with large objects. As a result,
4088 <structname>pg_largeobject</structname> was publicly readable and could be
4089 used to obtain the OIDs (and contents) of all large objects in the system.
4090 This is no longer the case; use
4091 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4092 to obtain a list of large object OIDs.
4096 <title><structname>pg_largeobject</> Columns</title>
4103 <entry>References</entry>
4104 <entry>Description</entry>
4110 <entry><structfield>loid</structfield></entry>
4111 <entry><type>oid</type></entry>
4112 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4113 <entry>Identifier of the large object that includes this page</entry>
4117 <entry><structfield>pageno</structfield></entry>
4118 <entry><type>int4</type></entry>
4120 <entry>Page number of this page within its large object
4121 (counting from zero)</entry>
4125 <entry><structfield>data</structfield></entry>
4126 <entry><type>bytea</type></entry>
4129 Actual data stored in the large object.
4130 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4138 Each row of <structname>pg_largeobject</structname> holds data
4139 for one page of a large object, beginning at
4140 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4141 allows sparse storage: pages might be missing, and might be shorter than
4142 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4143 Missing regions within a large object read as zeroes.
4148 <sect1 id="catalog-pg-largeobject-metadata">
4149 <title><structname>pg_largeobject_metadata</structname></title>
4151 <indexterm zone="catalog-pg-largeobject-metadata">
4152 <primary>pg_largeobject_metadata</primary>
4156 The catalog <structname>pg_largeobject_metadata</structname>
4157 holds metadata associated with large objects. The actual large object
4159 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4163 <title><structname>pg_largeobject_metadata</> Columns</title>
4170 <entry>References</entry>
4171 <entry>Description</entry>
4177 <entry><structfield>oid</structfield></entry>
4178 <entry><type>oid</type></entry>
4180 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4184 <entry><structfield>lomowner</structfield></entry>
4185 <entry><type>oid</type></entry>
4186 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4187 <entry>Owner of the large object</entry>
4191 <entry><structfield>lomacl</structfield></entry>
4192 <entry><type>aclitem[]</type></entry>
4195 Access privileges; see
4196 <xref linkend="sql-grant"> and
4197 <xref linkend="sql-revoke">
4207 <sect1 id="catalog-pg-namespace">
4208 <title><structname>pg_namespace</structname></title>
4210 <indexterm zone="catalog-pg-namespace">
4211 <primary>pg_namespace</primary>
4215 The catalog <structname>pg_namespace</> stores namespaces.
4216 A namespace is the structure underlying SQL schemas: each namespace
4217 can have a separate collection of relations, types, etc. without name
4222 <title><structname>pg_namespace</> Columns</title>
4229 <entry>References</entry>
4230 <entry>Description</entry>
4236 <entry><structfield>oid</structfield></entry>
4237 <entry><type>oid</type></entry>
4239 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4243 <entry><structfield>nspname</structfield></entry>
4244 <entry><type>name</type></entry>
4246 <entry>Name of the namespace</entry>
4250 <entry><structfield>nspowner</structfield></entry>
4251 <entry><type>oid</type></entry>
4252 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4253 <entry>Owner of the namespace</entry>
4257 <entry><structfield>nspacl</structfield></entry>
4258 <entry><type>aclitem[]</type></entry>
4261 Access privileges; see
4262 <xref linkend="sql-grant"> and
4263 <xref linkend="sql-revoke">
4274 <sect1 id="catalog-pg-opclass">
4275 <title><structname>pg_opclass</structname></title>
4277 <indexterm zone="catalog-pg-opclass">
4278 <primary>pg_opclass</primary>
4282 The catalog <structname>pg_opclass</structname> defines
4283 index access method operator classes. Each operator class defines
4284 semantics for index columns of a particular data type and a particular
4285 index access method. An operator class essentially specifies that a
4286 particular operator family is applicable to a particular indexable column
4287 data type. The set of operators from the family that are actually usable
4288 with the indexed column are whichever ones accept the column's data type
4289 as their left-hand input.
4293 Operator classes are described at length in <xref linkend="xindex">.
4297 <title><structname>pg_opclass</> Columns</title>
4304 <entry>References</entry>
4305 <entry>Description</entry>
4311 <entry><structfield>oid</structfield></entry>
4312 <entry><type>oid</type></entry>
4314 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4318 <entry><structfield>opcmethod</structfield></entry>
4319 <entry><type>oid</type></entry>
4320 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4321 <entry>Index access method operator class is for</entry>
4325 <entry><structfield>opcname</structfield></entry>
4326 <entry><type>name</type></entry>
4328 <entry>Name of this operator class</entry>
4332 <entry><structfield>opcnamespace</structfield></entry>
4333 <entry><type>oid</type></entry>
4334 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4335 <entry>Namespace of this operator class</entry>
4339 <entry><structfield>opcowner</structfield></entry>
4340 <entry><type>oid</type></entry>
4341 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4342 <entry>Owner of the operator class</entry>
4346 <entry><structfield>opcfamily</structfield></entry>
4347 <entry><type>oid</type></entry>
4348 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4349 <entry>Operator family containing the operator class</entry>
4353 <entry><structfield>opcintype</structfield></entry>
4354 <entry><type>oid</type></entry>
4355 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4356 <entry>Data type that the operator class indexes</entry>
4360 <entry><structfield>opcdefault</structfield></entry>
4361 <entry><type>bool</type></entry>
4363 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4367 <entry><structfield>opckeytype</structfield></entry>
4368 <entry><type>oid</type></entry>
4369 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4370 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4378 An operator class's <structfield>opcmethod</> must match the
4379 <structname>opfmethod</> of its containing operator family.
4380 Also, there must be no more than one <structname>pg_opclass</structname>
4381 row having <structname>opcdefault</> true for any given combination of
4382 <structname>opcmethod</> and <structname>opcintype</>.
4388 <sect1 id="catalog-pg-operator">
4389 <title><structname>pg_operator</structname></title>
4391 <indexterm zone="catalog-pg-operator">
4392 <primary>pg_operator</primary>
4396 The catalog <structname>pg_operator</> stores information about operators.
4397 See <xref linkend="sql-createoperator">
4398 and <xref linkend="xoper"> for more information.
4402 <title><structname>pg_operator</> Columns</title>
4409 <entry>References</entry>
4410 <entry>Description</entry>
4416 <entry><structfield>oid</structfield></entry>
4417 <entry><type>oid</type></entry>
4419 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4423 <entry><structfield>oprname</structfield></entry>
4424 <entry><type>name</type></entry>
4426 <entry>Name of the operator</entry>
4430 <entry><structfield>oprnamespace</structfield></entry>
4431 <entry><type>oid</type></entry>
4432 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4434 The OID of the namespace that contains this operator
4439 <entry><structfield>oprowner</structfield></entry>
4440 <entry><type>oid</type></entry>
4441 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4442 <entry>Owner of the operator</entry>
4446 <entry><structfield>oprkind</structfield></entry>
4447 <entry><type>char</type></entry>
4450 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4451 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4456 <entry><structfield>oprcanmerge</structfield></entry>
4457 <entry><type>bool</type></entry>
4459 <entry>This operator supports merge joins</entry>
4463 <entry><structfield>oprcanhash</structfield></entry>
4464 <entry><type>bool</type></entry>
4466 <entry>This operator supports hash joins</entry>
4470 <entry><structfield>oprleft</structfield></entry>
4471 <entry><type>oid</type></entry>
4472 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4473 <entry>Type of the left operand</entry>
4477 <entry><structfield>oprright</structfield></entry>
4478 <entry><type>oid</type></entry>
4479 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4480 <entry>Type of the right operand</entry>
4484 <entry><structfield>oprresult</structfield></entry>
4485 <entry><type>oid</type></entry>
4486 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4487 <entry>Type of the result</entry>
4491 <entry><structfield>oprcom</structfield></entry>
4492 <entry><type>oid</type></entry>
4493 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4494 <entry>Commutator of this operator, if any</entry>
4498 <entry><structfield>oprnegate</structfield></entry>
4499 <entry><type>oid</type></entry>
4500 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4501 <entry>Negator of this operator, if any</entry>
4505 <entry><structfield>oprcode</structfield></entry>
4506 <entry><type>regproc</type></entry>
4507 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4508 <entry>Function that implements this operator</entry>
4512 <entry><structfield>oprrest</structfield></entry>
4513 <entry><type>regproc</type></entry>
4514 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4515 <entry>Restriction selectivity estimation function for this operator</entry>
4519 <entry><structfield>oprjoin</structfield></entry>
4520 <entry><type>regproc</type></entry>
4521 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4522 <entry>Join selectivity estimation function for this operator</entry>
4529 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4530 is zero for a prefix operator.
4536 <sect1 id="catalog-pg-opfamily">
4537 <title><structname>pg_opfamily</structname></title>
4539 <indexterm zone="catalog-pg-opfamily">
4540 <primary>pg_opfamily</primary>
4544 The catalog <structname>pg_opfamily</structname> defines operator families.
4545 Each operator family is a collection of operators and associated
4546 support routines that implement the semantics specified for a particular
4547 index access method. Furthermore, the operators in a family are all
4548 <quote>compatible</>, in a way that is specified by the access method.
4549 The operator family concept allows cross-data-type operators to be used
4550 with indexes and to be reasoned about using knowledge of access method
4555 Operator families are described at length in <xref linkend="xindex">.
4559 <title><structname>pg_opfamily</> Columns</title>
4566 <entry>References</entry>
4567 <entry>Description</entry>
4573 <entry><structfield>oid</structfield></entry>
4574 <entry><type>oid</type></entry>
4576 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4580 <entry><structfield>opfmethod</structfield></entry>
4581 <entry><type>oid</type></entry>
4582 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4583 <entry>Index access method operator family is for</entry>
4587 <entry><structfield>opfname</structfield></entry>
4588 <entry><type>name</type></entry>
4590 <entry>Name of this operator family</entry>
4594 <entry><structfield>opfnamespace</structfield></entry>
4595 <entry><type>oid</type></entry>
4596 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4597 <entry>Namespace of this operator family</entry>
4601 <entry><structfield>opfowner</structfield></entry>
4602 <entry><type>oid</type></entry>
4603 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4604 <entry>Owner of the operator family</entry>
4612 The majority of the information defining an operator family is not in its
4613 <structname>pg_opfamily</structname> row, but in the associated rows in
4614 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4615 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4617 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4623 <sect1 id="catalog-pg-pltemplate">
4624 <title><structname>pg_pltemplate</structname></title>
4626 <indexterm zone="catalog-pg-pltemplate">
4627 <primary>pg_pltemplate</primary>
4631 The catalog <structname>pg_pltemplate</structname> stores
4632 <quote>template</> information for procedural languages.
4633 A template for a language allows the language to be created in a
4634 particular database by a simple <command>CREATE LANGUAGE</> command,
4635 with no need to specify implementation details.
4639 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4640 is shared across all databases of a cluster: there is only one
4641 copy of <structname>pg_pltemplate</structname> per cluster, not
4642 one per database. This allows the information to be accessible in
4643 each database as it is needed.
4647 <title><structname>pg_pltemplate</> Columns</title>
4654 <entry>Description</entry>
4660 <entry><structfield>tmplname</structfield></entry>
4661 <entry><type>name</type></entry>
4662 <entry>Name of the language this template is for</entry>
4666 <entry><structfield>tmpltrusted</structfield></entry>
4667 <entry><type>boolean</type></entry>
4668 <entry>True if language is considered trusted</entry>
4672 <entry><structfield>tmpldbacreate</structfield></entry>
4673 <entry><type>boolean</type></entry>
4674 <entry>True if language may be created by a database owner</entry>
4678 <entry><structfield>tmplhandler</structfield></entry>
4679 <entry><type>text</type></entry>
4680 <entry>Name of call handler function</entry>
4684 <entry><structfield>tmplinline</structfield></entry>
4685 <entry><type>text</type></entry>
4686 <entry>Name of anonymous-block handler function, or null if none</entry>
4690 <entry><structfield>tmplvalidator</structfield></entry>
4691 <entry><type>text</type></entry>
4692 <entry>Name of validator function, or null if none</entry>
4696 <entry><structfield>tmpllibrary</structfield></entry>
4697 <entry><type>text</type></entry>
4698 <entry>Path of shared library that implements language</entry>
4702 <entry><structfield>tmplacl</structfield></entry>
4703 <entry><type>aclitem[]</type></entry>
4704 <entry>Access privileges for template (not actually used)</entry>
4712 There are not currently any commands that manipulate procedural language
4713 templates; to change the built-in information, a superuser must modify
4714 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4715 or <command>UPDATE</command> commands.
4720 It is likely that <structname>pg_pltemplate</> will be removed in some
4721 future release of <productname>PostgreSQL</productname>, in favor of
4722 keeping this knowledge about procedural languages in their respective
4723 extension installation scripts.
4729 <sect1 id="catalog-pg-policy">
4730 <title><structname>pg_policy</structname></title>
4732 <indexterm zone="catalog-pg-policy">
4733 <primary>pg_policy</primary>
4737 The catalog <structname>pg_policy</structname> stores row level
4738 security policies for tables. A policy includes the kind of
4739 command that it applies to (possibly all commands), the roles that it
4740 applies to, the expression to be added as a security-barrier
4741 qualification to queries that include the table, and the expression
4742 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4743 add new records to the table.
4748 <title><structname>pg_policy</structname> Columns</title>
4755 <entry>References</entry>
4756 <entry>Description</entry>
4762 <entry><structfield>polname</structfield></entry>
4763 <entry><type>name</type></entry>
4765 <entry>The name of the policy</entry>
4769 <entry><structfield>polrelid</structfield></entry>
4770 <entry><type>oid</type></entry>
4771 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4772 <entry>The table to which the policy applies</entry>
4776 <entry><structfield>polcmd</structfield></entry>
4777 <entry><type>char</type></entry>
4779 <entry>The command type to which the policy is applied:
4780 <literal>r</> for <command>SELECT</>,
4781 <literal>a</> for <command>INSERT</>,
4782 <literal>w</> for <command>UPDATE</>,
4783 <literal>d</> for <command>DELETE</>,
4784 or <literal>*</> for all</entry>
4788 <entry><structfield>polroles</structfield></entry>
4789 <entry><type>oid[]</type></entry>
4790 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4791 <entry>The roles to which the policy is applied</entry>
4795 <entry><structfield>polqual</structfield></entry>
4796 <entry><type>pg_node_tree</type></entry>
4798 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4802 <entry><structfield>polwithcheck</structfield></entry>
4803 <entry><type>pg_node_tree</type></entry>
4805 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4814 Policies stored in <structname>pg_policy</> are applied only when
4815 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4822 <sect1 id="catalog-pg-proc">
4823 <title><structname>pg_proc</structname></title>
4825 <indexterm zone="catalog-pg-proc">
4826 <primary>pg_proc</primary>
4830 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4831 See <xref linkend="sql-createfunction">
4832 and <xref linkend="xfunc"> for more information.
4836 The table contains data for aggregate functions as well as plain functions.
4837 If <structfield>proisagg</structfield> is true, there should be a matching
4838 row in <structfield>pg_aggregate</structfield>.
4842 <title><structname>pg_proc</> Columns</title>
4849 <entry>References</entry>
4850 <entry>Description</entry>
4856 <entry><structfield>oid</structfield></entry>
4857 <entry><type>oid</type></entry>
4859 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4863 <entry><structfield>proname</structfield></entry>
4864 <entry><type>name</type></entry>
4866 <entry>Name of the function</entry>
4870 <entry><structfield>pronamespace</structfield></entry>
4871 <entry><type>oid</type></entry>
4872 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4874 The OID of the namespace that contains this function
4879 <entry><structfield>proowner</structfield></entry>
4880 <entry><type>oid</type></entry>
4881 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4882 <entry>Owner of the function</entry>
4886 <entry><structfield>prolang</structfield></entry>
4887 <entry><type>oid</type></entry>
4888 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4889 <entry>Implementation language or call interface of this function</entry>
4893 <entry><structfield>procost</structfield></entry>
4894 <entry><type>float4</type></entry>
4896 <entry>Estimated execution cost (in units of
4897 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4898 this is cost per row returned</entry>
4902 <entry><structfield>prorows</structfield></entry>
4903 <entry><type>float4</type></entry>
4905 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4909 <entry><structfield>provariadic</structfield></entry>
4910 <entry><type>oid</type></entry>
4911 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4912 <entry>Data type of the variadic array parameter's elements,
4913 or zero if the function does not have a variadic parameter</entry>
4917 <entry><structfield>protransform</structfield></entry>
4918 <entry><type>regproc</type></entry>
4919 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4920 <entry>Calls to this function can be simplified by this other function
4921 (see <xref linkend="xfunc-transform-functions">)</entry>
4925 <entry><structfield>proisagg</structfield></entry>
4926 <entry><type>bool</type></entry>
4928 <entry>Function is an aggregate function</entry>
4932 <entry><structfield>proiswindow</structfield></entry>
4933 <entry><type>bool</type></entry>
4935 <entry>Function is a window function</entry>
4939 <entry><structfield>prosecdef</structfield></entry>
4940 <entry><type>bool</type></entry>
4942 <entry>Function is a security definer (i.e., a <quote>setuid</>
4947 <entry><structfield>proleakproof</structfield></entry>
4948 <entry><type>bool</type></entry>
4951 The function has no side effects. No information about the
4952 arguments is conveyed except via the return value. Any function
4953 that might throw an error depending on the values of its arguments
4959 <entry><structfield>proisstrict</structfield></entry>
4960 <entry><type>bool</type></entry>
4963 Function returns null if any call argument is null. In that
4964 case the function won't actually be called at all. Functions
4965 that are not <quote>strict</quote> must be prepared to handle
4971 <entry><structfield>proretset</structfield></entry>
4972 <entry><type>bool</type></entry>
4974 <entry>Function returns a set (i.e., multiple values of the specified
4979 <entry><structfield>provolatile</structfield></entry>
4980 <entry><type>char</type></entry>
4983 <structfield>provolatile</structfield> tells whether the function's
4984 result depends only on its input arguments, or is affected by outside
4986 It is <literal>i</literal> for <quote>immutable</> functions,
4987 which always deliver the same result for the same inputs.
4988 It is <literal>s</literal> for <quote>stable</> functions,
4989 whose results (for fixed inputs) do not change within a scan.
4990 It is <literal>v</literal> for <quote>volatile</> functions,
4991 whose results might change at any time. (Use <literal>v</literal> also
4992 for functions with side-effects, so that calls to them cannot get
4998 <entry><structfield>pronargs</structfield></entry>
4999 <entry><type>int2</type></entry>
5001 <entry>Number of input arguments</entry>
5005 <entry><structfield>pronargdefaults</structfield></entry>
5006 <entry><type>int2</type></entry>
5008 <entry>Number of arguments that have defaults</entry>
5012 <entry><structfield>prorettype</structfield></entry>
5013 <entry><type>oid</type></entry>
5014 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5015 <entry>Data type of the return value</entry>
5019 <entry><structfield>proargtypes</structfield></entry>
5020 <entry><type>oidvector</type></entry>
5021 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5023 An array with the data types of the function arguments. This includes
5024 only input arguments (including <literal>INOUT</literal> and
5025 <literal>VARIADIC</> arguments), and thus represents
5026 the call signature of the function.
5031 <entry><structfield>proallargtypes</structfield></entry>
5032 <entry><type>oid[]</type></entry>
5033 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5035 An array with the data types of the function arguments. This includes
5036 all arguments (including <literal>OUT</literal> and
5037 <literal>INOUT</literal> arguments); however, if all the
5038 arguments are <literal>IN</literal> arguments, this field will be null.
5039 Note that subscripting is 1-based, whereas for historical reasons
5040 <structfield>proargtypes</> is subscripted from 0.
5045 <entry><structfield>proargmodes</structfield></entry>
5046 <entry><type>char[]</type></entry>
5049 An array with the modes of the function arguments, encoded as
5050 <literal>i</literal> for <literal>IN</> arguments,
5051 <literal>o</literal> for <literal>OUT</> arguments,
5052 <literal>b</literal> for <literal>INOUT</> arguments,
5053 <literal>v</literal> for <literal>VARIADIC</> arguments,
5054 <literal>t</literal> for <literal>TABLE</> arguments.
5055 If all the arguments are <literal>IN</literal> arguments,
5056 this field will be null.
5057 Note that subscripts correspond to positions of
5058 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5063 <entry><structfield>proargnames</structfield></entry>
5064 <entry><type>text[]</type></entry>
5067 An array with the names of the function arguments.
5068 Arguments without a name are set to empty strings in the array.
5069 If none of the arguments have a name, this field will be null.
5070 Note that subscripts correspond to positions of
5071 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5076 <entry><structfield>proargdefaults</structfield></entry>
5077 <entry><type>pg_node_tree</type></entry>
5080 Expression trees (in <function>nodeToString()</function> representation)
5081 for default values. This is a list with
5082 <structfield>pronargdefaults</> elements, corresponding to the last
5083 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5084 <replaceable>N</> <structfield>proargtypes</> positions).
5085 If none of the arguments have defaults, this field will be null.
5090 <entry><structfield>protrftypes</structfield></entry>
5091 <entry><type>oid[]</type></entry>
5094 Data type OIDs for which to apply transforms.
5099 <entry><structfield>prosrc</structfield></entry>
5100 <entry><type>text</type></entry>
5103 This tells the function handler how to invoke the function. It
5104 might be the actual source code of the function for interpreted
5105 languages, a link symbol, a file name, or just about anything
5106 else, depending on the implementation language/call convention.
5111 <entry><structfield>probin</structfield></entry>
5112 <entry><type>text</type></entry>
5115 Additional information about how to invoke the function.
5116 Again, the interpretation is language-specific.
5121 <entry><structfield>proconfig</structfield></entry>
5122 <entry><type>text[]</type></entry>
5124 <entry>Function's local settings for run-time configuration variables</entry>
5128 <entry><structfield>proacl</structfield></entry>
5129 <entry><type>aclitem[]</type></entry>
5132 Access privileges; see
5133 <xref linkend="sql-grant"> and
5134 <xref linkend="sql-revoke">
5143 For compiled functions, both built-in and dynamically loaded,
5144 <structfield>prosrc</structfield> contains the function's C-language
5145 name (link symbol). For all other currently-known language types,
5146 <structfield>prosrc</structfield> contains the function's source
5147 text. <structfield>probin</structfield> is unused except for
5148 dynamically-loaded C functions, for which it gives the name of the
5149 shared library file containing the function.
5154 <sect1 id="catalog-pg-range">
5155 <title><structname>pg_range</structname></title>
5157 <indexterm zone="catalog-pg-range">
5158 <primary>pg_range</primary>
5162 The catalog <structname>pg_range</structname> stores information about
5163 range types. This is in addition to the types' entries in
5164 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5168 <title><structname>pg_range</> Columns</title>
5175 <entry>References</entry>
5176 <entry>Description</entry>
5182 <entry><structfield>rngtypid</structfield></entry>
5183 <entry><type>oid</type></entry>
5184 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5185 <entry>OID of the range type</entry>
5189 <entry><structfield>rngsubtype</structfield></entry>
5190 <entry><type>oid</type></entry>
5191 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5192 <entry>OID of the element type (subtype) of this range type</entry>
5196 <entry><structfield>rngcollation</structfield></entry>
5197 <entry><type>oid</type></entry>
5198 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5199 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5203 <entry><structfield>rngsubopc</structfield></entry>
5204 <entry><type>oid</type></entry>
5205 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5206 <entry>OID of the subtype's operator class used for range comparisons</entry>
5210 <entry><structfield>rngcanonical</structfield></entry>
5211 <entry><type>regproc</type></entry>
5212 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5213 <entry>OID of the function to convert a range value into canonical form,
5214 or 0 if none</entry>
5218 <entry><structfield>rngsubdiff</structfield></entry>
5219 <entry><type>regproc</type></entry>
5220 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5221 <entry>OID of the function to return the difference between two element
5222 values as <type>double precision</type>, or 0 if none</entry>
5229 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5230 element type is collatable) determines the sort ordering used by the range
5231 type. <structfield>rngcanonical</> is used when the element type is
5232 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5233 improve performance of GiST indexes on the range type.
5238 <sect1 id="catalog-pg-rewrite">
5239 <title><structname>pg_rewrite</structname></title>
5241 <indexterm zone="catalog-pg-rewrite">
5242 <primary>pg_rewrite</primary>
5246 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5250 <title><structname>pg_rewrite</> Columns</title>
5257 <entry>References</entry>
5258 <entry>Description</entry>
5264 <entry><structfield>oid</structfield></entry>
5265 <entry><type>oid</type></entry>
5267 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5271 <entry><structfield>rulename</structfield></entry>
5272 <entry><type>name</type></entry>
5274 <entry>Rule name</entry>
5278 <entry><structfield>ev_class</structfield></entry>
5279 <entry><type>oid</type></entry>
5280 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5281 <entry>The table this rule is for</entry>
5285 <entry><structfield>ev_type</structfield></entry>
5286 <entry><type>char</type></entry>
5289 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5290 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5296 <entry><structfield>ev_enabled</structfield></entry>
5297 <entry><type>char</type></entry>
5300 Controls in which <xref linkend="guc-session-replication-role"> modes
5302 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5303 <literal>D</> = rule is disabled,
5304 <literal>R</> = rule fires in <quote>replica</> mode,
5305 <literal>A</> = rule fires always.
5310 <entry><structfield>is_instead</structfield></entry>
5311 <entry><type>bool</type></entry>
5313 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5317 <entry><structfield>ev_qual</structfield></entry>
5318 <entry><type>pg_node_tree</type></entry>
5321 Expression tree (in the form of a
5322 <function>nodeToString()</function> representation) for the
5323 rule's qualifying condition
5328 <entry><structfield>ev_action</structfield></entry>
5329 <entry><type>pg_node_tree</type></entry>
5332 Query tree (in the form of a
5333 <function>nodeToString()</function> representation) for the
5343 <literal>pg_class.relhasrules</literal>
5344 must be true if a table has any rules in this catalog.
5350 <sect1 id="catalog-pg-replication-origin">
5351 <title><structname>pg_replication_origin</structname></title>
5353 <indexterm zone="catalog-pg-replication-origin">
5354 <primary>pg_replication_origin</primary>
5358 The <structname>pg_replication_origin</structname> catalog contains
5359 all replication origins created. For more on replication origins
5360 see <xref linkend="replication-origins">.
5365 <title><structname>pg_replication_origin</structname> Columns</title>
5372 <entry>References</entry>
5373 <entry>Description</entry>
5379 <entry><structfield>roident</structfield></entry>
5380 <entry><type>Oid</type></entry>
5382 <entry>A unique, cluster-wide identifier for the replication
5383 origin. Should never leave the system.</entry>
5387 <entry><structfield>roname</structfield></entry>
5388 <entry><type>text</type></entry>
5390 <entry>The external, user defined, name of a replication
5398 <sect1 id="catalog-pg-replication-origin-status">
5399 <title><structname>pg_replication_origin_status</structname></title>
5401 <indexterm zone="catalog-pg-replication-origin-status">
5402 <primary>pg_replication_origin_status</primary>
5406 The <structname>pg_replication_origin_status</structname> view
5407 contains information about how far replay for a certain origin has
5408 progressed. For more on replication origins
5409 see <xref linkend="replication-origins">.
5414 <title><structname>pg_replication_origin_status</structname> Columns</title>
5421 <entry>References</entry>
5422 <entry>Description</entry>
5428 <entry><structfield>local_id</structfield></entry>
5429 <entry><type>Oid</type></entry>
5430 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
5431 <entry>internal node identifier</entry>
5435 <entry><structfield>external_id</structfield></entry>
5436 <entry><type>text</type></entry>
5437 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
5438 <entry>external node identifier</entry>
5442 <entry><structfield>remote_lsn</structfield></entry>
5443 <entry><type>pg_lsn</type></entry>
5445 <entry>The origin node's LSN up to which data has been replicated.</entry>
5450 <entry><structfield>local_lsn</structfield></entry>
5451 <entry><type>pg_lsn</type></entry>
5454 This node's LSN at which <literal>remote_lsn</literal> has
5455 been replicated. Used to flush commit records before persisting
5456 data to disk when using asynchronous commits.
5464 <sect1 id="catalog-pg-replication-slots">
5465 <title><structname>pg_replication_slots</structname></title>
5467 <indexterm zone="catalog-pg-replication-slots">
5468 <primary>pg_replication_slots</primary>
5472 The <structname>pg_replication_slots</structname> view provides a listing
5473 of all replication slots that currently exist on the database cluster,
5474 along with their current state.
5478 For more on replication slots,
5479 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
5484 <title><structname>pg_replication_slots</structname> Columns</title>
5491 <entry>References</entry>
5492 <entry>Description</entry>
5498 <entry><structfield>slot_name</structfield></entry>
5499 <entry><type>name</type></entry>
5501 <entry>A unique, cluster-wide identifier for the replication slot</entry>
5505 <entry><structfield>plugin</structfield></entry>
5506 <entry><type>name</type></entry>
5508 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
5512 <entry><structfield>slot_type</structfield></entry>
5513 <entry><type>text</type></entry>
5515 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
5519 <entry><structfield>datoid</structfield></entry>
5520 <entry><type>oid</type></entry>
5521 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5522 <entry>The OID of the database this slot is associated with, or
5523 null. Only logical slots have an associated database.</entry>
5527 <entry><structfield>database</structfield></entry>
5528 <entry><type>text</type></entry>
5529 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5530 <entry>The name of the database this slot is associated with, or
5531 null. Only logical slots have an associated database.</entry>
5535 <entry><structfield>active</structfield></entry>
5536 <entry><type>boolean</type></entry>
5538 <entry>True if this slot is currently actively being used</entry>
5542 <entry><structfield>active_pid</structfield></entry>
5543 <entry><type>integer</type></entry>
5545 <entry>The process ID of the session using this slot if the slot
5546 is currently actively being used. <literal>NULL</literal> if
5552 <entry><structfield>xmin</structfield></entry>
5553 <entry><type>xid</type></entry>
5555 <entry>The oldest transaction that this slot needs the database to
5556 retain. <literal>VACUUM</literal> cannot remove tuples deleted
5557 by any later transaction.
5562 <entry><structfield>catalog_xmin</structfield></entry>
5563 <entry><type>xid</type></entry>
5565 <entry>The oldest transaction affecting the system catalogs that this
5566 slot needs the database to retain. <literal>VACUUM</literal> cannot
5567 remove catalog tuples deleted by any later transaction.
5572 <entry><structfield>restart_lsn</structfield></entry>
5573 <entry><type>pg_lsn</type></entry>
5575 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
5576 might be required by the consumer of this slot and thus won't be
5577 automatically removed during checkpoints.
5585 <sect1 id="catalog-pg-seclabel">
5586 <title><structname>pg_seclabel</structname></title>
5588 <indexterm zone="catalog-pg-seclabel">
5589 <primary>pg_seclabel</primary>
5593 The catalog <structname>pg_seclabel</structname> stores security
5594 labels on database objects. Security labels can be manipulated
5595 with the <xref linkend="sql-security-label"> command. For an easier
5596 way to view security labels, see <xref linkend="view-pg-seclabels">.
5600 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5601 which performs a similar function for security labels of database objects
5602 that are shared across a database cluster.
5606 <title><structname>pg_seclabel</structname> Columns</title>
5613 <entry>References</entry>
5614 <entry>Description</entry>
5620 <entry><structfield>objoid</structfield></entry>
5621 <entry><type>oid</type></entry>
5622 <entry>any OID column</entry>
5623 <entry>The OID of the object this security label pertains to</entry>
5627 <entry><structfield>classoid</structfield></entry>
5628 <entry><type>oid</type></entry>
5629 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5630 <entry>The OID of the system catalog this object appears in</entry>
5634 <entry><structfield>objsubid</structfield></entry>
5635 <entry><type>int4</type></entry>
5638 For a security label on a table column, this is the column number (the
5639 <structfield>objoid</> and <structfield>classoid</> refer to
5640 the table itself). For all other object types, this column is
5646 <entry><structfield>provider</structfield></entry>
5647 <entry><type>text</type></entry>
5649 <entry>The label provider associated with this label.</entry>
5653 <entry><structfield>label</structfield></entry>
5654 <entry><type>text</type></entry>
5656 <entry>The security label applied to this object.</entry>
5663 <sect1 id="catalog-pg-shdepend">
5664 <title><structname>pg_shdepend</structname></title>
5666 <indexterm zone="catalog-pg-shdepend">
5667 <primary>pg_shdepend</primary>
5671 The catalog <structname>pg_shdepend</structname> records the
5672 dependency relationships between database objects and shared objects,
5673 such as roles. This information allows
5674 <productname>PostgreSQL</productname> to ensure that those objects are
5675 unreferenced before attempting to delete them.
5679 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5680 which performs a similar function for dependencies involving objects
5681 within a single database.
5685 Unlike most system catalogs, <structname>pg_shdepend</structname>
5686 is shared across all databases of a cluster: there is only one
5687 copy of <structname>pg_shdepend</structname> per cluster, not
5692 <title><structname>pg_shdepend</> Columns</title>
5699 <entry>References</entry>
5700 <entry>Description</entry>
5706 <entry><structfield>dbid</structfield></entry>
5707 <entry><type>oid</type></entry>
5708 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5709 <entry>The OID of the database the dependent object is in,
5710 or zero for a shared object</entry>
5714 <entry><structfield>classid</structfield></entry>
5715 <entry><type>oid</type></entry>
5716 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5717 <entry>The OID of the system catalog the dependent object is in</entry>
5721 <entry><structfield>objid</structfield></entry>
5722 <entry><type>oid</type></entry>
5723 <entry>any OID column</entry>
5724 <entry>The OID of the specific dependent object</entry>
5728 <entry><structfield>objsubid</structfield></entry>
5729 <entry><type>int4</type></entry>
5732 For a table column, this is the column number (the
5733 <structfield>objid</> and <structfield>classid</> refer to the
5734 table itself). For all other object types, this column is zero.
5739 <entry><structfield>refclassid</structfield></entry>
5740 <entry><type>oid</type></entry>
5741 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5742 <entry>The OID of the system catalog the referenced object is in
5743 (must be a shared catalog)</entry>
5747 <entry><structfield>refobjid</structfield></entry>
5748 <entry><type>oid</type></entry>
5749 <entry>any OID column</entry>
5750 <entry>The OID of the specific referenced object</entry>
5754 <entry><structfield>deptype</structfield></entry>
5755 <entry><type>char</type></entry>
5758 A code defining the specific semantics of this dependency relationship; see text
5767 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5768 the referenced object cannot be dropped without also dropping the dependent
5769 object. However, there are several subflavors identified by
5770 <structfield>deptype</>:
5774 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5777 The referenced object (which must be a role) is the owner of the
5784 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5787 The referenced object (which must be a role) is mentioned in the
5788 ACL (access control list, i.e., privileges list) of the
5789 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5790 not made for the owner of the object, since the owner will have
5791 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5797 <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
5800 The referenced object (which must be a role) is mentioned as the
5801 target of a dependent policy object.
5807 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5810 There is no dependent object; this type of entry is a signal
5811 that the system itself depends on the referenced object, and so
5812 that object must never be deleted. Entries of this type are
5813 created only by <command>initdb</command>. The columns for the
5814 dependent object contain zeroes.
5820 Other dependency flavors might be needed in future. Note in particular
5821 that the current definition only supports roles as referenced objects.
5826 <sect1 id="catalog-pg-shdescription">
5827 <title><structname>pg_shdescription</structname></title>
5829 <indexterm zone="catalog-pg-shdescription">
5830 <primary>pg_shdescription</primary>
5834 The catalog <structname>pg_shdescription</structname> stores optional
5835 descriptions (comments) for shared database objects. Descriptions can be
5836 manipulated with the <xref linkend="sql-comment"> command and viewed with
5837 <application>psql</application>'s <literal>\d</literal> commands.
5841 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5842 which performs a similar function for descriptions involving objects
5843 within a single database.
5847 Unlike most system catalogs, <structname>pg_shdescription</structname>
5848 is shared across all databases of a cluster: there is only one
5849 copy of <structname>pg_shdescription</structname> per cluster, not
5854 <title><structname>pg_shdescription</> Columns</title>
5861 <entry>References</entry>
5862 <entry>Description</entry>
5868 <entry><structfield>objoid</structfield></entry>
5869 <entry><type>oid</type></entry>
5870 <entry>any OID column</entry>
5871 <entry>The OID of the object this description pertains to</entry>
5875 <entry><structfield>classoid</structfield></entry>
5876 <entry><type>oid</type></entry>
5877 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5878 <entry>The OID of the system catalog this object appears in</entry>
5882 <entry><structfield>description</structfield></entry>
5883 <entry><type>text</type></entry>
5885 <entry>Arbitrary text that serves as the description of this object</entry>
5893 <sect1 id="catalog-pg-shseclabel">
5894 <title><structname>pg_shseclabel</structname></title>
5896 <indexterm zone="catalog-pg-shseclabel">
5897 <primary>pg_shseclabel</primary>
5901 The catalog <structname>pg_shseclabel</structname> stores security
5902 labels on shared database objects. Security labels can be manipulated
5903 with the <xref linkend="sql-security-label"> command. For an easier
5904 way to view security labels, see <xref linkend="view-pg-seclabels">.
5908 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5909 which performs a similar function for security labels involving objects
5910 within a single database.
5914 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5915 is shared across all databases of a cluster: there is only one
5916 copy of <structname>pg_shseclabel</structname> per cluster, not
5921 <title><structname>pg_shseclabel</structname> Columns</title>
5927 <entry>References</entry>
5928 <entry>Description</entry>
5933 <entry><structfield>objoid</structfield></entry>
5934 <entry><type>oid</type></entry>
5935 <entry>any OID column</entry>
5936 <entry>The OID of the object this security label pertains to</entry>
5939 <entry><structfield>classoid</structfield></entry>
5940 <entry><type>oid</type></entry>
5941 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5942 <entry>The OID of the system catalog this object appears in</entry>
5945 <entry><structfield>provider</structfield></entry>
5946 <entry><type>text</type></entry>
5948 <entry>The label provider associated with this label.</entry>
5951 <entry><structfield>label</structfield></entry>
5952 <entry><type>text</type></entry>
5954 <entry>The security label applied to this object.</entry>
5961 <sect1 id="catalog-pg-statistic">
5962 <title><structname>pg_statistic</structname></title>
5964 <indexterm zone="catalog-pg-statistic">
5965 <primary>pg_statistic</primary>
5969 The catalog <structname>pg_statistic</structname> stores
5970 statistical data about the contents of the database. Entries are
5971 created by <xref linkend="sql-analyze">
5972 and subsequently used by the query planner. Note that all the
5973 statistical data is inherently approximate, even assuming that it
5978 Normally there is one entry, with <structfield>stainherit</> =
5979 <literal>false</>, for each table column that has been analyzed.
5980 If the table has inheritance children, a second entry with
5981 <structfield>stainherit</> = <literal>true</> is also created. This row
5982 represents the column's statistics over the inheritance tree, i.e.,
5983 statistics for the data you'd see with
5984 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5985 whereas the <structfield>stainherit</> = <literal>false</> row represents
5987 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5991 <structname>pg_statistic</structname> also stores statistical data about
5992 the values of index expressions. These are described as if they were
5993 actual data columns; in particular, <structfield>starelid</structfield>
5994 references the index. No entry is made for an ordinary non-expression
5995 index column, however, since it would be redundant with the entry
5996 for the underlying table column. Currently, entries for index expressions
5997 always have <structfield>stainherit</> = <literal>false</>.
6001 Since different kinds of statistics might be appropriate for different
6002 kinds of data, <structname>pg_statistic</structname> is designed not
6003 to assume very much about what sort of statistics it stores. Only
6004 extremely general statistics (such as nullness) are given dedicated
6005 columns in <structname>pg_statistic</structname>. Everything else
6006 is stored in <quote>slots</quote>, which are groups of associated columns
6007 whose content is identified by a code number in one of the slot's columns.
6008 For more information see
6009 <filename>src/include/catalog/pg_statistic.h</filename>.
6013 <structname>pg_statistic</structname> should not be readable by the
6014 public, since even statistical information about a table's contents
6015 might be considered sensitive. (Example: minimum and maximum values
6016 of a salary column might be quite interesting.)
6017 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6018 is a publicly readable view on
6019 <structname>pg_statistic</structname> that only exposes information
6020 about those tables that are readable by the current user.
6024 <title><structname>pg_statistic</> Columns</title>
6031 <entry>References</entry>
6032 <entry>Description</entry>
6038 <entry><structfield>starelid</structfield></entry>
6039 <entry><type>oid</type></entry>
6040 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6041 <entry>The table or index that the described column belongs to</entry>
6045 <entry><structfield>staattnum</structfield></entry>
6046 <entry><type>int2</type></entry>
6047 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6048 <entry>The number of the described column</entry>
6052 <entry><structfield>stainherit</structfield></entry>
6053 <entry><type>bool</type></entry>
6055 <entry>If true, the stats include inheritance child columns, not just the
6056 values in the specified relation</entry>
6060 <entry><structfield>stanullfrac</structfield></entry>
6061 <entry><type>float4</type></entry>
6063 <entry>The fraction of the column's entries that are null</entry>
6067 <entry><structfield>stawidth</structfield></entry>
6068 <entry><type>int4</type></entry>
6070 <entry>The average stored width, in bytes, of nonnull entries</entry>
6074 <entry><structfield>stadistinct</structfield></entry>
6075 <entry><type>float4</type></entry>
6077 <entry>The number of distinct nonnull data values in the column.
6078 A value greater than zero is the actual number of distinct values.
6079 A value less than zero is the negative of a multiplier for the number
6080 of rows in the table; for example, a column in which values appear about
6081 twice on the average could be represented by
6082 <structfield>stadistinct</> = -0.5.
6083 A zero value means the number of distinct values is unknown.
6088 <entry><structfield>stakind<replaceable>N</></structfield></entry>
6089 <entry><type>int2</type></entry>
6092 A code number indicating the kind of statistics stored in the
6093 <replaceable>N</>th <quote>slot</quote> of the
6094 <structname>pg_statistic</structname> row.
6099 <entry><structfield>staop<replaceable>N</></structfield></entry>
6100 <entry><type>oid</type></entry>
6101 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6103 An operator used to derive the statistics stored in the
6104 <replaceable>N</>th <quote>slot</quote>. For example, a
6105 histogram slot would show the <literal><</literal> operator
6106 that defines the sort order of the data.
6111 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6112 <entry><type>float4[]</type></entry>
6115 Numerical statistics of the appropriate kind for the
6116 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6117 kind does not involve numerical values
6122 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6123 <entry><type>anyarray</type></entry>
6126 Column data values of the appropriate kind for the
6127 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6128 kind does not store any data values. Each array's element
6129 values are actually of the specific column's data type, or a related
6130 type such as an array's element type, so there is no way to define
6131 these columns' type more specifically than <type>anyarray</>.
6141 <sect1 id="catalog-pg-tablespace">
6142 <title><structname>pg_tablespace</structname></title>
6144 <indexterm zone="catalog-pg-tablespace">
6145 <primary>pg_tablespace</primary>
6149 The catalog <structname>pg_tablespace</structname> stores information
6150 about the available tablespaces. Tables can be placed in particular
6151 tablespaces to aid administration of disk layout.
6155 Unlike most system catalogs, <structname>pg_tablespace</structname>
6156 is shared across all databases of a cluster: there is only one
6157 copy of <structname>pg_tablespace</structname> per cluster, not
6162 <title><structname>pg_tablespace</> Columns</title>
6169 <entry>References</entry>
6170 <entry>Description</entry>
6176 <entry><structfield>oid</structfield></entry>
6177 <entry><type>oid</type></entry>
6179 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6183 <entry><structfield>spcname</structfield></entry>
6184 <entry><type>name</type></entry>
6186 <entry>Tablespace name</entry>
6190 <entry><structfield>spcowner</structfield></entry>
6191 <entry><type>oid</type></entry>
6192 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6193 <entry>Owner of the tablespace, usually the user who created it</entry>
6197 <entry><structfield>spcacl</structfield></entry>
6198 <entry><type>aclitem[]</type></entry>
6201 Access privileges; see
6202 <xref linkend="sql-grant"> and
6203 <xref linkend="sql-revoke">
6209 <entry><structfield>spcoptions</structfield></entry>
6210 <entry><type>text[]</type></entry>
6213 Tablespace-level options, as <quote>keyword=value</> strings
6222 <sect1 id="catalog-pg-transform">
6223 <title><structname>pg_transform</structname></title>
6225 <indexterm zone="catalog-pg-transform">
6226 <primary>pg_transform</primary>
6230 The catalog <structname>pg_transform</structname> stores information about
6231 transforms, which are a mechanism to adapt data types to procedural
6232 languages. See <xref linkend="sql-createtransform"> for more information.
6236 <title><structname>pg_transform</> Columns</title>
6243 <entry>References</entry>
6244 <entry>Description</entry>
6250 <entry><structfield>trftype</structfield></entry>
6251 <entry><type>oid</type></entry>
6252 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6253 <entry>OID of the data type this transform is for</entry>
6257 <entry><structfield>trflang</structfield></entry>
6258 <entry><type>oid</type></entry>
6259 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6260 <entry>OID of the language this transform is for</entry>
6264 <entry><structfield>trffromsql</structfield></entry>
6265 <entry><type>regproc</type></entry>
6266 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6268 The OID of the function to use when converting the data type for input
6269 to the procedural language (e.g., function parameters). Zero is stored
6270 if this operation is not supported.
6275 <entry><structfield>trftosql</structfield></entry>
6276 <entry><type>regproc</type></entry>
6277 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6279 The OID of the function to use when converting output from the
6280 procedural language (e.g., return values) to the data type. Zero is
6281 stored if this operation is not supported.
6290 <sect1 id="catalog-pg-trigger">
6291 <title><structname>pg_trigger</structname></title>
6293 <indexterm zone="catalog-pg-trigger">
6294 <primary>pg_trigger</primary>
6298 The catalog <structname>pg_trigger</structname> stores triggers on tables
6300 See <xref linkend="sql-createtrigger">
6301 for more information.
6305 <title><structname>pg_trigger</> Columns</title>
6312 <entry>References</entry>
6313 <entry>Description</entry>
6319 <entry><structfield>oid</structfield></entry>
6320 <entry><type>oid</type></entry>
6322 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6326 <entry><structfield>tgrelid</structfield></entry>
6327 <entry><type>oid</type></entry>
6328 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6329 <entry>The table this trigger is on</entry>
6333 <entry><structfield>tgname</structfield></entry>
6334 <entry><type>name</type></entry>
6336 <entry>Trigger name (must be unique among triggers of same table)</entry>
6340 <entry><structfield>tgfoid</structfield></entry>
6341 <entry><type>oid</type></entry>
6342 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6343 <entry>The function to be called</entry>
6347 <entry><structfield>tgtype</structfield></entry>
6348 <entry><type>int2</type></entry>
6350 <entry>Bit mask identifying trigger firing conditions</entry>
6354 <entry><structfield>tgenabled</structfield></entry>
6355 <entry><type>char</type></entry>
6358 Controls in which <xref linkend="guc-session-replication-role"> modes
6360 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6361 <literal>D</> = trigger is disabled,
6362 <literal>R</> = trigger fires in <quote>replica</> mode,
6363 <literal>A</> = trigger fires always.
6368 <entry><structfield>tgisinternal</structfield></entry>
6369 <entry><type>bool</type></entry>
6371 <entry>True if trigger is internally generated (usually, to enforce
6372 the constraint identified by <structfield>tgconstraint</>)</entry>
6376 <entry><structfield>tgconstrrelid</structfield></entry>
6377 <entry><type>oid</type></entry>
6378 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6379 <entry>The table referenced by a referential integrity constraint</entry>
6383 <entry><structfield>tgconstrindid</structfield></entry>
6384 <entry><type>oid</type></entry>
6385 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6386 <entry>The index supporting a unique, primary key, referential integrity,
6387 or exclusion constraint</entry>
6391 <entry><structfield>tgconstraint</structfield></entry>
6392 <entry><type>oid</type></entry>
6393 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6394 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6398 <entry><structfield>tgdeferrable</structfield></entry>
6399 <entry><type>bool</type></entry>
6401 <entry>True if constraint trigger is deferrable</entry>
6405 <entry><structfield>tginitdeferred</structfield></entry>
6406 <entry><type>bool</type></entry>
6408 <entry>True if constraint trigger is initially deferred</entry>
6412 <entry><structfield>tgnargs</structfield></entry>
6413 <entry><type>int2</type></entry>
6415 <entry>Number of argument strings passed to trigger function</entry>
6419 <entry><structfield>tgattr</structfield></entry>
6420 <entry><type>int2vector</type></entry>
6421 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6422 <entry>Column numbers, if trigger is column-specific; otherwise an
6427 <entry><structfield>tgargs</structfield></entry>
6428 <entry><type>bytea</type></entry>
6430 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6434 <entry><structfield>tgqual</structfield></entry>
6435 <entry><type>pg_node_tree</type></entry>
6437 <entry>Expression tree (in <function>nodeToString()</function>
6438 representation) for the trigger's <literal>WHEN</> condition, or null
6446 Currently, column-specific triggering is supported only for
6447 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6448 only for that event type. <structfield>tgtype</structfield> might
6449 contain bits for other event types as well, but those are presumed
6450 to be table-wide regardless of what is in <structfield>tgattr</>.
6455 When <structfield>tgconstraint</> is nonzero,
6456 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6457 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6458 largely redundant with the referenced <structname>pg_constraint</> entry.
6459 However, it is possible for a non-deferrable trigger to be associated
6460 with a deferrable constraint: foreign key constraints can have some
6461 deferrable and some non-deferrable triggers.
6467 <literal>pg_class.relhastriggers</literal>
6468 must be true if a relation has any triggers in this catalog.
6475 <sect1 id="catalog-pg-ts-config">
6476 <title><structname>pg_ts_config</structname></title>
6478 <indexterm zone="catalog-pg-ts-config">
6479 <primary>pg_ts_config</primary>
6483 The <structname>pg_ts_config</structname> catalog contains entries
6484 representing text search configurations. A configuration specifies
6485 a particular text search parser and a list of dictionaries to use
6486 for each of the parser's output token types. The parser is shown
6487 in the <structname>pg_ts_config</structname> entry, but the
6488 token-to-dictionary mapping is defined by subsidiary entries in <link
6489 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6493 <productname>PostgreSQL</productname>'s text search features are
6494 described at length in <xref linkend="textsearch">.
6498 <title><structname>pg_ts_config</> Columns</title>
6505 <entry>References</entry>
6506 <entry>Description</entry>
6512 <entry><structfield>oid</structfield></entry>
6513 <entry><type>oid</type></entry>
6515 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6519 <entry><structfield>cfgname</structfield></entry>
6520 <entry><type>name</type></entry>
6522 <entry>Text search configuration name</entry>
6526 <entry><structfield>cfgnamespace</structfield></entry>
6527 <entry><type>oid</type></entry>
6528 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6530 The OID of the namespace that contains this configuration
6535 <entry><structfield>cfgowner</structfield></entry>
6536 <entry><type>oid</type></entry>
6537 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6538 <entry>Owner of the configuration</entry>
6542 <entry><structfield>cfgparser</structfield></entry>
6543 <entry><type>oid</type></entry>
6544 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6545 <entry>The OID of the text search parser for this configuration</entry>
6553 <sect1 id="catalog-pg-ts-config-map">
6554 <title><structname>pg_ts_config_map</structname></title>
6556 <indexterm zone="catalog-pg-ts-config-map">
6557 <primary>pg_ts_config_map</primary>
6561 The <structname>pg_ts_config_map</structname> catalog contains entries
6562 showing which text search dictionaries should be consulted, and in
6563 what order, for each output token type of each text search configuration's
6568 <productname>PostgreSQL</productname>'s text search features are
6569 described at length in <xref linkend="textsearch">.
6573 <title><structname>pg_ts_config_map</> Columns</title>
6580 <entry>References</entry>
6581 <entry>Description</entry>
6587 <entry><structfield>mapcfg</structfield></entry>
6588 <entry><type>oid</type></entry>
6589 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6590 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6594 <entry><structfield>maptokentype</structfield></entry>
6595 <entry><type>integer</type></entry>
6597 <entry>A token type emitted by the configuration's parser</entry>
6601 <entry><structfield>mapseqno</structfield></entry>
6602 <entry><type>integer</type></entry>
6604 <entry>Order in which to consult this entry (lower
6605 <structfield>mapseqno</>s first)</entry>
6609 <entry><structfield>mapdict</structfield></entry>
6610 <entry><type>oid</type></entry>
6611 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6612 <entry>The OID of the text search dictionary to consult</entry>
6620 <sect1 id="catalog-pg-ts-dict">
6621 <title><structname>pg_ts_dict</structname></title>
6623 <indexterm zone="catalog-pg-ts-dict">
6624 <primary>pg_ts_dict</primary>
6628 The <structname>pg_ts_dict</structname> catalog contains entries
6629 defining text search dictionaries. A dictionary depends on a text
6630 search template, which specifies all the implementation functions
6631 needed; the dictionary itself provides values for the user-settable
6632 parameters supported by the template. This division of labor allows
6633 dictionaries to be created by unprivileged users. The parameters
6634 are specified by a text string <structfield>dictinitoption</>,
6635 whose format and meaning vary depending on the template.
6639 <productname>PostgreSQL</productname>'s text search features are
6640 described at length in <xref linkend="textsearch">.
6644 <title><structname>pg_ts_dict</> Columns</title>
6651 <entry>References</entry>
6652 <entry>Description</entry>
6658 <entry><structfield>oid</structfield></entry>
6659 <entry><type>oid</type></entry>
6661 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6665 <entry><structfield>dictname</structfield></entry>
6666 <entry><type>name</type></entry>
6668 <entry>Text search dictionary name</entry>
6672 <entry><structfield>dictnamespace</structfield></entry>
6673 <entry><type>oid</type></entry>
6674 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6676 The OID of the namespace that contains this dictionary
6681 <entry><structfield>dictowner</structfield></entry>
6682 <entry><type>oid</type></entry>
6683 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6684 <entry>Owner of the dictionary</entry>
6688 <entry><structfield>dicttemplate</structfield></entry>
6689 <entry><type>oid</type></entry>
6690 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6691 <entry>The OID of the text search template for this dictionary</entry>
6695 <entry><structfield>dictinitoption</structfield></entry>
6696 <entry><type>text</type></entry>
6698 <entry>Initialization option string for the template</entry>
6706 <sect1 id="catalog-pg-ts-parser">
6707 <title><structname>pg_ts_parser</structname></title>
6709 <indexterm zone="catalog-pg-ts-parser">
6710 <primary>pg_ts_parser</primary>
6714 The <structname>pg_ts_parser</structname> catalog contains entries
6715 defining text search parsers. A parser is responsible for splitting
6716 input text into lexemes and assigning a token type to each lexeme.
6717 Since a parser must be implemented by C-language-level functions,
6718 creation of new parsers is restricted to database superusers.
6722 <productname>PostgreSQL</productname>'s text search features are
6723 described at length in <xref linkend="textsearch">.
6727 <title><structname>pg_ts_parser</> Columns</title>
6734 <entry>References</entry>
6735 <entry>Description</entry>
6741 <entry><structfield>oid</structfield></entry>
6742 <entry><type>oid</type></entry>
6744 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6748 <entry><structfield>prsname</structfield></entry>
6749 <entry><type>name</type></entry>
6751 <entry>Text search parser name</entry>
6755 <entry><structfield>prsnamespace</structfield></entry>
6756 <entry><type>oid</type></entry>
6757 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6759 The OID of the namespace that contains this parser
6764 <entry><structfield>prsstart</structfield></entry>
6765 <entry><type>regproc</type></entry>
6766 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6767 <entry>OID of the parser's startup function</entry>
6771 <entry><structfield>prstoken</structfield></entry>
6772 <entry><type>regproc</type></entry>
6773 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6774 <entry>OID of the parser's next-token function</entry>
6778 <entry><structfield>prsend</structfield></entry>
6779 <entry><type>regproc</type></entry>
6780 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6781 <entry>OID of the parser's shutdown function</entry>
6785 <entry><structfield>prsheadline</structfield></entry>
6786 <entry><type>regproc</type></entry>
6787 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6788 <entry>OID of the parser's headline function</entry>
6792 <entry><structfield>prslextype</structfield></entry>
6793 <entry><type>regproc</type></entry>
6794 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6795 <entry>OID of the parser's lextype function</entry>
6803 <sect1 id="catalog-pg-ts-template">
6804 <title><structname>pg_ts_template</structname></title>
6806 <indexterm zone="catalog-pg-ts-template">
6807 <primary>pg_ts_template</primary>
6811 The <structname>pg_ts_template</structname> catalog contains entries
6812 defining text search templates. A template is the implementation
6813 skeleton for a class of text search dictionaries.
6814 Since a template must be implemented by C-language-level functions,
6815 creation of new templates is restricted to database superusers.
6819 <productname>PostgreSQL</productname>'s text search features are
6820 described at length in <xref linkend="textsearch">.
6824 <title><structname>pg_ts_template</> Columns</title>
6831 <entry>References</entry>
6832 <entry>Description</entry>
6838 <entry><structfield>oid</structfield></entry>
6839 <entry><type>oid</type></entry>
6841 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6845 <entry><structfield>tmplname</structfield></entry>
6846 <entry><type>name</type></entry>
6848 <entry>Text search template name</entry>
6852 <entry><structfield>tmplnamespace</structfield></entry>
6853 <entry><type>oid</type></entry>
6854 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6856 The OID of the namespace that contains this template
6861 <entry><structfield>tmplinit</structfield></entry>
6862 <entry><type>regproc</type></entry>
6863 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6864 <entry>OID of the template's initialization function</entry>
6868 <entry><structfield>tmpllexize</structfield></entry>
6869 <entry><type>regproc</type></entry>
6870 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6871 <entry>OID of the template's lexize function</entry>
6879 <sect1 id="catalog-pg-type">
6880 <title><structname>pg_type</structname></title>
6882 <indexterm zone="catalog-pg-type">
6883 <primary>pg_type</primary>
6887 The catalog <structname>pg_type</structname> stores information about data
6888 types. Base types and enum types (scalar types) are created with
6889 <xref linkend="sql-createtype">, and
6891 <xref linkend="sql-createdomain">.
6892 A composite type is automatically created for each table in the database, to
6893 represent the row structure of the table. It is also possible to create
6894 composite types with <command>CREATE TYPE AS</command>.
6898 <title><structname>pg_type</> Columns</title>
6905 <entry>References</entry>
6906 <entry>Description</entry>
6912 <entry><structfield>oid</structfield></entry>
6913 <entry><type>oid</type></entry>
6915 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6919 <entry><structfield>typname</structfield></entry>
6920 <entry><type>name</type></entry>
6922 <entry>Data type name</entry>
6926 <entry><structfield>typnamespace</structfield></entry>
6927 <entry><type>oid</type></entry>
6928 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6930 The OID of the namespace that contains this type
6935 <entry><structfield>typowner</structfield></entry>
6936 <entry><type>oid</type></entry>
6937 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6938 <entry>Owner of the type</entry>
6942 <entry><structfield>typlen</structfield></entry>
6943 <entry><type>int2</type></entry>
6946 For a fixed-size type, <structfield>typlen</structfield> is the number
6947 of bytes in the internal representation of the type. But for a
6948 variable-length type, <structfield>typlen</structfield> is negative.
6949 -1 indicates a <quote>varlena</> type (one that has a length word),
6950 -2 indicates a null-terminated C string.
6955 <entry><structfield>typbyval</structfield></entry>
6956 <entry><type>bool</type></entry>
6959 <structfield>typbyval</structfield> determines whether internal
6960 routines pass a value of this type by value or by reference.
6961 <structfield>typbyval</structfield> had better be false if
6962 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6963 where Datum is 8 bytes).
6964 Variable-length types are always passed by reference. Note that
6965 <structfield>typbyval</structfield> can be false even if the
6966 length would allow pass-by-value.
6971 <entry><structfield>typtype</structfield></entry>
6972 <entry><type>char</type></entry>
6975 <structfield>typtype</structfield> is
6976 <literal>b</literal> for a base type,
6977 <literal>c</literal> for a composite type (e.g., a table's row type),
6978 <literal>d</literal> for a domain,
6979 <literal>e</literal> for an enum type,
6980 <literal>p</literal> for a pseudo-type, or
6981 <literal>r</literal> for a range type.
6982 See also <structfield>typrelid</structfield> and
6983 <structfield>typbasetype</structfield>.
6988 <entry><structfield>typcategory</structfield></entry>
6989 <entry><type>char</type></entry>
6992 <structfield>typcategory</structfield> is an arbitrary classification
6993 of data types that is used by the parser to determine which implicit
6994 casts should be <quote>preferred</>.
6995 See <xref linkend="catalog-typcategory-table">.
7000 <entry><structfield>typispreferred</structfield></entry>
7001 <entry><type>bool</type></entry>
7004 True if the type is a preferred cast target within its
7005 <structfield>typcategory</structfield>
7010 <entry><structfield>typisdefined</structfield></entry>
7011 <entry><type>bool</type></entry>
7014 True if the type is defined, false if this is a placeholder
7015 entry for a not-yet-defined type. When
7016 <structfield>typisdefined</structfield> is false, nothing
7017 except the type name, namespace, and OID can be relied on.
7022 <entry><structfield>typdelim</structfield></entry>
7023 <entry><type>char</type></entry>
7026 Character that separates two values of this type when parsing
7027 array input. Note that the delimiter is associated with the array
7028 element data type, not the array data type.
7033 <entry><structfield>typrelid</structfield></entry>
7034 <entry><type>oid</type></entry>
7035 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7037 If this is a composite type (see
7038 <structfield>typtype</structfield>), then this column points to
7039 the <structname>pg_class</structname> entry that defines the
7040 corresponding table. (For a free-standing composite type, the
7041 <structname>pg_class</structname> entry doesn't really represent
7042 a table, but it is needed anyway for the type's
7043 <structname>pg_attribute</structname> entries to link to.)
7044 Zero for non-composite types.
7049 <entry><structfield>typelem</structfield></entry>
7050 <entry><type>oid</type></entry>
7051 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7053 If <structfield>typelem</structfield> is not 0 then it
7054 identifies another row in <structname>pg_type</structname>.
7055 The current type can then be subscripted like an array yielding
7056 values of type <structfield>typelem</structfield>. A
7057 <quote>true</quote> array type is variable length
7058 (<structfield>typlen</structfield> = -1),
7059 but some fixed-length (<structfield>typlen</structfield> > 0) types
7060 also have nonzero <structfield>typelem</structfield>, for example
7061 <type>name</type> and <type>point</type>.
7062 If a fixed-length type has a <structfield>typelem</structfield> then
7063 its internal representation must be some number of values of the
7064 <structfield>typelem</structfield> data type with no other data.
7065 Variable-length array types have a header defined by the array
7071 <entry><structfield>typarray</structfield></entry>
7072 <entry><type>oid</type></entry>
7073 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7075 If <structfield>typarray</structfield> is not 0 then it
7076 identifies another row in <structname>pg_type</structname>, which
7077 is the <quote>true</quote> array type having this type as element
7082 <entry><structfield>typinput</structfield></entry>
7083 <entry><type>regproc</type></entry>
7084 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7085 <entry>Input conversion function (text format)</entry>
7089 <entry><structfield>typoutput</structfield></entry>
7090 <entry><type>regproc</type></entry>
7091 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7092 <entry>Output conversion function (text format)</entry>
7096 <entry><structfield>typreceive</structfield></entry>
7097 <entry><type>regproc</type></entry>
7098 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7099 <entry>Input conversion function (binary format), or 0 if none</entry>
7103 <entry><structfield>typsend</structfield></entry>
7104 <entry><type>regproc</type></entry>
7105 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7106 <entry>Output conversion function (binary format), or 0 if none</entry>
7110 <entry><structfield>typmodin</structfield></entry>
7111 <entry><type>regproc</type></entry>
7112 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7113 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7117 <entry><structfield>typmodout</structfield></entry>
7118 <entry><type>regproc</type></entry>
7119 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7120 <entry>Type modifier output function, or 0 to use the standard format</entry>
7124 <entry><structfield>typanalyze</structfield></entry>
7125 <entry><type>regproc</type></entry>
7126 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7127 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7131 <entry><structfield>typalign</structfield></entry>
7132 <entry><type>char</type></entry>
7136 <structfield>typalign</structfield> is the alignment required
7137 when storing a value of this type. It applies to storage on
7138 disk as well as most representations of the value inside
7139 <productname>PostgreSQL</>.
7140 When multiple values are stored consecutively, such
7141 as in the representation of a complete row on disk, padding is
7142 inserted before a datum of this type so that it begins on the
7143 specified boundary. The alignment reference is the beginning
7144 of the first datum in the sequence.
7148 Possible values are:
7151 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7154 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7157 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7160 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7165 For types used in system tables, it is critical that the size
7166 and alignment defined in <structname>pg_type</structname>
7167 agree with the way that the compiler will lay out the column in
7168 a structure representing a table row.
7174 <entry><structfield>typstorage</structfield></entry>
7175 <entry><type>char</type></entry>
7178 <structfield>typstorage</structfield> tells for varlena
7179 types (those with <structfield>typlen</structfield> = -1) if
7180 the type is prepared for toasting and what the default strategy
7181 for attributes of this type should be.
7185 <para><literal>p</>: Value must always be stored plain.</para>
7189 <literal>e</>: Value can be stored in a <quote>secondary</quote>
7190 relation (if relation has one, see
7191 <literal>pg_class.reltoastrelid</literal>).
7195 <para><literal>m</>: Value can be stored compressed inline.</para>
7198 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7201 Note that <literal>m</> columns can also be moved out to secondary
7202 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7208 <entry><structfield>typnotnull</structfield></entry>
7209 <entry><type>bool</type></entry>
7212 <structfield>typnotnull</structfield> represents a not-null
7213 constraint on a type. Used for domains only.
7218 <entry><structfield>typbasetype</structfield></entry>
7219 <entry><type>oid</type></entry>
7220 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7222 If this is a domain (see <structfield>typtype</structfield>), then
7223 <structfield>typbasetype</structfield> identifies the type that this
7224 one is based on. Zero if this type is not a domain.
7229 <entry><structfield>typtypmod</structfield></entry>
7230 <entry><type>int4</type></entry>
7233 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7234 to be applied to their base type (-1 if base type does not use a
7235 <literal>typmod</>). -1 if this type is not a domain.
7240 <entry><structfield>typndims</structfield></entry>
7241 <entry><type>int4</type></entry>
7244 <structfield>typndims</structfield> is the number of array dimensions
7245 for a domain over an array (that is, <structfield>typbasetype</> is
7247 Zero for types other than domains over array types.
7252 <entry><structfield>typcollation</structfield></entry>
7253 <entry><type>oid</type></entry>
7254 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7256 <structfield>typcollation</structfield> specifies the collation
7257 of the type. If the type does not support collations, this will
7258 be zero. A base type that supports collations will have
7259 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7260 collatable type can have some other collation OID, if one was
7261 specified for the domain.
7266 <entry><structfield>typdefaultbin</structfield></entry>
7267 <entry><type>pg_node_tree</type></entry>
7270 If <structfield>typdefaultbin</> is not null, it is the
7271 <function>nodeToString()</function>
7272 representation of a default expression for the type. This is
7273 only used for domains.
7278 <entry><structfield>typdefault</structfield></entry>
7279 <entry><type>text</type></entry>
7282 <structfield>typdefault</> is null if the type has no associated
7283 default value. If <structfield>typdefaultbin</> is not null,
7284 <structfield>typdefault</> must contain a human-readable version of the
7285 default expression represented by <structfield>typdefaultbin</>. If
7286 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7287 not, then <structfield>typdefault</> is the external representation of
7288 the type's default value, which can be fed to the type's input
7289 converter to produce a constant.
7294 <entry><structfield>typacl</structfield></entry>
7295 <entry><type>aclitem[]</type></entry>
7298 Access privileges; see
7299 <xref linkend="sql-grant"> and
7300 <xref linkend="sql-revoke">
7309 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7310 of <structfield>typcategory</>. Any future additions to this list will
7311 also be upper-case ASCII letters. All other ASCII characters are reserved
7312 for user-defined categories.
7315 <table id="catalog-typcategory-table">
7316 <title><structfield>typcategory</> Codes</title>
7322 <entry>Category</entry>
7328 <entry><literal>A</literal></entry>
7329 <entry>Array types</entry>
7332 <entry><literal>B</literal></entry>
7333 <entry>Boolean types</entry>
7336 <entry><literal>C</literal></entry>
7337 <entry>Composite types</entry>
7340 <entry><literal>D</literal></entry>
7341 <entry>Date/time types</entry>
7344 <entry><literal>E</literal></entry>
7345 <entry>Enum types</entry>
7348 <entry><literal>G</literal></entry>
7349 <entry>Geometric types</entry>
7352 <entry><literal>I</literal></entry>
7353 <entry>Network address types</entry>
7356 <entry><literal>N</literal></entry>
7357 <entry>Numeric types</entry>
7360 <entry><literal>P</literal></entry>
7361 <entry>Pseudo-types</entry>
7364 <entry><literal>R</literal></entry>
7365 <entry>Range types</entry>
7368 <entry><literal>S</literal></entry>
7369 <entry>String types</entry>
7372 <entry><literal>T</literal></entry>
7373 <entry>Timespan types</entry>
7376 <entry><literal>U</literal></entry>
7377 <entry>User-defined types</entry>
7380 <entry><literal>V</literal></entry>
7381 <entry>Bit-string types</entry>
7384 <entry><literal>X</literal></entry>
7385 <entry><type>unknown</> type</entry>
7394 <sect1 id="catalog-pg-user-mapping">
7395 <title><structname>pg_user_mapping</structname></title>
7397 <indexterm zone="catalog-pg-user-mapping">
7398 <primary>pg_user_mapping</primary>
7402 The catalog <structname>pg_user_mapping</structname> stores
7403 the mappings from local user to remote. Access to this catalog is
7404 restricted from normal users, use the view
7405 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7410 <title><structname>pg_user_mapping</> Columns</title>
7417 <entry>References</entry>
7418 <entry>Description</entry>
7424 <entry><structfield>oid</structfield></entry>
7425 <entry><type>oid</type></entry>
7427 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7431 <entry><structfield>umuser</structfield></entry>
7432 <entry><type>oid</type></entry>
7433 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7434 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7438 <entry><structfield>umserver</structfield></entry>
7439 <entry><type>oid</type></entry>
7440 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7442 The OID of the foreign server that contains this mapping
7447 <entry><structfield>umoptions</structfield></entry>
7448 <entry><type>text[]</type></entry>
7451 User mapping specific options, as <quote>keyword=value</> strings
7460 <sect1 id="views-overview">
7461 <title>System Views</title>
7464 In addition to the system catalogs, <productname>PostgreSQL</productname>
7465 provides a number of built-in views. Some system views provide convenient
7466 access to some commonly used queries on the system catalogs. Other views
7467 provide access to internal server state.
7471 The information schema (<xref linkend="information-schema">) provides
7472 an alternative set of views which overlap the functionality of the system
7473 views. Since the information schema is SQL-standard whereas the views
7474 described here are <productname>PostgreSQL</productname>-specific,
7475 it's usually better to use the information schema if it provides all
7476 the information you need.
7480 <xref linkend="view-table"> lists the system views described here.
7481 More detailed documentation of each view follows below.
7482 There are some additional views that provide access to the results of
7483 the statistics collector; they are described in <xref
7484 linkend="monitoring-stats-views-table">.
7488 Except where noted, all the views described here are read-only.
7491 <table id="view-table">
7492 <title>System Views</title>
7497 <entry>View Name</entry>
7498 <entry>Purpose</entry>
7504 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7505 <entry>available extensions</entry>
7509 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7510 <entry>available versions of extensions</entry>
7514 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7515 <entry>open cursors</entry>
7519 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
7520 <entry>summary of configuration file contents</entry>
7524 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7525 <entry>groups of database users</entry>
7529 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7530 <entry>indexes</entry>
7534 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7535 <entry>currently held locks</entry>
7539 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7540 <entry>materialized views</entry>
7544 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7545 <entry>policies</entry>
7549 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7550 <entry>prepared statements</entry>
7554 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7555 <entry>prepared transactions</entry>
7559 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7560 <entry>database roles</entry>
7564 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7565 <entry>rules</entry>
7569 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7570 <entry>security labels</entry>
7574 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7575 <entry>parameter settings</entry>
7579 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7580 <entry>database users</entry>
7584 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7585 <entry>planner statistics</entry>
7589 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7590 <entry>tables</entry>
7594 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7595 <entry>time zone abbreviations</entry>
7599 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7600 <entry>time zone names</entry>
7604 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7605 <entry>database users</entry>
7609 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7610 <entry>user mappings</entry>
7614 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7615 <entry>views</entry>
7623 <sect1 id="view-pg-available-extensions">
7624 <title><structname>pg_available_extensions</structname></title>
7626 <indexterm zone="view-pg-available-extensions">
7627 <primary>pg_available_extensions</primary>
7631 The <structname>pg_available_extensions</structname> view lists the
7632 extensions that are available for installation.
7634 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7635 catalog, which shows the extensions currently installed.
7639 <title><structname>pg_available_extensions</> Columns</title>
7646 <entry>Description</entry>
7652 <entry><structfield>name</structfield></entry>
7653 <entry><type>name</type></entry>
7654 <entry>Extension name</entry>
7658 <entry><structfield>default_version</structfield></entry>
7659 <entry><type>text</type></entry>
7660 <entry>Name of default version, or <literal>NULL</literal> if none is
7665 <entry><structfield>installed_version</structfield></entry>
7666 <entry><type>text</type></entry>
7667 <entry>Currently installed version of the extension,
7668 or <literal>NULL</literal> if not installed</entry>
7672 <entry><structfield>comment</structfield></entry>
7673 <entry><type>text</type></entry>
7674 <entry>Comment string from the extension's control file</entry>
7681 The <structname>pg_available_extensions</structname> view is read only.
7685 <sect1 id="view-pg-available-extension-versions">
7686 <title><structname>pg_available_extension_versions</structname></title>
7688 <indexterm zone="view-pg-available-extension-versions">
7689 <primary>pg_available_extension_versions</primary>
7693 The <structname>pg_available_extension_versions</structname> view lists the
7694 specific extension versions that are available for installation.
7696 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7697 catalog, which shows the extensions currently installed.
7701 <title><structname>pg_available_extension_versions</> Columns</title>
7708 <entry>Description</entry>
7714 <entry><structfield>name</structfield></entry>
7715 <entry><type>name</type></entry>
7716 <entry>Extension name</entry>
7720 <entry><structfield>version</structfield></entry>
7721 <entry><type>text</type></entry>
7722 <entry>Version name</entry>
7726 <entry><structfield>installed</structfield></entry>
7727 <entry><type>bool</type></entry>
7728 <entry>True if this version of this extension is currently
7733 <entry><structfield>superuser</structfield></entry>
7734 <entry><type>bool</type></entry>
7735 <entry>True if only superusers are allowed to install this extension</entry>
7739 <entry><structfield>relocatable</structfield></entry>
7740 <entry><type>bool</type></entry>
7741 <entry>True if extension can be relocated to another schema</entry>
7745 <entry><structfield>schema</structfield></entry>
7746 <entry><type>name</type></entry>
7747 <entry>Name of the schema that the extension must be installed into,
7748 or <literal>NULL</literal> if partially or fully relocatable</entry>
7752 <entry><structfield>requires</structfield></entry>
7753 <entry><type>name[]</type></entry>
7754 <entry>Names of prerequisite extensions,
7755 or <literal>NULL</literal> if none</entry>
7759 <entry><structfield>comment</structfield></entry>
7760 <entry><type>text</type></entry>
7761 <entry>Comment string from the extension's control file</entry>
7768 The <structname>pg_available_extension_versions</structname> view is read
7773 <sect1 id="view-pg-cursors">
7774 <title><structname>pg_cursors</structname></title>
7776 <indexterm zone="view-pg-cursors">
7777 <primary>pg_cursors</primary>
7781 The <structname>pg_cursors</structname> view lists the cursors that
7782 are currently available. Cursors can be defined in several ways:
7786 via the <xref linkend="sql-declare">
7793 via the Bind message in the frontend/backend protocol, as
7794 described in <xref linkend="protocol-flow-ext-query">
7800 via the Server Programming Interface (SPI), as described in
7801 <xref linkend="spi-interface">
7806 The <structname>pg_cursors</structname> view displays cursors
7807 created by any of these means. Cursors only exist for the duration
7808 of the transaction that defines them, unless they have been
7809 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7810 cursors are only present in the view until the end of their
7811 creating transaction.
7815 Cursors are used internally to implement some of the components
7816 of <productname>PostgreSQL</>, such as procedural languages.
7817 Therefore, the <structname>pg_cursors</> view might include cursors
7818 that have not been explicitly created by the user.
7824 <title><structname>pg_cursors</> Columns</title>
7831 <entry>Description</entry>
7837 <entry><structfield>name</structfield></entry>
7838 <entry><type>text</type></entry>
7839 <entry>The name of the cursor</entry>
7843 <entry><structfield>statement</structfield></entry>
7844 <entry><type>text</type></entry>
7845 <entry>The verbatim query string submitted to declare this cursor</entry>
7849 <entry><structfield>is_holdable</structfield></entry>
7850 <entry><type>boolean</type></entry>
7852 <literal>true</literal> if the cursor is holdable (that is, it
7853 can be accessed after the transaction that declared the cursor
7854 has committed); <literal>false</literal> otherwise
7859 <entry><structfield>is_binary</structfield></entry>
7860 <entry><type>boolean</type></entry>
7862 <literal>true</literal> if the cursor was declared
7863 <literal>BINARY</literal>; <literal>false</literal>
7869 <entry><structfield>is_scrollable</structfield></entry>
7870 <entry><type>boolean</type></entry>
7872 <literal>true</> if the cursor is scrollable (that is, it
7873 allows rows to be retrieved in a nonsequential manner);
7874 <literal>false</literal> otherwise
7879 <entry><structfield>creation_time</structfield></entry>
7880 <entry><type>timestamptz</type></entry>
7881 <entry>The time at which the cursor was declared</entry>
7888 The <structname>pg_cursors</structname> view is read only.
7893 <sect1 id="view-pg-file-settings">
7894 <title><structname>pg_file_settings</structname></title>
7896 <indexterm zone="view-pg-file-settings">
7897 <primary>pg_file_settings</primary>
7901 The view <structname>pg_file_settings</structname> provides a summary of
7902 the contents of the server's configuration file(s). A row appears in
7903 this view for each <quote>name = value</> entry appearing in the files,
7904 with annotations indicating whether the value could be applied
7905 successfully. Additional row(s) may appear for problems not linked to
7906 a <quote>name = value</> entry, such as syntax errors in the files.
7910 This view is helpful for checking whether planned changes in the
7911 configuration files will work, or for diagnosing a previous failure.
7912 Note that this view reports on the <emphasis>current</> contents of the
7913 files, not on what was last applied by the server. (The
7914 <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
7915 view is usually sufficient to determine that.)
7919 The <structname>pg_file_settings</structname> view can be read only by
7924 <title><structname>pg_file_settings</> Columns</title>
7931 <entry>Description</entry>
7936 <entry><structfield>sourcefile</structfield></entry>
7937 <entry><structfield>text</structfield></entry>
7938 <entry>Full pathname of the configuration file</entry>
7941 <entry><structfield>sourceline</structfield></entry>
7942 <entry><structfield>integer</structfield></entry>
7944 Line number within the configuration file where the entry appears
7948 <entry><structfield>seqno</structfield></entry>
7949 <entry><structfield>integer</structfield></entry>
7950 <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
7953 <entry><structfield>name</structfield></entry>
7954 <entry><structfield>text</structfield></entry>
7955 <entry>Configuration parameter name</entry>
7958 <entry><structfield>setting</structfield></entry>
7959 <entry><structfield>text</structfield></entry>
7960 <entry>Value to be assigned to the parameter</entry>
7963 <entry><structfield>applied</structfield></entry>
7964 <entry><structfield>boolean</structfield></entry>
7965 <entry>True if the value can be applied successfully</entry>
7968 <entry><structfield>error</structfield></entry>
7969 <entry><structfield>text</structfield></entry>
7970 <entry>If not null, an error message indicating why this entry could
7971 not be applied</entry>
7978 If the configuration file contains syntax errors or invalid parameter
7979 names, the server will not attempt to apply any settings from it, and
7980 therefore all the <structfield>applied</> fields will read as false.
7981 In such a case there will be one or more rows with
7982 non-null <structfield>error</structfield> fields indicating the
7983 problem(s). Otherwise, individual settings will be applied if possible.
7984 If an individual setting cannot be applied (e.g., invalid value, or the
7985 setting cannot be changed after server start) it will have an appropriate
7986 message in the <structfield>error</structfield> field. Another way that
7987 an entry might have <structfield>applied</> = false is that it is
7988 overridden by a later entry for the same parameter name; this case is not
7989 considered an error so nothing appears in
7990 the <structfield>error</structfield> field.
7994 See <xref linkend="config-setting"> for more information about the various
7995 ways to change run-time parameters.
8000 <sect1 id="view-pg-group">
8001 <title><structname>pg_group</structname></title>
8003 <indexterm zone="view-pg-group">
8004 <primary>pg_group</primary>
8008 The view <structname>pg_group</structname> exists for backwards
8009 compatibility: it emulates a catalog that existed in
8010 <productname>PostgreSQL</productname> before version 8.1.
8011 It shows the names and members of all roles that are marked as not
8012 <structfield>rolcanlogin</>, which is an approximation to the set
8013 of roles that are being used as groups.
8017 <title><structname>pg_group</> Columns</title>
8024 <entry>References</entry>
8025 <entry>Description</entry>
8031 <entry><structfield>groname</structfield></entry>
8032 <entry><type>name</type></entry>
8033 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8034 <entry>Name of the group</entry>
8038 <entry><structfield>grosysid</structfield></entry>
8039 <entry><type>oid</type></entry>
8040 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8041 <entry>ID of this group</entry>
8045 <entry><structfield>grolist</structfield></entry>
8046 <entry><type>oid[]</type></entry>
8047 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8048 <entry>An array containing the IDs of the roles in this group</entry>
8056 <sect1 id="view-pg-indexes">
8057 <title><structname>pg_indexes</structname></title>
8059 <indexterm zone="view-pg-indexes">
8060 <primary>pg_indexes</primary>
8064 The view <structname>pg_indexes</structname> provides access to
8065 useful information about each index in the database.
8069 <title><structname>pg_indexes</> Columns</title>
8076 <entry>References</entry>
8077 <entry>Description</entry>
8082 <entry><structfield>schemaname</structfield></entry>
8083 <entry><type>name</type></entry>
8084 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8085 <entry>Name of schema containing table and index</entry>
8088 <entry><structfield>tablename</structfield></entry>
8089 <entry><type>name</type></entry>
8090 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8091 <entry>Name of table the index is for</entry>
8094 <entry><structfield>indexname</structfield></entry>
8095 <entry><type>name</type></entry>
8096 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8097 <entry>Name of index</entry>
8100 <entry><structfield>tablespace</structfield></entry>
8101 <entry><type>name</type></entry>
8102 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8103 <entry>Name of tablespace containing index (null if default for database)</entry>
8106 <entry><structfield>indexdef</structfield></entry>
8107 <entry><type>text</type></entry>
8109 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8118 <sect1 id="view-pg-locks">
8119 <title><structname>pg_locks</structname></title>
8121 <indexterm zone="view-pg-locks">
8122 <primary>pg_locks</primary>
8126 The view <structname>pg_locks</structname> provides access to
8127 information about the locks held by open transactions within the
8128 database server. See <xref linkend="mvcc"> for more discussion
8133 <structname>pg_locks</structname> contains one row per active lockable
8134 object, requested lock mode, and relevant transaction. Thus, the same
8135 lockable object might
8136 appear many times, if multiple transactions are holding or waiting
8137 for locks on it. However, an object that currently has no locks on it
8138 will not appear at all.
8142 There are several distinct types of lockable objects:
8143 whole relations (e.g., tables), individual pages of relations,
8144 individual tuples of relations,
8145 transaction IDs (both virtual and permanent IDs),
8146 and general database objects (identified by class OID and object OID,
8147 in the same way as in <structname>pg_description</structname> or
8148 <structname>pg_depend</structname>). Also, the right to extend a
8149 relation is represented as a separate lockable object.
8150 Also, <quote>advisory</> locks can be taken on numbers that have
8151 user-defined meanings.
8155 <title><structname>pg_locks</> Columns</title>
8162 <entry>References</entry>
8163 <entry>Description</entry>
8168 <entry><structfield>locktype</structfield></entry>
8169 <entry><type>text</type></entry>
8172 Type of the lockable object:
8173 <literal>relation</>,
8177 <literal>transactionid</>,
8178 <literal>virtualxid</>,
8180 <literal>userlock</>, or
8181 <literal>advisory</>
8185 <entry><structfield>database</structfield></entry>
8186 <entry><type>oid</type></entry>
8187 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8189 OID of the database in which the lock target exists, or
8190 zero if the target is a shared object, or
8191 null if the target is a transaction ID
8195 <entry><structfield>relation</structfield></entry>
8196 <entry><type>oid</type></entry>
8197 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8199 OID of the relation targeted by the lock, or null if the target is not
8200 a relation or part of a relation
8204 <entry><structfield>page</structfield></entry>
8205 <entry><type>integer</type></entry>
8208 Page number targeted by the lock within the relation,
8209 or null if the target is not a relation page or tuple
8213 <entry><structfield>tuple</structfield></entry>
8214 <entry><type>smallint</type></entry>
8217 Tuple number targeted by the lock within the page,
8218 or null if the target is not a tuple
8222 <entry><structfield>virtualxid</structfield></entry>
8223 <entry><type>text</type></entry>
8226 Virtual ID of the transaction targeted by the lock,
8227 or null if the target is not a virtual transaction ID
8231 <entry><structfield>transactionid</structfield></entry>
8232 <entry><type>xid</type></entry>
8235 ID of the transaction targeted by the lock,
8236 or null if the target is not a transaction ID
8240 <entry><structfield>classid</structfield></entry>
8241 <entry><type>oid</type></entry>
8242 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8244 OID of the system catalog containing the lock target, or null if the
8245 target is not a general database object
8249 <entry><structfield>objid</structfield></entry>
8250 <entry><type>oid</type></entry>
8251 <entry>any OID column</entry>
8253 OID of the lock target within its system catalog, or null if the
8254 target is not a general database object
8258 <entry><structfield>objsubid</structfield></entry>
8259 <entry><type>smallint</type></entry>
8262 Column number targeted by the lock (the
8263 <structfield>classid</> and <structfield>objid</> refer to the
8265 or zero if the target is some other general database object,
8266 or null if the target is not a general database object
8270 <entry><structfield>virtualtransaction</structfield></entry>
8271 <entry><type>text</type></entry>
8274 Virtual ID of the transaction that is holding or awaiting this lock
8278 <entry><structfield>pid</structfield></entry>
8279 <entry><type>integer</type></entry>
8282 Process ID of the server process holding or awaiting this
8283 lock, or null if the lock is held by a prepared transaction
8287 <entry><structfield>mode</structfield></entry>
8288 <entry><type>text</type></entry>
8290 <entry>Name of the lock mode held or desired by this process (see <xref
8291 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8294 <entry><structfield>granted</structfield></entry>
8295 <entry><type>boolean</type></entry>
8297 <entry>True if lock is held, false if lock is awaited</entry>
8300 <entry><structfield>fastpath</structfield></entry>
8301 <entry><type>boolean</type></entry>
8303 <entry>True if lock was taken via fast path, false if taken via main
8311 <structfield>granted</structfield> is true in a row representing a lock
8312 held by the indicated transaction. False indicates that this transaction is
8313 currently waiting to acquire this lock, which implies that some other
8314 transaction is holding a conflicting lock mode on the same lockable object.
8315 The waiting transaction will sleep until the other lock is released (or a
8316 deadlock situation is detected). A single transaction can be waiting to
8317 acquire at most one lock at a time.
8321 Every transaction holds an exclusive lock on its virtual transaction ID for
8322 its entire duration. If a permanent ID is assigned to the transaction
8323 (which normally happens only if the transaction changes the state of the
8324 database), it also holds an exclusive lock on its permanent transaction ID
8325 until it ends. When one transaction finds it necessary to wait specifically
8326 for another transaction, it does so by attempting to acquire share lock on
8327 the other transaction ID (either virtual or permanent ID depending on the
8328 situation). That will succeed only when the other transaction
8329 terminates and releases its locks.
8333 Although tuples are a lockable type of object,
8334 information about row-level locks is stored on disk, not in memory,
8335 and therefore row-level locks normally do not appear in this view.
8336 If a transaction is waiting for a
8337 row-level lock, it will usually appear in the view as waiting for the
8338 permanent transaction ID of the current holder of that row lock.
8342 Advisory locks can be acquired on keys consisting of either a single
8343 <type>bigint</type> value or two integer values.
8344 A <type>bigint</type> key is displayed with its
8345 high-order half in the <structfield>classid</> column, its low-order half
8346 in the <structfield>objid</> column, and <structfield>objsubid</> equal
8347 to 1. The original <type>bigint</type> value can be reassembled with the
8348 expression <literal>(classid::bigint << 32) |
8349 objid::bigint</literal>. Integer keys are displayed with the
8351 <structfield>classid</> column, the second key in the <structfield>objid</>
8352 column, and <structfield>objsubid</> equal to 2. The actual meaning of
8353 the keys is up to the user. Advisory locks are local to each database,
8354 so the <structfield>database</> column is meaningful for an advisory lock.
8358 <structname>pg_locks</structname> provides a global view of all locks
8359 in the database cluster, not only those relevant to the current database.
8360 Although its <structfield>relation</structfield> column can be joined
8361 against <structname>pg_class</>.<structfield>oid</> to identify locked
8362 relations, this will only work correctly for relations in the current
8363 database (those for which the <structfield>database</structfield> column
8364 is either the current database's OID or zero).
8368 The <structfield>pid</structfield> column can be joined to the
8369 <structfield>pid</structfield> column of the <link
8370 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8372 information on the session holding or waiting to hold each lock,
8375 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8376 ON pl.pid = psa.pid;
8378 Also, if you are using prepared transactions, the
8379 <structfield>virtualtransaction</> column can be joined to the
8380 <structfield>transaction</structfield> column of the <link
8381 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8382 view to get more information on prepared transactions that hold locks.
8383 (A prepared transaction can never be waiting for a lock,
8384 but it continues to hold the locks it acquired while running.)
8387 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8388 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8393 The <structname>pg_locks</structname> view displays data from both the
8394 regular lock manager and the predicate lock manager, which are
8395 separate systems; in addition, the regular lock manager subdivides its
8396 locks into regular and <firstterm>fast-path</> locks.
8397 This data is not guaranteed to be entirely consistent.
8398 When the view is queried,
8399 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8400 is gathered from each backend one at a time, without freezing the state of
8401 the entire lock manager, so it is possible for locks to be taken or
8402 released while information is gathered. Note, however, that these locks are
8403 known not to conflict with any other lock currently in place. After
8404 all backends have been queried for fast-path locks, the remainder of the
8405 regular lock manager is locked as a unit, and a consistent snapshot of all
8406 remaining locks is collected as an atomic action. After unlocking the
8407 regular lock manager, the predicate lock manager is similarly locked and all
8408 predicate locks are collected as an atomic action. Thus, with the exception
8409 of fast-path locks, each lock manager will deliver a consistent set of
8410 results, but as we do not lock both lock managers simultaneously, it is
8411 possible for locks to be taken or released after we interrogate the regular
8412 lock manager and before we interrogate the predicate lock manager.
8416 Locking the regular and/or predicate lock manager could have some
8417 impact on database performance if this view is very frequently accessed.
8418 The locks are held only for the minimum amount of time necessary to
8419 obtain data from the lock managers, but this does not completely eliminate
8420 the possibility of a performance impact.
8425 <sect1 id="view-pg-matviews">
8426 <title><structname>pg_matviews</structname></title>
8428 <indexterm zone="view-pg-matviews">
8429 <primary>pg_matviews</primary>
8432 <indexterm zone="view-pg-matviews">
8433 <primary>materialized views</primary>
8437 The view <structname>pg_matviews</structname> provides access to
8438 useful information about each materialized view in the database.
8442 <title><structname>pg_matviews</> Columns</title>
8449 <entry>References</entry>
8450 <entry>Description</entry>
8455 <entry><structfield>schemaname</structfield></entry>
8456 <entry><type>name</type></entry>
8457 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8458 <entry>Name of schema containing materialized view</entry>
8461 <entry><structfield>matviewname</structfield></entry>
8462 <entry><type>name</type></entry>
8463 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8464 <entry>Name of materialized view</entry>
8467 <entry><structfield>matviewowner</structfield></entry>
8468 <entry><type>name</type></entry>
8469 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8470 <entry>Name of materialized view's owner</entry>
8473 <entry><structfield>tablespace</structfield></entry>
8474 <entry><type>name</type></entry>
8475 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8476 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8479 <entry><structfield>hasindexes</structfield></entry>
8480 <entry><type>boolean</type></entry>
8482 <entry>True if materialized view has (or recently had) any indexes</entry>
8485 <entry><structfield>ispopulated</structfield></entry>
8486 <entry><type>boolean</type></entry>
8488 <entry>True if materialized view is currently populated</entry>
8491 <entry><structfield>definition</structfield></entry>
8492 <entry><type>text</type></entry>
8494 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8502 <sect1 id="view-pg-policies">
8503 <title><structname>pg_policies</structname></title>
8505 <indexterm zone="view-pg-policies">
8506 <primary>pg_policies</primary>
8510 The view <structname>pg_policies</structname> provides access to
8511 useful information about each row-level security policy in the database.
8515 <title><structname>pg_policies</> Columns</title>
8522 <entry>References</entry>
8523 <entry>Description</entry>
8528 <entry><structfield>schemaname</structfield></entry>
8529 <entry><type>name</type></entry>
8530 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8531 <entry>Name of schema containing table policy is on</entry>
8534 <entry><structfield>tablename</structfield></entry>
8535 <entry><type>name</type></entry>
8536 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8537 <entry>Name of table policy is on</entry>
8540 <entry><structfield>policyname</structfield></entry>
8541 <entry><type>name</type></entry>
8542 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
8543 <entry>Name of policy</entry>
8546 <entry><structfield>roles</structfield></entry>
8547 <entry><type>name[]</type></entry>
8549 <entry>The roles to which this policy applies</entry>
8552 <entry><structfield>cmd</structfield></entry>
8553 <entry><type>text</type></entry>
8555 <entry>The command type to which the policy is applied</entry>
8558 <entry><structfield>qual</structfield></entry>
8559 <entry><type>text</type></entry>
8561 <entry>The expression added to the security barrier qualifications for
8562 queries that this policy applies to</entry>
8565 <entry><structfield>with_check</structfield></entry>
8566 <entry><type>text</type></entry>
8568 <entry>The expression added to the WITH CHECK qualifications for
8569 queries that attempt to add rows to this table</entry>
8577 <sect1 id="view-pg-prepared-statements">
8578 <title><structname>pg_prepared_statements</structname></title>
8580 <indexterm zone="view-pg-prepared-statements">
8581 <primary>pg_prepared_statements</primary>
8585 The <structname>pg_prepared_statements</structname> view displays
8586 all the prepared statements that are available in the current
8587 session. See <xref linkend="sql-prepare"> for more information about prepared
8592 <structname>pg_prepared_statements</structname> contains one row
8593 for each prepared statement. Rows are added to the view when a new
8594 prepared statement is created and removed when a prepared statement
8595 is released (for example, via the <xref linkend="sql-deallocate"> command).
8599 <title><structname>pg_prepared_statements</> Columns</title>
8606 <entry>Description</entry>
8611 <entry><structfield>name</structfield></entry>
8612 <entry><type>text</type></entry>
8614 The identifier of the prepared statement
8618 <entry><structfield>statement</structfield></entry>
8619 <entry><type>text</type></entry>
8621 The query string submitted by the client to create this
8622 prepared statement. For prepared statements created via SQL,
8623 this is the <command>PREPARE</command> statement submitted by
8624 the client. For prepared statements created via the
8625 frontend/backend protocol, this is the text of the prepared
8630 <entry><structfield>prepare_time</structfield></entry>
8631 <entry><type>timestamptz</type></entry>
8633 The time at which the prepared statement was created
8637 <entry><structfield>parameter_types</structfield></entry>
8638 <entry><type>regtype[]</type></entry>
8640 The expected parameter types for the prepared statement in the
8641 form of an array of <type>regtype</type>. The OID corresponding
8642 to an element of this array can be obtained by casting the
8643 <type>regtype</type> value to <type>oid</type>.
8647 <entry><structfield>from_sql</structfield></entry>
8648 <entry><type>boolean</type></entry>
8650 <literal>true</literal> if the prepared statement was created
8651 via the <command>PREPARE</command> SQL statement;
8652 <literal>false</literal> if the statement was prepared via the
8653 frontend/backend protocol
8661 The <structname>pg_prepared_statements</structname> view is read only.
8665 <sect1 id="view-pg-prepared-xacts">
8666 <title><structname>pg_prepared_xacts</structname></title>
8668 <indexterm zone="view-pg-prepared-xacts">
8669 <primary>pg_prepared_xacts</primary>
8673 The view <structname>pg_prepared_xacts</structname> displays
8674 information about transactions that are currently prepared for two-phase
8675 commit (see <xref linkend="sql-prepare-transaction"> for details).
8679 <structname>pg_prepared_xacts</structname> contains one row per prepared
8680 transaction. An entry is removed when the transaction is committed or
8685 <title><structname>pg_prepared_xacts</> Columns</title>
8692 <entry>References</entry>
8693 <entry>Description</entry>
8698 <entry><structfield>transaction</structfield></entry>
8699 <entry><type>xid</type></entry>
8702 Numeric transaction identifier of the prepared transaction
8706 <entry><structfield>gid</structfield></entry>
8707 <entry><type>text</type></entry>
8710 Global transaction identifier that was assigned to the transaction
8714 <entry><structfield>prepared</structfield></entry>
8715 <entry><type>timestamp with time zone</type></entry>
8718 Time at which the transaction was prepared for commit
8722 <entry><structfield>owner</structfield></entry>
8723 <entry><type>name</type></entry>
8724 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8726 Name of the user that executed the transaction
8730 <entry><structfield>database</structfield></entry>
8731 <entry><type>name</type></entry>
8732 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8734 Name of the database in which the transaction was executed
8742 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8743 internal transaction manager data structures are momentarily locked, and
8744 a copy is made for the view to display. This ensures that the
8745 view produces a consistent set of results, while not blocking
8746 normal operations longer than necessary. Nonetheless
8747 there could be some impact on database performance if this view is
8748 frequently accessed.
8753 <sect1 id="view-pg-roles">
8754 <title><structname>pg_roles</structname></title>
8756 <indexterm zone="view-pg-roles">
8757 <primary>pg_roles</primary>
8761 The view <structname>pg_roles</structname> provides access to
8762 information about database roles. This is simply a publicly
8764 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8765 that blanks out the password field.
8769 This view explicitly exposes the OID column of the underlying table,
8770 since that is needed to do joins to other catalogs.
8774 <title><structname>pg_roles</> Columns</title>
8781 <entry>References</entry>
8782 <entry>Description</entry>
8788 <entry><structfield>rolname</structfield></entry>
8789 <entry><type>name</type></entry>
8791 <entry>Role name</entry>
8795 <entry><structfield>rolsuper</structfield></entry>
8796 <entry><type>bool</type></entry>
8798 <entry>Role has superuser privileges</entry>
8802 <entry><structfield>rolinherit</structfield></entry>
8803 <entry><type>bool</type></entry>
8805 <entry>Role automatically inherits privileges of roles it is a
8810 <entry><structfield>rolcreaterole</structfield></entry>
8811 <entry><type>bool</type></entry>
8813 <entry>Role can create more roles</entry>
8817 <entry><structfield>rolcreatedb</structfield></entry>
8818 <entry><type>bool</type></entry>
8820 <entry>Role can create databases</entry>
8824 <entry><structfield>rolcanlogin</structfield></entry>
8825 <entry><type>bool</type></entry>
8828 Role can log in. That is, this role can be given as the initial
8829 session authorization identifier
8834 <entry><structfield>rolreplication</structfield></entry>
8835 <entry><type>bool</type></entry>
8838 Role is a replication role. That is, this role can initiate streaming
8839 replication (see <xref linkend="streaming-replication">) and set/unset
8840 the system backup mode using <function>pg_start_backup</> and
8841 <function>pg_stop_backup</>
8846 <entry><structfield>rolconnlimit</structfield></entry>
8847 <entry><type>int4</type></entry>
8850 For roles that can log in, this sets maximum number of concurrent
8851 connections this role can make. -1 means no limit.
8856 <entry><structfield>rolpassword</structfield></entry>
8857 <entry><type>text</type></entry>
8859 <entry>Not the password (always reads as <literal>********</>)</entry>
8863 <entry><structfield>rolvaliduntil</structfield></entry>
8864 <entry><type>timestamptz</type></entry>
8866 <entry>Password expiry time (only used for password authentication);
8867 null if no expiration</entry>
8871 <entry><structfield>rolconfig</structfield></entry>
8872 <entry><type>text[]</type></entry>
8874 <entry>Role-specific defaults for run-time configuration variables</entry>
8878 <entry><structfield>oid</structfield></entry>
8879 <entry><type>oid</type></entry>
8880 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8881 <entry>ID of role</entry>
8889 <sect1 id="view-pg-rules">
8890 <title><structname>pg_rules</structname></title>
8892 <indexterm zone="view-pg-rules">
8893 <primary>pg_rules</primary>
8897 The view <structname>pg_rules</structname> provides access to
8898 useful information about query rewrite rules.
8902 <title><structname>pg_rules</> Columns</title>
8909 <entry>References</entry>
8910 <entry>Description</entry>
8915 <entry><structfield>schemaname</structfield></entry>
8916 <entry><type>name</type></entry>
8917 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8918 <entry>Name of schema containing table</entry>
8921 <entry><structfield>tablename</structfield></entry>
8922 <entry><type>name</type></entry>
8923 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8924 <entry>Name of table the rule is for</entry>
8927 <entry><structfield>rulename</structfield></entry>
8928 <entry><type>name</type></entry>
8929 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8930 <entry>Name of rule</entry>
8933 <entry><structfield>definition</structfield></entry>
8934 <entry><type>text</type></entry>
8936 <entry>Rule definition (a reconstructed creation command)</entry>
8943 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8944 of views and materialized views; those can be seen in
8945 <structname>pg_views</> and <structname>pg_matviews</>.
8950 <sect1 id="view-pg-seclabels">
8951 <title><structname>pg_seclabels</structname></title>
8953 <indexterm zone="view-pg-seclabels">
8954 <primary>pg_seclabels</primary>
8958 The view <structname>pg_seclabels</structname> provides information about
8959 security labels. It as an easier-to-query version of the
8960 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
8964 <title><structname>pg_seclabels</> Columns</title>
8971 <entry>References</entry>
8972 <entry>Description</entry>
8977 <entry><structfield>objoid</structfield></entry>
8978 <entry><type>oid</type></entry>
8979 <entry>any OID column</entry>
8980 <entry>The OID of the object this security label pertains to</entry>
8983 <entry><structfield>classoid</structfield></entry>
8984 <entry><type>oid</type></entry>
8985 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8986 <entry>The OID of the system catalog this object appears in</entry>
8989 <entry><structfield>objsubid</structfield></entry>
8990 <entry><type>int4</type></entry>
8993 For a security label on a table column, this is the column number (the
8994 <structfield>objoid</> and <structfield>classoid</> refer to
8995 the table itself). For all other object types, this column is
9000 <entry><structfield>objtype</structfield></entry>
9001 <entry><type>text</type></entry>
9004 The type of object to which this label applies, as text.
9008 <entry><structfield>objnamespace</structfield></entry>
9009 <entry><type>oid</type></entry>
9010 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9012 The OID of the namespace for this object, if applicable;
9017 <entry><structfield>objname</structfield></entry>
9018 <entry><type>text</type></entry>
9021 The name of the object to which this label applies, as text.
9025 <entry><structfield>provider</structfield></entry>
9026 <entry><type>text</type></entry>
9027 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9028 <entry>The label provider associated with this label.</entry>
9031 <entry><structfield>label</structfield></entry>
9032 <entry><type>text</type></entry>
9033 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
9034 <entry>The security label applied to this object.</entry>
9041 <sect1 id="view-pg-settings">
9042 <title><structname>pg_settings</structname></title>
9044 <indexterm zone="view-pg-settings">
9045 <primary>pg_settings</primary>
9049 The view <structname>pg_settings</structname> provides access to
9050 run-time parameters of the server. It is essentially an alternative
9051 interface to the <xref linkend="sql-show">
9052 and <xref linkend="sql-set"> commands.
9053 It also provides access to some facts about each parameter that are
9054 not directly available from <command>SHOW</>, such as minimum and
9059 <title><structname>pg_settings</> Columns</title>
9066 <entry>Description</entry>
9071 <entry><structfield>name</structfield></entry>
9072 <entry><type>text</type></entry>
9073 <entry>Run-time configuration parameter name</entry>
9076 <entry><structfield>setting</structfield></entry>
9077 <entry><type>text</type></entry>
9078 <entry>Current value of the parameter</entry>
9081 <entry><structfield>unit</structfield></entry>
9082 <entry><type>text</type></entry>
9083 <entry>Implicit unit of the parameter</entry>
9086 <entry><structfield>category</structfield></entry>
9087 <entry><type>text</type></entry>
9088 <entry>Logical group of the parameter</entry>
9091 <entry><structfield>short_desc</structfield></entry>
9092 <entry><type>text</type></entry>
9093 <entry>A brief description of the parameter</entry>
9096 <entry><structfield>extra_desc</structfield></entry>
9097 <entry><type>text</type></entry>
9098 <entry>Additional, more detailed, description of the parameter</entry>
9101 <entry><structfield>context</structfield></entry>
9102 <entry><type>text</type></entry>
9103 <entry>Context required to set the parameter's value (see below)</entry>
9106 <entry><structfield>vartype</structfield></entry>
9107 <entry><type>text</type></entry>
9108 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
9109 <literal>integer</>, <literal>real</>, or <literal>string</>)
9113 <entry><structfield>source</structfield></entry>
9114 <entry><type>text</type></entry>
9115 <entry>Source of the current parameter value</entry>
9118 <entry><structfield>min_val</structfield></entry>
9119 <entry><type>text</type></entry>
9120 <entry>Minimum allowed value of the parameter (null for non-numeric
9124 <entry><structfield>max_val</structfield></entry>
9125 <entry><type>text</type></entry>
9126 <entry>Maximum allowed value of the parameter (null for non-numeric
9130 <entry><structfield>enumvals</structfield></entry>
9131 <entry><type>text[]</type></entry>
9132 <entry>Allowed values of an enum parameter (null for non-enum
9136 <entry><structfield>boot_val</structfield></entry>
9137 <entry><type>text</type></entry>
9138 <entry>Parameter value assumed at server startup if the parameter is
9139 not otherwise set</entry>
9142 <entry><structfield>reset_val</structfield></entry>
9143 <entry><type>text</type></entry>
9144 <entry>Value that <command>RESET</command> would reset the parameter to
9145 in the current session</entry>
9148 <entry><structfield>sourcefile</structfield></entry>
9149 <entry><type>text</type></entry>
9150 <entry>Configuration file the current value was set in (null for
9151 values set from sources other than configuration files, or when
9152 examined by a non-superuser);
9153 helpful when using <literal>include</> directives in configuration files</entry>
9156 <entry><structfield>sourceline</structfield></entry>
9157 <entry><type>integer</type></entry>
9158 <entry>Line number within the configuration file the current value was
9159 set at (null for values set from sources other than configuration files,
9160 or when examined by a non-superuser)
9164 <entry><structfield>pending_restart</structfield></entry>
9165 <entry><type>boolean</type></entry>
9166 <entry><literal>true</literal> if the value has been changed in the
9167 configuration file but needs a restart; or <literal>false</literal>
9176 There are several possible values of <structfield>context</structfield>.
9177 In order of decreasing difficulty of changing the setting, they are:
9182 <!-- PGC_INTERNAL -->
9183 <term><literal>internal</literal></term>
9186 These settings cannot be changed directly; they reflect internally
9187 determined values. Some of them may be adjustable by rebuilding the
9188 server with different configuration options, or by changing options
9189 supplied to <command>initdb</command>.
9194 <!-- PGC_POSTMASTER -->
9195 <term><literal>postmaster</literal></term>
9198 These settings can only be applied when the server starts, so any change
9199 requires restarting the server. Values for these settings are typically
9200 stored in the <filename>postgresql.conf</filename> file, or passed on
9201 the command line when starting the server. Of course, settings with any
9202 of the lower <structfield>context</structfield> types can also be
9203 set at server start time.
9209 <term><literal>sighup</literal></term>
9212 Changes to these settings can be made in
9213 <filename>postgresql.conf</filename> without restarting the server.
9214 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
9215 cause it to re-read <filename>postgresql.conf</filename> and apply
9216 the changes. The postmaster will also forward the
9217 <systemitem>SIGHUP</systemitem> signal to its child processes so that
9218 they all pick up the new value.
9223 <!-- PGC_SU_BACKEND -->
9224 <term><literal>superuser-backend</literal></term>
9227 Changes to these settings can be made in
9228 <filename>postgresql.conf</filename> without restarting the server.
9229 They can also be set for a particular session in the connection request
9230 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9231 environment variable), but only if the connecting user is a superuser.
9232 However, these settings never change in a session after it is started.
9233 If you change them in <filename>postgresql.conf</filename>, send a
9234 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9235 re-read <filename>postgresql.conf</filename>. The new values will only
9236 affect subsequently-launched sessions.
9241 <!-- PGC_BACKEND -->
9242 <term><literal>backend</literal></term>
9245 Changes to these settings can be made in
9246 <filename>postgresql.conf</filename> without restarting the server.
9247 They can also be set for a particular session in the connection request
9248 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9249 environment variable); any user can make such a change for his session.
9250 However, these settings never change in a session after it is started.
9251 If you change them in <filename>postgresql.conf</filename>, send a
9252 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9253 re-read <filename>postgresql.conf</filename>. The new values will only
9254 affect subsequently-launched sessions.
9260 <term><literal>superuser</literal></term>
9263 These settings can be set from <filename>postgresql.conf</filename>,
9264 or within a session via the <command>SET</> command; but only superusers
9265 can change them via <command>SET</>. Changes in
9266 <filename>postgresql.conf</filename> will affect existing sessions
9267 only if no session-local value has been established with <command>SET</>.
9272 <!-- PGC_USERSET -->
9273 <term><literal>user</literal></term>
9276 These settings can be set from <filename>postgresql.conf</filename>,
9277 or within a session via the <command>SET</> command. Any user is
9278 allowed to change his session-local value. Changes in
9279 <filename>postgresql.conf</filename> will affect existing sessions
9280 only if no session-local value has been established with <command>SET</>.
9287 See <xref linkend="config-setting"> for more information about the various
9288 ways to change these parameters.
9292 The <structname>pg_settings</structname> view cannot be inserted into or
9293 deleted from, but it can be updated. An <command>UPDATE</command> applied
9294 to a row of <structname>pg_settings</structname> is equivalent to executing
9295 the <xref linkend="sql-set"> command on that named
9296 parameter. The change only affects the value used by the current
9297 session. If an <command>UPDATE</command> is issued within a transaction
9298 that is later aborted, the effects of the <command>UPDATE</command> command
9299 disappear when the transaction is rolled back. Once the surrounding
9300 transaction is committed, the effects will persist until the end of the
9301 session, unless overridden by another <command>UPDATE</command> or
9302 <command>SET</command>.
9307 <sect1 id="view-pg-shadow">
9308 <title><structname>pg_shadow</structname></title>
9310 <indexterm zone="view-pg-shadow">
9311 <primary>pg_shadow</primary>
9315 The view <structname>pg_shadow</structname> exists for backwards
9316 compatibility: it emulates a catalog that existed in
9317 <productname>PostgreSQL</productname> before version 8.1.
9318 It shows properties of all roles that are marked as
9319 <structfield>rolcanlogin</> in
9320 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
9324 The name stems from the fact that this table
9325 should not be readable by the public since it contains passwords.
9326 <link linkend="view-pg-user"><structname>pg_user</structname></link>
9327 is a publicly readable view on
9328 <structname>pg_shadow</structname> that blanks out the password field.
9332 <title><structname>pg_shadow</> Columns</title>
9339 <entry>References</entry>
9340 <entry>Description</entry>
9346 <entry><structfield>usename</structfield></entry>
9347 <entry><type>name</type></entry>
9348 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9349 <entry>User name</entry>
9353 <entry><structfield>usesysid</structfield></entry>
9354 <entry><type>oid</type></entry>
9355 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9356 <entry>ID of this user</entry>
9360 <entry><structfield>usecreatedb</structfield></entry>
9361 <entry><type>bool</type></entry>
9363 <entry>User can create databases</entry>
9367 <entry><structfield>usesuper</structfield></entry>
9368 <entry><type>bool</type></entry>
9370 <entry>User is a superuser</entry>
9374 <entry><structfield>userepl</structfield></entry>
9375 <entry><type>bool</type></entry>
9378 User can initiate streaming replication and put the system in and
9384 <entry><structfield>usebypassrls</structfield></entry>
9385 <entry><type>bool</type></entry>
9388 User can bypass row level security policies, see
9389 <xref linkend="ddl-rowsecurity"> for more information.
9394 <entry><structfield>passwd</structfield></entry>
9395 <entry><type>text</type></entry>
9397 <entry>Password (possibly encrypted); null if none. See
9398 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9399 for details of how encrypted passwords are stored.</entry>
9403 <entry><structfield>valuntil</structfield></entry>
9404 <entry><type>abstime</type></entry>
9406 <entry>Password expiry time (only used for password authentication)</entry>
9410 <entry><structfield>useconfig</structfield></entry>
9411 <entry><type>text[]</type></entry>
9413 <entry>Session defaults for run-time configuration variables</entry>
9421 <sect1 id="view-pg-stats">
9422 <title><structname>pg_stats</structname></title>
9424 <indexterm zone="view-pg-stats">
9425 <primary>pg_stats</primary>
9429 The view <structname>pg_stats</structname> provides access to
9430 the information stored in the <link
9431 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
9432 catalog. This view allows access only to rows of
9433 <structname>pg_statistic</structname> that correspond to tables the
9434 user has permission to read, and therefore it is safe to allow public
9435 read access to this view.
9439 <structname>pg_stats</structname> is also designed to present the
9440 information in a more readable format than the underlying catalog
9441 — at the cost that its schema must be extended whenever new slot types
9442 are defined for <structname>pg_statistic</structname>.
9446 <title><structname>pg_stats</> Columns</title>
9453 <entry>References</entry>
9454 <entry>Description</entry>
9459 <entry><structfield>schemaname</structfield></entry>
9460 <entry><type>name</type></entry>
9461 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9462 <entry>Name of schema containing table</entry>
9466 <entry><structfield>tablename</structfield></entry>
9467 <entry><type>name</type></entry>
9468 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9469 <entry>Name of table</entry>
9473 <entry><structfield>attname</structfield></entry>
9474 <entry><type>name</type></entry>
9475 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9476 <entry>Name of the column described by this row</entry>
9480 <entry><structfield>inherited</structfield></entry>
9481 <entry><type>bool</type></entry>
9483 <entry>If true, this row includes inheritance child columns, not just the
9484 values in the specified table</entry>
9488 <entry><structfield>null_frac</structfield></entry>
9489 <entry><type>real</type></entry>
9491 <entry>Fraction of column entries that are null</entry>
9495 <entry><structfield>avg_width</structfield></entry>
9496 <entry><type>integer</type></entry>
9498 <entry>Average width in bytes of column's entries</entry>
9502 <entry><structfield>n_distinct</structfield></entry>
9503 <entry><type>real</type></entry>
9506 If greater than zero, the estimated number of distinct values in the
9507 column. If less than zero, the negative of the number of distinct
9508 values divided by the number of rows. (The negated form is used when
9509 <command>ANALYZE</> believes that the number of distinct values is
9510 likely to increase as the table grows; the positive form is used when
9511 the column seems to have a fixed number of possible values.) For
9512 example, -1 indicates a unique column in which the number of distinct
9513 values is the same as the number of rows.
9518 <entry><structfield>most_common_vals</structfield></entry>
9519 <entry><type>anyarray</type></entry>
9522 A list of the most common values in the column. (Null if
9523 no values seem to be more common than any others.)
9528 <entry><structfield>most_common_freqs</structfield></entry>
9529 <entry><type>real[]</type></entry>
9532 A list of the frequencies of the most common values,
9533 i.e., number of occurrences of each divided by total number of rows.
9534 (Null when <structfield>most_common_vals</structfield> is.)
9539 <entry><structfield>histogram_bounds</structfield></entry>
9540 <entry><type>anyarray</type></entry>
9543 A list of values that divide the column's values into groups of
9544 approximately equal population. The values in
9545 <structfield>most_common_vals</>, if present, are omitted from this
9546 histogram calculation. (This column is null if the column data type
9547 does not have a <literal><</> operator or if the
9548 <structfield>most_common_vals</> list accounts for the entire
9554 <entry><structfield>correlation</structfield></entry>
9555 <entry><type>real</type></entry>
9558 Statistical correlation between physical row ordering and
9559 logical ordering of the column values. This ranges from -1 to +1.
9560 When the value is near -1 or +1, an index scan on the column will
9561 be estimated to be cheaper than when it is near zero, due to reduction
9562 of random access to the disk. (This column is null if the column data
9563 type does not have a <literal><</> operator.)
9568 <entry><structfield>most_common_elems</structfield></entry>
9569 <entry><type>anyarray</type></entry>
9572 A list of non-null element values most often appearing within values of
9573 the column. (Null for scalar types.)
9578 <entry><structfield>most_common_elem_freqs</structfield></entry>
9579 <entry><type>real[]</type></entry>
9582 A list of the frequencies of the most common element values, i.e., the
9583 fraction of rows containing at least one instance of the given value.
9584 Two or three additional values follow the per-element frequencies;
9585 these are the minimum and maximum of the preceding per-element
9586 frequencies, and optionally the frequency of null elements.
9587 (Null when <structfield>most_common_elems</structfield> is.)
9592 <entry><structfield>elem_count_histogram</structfield></entry>
9593 <entry><type>real[]</type></entry>
9596 A histogram of the counts of distinct non-null element values within the
9597 values of the column, followed by the average number of distinct
9598 non-null elements. (Null for scalar types.)
9606 The maximum number of entries in the array fields can be controlled on a
9607 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9608 command, or globally by setting the
9609 <xref linkend="guc-default-statistics-target"> run-time parameter.
9614 <sect1 id="view-pg-tables">
9615 <title><structname>pg_tables</structname></title>
9617 <indexterm zone="view-pg-tables">
9618 <primary>pg_tables</primary>
9622 The view <structname>pg_tables</structname> provides access to
9623 useful information about each table in the database.
9627 <title><structname>pg_tables</> Columns</title>
9634 <entry>References</entry>
9635 <entry>Description</entry>
9640 <entry><structfield>schemaname</structfield></entry>
9641 <entry><type>name</type></entry>
9642 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9643 <entry>Name of schema containing table</entry>
9646 <entry><structfield>tablename</structfield></entry>
9647 <entry><type>name</type></entry>
9648 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9649 <entry>Name of table</entry>
9652 <entry><structfield>tableowner</structfield></entry>
9653 <entry><type>name</type></entry>
9654 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9655 <entry>Name of table's owner</entry>
9658 <entry><structfield>tablespace</structfield></entry>
9659 <entry><type>name</type></entry>
9660 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9661 <entry>Name of tablespace containing table (null if default for database)</entry>
9664 <entry><structfield>hasindexes</structfield></entry>
9665 <entry><type>boolean</type></entry>
9666 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9667 <entry>True if table has (or recently had) any indexes</entry>
9670 <entry><structfield>hasrules</structfield></entry>
9671 <entry><type>boolean</type></entry>
9672 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9673 <entry>True if table has (or once had) rules</entry>
9676 <entry><structfield>hastriggers</structfield></entry>
9677 <entry><type>boolean</type></entry>
9678 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9679 <entry>True if table has (or once had) triggers</entry>
9682 <entry><structfield>rowsecurity</structfield></entry>
9683 <entry><type>boolean</type></entry>
9684 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
9685 <entry>True if row security is enabled on the table</entry>
9693 <sect1 id="view-pg-timezone-abbrevs">
9694 <title><structname>pg_timezone_abbrevs</structname></title>
9696 <indexterm zone="view-pg-timezone-abbrevs">
9697 <primary>pg_timezone_abbrevs</primary>
9701 The view <structname>pg_timezone_abbrevs</structname> provides a list
9702 of time zone abbreviations that are currently recognized by the datetime
9703 input routines. The contents of this view change when the
9704 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9708 <title><structname>pg_timezone_abbrevs</> Columns</title>
9715 <entry>Description</entry>
9720 <entry><structfield>abbrev</structfield></entry>
9721 <entry><type>text</type></entry>
9722 <entry>Time zone abbreviation</entry>
9725 <entry><structfield>utc_offset</structfield></entry>
9726 <entry><type>interval</type></entry>
9727 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9730 <entry><structfield>is_dst</structfield></entry>
9731 <entry><type>boolean</type></entry>
9732 <entry>True if this is a daylight-savings abbreviation</entry>
9740 <sect1 id="view-pg-timezone-names">
9741 <title><structname>pg_timezone_names</structname></title>
9743 <indexterm zone="view-pg-timezone-names">
9744 <primary>pg_timezone_names</primary>
9748 The view <structname>pg_timezone_names</structname> provides a list
9749 of time zone names that are recognized by <command>SET TIMEZONE</>,
9750 along with their associated abbreviations, UTC offsets,
9751 and daylight-savings status. (Technically,
9752 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9753 than UTC because leap seconds are not handled.)
9754 Unlike the abbreviations shown in <link
9755 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9756 date rules. Therefore, the associated information changes across local DST
9757 boundaries. The displayed information is computed based on the current
9758 value of <function>CURRENT_TIMESTAMP</>.
9762 <title><structname>pg_timezone_names</> Columns</title>
9769 <entry>Description</entry>
9774 <entry><structfield>name</structfield></entry>
9775 <entry><type>text</type></entry>
9776 <entry>Time zone name</entry>
9779 <entry><structfield>abbrev</structfield></entry>
9780 <entry><type>text</type></entry>
9781 <entry>Time zone abbreviation</entry>
9784 <entry><structfield>utc_offset</structfield></entry>
9785 <entry><type>interval</type></entry>
9786 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9789 <entry><structfield>is_dst</structfield></entry>
9790 <entry><type>boolean</type></entry>
9791 <entry>True if currently observing daylight savings</entry>
9799 <sect1 id="view-pg-user">
9800 <title><structname>pg_user</structname></title>
9802 <indexterm zone="view-pg-user">
9803 <primary>pg_user</primary>
9807 The view <structname>pg_user</structname> provides access to
9808 information about database users. This is simply a publicly
9810 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9811 that blanks out the password field.
9815 <title><structname>pg_user</> Columns</title>
9822 <entry>Description</entry>
9827 <entry><structfield>usename</structfield></entry>
9828 <entry><type>name</type></entry>
9829 <entry>User name</entry>
9833 <entry><structfield>usesysid</structfield></entry>
9834 <entry><type>oid</type></entry>
9835 <entry>ID of this user</entry>
9839 <entry><structfield>usecreatedb</structfield></entry>
9840 <entry><type>bool</type></entry>
9841 <entry>User can create databases</entry>
9845 <entry><structfield>usesuper</structfield></entry>
9846 <entry><type>bool</type></entry>
9847 <entry>User is a superuser</entry>
9851 <entry><structfield>userepl</structfield></entry>
9852 <entry><type>bool</type></entry>
9854 User can initiate streaming replication and put the system in and
9860 <entry><structfield>usebypassrls</structfield></entry>
9861 <entry><type>bool</type></entry>
9863 User can bypass row level security policies, see
9864 <xref linkend="ddl-rowsecurity"> for more information.
9869 <entry><structfield>passwd</structfield></entry>
9870 <entry><type>text</type></entry>
9871 <entry>Not the password (always reads as <literal>********</>)</entry>
9875 <entry><structfield>valuntil</structfield></entry>
9876 <entry><type>abstime</type></entry>
9877 <entry>Password expiry time (only used for password authentication)</entry>
9881 <entry><structfield>useconfig</structfield></entry>
9882 <entry><type>text[]</type></entry>
9883 <entry>Session defaults for run-time configuration variables</entry>
9891 <sect1 id="view-pg-user-mappings">
9892 <title><structname>pg_user_mappings</structname></title>
9894 <indexterm zone="view-pg-user-mappings">
9895 <primary>pg_user_mappings</primary>
9899 The view <structname>pg_user_mappings</structname> provides access
9900 to information about user mappings. This is essentially a publicly
9902 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9903 that leaves out the options field if the user has no rights to use
9908 <title><structname>pg_user_mappings</> Columns</title>
9915 <entry>References</entry>
9916 <entry>Description</entry>
9922 <entry><structfield>umid</structfield></entry>
9923 <entry><type>oid</type></entry>
9924 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
9925 <entry>OID of the user mapping</entry>
9929 <entry><structfield>srvid</structfield></entry>
9930 <entry><type>oid</type></entry>
9931 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
9933 The OID of the foreign server that contains this mapping
9938 <entry><structfield>srvname</structfield></entry>
9939 <entry><type>name</type></entry>
9940 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
9942 Name of the foreign server
9947 <entry><structfield>umuser</structfield></entry>
9948 <entry><type>oid</type></entry>
9949 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9950 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
9954 <entry><structfield>usename</structfield></entry>
9955 <entry><type>name</type></entry>
9957 <entry>Name of the local user to be mapped</entry>
9961 <entry><structfield>umoptions</structfield></entry>
9962 <entry><type>text[]</type></entry>
9965 User mapping specific options, as <quote>keyword=value</>
9966 strings, if the current user is the owner of the foreign
9976 <sect1 id="view-pg-views">
9977 <title><structname>pg_views</structname></title>
9979 <indexterm zone="view-pg-views">
9980 <primary>pg_views</primary>
9984 The view <structname>pg_views</structname> provides access to
9985 useful information about each view in the database.
9989 <title><structname>pg_views</> Columns</title>
9996 <entry>References</entry>
9997 <entry>Description</entry>
10002 <entry><structfield>schemaname</structfield></entry>
10003 <entry><type>name</type></entry>
10004 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10005 <entry>Name of schema containing view</entry>
10008 <entry><structfield>viewname</structfield></entry>
10009 <entry><type>name</type></entry>
10010 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10011 <entry>Name of view</entry>
10014 <entry><structfield>viewowner</structfield></entry>
10015 <entry><type>name</type></entry>
10016 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10017 <entry>Name of view's owner</entry>
10020 <entry><structfield>definition</structfield></entry>
10021 <entry><type>text</type></entry>
10023 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>