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-tablesample-method"><structname>pg_tablesample_method</structname></link></entry>
283 <entry>table sampling methods</entry>
287 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
288 <entry>tablespaces within this database cluster</entry>
292 <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
293 <entry>transforms (data type to procedural language conversions)</entry>
297 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
298 <entry>triggers</entry>
302 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
303 <entry>text search configurations</entry>
307 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
308 <entry>text search configurations' token mappings</entry>
312 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
313 <entry>text search dictionaries</entry>
317 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
318 <entry>text search parsers</entry>
322 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
323 <entry>text search templates</entry>
327 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
328 <entry>data types</entry>
332 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
333 <entry>mappings of users to foreign servers</entry>
341 <sect1 id="catalog-pg-aggregate">
342 <title><structname>pg_aggregate</structname></title>
344 <indexterm zone="catalog-pg-aggregate">
345 <primary>pg_aggregate</primary>
349 The catalog <structname>pg_aggregate</structname> stores information about
350 aggregate functions. An aggregate function is a function that
351 operates on a set of values (typically one column from each row
352 that matches a query condition) and returns a single value computed
353 from all these values. Typical aggregate functions are
354 <function>sum</function>, <function>count</function>, and
355 <function>max</function>. Each entry in
356 <structname>pg_aggregate</structname> is an extension of an entry
357 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
358 entry carries the aggregate's name, input and output data types, and
359 other information that is similar to ordinary functions.
363 <title><structname>pg_aggregate</> Columns</title>
370 <entry>References</entry>
371 <entry>Description</entry>
376 <entry><structfield>aggfnoid</structfield></entry>
377 <entry><type>regproc</type></entry>
378 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
379 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
382 <entry><structfield>aggkind</structfield></entry>
383 <entry><type>char</type></entry>
385 <entry>Aggregate kind:
386 <literal>n</literal> for <quote>normal</> aggregates,
387 <literal>o</literal> for <quote>ordered-set</> aggregates, or
388 <literal>h</literal> for <quote>hypothetical-set</> aggregates
392 <entry><structfield>aggnumdirectargs</structfield></entry>
393 <entry><type>int2</type></entry>
395 <entry>Number of direct (non-aggregated) arguments of an ordered-set or
396 hypothetical-set aggregate, counting a variadic array as one argument.
397 If equal to <structfield>pronargs</>, the aggregate must be variadic
398 and the variadic array describes the aggregated arguments as well as
399 the final direct arguments.
400 Always zero for normal aggregates.</entry>
403 <entry><structfield>aggtransfn</structfield></entry>
404 <entry><type>regproc</type></entry>
405 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
406 <entry>Transition function</entry>
409 <entry><structfield>aggfinalfn</structfield></entry>
410 <entry><type>regproc</type></entry>
411 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
412 <entry>Final function (zero if none)</entry>
415 <entry><structfield>aggmtransfn</structfield></entry>
416 <entry><type>regproc</type></entry>
417 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
418 <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
421 <entry><structfield>aggminvtransfn</structfield></entry>
422 <entry><type>regproc</type></entry>
423 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
424 <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
427 <entry><structfield>aggmfinalfn</structfield></entry>
428 <entry><type>regproc</type></entry>
429 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
430 <entry>Final function for moving-aggregate mode (zero if none)</entry>
433 <entry><structfield>aggfinalextra</structfield></entry>
434 <entry><type>bool</type></entry>
436 <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
439 <entry><structfield>aggmfinalextra</structfield></entry>
440 <entry><type>bool</type></entry>
442 <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
445 <entry><structfield>aggsortop</structfield></entry>
446 <entry><type>oid</type></entry>
447 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
448 <entry>Associated sort operator (zero if none)</entry>
451 <entry><structfield>aggtranstype</structfield></entry>
452 <entry><type>oid</type></entry>
453 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
454 <entry>Data type of the aggregate function's internal transition (state) data</entry>
457 <entry><structfield>aggtransspace</structfield></entry>
458 <entry><type>int4</type></entry>
460 <entry>Approximate average size (in bytes) of the transition state
461 data, or zero to use a default estimate</entry>
464 <entry><structfield>aggmtranstype</structfield></entry>
465 <entry><type>oid</type></entry>
466 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
467 <entry>Data type of the aggregate function's internal transition (state)
468 data for moving-aggregate mode (zero if none)</entry>
471 <entry><structfield>aggmtransspace</structfield></entry>
472 <entry><type>int4</type></entry>
474 <entry>Approximate average size (in bytes) of the transition state data
475 for moving-aggregate mode, or zero to use a default estimate</entry>
478 <entry><structfield>agginitval</structfield></entry>
479 <entry><type>text</type></entry>
482 The initial value of the transition state. This is a text
483 field containing the initial value in its external string
484 representation. If this field is null, the transition state
485 value starts out null.
489 <entry><structfield>aggminitval</structfield></entry>
490 <entry><type>text</type></entry>
493 The initial value of the transition state for moving-aggregate mode.
494 This is a text field containing the initial value in its external
495 string representation. If this field is null, the transition state
496 value starts out null.
504 New aggregate functions are registered with the <xref
505 linkend="sql-createaggregate">
506 command. See <xref linkend="xaggr"> for more information about
507 writing aggregate functions and the meaning of the transition
514 <sect1 id="catalog-pg-am">
515 <title><structname>pg_am</structname></title>
517 <indexterm zone="catalog-pg-am">
518 <primary>pg_am</primary>
522 The catalog <structname>pg_am</structname> stores information about index
523 access methods. There is one row for each index access method supported by
524 the system. The contents of this catalog are discussed in detail in
525 <xref linkend="indexam">.
529 <title><structname>pg_am</> Columns</title>
536 <entry>References</entry>
537 <entry>Description</entry>
543 <entry><structfield>oid</structfield></entry>
544 <entry><type>oid</type></entry>
546 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
550 <entry><structfield>amname</structfield></entry>
551 <entry><type>name</type></entry>
553 <entry>Name of the access method</entry>
557 <entry><structfield>amstrategies</structfield></entry>
558 <entry><type>int2</type></entry>
560 <entry>Number of operator strategies for this access method,
561 or zero if access method does not have a fixed set of operator
566 <entry><structfield>amsupport</structfield></entry>
567 <entry><type>int2</type></entry>
569 <entry>Number of support routines for this access method</entry>
573 <entry><structfield>amcanorder</structfield></entry>
574 <entry><type>bool</type></entry>
576 <entry>Does the access method support ordered scans sorted by the
577 indexed column's value?</entry>
581 <entry><structfield>amcanorderbyop</structfield></entry>
582 <entry><type>bool</type></entry>
584 <entry>Does the access method support ordered scans sorted by the result
585 of an operator on the indexed column?</entry>
589 <entry><structfield>amcanbackward</structfield></entry>
590 <entry><type>bool</type></entry>
592 <entry>Does the access method support backward scanning?</entry>
596 <entry><structfield>amcanunique</structfield></entry>
597 <entry><type>bool</type></entry>
599 <entry>Does the access method support unique indexes?</entry>
603 <entry><structfield>amcanmulticol</structfield></entry>
604 <entry><type>bool</type></entry>
606 <entry>Does the access method support multicolumn indexes?</entry>
610 <entry><structfield>amoptionalkey</structfield></entry>
611 <entry><type>bool</type></entry>
613 <entry>Does the access method support a scan without any constraint
614 for the first index column?</entry>
618 <entry><structfield>amsearcharray</structfield></entry>
619 <entry><type>bool</type></entry>
621 <entry>Does the access method support <literal>ScalarArrayOpExpr</> searches?</entry>
625 <entry><structfield>amsearchnulls</structfield></entry>
626 <entry><type>bool</type></entry>
628 <entry>Does the access method support <literal>IS NULL</>/<literal>NOT NULL</> searches?</entry>
632 <entry><structfield>amstorage</structfield></entry>
633 <entry><type>bool</type></entry>
635 <entry>Can index storage data type differ from column data type?</entry>
639 <entry><structfield>amclusterable</structfield></entry>
640 <entry><type>bool</type></entry>
642 <entry>Can an index of this type be clustered on?</entry>
646 <entry><structfield>ampredlocks</structfield></entry>
647 <entry><type>bool</type></entry>
649 <entry>Does an index of this type manage fine-grained predicate locks?</entry>
653 <entry><structfield>amkeytype</structfield></entry>
654 <entry><type>oid</type></entry>
655 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
656 <entry>Type of data stored in index, or zero if not a fixed type</entry>
660 <entry><structfield>aminsert</structfield></entry>
661 <entry><type>regproc</type></entry>
662 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
663 <entry><quote>Insert this tuple</quote> function</entry>
667 <entry><structfield>ambeginscan</structfield></entry>
668 <entry><type>regproc</type></entry>
669 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
670 <entry><quote>Prepare for index scan</quote> function</entry>
674 <entry><structfield>amgettuple</structfield></entry>
675 <entry><type>regproc</type></entry>
676 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
677 <entry><quote>Next valid tuple</quote> function, or zero if none</entry>
681 <entry><structfield>amgetbitmap</structfield></entry>
682 <entry><type>regproc</type></entry>
683 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
684 <entry><quote>Fetch all valid tuples</quote> function, or zero if none</entry>
688 <entry><structfield>amrescan</structfield></entry>
689 <entry><type>regproc</type></entry>
690 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
691 <entry><quote>(Re)start index scan</quote> function</entry>
695 <entry><structfield>amendscan</structfield></entry>
696 <entry><type>regproc</type></entry>
697 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
698 <entry><quote>Clean up after index scan</quote> function</entry>
702 <entry><structfield>ammarkpos</structfield></entry>
703 <entry><type>regproc</type></entry>
704 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
705 <entry><quote>Mark current scan position</quote> function</entry>
709 <entry><structfield>amrestrpos</structfield></entry>
710 <entry><type>regproc</type></entry>
711 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
712 <entry><quote>Restore marked scan position</quote> function</entry>
716 <entry><structfield>ambuild</structfield></entry>
717 <entry><type>regproc</type></entry>
718 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
719 <entry><quote>Build new index</quote> function</entry>
723 <entry><structfield>ambuildempty</structfield></entry>
724 <entry><type>regproc</type></entry>
725 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
726 <entry><quote>Build empty index</quote> function</entry>
730 <entry><structfield>ambulkdelete</structfield></entry>
731 <entry><type>regproc</type></entry>
732 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
733 <entry>Bulk-delete function</entry>
737 <entry><structfield>amvacuumcleanup</structfield></entry>
738 <entry><type>regproc</type></entry>
739 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
740 <entry>Post-<command>VACUUM</command> cleanup function</entry>
744 <entry><structfield>amcanreturn</structfield></entry>
745 <entry><type>regproc</type></entry>
746 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
747 <entry>Function to check whether an index column supports index-only
748 scans. Can be zero if index-only scans are never supported.</entry>
752 <entry><structfield>amcostestimate</structfield></entry>
753 <entry><type>regproc</type></entry>
754 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
755 <entry>Function to estimate cost of an index scan</entry>
759 <entry><structfield>amoptions</structfield></entry>
760 <entry><type>regproc</type></entry>
761 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
762 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
772 <sect1 id="catalog-pg-amop">
773 <title><structname>pg_amop</structname></title>
775 <indexterm zone="catalog-pg-amop">
776 <primary>pg_amop</primary>
780 The catalog <structname>pg_amop</structname> stores information about
781 operators associated with access method operator families. There is one
782 row for each operator that is a member of an operator family. A family
783 member can be either a <firstterm>search</> operator or an
784 <firstterm>ordering</> operator. An operator
785 can appear in more than one family, but cannot appear in more than one
786 search position nor more than one ordering position within a family.
787 (It is allowed, though unlikely, for an operator to be used for both
788 search and ordering purposes.)
792 <title><structname>pg_amop</> Columns</title>
799 <entry>References</entry>
800 <entry>Description</entry>
806 <entry><structfield>oid</structfield></entry>
807 <entry><type>oid</type></entry>
809 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
813 <entry><structfield>amopfamily</structfield></entry>
814 <entry><type>oid</type></entry>
815 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
816 <entry>The operator family this entry is for</entry>
820 <entry><structfield>amoplefttype</structfield></entry>
821 <entry><type>oid</type></entry>
822 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
823 <entry>Left-hand input data type of operator</entry>
827 <entry><structfield>amoprighttype</structfield></entry>
828 <entry><type>oid</type></entry>
829 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
830 <entry>Right-hand input data type of operator</entry>
834 <entry><structfield>amopstrategy</structfield></entry>
835 <entry><type>int2</type></entry>
837 <entry>Operator strategy number</entry>
841 <entry><structfield>amoppurpose</structfield></entry>
842 <entry><type>char</type></entry>
844 <entry>Operator purpose, either <literal>s</> for search or
845 <literal>o</> for ordering</entry>
849 <entry><structfield>amopopr</structfield></entry>
850 <entry><type>oid</type></entry>
851 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
852 <entry>OID of the operator</entry>
856 <entry><structfield>amopmethod</structfield></entry>
857 <entry><type>oid</type></entry>
858 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
859 <entry>Index access method operator family is for</entry>
863 <entry><structfield>amopsortfamily</structfield></entry>
864 <entry><type>oid</type></entry>
865 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
866 <entry>The B-tree operator family this entry sorts according to, if an
867 ordering operator; zero if a search operator</entry>
875 A <quote>search</> operator entry indicates that an index of this operator
876 family can be searched to find all rows satisfying
878 <replaceable>indexed_column</>
879 <replaceable>operator</>
880 <replaceable>constant</>.
881 Obviously, such an operator must return <type>boolean</type>, and its left-hand input
882 type must match the index's column data type.
886 An <quote>ordering</> operator entry indicates that an index of this
887 operator family can be scanned to return rows in the order represented by
889 <replaceable>indexed_column</>
890 <replaceable>operator</>
891 <replaceable>constant</>.
892 Such an operator could return any sortable data type, though again
893 its left-hand input type must match the index's column data type.
894 The exact semantics of the <literal>ORDER BY</> are specified by the
895 <structfield>amopsortfamily</structfield> column, which must reference
896 a B-tree operator family for the operator's result type.
901 At present, it's assumed that the sort order for an ordering operator
902 is the default for the referenced operator family, i.e., <literal>ASC NULLS
903 LAST</>. This might someday be relaxed by adding additional columns
904 to specify sort options explicitly.
909 An entry's <structfield>amopmethod</> must match the
910 <structname>opfmethod</> of its containing operator family (including
911 <structfield>amopmethod</> here is an intentional denormalization of the
912 catalog structure for performance reasons). Also,
913 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
914 the <structfield>oprleft</> and <structfield>oprright</> fields of the
915 referenced <structname>pg_operator</> entry.
921 <sect1 id="catalog-pg-amproc">
922 <title><structname>pg_amproc</structname></title>
924 <indexterm zone="catalog-pg-amproc">
925 <primary>pg_amproc</primary>
929 The catalog <structname>pg_amproc</structname> stores information about
930 support procedures associated with access method operator families. There
931 is one row for each support procedure belonging to an operator family.
935 <title><structname>pg_amproc</structname> Columns</title>
942 <entry>References</entry>
943 <entry>Description</entry>
949 <entry><structfield>oid</structfield></entry>
950 <entry><type>oid</type></entry>
952 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
956 <entry><structfield>amprocfamily</structfield></entry>
957 <entry><type>oid</type></entry>
958 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
959 <entry>The operator family this entry is for</entry>
963 <entry><structfield>amproclefttype</structfield></entry>
964 <entry><type>oid</type></entry>
965 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
966 <entry>Left-hand input data type of associated operator</entry>
970 <entry><structfield>amprocrighttype</structfield></entry>
971 <entry><type>oid</type></entry>
972 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
973 <entry>Right-hand input data type of associated operator</entry>
977 <entry><structfield>amprocnum</structfield></entry>
978 <entry><type>int2</type></entry>
980 <entry>Support procedure number</entry>
984 <entry><structfield>amproc</structfield></entry>
985 <entry><type>regproc</type></entry>
986 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
987 <entry>OID of the procedure</entry>
995 The usual interpretation of the
996 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
997 is that they identify the left and right input types of the operator(s)
998 that a particular support procedure supports. For some access methods
999 these match the input data type(s) of the support procedure itself, for
1000 others not. There is a notion of <quote>default</> support procedures for
1001 an index, which are those with <structfield>amproclefttype</> and
1002 <structfield>amprocrighttype</> both equal to the index operator class's
1003 <structfield>opcintype</>.
1009 <sect1 id="catalog-pg-attrdef">
1010 <title><structname>pg_attrdef</structname></title>
1012 <indexterm zone="catalog-pg-attrdef">
1013 <primary>pg_attrdef</primary>
1017 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
1018 about columns is stored in <structname>pg_attribute</structname>
1019 (see below). Only columns that explicitly specify a default value
1020 (when the table is created or the column is added) will have an
1025 <title><structname>pg_attrdef</> Columns</title>
1032 <entry>References</entry>
1033 <entry>Description</entry>
1039 <entry><structfield>oid</structfield></entry>
1040 <entry><type>oid</type></entry>
1042 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1046 <entry><structfield>adrelid</structfield></entry>
1047 <entry><type>oid</type></entry>
1048 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1049 <entry>The table this column belongs to</entry>
1053 <entry><structfield>adnum</structfield></entry>
1054 <entry><type>int2</type></entry>
1055 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
1056 <entry>The number of the column</entry>
1060 <entry><structfield>adbin</structfield></entry>
1061 <entry><type>pg_node_tree</type></entry>
1063 <entry>The internal representation of the column default value</entry>
1067 <entry><structfield>adsrc</structfield></entry>
1068 <entry><type>text</type></entry>
1070 <entry>A human-readable representation of the default value</entry>
1077 The <structfield>adsrc</structfield> field is historical, and is best
1078 not used, because it does not track outside changes that might affect
1079 the representation of the default value. Reverse-compiling the
1080 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
1081 example) is a better way to display the default value.
1087 <sect1 id="catalog-pg-attribute">
1088 <title><structname>pg_attribute</structname></title>
1090 <indexterm zone="catalog-pg-attribute">
1091 <primary>pg_attribute</primary>
1095 The catalog <structname>pg_attribute</structname> stores information about
1096 table columns. There will be exactly one
1097 <structname>pg_attribute</structname> row for every column in every
1098 table in the database. (There will also be attribute entries for
1099 indexes, and indeed all objects that have <structname>pg_class</structname>
1104 The term attribute is equivalent to column and is used for
1109 <title><structname>pg_attribute</> Columns</title>
1116 <entry>References</entry>
1117 <entry>Description</entry>
1123 <entry><structfield>attrelid</structfield></entry>
1124 <entry><type>oid</type></entry>
1125 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1126 <entry>The table this column belongs to</entry>
1130 <entry><structfield>attname</structfield></entry>
1131 <entry><type>name</type></entry>
1133 <entry>The column name</entry>
1137 <entry><structfield>atttypid</structfield></entry>
1138 <entry><type>oid</type></entry>
1139 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1140 <entry>The data type of this column</entry>
1144 <entry><structfield>attstattarget</structfield></entry>
1145 <entry><type>int4</type></entry>
1148 <structfield>attstattarget</structfield> controls the level of detail
1149 of statistics accumulated for this column by
1150 <xref linkend="sql-analyze">.
1151 A zero value indicates that no statistics should be collected.
1152 A negative value says to use the system default statistics target.
1153 The exact meaning of positive values is data type-dependent.
1154 For scalar data types, <structfield>attstattarget</structfield>
1155 is both the target number of <quote>most common values</quote>
1156 to collect, and the target number of histogram bins to create.
1161 <entry><structfield>attlen</structfield></entry>
1162 <entry><type>int2</type></entry>
1165 A copy of <literal>pg_type.typlen</literal> of this column's
1171 <entry><structfield>attnum</structfield></entry>
1172 <entry><type>int2</type></entry>
1175 The number of the column. Ordinary columns are numbered from 1
1176 up. System columns, such as <structfield>oid</structfield>,
1177 have (arbitrary) negative numbers.
1182 <entry><structfield>attndims</structfield></entry>
1183 <entry><type>int4</type></entry>
1186 Number of dimensions, if the column is an array type; otherwise 0.
1187 (Presently, the number of dimensions of an array is not enforced,
1188 so any nonzero value effectively means <quote>it's an array</>.)
1193 <entry><structfield>attcacheoff</structfield></entry>
1194 <entry><type>int4</type></entry>
1197 Always -1 in storage, but when loaded into a row descriptor
1198 in memory this might be updated to cache the offset of the attribute
1204 <entry><structfield>atttypmod</structfield></entry>
1205 <entry><type>int4</type></entry>
1208 <structfield>atttypmod</structfield> records type-specific data
1209 supplied at table creation time (for example, the maximum
1210 length of a <type>varchar</type> column). It is passed to
1211 type-specific input functions and length coercion functions.
1212 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1217 <entry><structfield>attbyval</structfield></entry>
1218 <entry><type>bool</type></entry>
1221 A copy of <literal>pg_type.typbyval</> of this column's type
1226 <entry><structfield>attstorage</structfield></entry>
1227 <entry><type>char</type></entry>
1230 Normally a copy of <literal>pg_type.typstorage</> of this
1231 column's type. For TOAST-able data types, this can be altered
1232 after column creation to control storage policy.
1237 <entry><structfield>attalign</structfield></entry>
1238 <entry><type>char</type></entry>
1241 A copy of <literal>pg_type.typalign</> of this column's type
1246 <entry><structfield>attnotnull</structfield></entry>
1247 <entry><type>bool</type></entry>
1250 This represents a not-null constraint.
1255 <entry><structfield>atthasdef</structfield></entry>
1256 <entry><type>bool</type></entry>
1259 This column has a default value, in which case there will be a
1260 corresponding entry in the <structname>pg_attrdef</structname>
1261 catalog that actually defines the value.
1266 <entry><structfield>attisdropped</structfield></entry>
1267 <entry><type>bool</type></entry>
1270 This column has been dropped and is no longer valid. A dropped
1271 column is still physically present in the table, but is
1272 ignored by the parser and so cannot be accessed via SQL.
1277 <entry><structfield>attislocal</structfield></entry>
1278 <entry><type>bool</type></entry>
1281 This column is defined locally in the relation. Note that a column can
1282 be locally defined and inherited simultaneously.
1287 <entry><structfield>attinhcount</structfield></entry>
1288 <entry><type>int4</type></entry>
1291 The number of direct ancestors this column has. A column with a
1292 nonzero number of ancestors cannot be dropped nor renamed.
1297 <entry><structfield>attcollation</structfield></entry>
1298 <entry><type>oid</type></entry>
1299 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1301 The defined collation of the column, or zero if the column is
1302 not of a collatable data type.
1307 <entry><structfield>attacl</structfield></entry>
1308 <entry><type>aclitem[]</type></entry>
1311 Column-level access privileges, if any have been granted specifically
1317 <entry><structfield>attoptions</structfield></entry>
1318 <entry><type>text[]</type></entry>
1321 Attribute-level options, as <quote>keyword=value</> strings
1326 <entry><structfield>attfdwoptions</structfield></entry>
1327 <entry><type>text[]</type></entry>
1330 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1339 In a dropped column's <structname>pg_attribute</structname> entry,
1340 <structfield>atttypid</structfield> is reset to zero, but
1341 <structfield>attlen</structfield> and the other fields copied from
1342 <structname>pg_type</> are still valid. This arrangement is needed
1343 to cope with the situation where the dropped column's data type was
1344 later dropped, and so there is no <structname>pg_type</> row anymore.
1345 <structfield>attlen</structfield> and the other fields can be used
1346 to interpret the contents of a row of the table.
1351 <sect1 id="catalog-pg-authid">
1352 <title><structname>pg_authid</structname></title>
1354 <indexterm zone="catalog-pg-authid">
1355 <primary>pg_authid</primary>
1359 The catalog <structname>pg_authid</structname> contains information about
1360 database authorization identifiers (roles). A role subsumes the concepts
1361 of <quote>users</> and <quote>groups</>. A user is essentially just a
1362 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1363 without <structfield>rolcanlogin</>) can have other roles as members; see
1364 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1368 Since this catalog contains passwords, it must not be publicly readable.
1369 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1370 is a publicly readable view on
1371 <structname>pg_authid</structname> that blanks out the password field.
1375 <xref linkend="user-manag"> contains detailed information about user and
1376 privilege management.
1380 Because user identities are cluster-wide,
1381 <structname>pg_authid</structname>
1382 is shared across all databases of a cluster: there is only one
1383 copy of <structname>pg_authid</structname> per cluster, not
1388 <title><structname>pg_authid</> Columns</title>
1395 <entry>Description</entry>
1402 <entry><structfield>oid</structfield></entry>
1403 <entry><type>oid</type></entry>
1404 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1408 <entry><structfield>rolname</structfield></entry>
1409 <entry><type>name</type></entry>
1410 <entry>Role name</entry>
1414 <entry><structfield>rolsuper</structfield></entry>
1415 <entry><type>bool</type></entry>
1416 <entry>Role has superuser privileges</entry>
1420 <entry><structfield>rolinherit</structfield></entry>
1421 <entry><type>bool</type></entry>
1422 <entry>Role automatically inherits privileges of roles it is a
1427 <entry><structfield>rolcreaterole</structfield></entry>
1428 <entry><type>bool</type></entry>
1429 <entry>Role can create more roles</entry>
1433 <entry><structfield>rolcreatedb</structfield></entry>
1434 <entry><type>bool</type></entry>
1435 <entry>Role can create databases</entry>
1439 <entry><structfield>rolcanlogin</structfield></entry>
1440 <entry><type>bool</type></entry>
1442 Role can log in. That is, this role can be given as the initial
1443 session authorization identifier
1448 <entry><structfield>rolreplication</structfield></entry>
1449 <entry><type>bool</type></entry>
1451 Role is a replication role. That is, this role can initiate streaming
1452 replication (see <xref linkend="streaming-replication">) and set/unset
1453 the system backup mode using <function>pg_start_backup</> and
1454 <function>pg_stop_backup</>
1459 <entry><structfield>rolbypassrls</structfield></entry>
1460 <entry><type>bool</type></entry>
1462 Role can bypass row level security policies, see
1463 <xref linkend="ddl-rowsecurity"> for more information.
1468 <entry><structfield>rolconnlimit</structfield></entry>
1469 <entry><type>int4</type></entry>
1471 For roles that can log in, this sets maximum number of concurrent
1472 connections this role can make. -1 means no limit.
1477 <entry><structfield>rolpassword</structfield></entry>
1478 <entry><type>text</type></entry>
1480 Password (possibly encrypted); null if none. If the password
1481 is encrypted, this column will begin with the string <literal>md5</>
1482 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1483 will be of the user's password concatenated to their user name.
1484 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1485 <productname>PostgreSQL</> will store the md5 hash of
1486 <literal>xyzzyjoe</>. A password that does not follow that
1487 format is assumed to be unencrypted.
1492 <entry><structfield>rolvaliduntil</structfield></entry>
1493 <entry><type>timestamptz</type></entry>
1494 <entry>Password expiry time (only used for password authentication);
1495 null if no expiration</entry>
1504 <sect1 id="catalog-pg-auth-members">
1505 <title><structname>pg_auth_members</structname></title>
1507 <indexterm zone="catalog-pg-auth-members">
1508 <primary>pg_auth_members</primary>
1512 The catalog <structname>pg_auth_members</structname> shows the membership
1513 relations between roles. Any non-circular set of relationships is allowed.
1517 Because user identities are cluster-wide,
1518 <structname>pg_auth_members</structname>
1519 is shared across all databases of a cluster: there is only one
1520 copy of <structname>pg_auth_members</structname> per cluster, not
1525 <title><structname>pg_auth_members</> Columns</title>
1532 <entry>References</entry>
1533 <entry>Description</entry>
1539 <entry><structfield>roleid</structfield></entry>
1540 <entry><type>oid</type></entry>
1541 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1542 <entry>ID of a role that has a member</entry>
1546 <entry><structfield>member</structfield></entry>
1547 <entry><type>oid</type></entry>
1548 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1549 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1553 <entry><structfield>grantor</structfield></entry>
1554 <entry><type>oid</type></entry>
1555 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1556 <entry>ID of the role that granted this membership</entry>
1560 <entry><structfield>admin_option</structfield></entry>
1561 <entry><type>bool</type></entry>
1563 <entry>True if <structfield>member</> can grant membership in
1564 <structfield>roleid</> to others</entry>
1573 <sect1 id="catalog-pg-cast">
1574 <title><structname>pg_cast</structname></title>
1576 <indexterm zone="catalog-pg-cast">
1577 <primary>pg_cast</primary>
1581 The catalog <structname>pg_cast</structname> stores data type conversion
1582 paths, both built-in and user-defined.
1586 It should be noted that <structname>pg_cast</structname> does not represent
1587 every type conversion that the system knows how to perform; only those that
1588 cannot be deduced from some generic rule. For example, casting between a
1589 domain and its base type is not explicitly represented in
1590 <structname>pg_cast</structname>. Another important exception is that
1591 <quote>automatic I/O conversion casts</>, those performed using a data
1592 type's own I/O functions to convert to or from <type>text</> or other
1593 string types, are not explicitly represented in
1594 <structname>pg_cast</structname>.
1598 <title><structname>pg_cast</> Columns</title>
1605 <entry>References</entry>
1606 <entry>Description</entry>
1612 <entry><structfield>oid</structfield></entry>
1613 <entry><type>oid</type></entry>
1615 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1619 <entry><structfield>castsource</structfield></entry>
1620 <entry><type>oid</type></entry>
1621 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1622 <entry>OID of the source data type</entry>
1626 <entry><structfield>casttarget</structfield></entry>
1627 <entry><type>oid</type></entry>
1628 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1629 <entry>OID of the target data type</entry>
1633 <entry><structfield>castfunc</structfield></entry>
1634 <entry><type>oid</type></entry>
1635 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1637 The OID of the function to use to perform this cast. Zero is
1638 stored if the cast method doesn't require a function.
1643 <entry><structfield>castcontext</structfield></entry>
1644 <entry><type>char</type></entry>
1647 Indicates what contexts the cast can be invoked in.
1648 <literal>e</> means only as an explicit cast (using
1649 <literal>CAST</> or <literal>::</> syntax).
1650 <literal>a</> means implicitly in assignment
1651 to a target column, as well as explicitly.
1652 <literal>i</> means implicitly in expressions, as well as the
1657 <entry><structfield>castmethod</structfield></entry>
1658 <entry><type>char</type></entry>
1661 Indicates how the cast is performed.
1662 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1663 <literal>i</> means that the input/output functions are used.
1664 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1672 The cast functions listed in <structname>pg_cast</structname> must
1673 always take the cast source type as their first argument type, and
1674 return the cast destination type as their result type. A cast
1675 function can have up to three arguments. The second argument,
1676 if present, must be type <type>integer</>; it receives the type
1677 modifier associated with the destination type, or -1
1678 if there is none. The third argument,
1679 if present, must be type <type>boolean</>; it receives <literal>true</>
1680 if the cast is an explicit cast, <literal>false</> otherwise.
1684 It is legitimate to create a <structname>pg_cast</structname> entry
1685 in which the source and target types are the same, if the associated
1686 function takes more than one argument. Such entries represent
1687 <quote>length coercion functions</> that coerce values of the type
1688 to be legal for a particular type modifier value.
1692 When a <structname>pg_cast</structname> entry has different source and
1693 target types and a function that takes more than one argument, it
1694 represents converting from one type to another and applying a length
1695 coercion in a single step. When no such entry is available, coercion
1696 to a type that uses a type modifier involves two steps, one to
1697 convert between data types and a second to apply the modifier.
1701 <sect1 id="catalog-pg-class">
1702 <title><structname>pg_class</structname></title>
1704 <indexterm zone="catalog-pg-class">
1705 <primary>pg_class</primary>
1709 The catalog <structname>pg_class</structname> catalogs tables and most
1710 everything else that has columns or is otherwise similar to a
1711 table. This includes indexes (but see also
1712 <structname>pg_index</structname>), sequences, views, materialized
1713 views, composite types, and TOAST tables; see <structfield>relkind</>.
1714 Below, when we mean all of these
1715 kinds of objects we speak of <quote>relations</quote>. Not all
1716 columns are meaningful for all relation types.
1720 <title><structname>pg_class</> Columns</title>
1727 <entry>References</entry>
1728 <entry>Description</entry>
1734 <entry><structfield>oid</structfield></entry>
1735 <entry><type>oid</type></entry>
1737 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1741 <entry><structfield>relname</structfield></entry>
1742 <entry><type>name</type></entry>
1744 <entry>Name of the table, index, view, etc.</entry>
1748 <entry><structfield>relnamespace</structfield></entry>
1749 <entry><type>oid</type></entry>
1750 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1752 The OID of the namespace that contains this relation
1757 <entry><structfield>reltype</structfield></entry>
1758 <entry><type>oid</type></entry>
1759 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1761 The OID of the data type that corresponds to this table's row type,
1762 if any (zero for indexes, which have no <structname>pg_type</> entry)
1767 <entry><structfield>reloftype</structfield></entry>
1768 <entry><type>oid</type></entry>
1769 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1771 For typed tables, the OID of the underlying composite type,
1772 zero for all other relations
1777 <entry><structfield>relowner</structfield></entry>
1778 <entry><type>oid</type></entry>
1779 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1780 <entry>Owner of the relation</entry>
1784 <entry><structfield>relam</structfield></entry>
1785 <entry><type>oid</type></entry>
1786 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1787 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1791 <entry><structfield>relfilenode</structfield></entry>
1792 <entry><type>oid</type></entry>
1794 <entry>Name of the on-disk file of this relation; zero means this
1795 is a <quote>mapped</> relation whose disk file name is determined
1796 by low-level state</entry>
1800 <entry><structfield>reltablespace</structfield></entry>
1801 <entry><type>oid</type></entry>
1802 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1804 The tablespace in which this relation is stored. If zero,
1805 the database's default tablespace is implied. (Not meaningful
1806 if the relation has no on-disk file.)
1811 <entry><structfield>relpages</structfield></entry>
1812 <entry><type>int4</type></entry>
1815 Size of the on-disk representation of this table in pages (of size
1816 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1817 planner. It is updated by <command>VACUUM</command>,
1818 <command>ANALYZE</command>, and a few DDL commands such as
1819 <command>CREATE INDEX</command>.
1824 <entry><structfield>reltuples</structfield></entry>
1825 <entry><type>float4</type></entry>
1828 Number of rows in the table. This is only an estimate used by the
1829 planner. It is updated by <command>VACUUM</command>,
1830 <command>ANALYZE</command>, and a few DDL commands such as
1831 <command>CREATE INDEX</command>.
1836 <entry><structfield>relallvisible</structfield></entry>
1837 <entry><type>int4</type></entry>
1840 Number of pages that are marked all-visible in the table's
1841 visibility map. This is only an estimate used by the
1842 planner. It is updated by <command>VACUUM</command>,
1843 <command>ANALYZE</command>, and a few DDL commands such as
1844 <command>CREATE INDEX</command>.
1849 <entry><structfield>reltoastrelid</structfield></entry>
1850 <entry><type>oid</type></entry>
1851 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1853 OID of the TOAST table associated with this table, 0 if none. The
1854 TOAST table stores large attributes <quote>out of line</quote> in a
1860 <entry><structfield>relhasindex</structfield></entry>
1861 <entry><type>bool</type></entry>
1864 True if this is a table and it has (or recently had) any indexes
1869 <entry><structfield>relisshared</structfield></entry>
1870 <entry><type>bool</type></entry>
1873 True if this table is shared across all databases in the cluster. Only
1874 certain system catalogs (such as <structname>pg_database</structname>)
1880 <entry><structfield>relpersistence</structfield></entry>
1881 <entry><type>char</type></entry>
1884 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1885 <literal>t</> = temporary table
1890 <entry><structfield>relkind</structfield></entry>
1891 <entry><type>char</type></entry>
1894 <literal>r</> = ordinary table, <literal>i</> = index,
1895 <literal>S</> = sequence, <literal>v</> = view,
1896 <literal>m</> = materialized view,
1897 <literal>c</> = composite type, <literal>t</> = TOAST table,
1898 <literal>f</> = foreign table
1903 <entry><structfield>relnatts</structfield></entry>
1904 <entry><type>int2</type></entry>
1907 Number of user columns in the relation (system columns not
1908 counted). There must be this many corresponding entries in
1909 <structname>pg_attribute</structname>. See also
1910 <literal>pg_attribute.attnum</literal>.
1915 <entry><structfield>relchecks</structfield></entry>
1916 <entry><type>int2</type></entry>
1919 Number of <literal>CHECK</> constraints on the table; see
1920 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1925 <entry><structfield>relhasoids</structfield></entry>
1926 <entry><type>bool</type></entry>
1929 True if we generate an OID for each row of the relation
1934 <entry><structfield>relhaspkey</structfield></entry>
1935 <entry><type>bool</type></entry>
1938 True if the table has (or once had) a primary key
1943 <entry><structfield>relhasrules</structfield></entry>
1944 <entry><type>bool</type></entry>
1947 True if table has (or once had) rules; see
1948 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1953 <entry><structfield>relhastriggers</structfield></entry>
1954 <entry><type>bool</type></entry>
1957 True if table has (or once had) triggers; see
1958 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1963 <entry><structfield>relhassubclass</structfield></entry>
1964 <entry><type>bool</type></entry>
1966 <entry>True if table has (or once had) any inheritance children</entry>
1970 <entry><structfield>relrowsecurity</structfield></entry>
1971 <entry><type>bool</type></entry>
1974 True if table has row level security enabled; see
1975 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1980 <entry><structfield>relispopulated</structfield></entry>
1981 <entry><type>bool</type></entry>
1983 <entry>True if relation is populated (this is true for all
1984 relations other than some materialized views)</entry>
1988 <entry><structfield>relreplident</structfield></entry>
1989 <entry><type>char</type></entry>
1992 Columns used to form <quote>replica identity</> for rows:
1993 <literal>d</> = default (primary key, if any),
1994 <literal>n</> = nothing,
1995 <literal>f</> = all columns
1996 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
2001 <entry><structfield>relfrozenxid</structfield></entry>
2002 <entry><type>xid</type></entry>
2005 All transaction IDs before this one have been replaced with a permanent
2006 (<quote>frozen</>) transaction ID in this table. This is used to track
2007 whether the table needs to be vacuumed in order to prevent transaction
2008 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
2009 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2014 <entry><structfield>relminmxid</structfield></entry>
2015 <entry><type>xid</type></entry>
2018 All multixact IDs before this one have been replaced by a
2019 transaction ID in this table. This is used to track
2020 whether the table needs to be vacuumed in order to prevent multixact ID
2021 wraparound or to allow <literal>pg_multixact</> to be shrunk. Zero
2022 (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
2027 <entry><structfield>relacl</structfield></entry>
2028 <entry><type>aclitem[]</type></entry>
2031 Access privileges; see
2032 <xref linkend="sql-grant"> and
2033 <xref linkend="sql-revoke">
2039 <entry><structfield>reloptions</structfield></entry>
2040 <entry><type>text[]</type></entry>
2043 Access-method-specific options, as <quote>keyword=value</> strings
2051 Several of the Boolean flags in <structname>pg_class</> are maintained
2052 lazily: they are guaranteed to be true if that's the correct state, but
2053 may not be reset to false immediately when the condition is no longer
2054 true. For example, <structfield>relhasindex</> is set by
2055 <command>CREATE INDEX</command>, but it is never cleared by
2056 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
2057 <structfield>relhasindex</> if it finds the table has no indexes. This
2058 arrangement avoids race conditions and improves concurrency.
2062 <sect1 id="catalog-pg-collation">
2063 <title><structname>pg_collation</structname></title>
2065 <indexterm zone="catalog-pg-collation">
2066 <primary>pg_collation</primary>
2070 The catalog <structname>pg_collation</structname> describes the
2071 available collations, which are essentially mappings from an SQL
2072 name to operating system locale categories.
2073 See <xref linkend="collation"> for more information.
2077 <title><structname>pg_collation</> Columns</title>
2084 <entry>References</entry>
2085 <entry>Description</entry>
2091 <entry><structfield>oid</structfield></entry>
2092 <entry><type>oid</type></entry>
2094 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2098 <entry><structfield>collname</structfield></entry>
2099 <entry><type>name</type></entry>
2101 <entry>Collation name (unique per namespace and encoding)</entry>
2105 <entry><structfield>collnamespace</structfield></entry>
2106 <entry><type>oid</type></entry>
2107 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2109 The OID of the namespace that contains this collation
2114 <entry><structfield>collowner</structfield></entry>
2115 <entry><type>oid</type></entry>
2116 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2117 <entry>Owner of the collation</entry>
2121 <entry><structfield>collencoding</structfield></entry>
2122 <entry><type>int4</type></entry>
2124 <entry>Encoding in which the collation is applicable, or -1 if it
2125 works for any encoding</entry>
2129 <entry><structfield>collcollate</structfield></entry>
2130 <entry><type>name</type></entry>
2132 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2136 <entry><structfield>collctype</structfield></entry>
2137 <entry><type>name</type></entry>
2139 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2146 Note that the unique key on this catalog is (<structfield>collname</>,
2147 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2148 (<structfield>collname</>, <structfield>collnamespace</>).
2149 <productname>PostgreSQL</productname> generally ignores all
2150 collations that do not have <structfield>collencoding</> equal to
2151 either the current database's encoding or -1, and creation of new entries
2152 with the same name as an entry with <structfield>collencoding</> = -1
2153 is forbidden. Therefore it is sufficient to use a qualified SQL name
2154 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2155 even though this is not unique according to the catalog definition.
2156 The reason for defining the catalog this way is that
2157 <application>initdb</> fills it in at cluster initialization time with
2158 entries for all locales available on the system, so it must be able to
2159 hold entries for all encodings that might ever be used in the cluster.
2163 In the <literal>template0</> database, it could be useful to create
2164 collations whose encoding does not match the database encoding,
2165 since they could match the encodings of databases later cloned from
2166 <literal>template0</>. This would currently have to be done manually.
2170 <sect1 id="catalog-pg-constraint">
2171 <title><structname>pg_constraint</structname></title>
2173 <indexterm zone="catalog-pg-constraint">
2174 <primary>pg_constraint</primary>
2178 The catalog <structname>pg_constraint</structname> stores check, primary
2179 key, unique, foreign key, and exclusion constraints on tables.
2180 (Column constraints are not treated specially. Every column constraint is
2181 equivalent to some table constraint.)
2182 Not-null constraints are represented in the <structname>pg_attribute</>
2187 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2188 TRIGGER</>) also give rise to an entry in this table.
2192 Check constraints on domains are stored here, too.
2196 <title><structname>pg_constraint</> Columns</title>
2203 <entry>References</entry>
2204 <entry>Description</entry>
2210 <entry><structfield>oid</structfield></entry>
2211 <entry><type>oid</type></entry>
2213 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2217 <entry><structfield>conname</structfield></entry>
2218 <entry><type>name</type></entry>
2220 <entry>Constraint name (not necessarily unique!)</entry>
2224 <entry><structfield>connamespace</structfield></entry>
2225 <entry><type>oid</type></entry>
2226 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2228 The OID of the namespace that contains this constraint
2233 <entry><structfield>contype</structfield></entry>
2234 <entry><type>char</type></entry>
2237 <literal>c</> = check constraint,
2238 <literal>f</> = foreign key constraint,
2239 <literal>p</> = primary key constraint,
2240 <literal>u</> = unique constraint,
2241 <literal>t</> = constraint trigger,
2242 <literal>x</> = exclusion constraint
2247 <entry><structfield>condeferrable</structfield></entry>
2248 <entry><type>bool</type></entry>
2250 <entry>Is the constraint deferrable?</entry>
2254 <entry><structfield>condeferred</structfield></entry>
2255 <entry><type>bool</type></entry>
2257 <entry>Is the constraint deferred by default?</entry>
2261 <entry><structfield>convalidated</structfield></entry>
2262 <entry><type>bool</type></entry>
2264 <entry>Has the constraint been validated?
2265 Currently, can only be false for foreign keys and CHECK constraints</entry>
2269 <entry><structfield>conrelid</structfield></entry>
2270 <entry><type>oid</type></entry>
2271 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2272 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2276 <entry><structfield>contypid</structfield></entry>
2277 <entry><type>oid</type></entry>
2278 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2279 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2283 <entry><structfield>conindid</structfield></entry>
2284 <entry><type>oid</type></entry>
2285 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2286 <entry>The index supporting this constraint, if it's a unique, primary
2287 key, foreign key, or exclusion constraint; else 0</entry>
2291 <entry><structfield>confrelid</structfield></entry>
2292 <entry><type>oid</type></entry>
2293 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2294 <entry>If a foreign key, the referenced table; else 0</entry>
2298 <entry><structfield>confupdtype</structfield></entry>
2299 <entry><type>char</type></entry>
2301 <entry>Foreign key update action code:
2302 <literal>a</> = no action,
2303 <literal>r</> = restrict,
2304 <literal>c</> = cascade,
2305 <literal>n</> = set null,
2306 <literal>d</> = set default
2311 <entry><structfield>confdeltype</structfield></entry>
2312 <entry><type>char</type></entry>
2314 <entry>Foreign key deletion action code:
2315 <literal>a</> = no action,
2316 <literal>r</> = restrict,
2317 <literal>c</> = cascade,
2318 <literal>n</> = set null,
2319 <literal>d</> = set default
2324 <entry><structfield>confmatchtype</structfield></entry>
2325 <entry><type>char</type></entry>
2327 <entry>Foreign key match type:
2328 <literal>f</> = full,
2329 <literal>p</> = partial,
2330 <literal>s</> = simple
2335 <entry><structfield>conislocal</structfield></entry>
2336 <entry><type>bool</type></entry>
2339 This constraint is defined locally for the relation. Note that a
2340 constraint can be locally defined and inherited simultaneously.
2345 <entry><structfield>coninhcount</structfield></entry>
2346 <entry><type>int4</type></entry>
2349 The number of direct inheritance ancestors this constraint has.
2351 a nonzero number of ancestors cannot be dropped nor renamed.
2356 <entry><structfield>connoinherit</structfield></entry>
2357 <entry><type>bool</type></entry>
2360 This constraint is defined locally for the relation. It is a
2361 non-inheritable constraint.
2366 <entry><structfield>conkey</structfield></entry>
2367 <entry><type>int2[]</type></entry>
2368 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2369 <entry>If a table constraint (including foreign keys, but not constraint
2370 triggers), list of the constrained columns</entry>
2374 <entry><structfield>confkey</structfield></entry>
2375 <entry><type>int2[]</type></entry>
2376 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2377 <entry>If a foreign key, list of the referenced columns</entry>
2381 <entry><structfield>conpfeqop</structfield></entry>
2382 <entry><type>oid[]</type></entry>
2383 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2384 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2388 <entry><structfield>conppeqop</structfield></entry>
2389 <entry><type>oid[]</type></entry>
2390 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2391 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2395 <entry><structfield>conffeqop</structfield></entry>
2396 <entry><type>oid[]</type></entry>
2397 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2398 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2402 <entry><structfield>conexclop</structfield></entry>
2403 <entry><type>oid[]</type></entry>
2404 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2405 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2409 <entry><structfield>conbin</structfield></entry>
2410 <entry><type>pg_node_tree</type></entry>
2412 <entry>If a check constraint, an internal representation of the expression</entry>
2416 <entry><structfield>consrc</structfield></entry>
2417 <entry><type>text</type></entry>
2419 <entry>If a check constraint, a human-readable representation of the expression</entry>
2426 In the case of an exclusion constraint, <structfield>conkey</structfield>
2427 is only useful for constraint elements that are simple column references.
2428 For other cases, a zero appears in <structfield>conkey</structfield>
2429 and the associated index must be consulted to discover the expression
2430 that is constrained. (<structfield>conkey</structfield> thus has the
2431 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2437 <structfield>consrc</structfield> is not updated when referenced objects
2438 change; for example, it won't track renaming of columns. Rather than
2439 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2440 to extract the definition of a check constraint.
2446 <literal>pg_class.relchecks</literal> needs to agree with the
2447 number of check-constraint entries found in this table for each
2454 <sect1 id="catalog-pg-conversion">
2455 <title><structname>pg_conversion</structname></title>
2457 <indexterm zone="catalog-pg-conversion">
2458 <primary>pg_conversion</primary>
2462 The catalog <structname>pg_conversion</structname> describes
2463 encoding conversion procedures. See <xref linkend="sql-createconversion">
2464 for more information.
2468 <title><structname>pg_conversion</> Columns</title>
2475 <entry>References</entry>
2476 <entry>Description</entry>
2482 <entry><structfield>oid</structfield></entry>
2483 <entry><type>oid</type></entry>
2485 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2489 <entry><structfield>conname</structfield></entry>
2490 <entry><type>name</type></entry>
2492 <entry>Conversion name (unique within a namespace)</entry>
2496 <entry><structfield>connamespace</structfield></entry>
2497 <entry><type>oid</type></entry>
2498 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2500 The OID of the namespace that contains this conversion
2505 <entry><structfield>conowner</structfield></entry>
2506 <entry><type>oid</type></entry>
2507 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2508 <entry>Owner of the conversion</entry>
2512 <entry><structfield>conforencoding</structfield></entry>
2513 <entry><type>int4</type></entry>
2515 <entry>Source encoding ID</entry>
2519 <entry><structfield>contoencoding</structfield></entry>
2520 <entry><type>int4</type></entry>
2522 <entry>Destination encoding ID</entry>
2526 <entry><structfield>conproc</structfield></entry>
2527 <entry><type>regproc</type></entry>
2528 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2529 <entry>Conversion procedure</entry>
2533 <entry><structfield>condefault</structfield></entry>
2534 <entry><type>bool</type></entry>
2536 <entry>True if this is the default conversion</entry>
2545 <sect1 id="catalog-pg-database">
2546 <title><structname>pg_database</structname></title>
2548 <indexterm zone="catalog-pg-database">
2549 <primary>pg_database</primary>
2553 The catalog <structname>pg_database</structname> stores information about
2554 the available databases. Databases are created with the <xref
2555 linkend="sql-createdatabase"> command.
2556 Consult <xref linkend="managing-databases"> for details about the meaning
2557 of some of the parameters.
2561 Unlike most system catalogs, <structname>pg_database</structname>
2562 is shared across all databases of a cluster: there is only one
2563 copy of <structname>pg_database</structname> per cluster, not
2568 <title><structname>pg_database</> Columns</title>
2575 <entry>References</entry>
2576 <entry>Description</entry>
2582 <entry><structfield>oid</structfield></entry>
2583 <entry><type>oid</type></entry>
2585 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2589 <entry><structfield>datname</structfield></entry>
2590 <entry><type>name</type></entry>
2592 <entry>Database name</entry>
2596 <entry><structfield>datdba</structfield></entry>
2597 <entry><type>oid</type></entry>
2598 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2599 <entry>Owner of the database, usually the user who created it</entry>
2603 <entry><structfield>encoding</structfield></entry>
2604 <entry><type>int4</type></entry>
2606 <entry>Character encoding for this database
2607 (<function>pg_encoding_to_char()</function> can translate
2608 this number to the encoding name)</entry>
2612 <entry><structfield>datcollate</structfield></entry>
2613 <entry><type>name</type></entry>
2615 <entry>LC_COLLATE for this database</entry>
2619 <entry><structfield>datctype</structfield></entry>
2620 <entry><type>name</type></entry>
2622 <entry>LC_CTYPE for this database</entry>
2626 <entry><structfield>datistemplate</structfield></entry>
2627 <entry><type>bool</type></entry>
2630 If true, then this database can be cloned by
2631 any user with <literal>CREATEDB</> privileges;
2632 if false, then only superusers or the owner of
2633 the database can clone it.
2638 <entry><structfield>datallowconn</structfield></entry>
2639 <entry><type>bool</type></entry>
2642 If false then no one can connect to this database. This is
2643 used to protect the <literal>template0</> database from being altered.
2648 <entry><structfield>datconnlimit</structfield></entry>
2649 <entry><type>int4</type></entry>
2652 Sets maximum number of concurrent connections that can be made
2653 to this database. -1 means no limit.
2658 <entry><structfield>datlastsysoid</structfield></entry>
2659 <entry><type>oid</type></entry>
2662 Last system OID in the database; useful
2663 particularly to <application>pg_dump</application>
2668 <entry><structfield>datfrozenxid</structfield></entry>
2669 <entry><type>xid</type></entry>
2672 All transaction IDs before this one have been replaced with a permanent
2673 (<quote>frozen</>) transaction ID in this database. This is used to
2674 track whether the database needs to be vacuumed in order to prevent
2675 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2676 It is the minimum of the per-table
2677 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2682 <entry><structfield>datminmxid</structfield></entry>
2683 <entry><type>xid</type></entry>
2686 All multixact IDs before this one have been replaced with a
2687 transaction ID in this database. This is used to
2688 track whether the database needs to be vacuumed in order to prevent
2689 multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2690 It is the minimum of the per-table
2691 <structname>pg_class</>.<structfield>relminmxid</> values.
2696 <entry><structfield>dattablespace</structfield></entry>
2697 <entry><type>oid</type></entry>
2698 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2700 The default tablespace for the database.
2701 Within this database, all tables for which
2702 <structname>pg_class</>.<structfield>reltablespace</> is zero
2703 will be stored in this tablespace; in particular, all the non-shared
2704 system catalogs will be there.
2709 <entry><structfield>datacl</structfield></entry>
2710 <entry><type>aclitem[]</type></entry>
2713 Access privileges; see
2714 <xref linkend="sql-grant"> and
2715 <xref linkend="sql-revoke">
2725 <sect1 id="catalog-pg-db-role-setting">
2726 <title><structname>pg_db_role_setting</structname></title>
2728 <indexterm zone="catalog-pg-db-role-setting">
2729 <primary>pg_db_role_setting</primary>
2733 The catalog <structname>pg_db_role_setting</structname> records the default
2734 values that have been set for run-time configuration variables,
2735 for each role and database combination.
2739 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2740 is shared across all databases of a cluster: there is only one
2741 copy of <structname>pg_db_role_setting</structname> per cluster, not
2746 <title><structname>pg_db_role_setting</> Columns</title>
2753 <entry>References</entry>
2754 <entry>Description</entry>
2760 <entry><structfield>setdatabase</structfield></entry>
2761 <entry><type>oid</type></entry>
2762 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2763 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2767 <entry><structfield>setrole</structfield></entry>
2768 <entry><type>oid</type></entry>
2769 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2770 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2774 <entry><structfield>setconfig</structfield></entry>
2775 <entry><type>text[]</type></entry>
2777 <entry>Defaults for run-time configuration variables</entry>
2785 <sect1 id="catalog-pg-default-acl">
2786 <title><structname>pg_default_acl</structname></title>
2788 <indexterm zone="catalog-pg-default-acl">
2789 <primary>pg_default_acl</primary>
2793 The catalog <structname>pg_default_acl</> stores initial
2794 privileges to be assigned to newly created objects.
2798 <title><structname>pg_default_acl</> Columns</title>
2805 <entry>References</entry>
2806 <entry>Description</entry>
2812 <entry><structfield>oid</structfield></entry>
2813 <entry><type>oid</type></entry>
2815 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2819 <entry><structfield>defaclrole</structfield></entry>
2820 <entry><type>oid</type></entry>
2821 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2822 <entry>The OID of the role associated with this entry</entry>
2826 <entry><structfield>defaclnamespace</structfield></entry>
2827 <entry><type>oid</type></entry>
2828 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2829 <entry>The OID of the namespace associated with this entry,
2830 or 0 if none</entry>
2834 <entry><structfield>defaclobjtype</structfield></entry>
2835 <entry><type>char</type></entry>
2838 Type of object this entry is for:
2839 <literal>r</> = relation (table, view),
2840 <literal>S</> = sequence,
2841 <literal>f</> = function,
2842 <literal>T</> = type
2847 <entry><structfield>defaclacl</structfield></entry>
2848 <entry><type>aclitem[]</type></entry>
2851 Access privileges that this type of object should have on creation
2859 A <structname>pg_default_acl</> entry shows the initial privileges to
2860 be assigned to an object belonging to the indicated user. There are
2861 currently two types of entry: <quote>global</> entries with
2862 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2863 that reference a particular schema. If a global entry is present then
2864 it <emphasis>overrides</> the normal hard-wired default privileges
2865 for the object type. A per-schema entry, if present, represents privileges
2866 to be <emphasis>added to</> the global or hard-wired default privileges.
2870 Note that when an ACL entry in another catalog is null, it is taken
2871 to represent the hard-wired default privileges for its object,
2872 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2873 at the moment. <structname>pg_default_acl</> is only consulted during
2880 <sect1 id="catalog-pg-depend">
2881 <title><structname>pg_depend</structname></title>
2883 <indexterm zone="catalog-pg-depend">
2884 <primary>pg_depend</primary>
2888 The catalog <structname>pg_depend</structname> records the dependency
2889 relationships between database objects. This information allows
2890 <command>DROP</> commands to find which other objects must be dropped
2891 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2896 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2897 which performs a similar function for dependencies involving objects
2898 that are shared across a database cluster.
2902 <title><structname>pg_depend</> Columns</title>
2909 <entry>References</entry>
2910 <entry>Description</entry>
2916 <entry><structfield>classid</structfield></entry>
2917 <entry><type>oid</type></entry>
2918 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2919 <entry>The OID of the system catalog the dependent object is in</entry>
2923 <entry><structfield>objid</structfield></entry>
2924 <entry><type>oid</type></entry>
2925 <entry>any OID column</entry>
2926 <entry>The OID of the specific dependent object</entry>
2930 <entry><structfield>objsubid</structfield></entry>
2931 <entry><type>int4</type></entry>
2934 For a table column, this is the column number (the
2935 <structfield>objid</> and <structfield>classid</> refer to the
2936 table itself). For all other object types, this column is
2942 <entry><structfield>refclassid</structfield></entry>
2943 <entry><type>oid</type></entry>
2944 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2945 <entry>The OID of the system catalog the referenced object is in</entry>
2949 <entry><structfield>refobjid</structfield></entry>
2950 <entry><type>oid</type></entry>
2951 <entry>any OID column</entry>
2952 <entry>The OID of the specific referenced object</entry>
2956 <entry><structfield>refobjsubid</structfield></entry>
2957 <entry><type>int4</type></entry>
2960 For a table column, this is the column number (the
2961 <structfield>refobjid</> and <structfield>refclassid</> refer
2962 to the table itself). For all other object types, this column
2968 <entry><structfield>deptype</structfield></entry>
2969 <entry><type>char</type></entry>
2972 A code defining the specific semantics of this dependency relationship; see text
2981 In all cases, a <structname>pg_depend</structname> entry indicates that the
2982 referenced object cannot be dropped without also dropping the dependent
2983 object. However, there are several subflavors identified by
2984 <structfield>deptype</>:
2988 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2991 A normal relationship between separately-created objects. The
2992 dependent object can be dropped without affecting the
2993 referenced object. The referenced object can only be dropped
2994 by specifying <literal>CASCADE</>, in which case the dependent
2995 object is dropped, too. Example: a table column has a normal
2996 dependency on its data type.
3002 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
3005 The dependent object can be dropped separately from the
3006 referenced object, and should be automatically dropped
3007 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
3008 mode) if the referenced object is dropped. Example: a named
3009 constraint on a table is made autodependent on the table, so
3010 that it will go away if the table is dropped.
3016 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
3019 The dependent object was created as part of creation of the
3020 referenced object, and is really just a part of its internal
3021 implementation. A <command>DROP</> of the dependent object
3022 will be disallowed outright (we'll tell the user to issue a
3023 <command>DROP</> against the referenced object, instead). A
3024 <command>DROP</> of the referenced object will be propagated
3025 through to drop the dependent object whether
3026 <command>CASCADE</> is specified or not. Example: a trigger
3027 that's created to enforce a foreign-key constraint is made
3028 internally dependent on the constraint's
3029 <structname>pg_constraint</> entry.
3035 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
3038 The dependent object is a member of the <firstterm>extension</> that is
3039 the referenced object (see
3040 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3041 The dependent object can be dropped only via
3042 <command>DROP EXTENSION</> on the referenced object. Functionally
3043 this dependency type acts the same as an internal dependency, but
3044 it's kept separate for clarity and to simplify <application>pg_dump</>.
3050 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3053 There is no dependent object; this type of entry is a signal
3054 that the system itself depends on the referenced object, and so
3055 that object must never be deleted. Entries of this type are
3056 created only by <command>initdb</command>. The columns for the
3057 dependent object contain zeroes.
3063 Other dependency flavors might be needed in future.
3069 <sect1 id="catalog-pg-description">
3070 <title><structname>pg_description</structname></title>
3072 <indexterm zone="catalog-pg-description">
3073 <primary>pg_description</primary>
3077 The catalog <structname>pg_description</> stores optional descriptions
3078 (comments) for each database object. Descriptions can be manipulated
3079 with the <xref linkend="sql-comment"> command and viewed with
3080 <application>psql</application>'s <literal>\d</literal> commands.
3081 Descriptions of many built-in system objects are provided in the initial
3082 contents of <structname>pg_description</structname>.
3086 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3087 which performs a similar function for descriptions involving objects that
3088 are shared across a database cluster.
3092 <title><structname>pg_description</> Columns</title>
3099 <entry>References</entry>
3100 <entry>Description</entry>
3106 <entry><structfield>objoid</structfield></entry>
3107 <entry><type>oid</type></entry>
3108 <entry>any OID column</entry>
3109 <entry>The OID of the object this description pertains to</entry>
3113 <entry><structfield>classoid</structfield></entry>
3114 <entry><type>oid</type></entry>
3115 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3116 <entry>The OID of the system catalog this object appears in</entry>
3120 <entry><structfield>objsubid</structfield></entry>
3121 <entry><type>int4</type></entry>
3124 For a comment on a table column, this is the column number (the
3125 <structfield>objoid</> and <structfield>classoid</> refer to
3126 the table itself). For all other object types, this column is
3132 <entry><structfield>description</structfield></entry>
3133 <entry><type>text</type></entry>
3135 <entry>Arbitrary text that serves as the description of this object</entry>
3144 <sect1 id="catalog-pg-enum">
3145 <title><structname>pg_enum</structname></title>
3147 <indexterm zone="catalog-pg-enum">
3148 <primary>pg_enum</primary>
3152 The <structname>pg_enum</structname> catalog contains entries
3153 showing the values and labels for each enum type. The
3154 internal representation of a given enum value is actually the OID
3155 of its associated row in <structname>pg_enum</structname>.
3159 <title><structname>pg_enum</> Columns</title>
3166 <entry>References</entry>
3167 <entry>Description</entry>
3173 <entry><structfield>oid</structfield></entry>
3174 <entry><type>oid</type></entry>
3176 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3180 <entry><structfield>enumtypid</structfield></entry>
3181 <entry><type>oid</type></entry>
3182 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3183 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3187 <entry><structfield>enumsortorder</structfield></entry>
3188 <entry><type>float4</type></entry>
3190 <entry>The sort position of this enum value within its enum type</entry>
3194 <entry><structfield>enumlabel</structfield></entry>
3195 <entry><type>name</type></entry>
3197 <entry>The textual label for this enum value</entry>
3204 The OIDs for <structname>pg_enum</structname> rows follow a special
3205 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3206 as the sort ordering of their enum type. That is, if two even OIDs
3207 belong to the same enum type, the smaller OID must have the smaller
3208 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3209 need bear no relationship to the sort order. This rule allows the
3210 enum comparison routines to avoid catalog lookups in many common cases.
3211 The routines that create and alter enum types attempt to assign even
3212 OIDs to enum values whenever possible.
3216 When an enum type is created, its members are assigned sort-order
3217 positions 1..<replaceable>n</>. But members added later might be given
3218 negative or fractional values of <structfield>enumsortorder</structfield>.
3219 The only requirement on these values is that they be correctly
3220 ordered and unique within each enum type.
3225 <sect1 id="catalog-pg-event-trigger">
3226 <title><structname>pg_event_trigger</structname></title>
3228 <indexterm zone="catalog-pg-event-trigger">
3229 <primary>pg_event_trigger</primary>
3233 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3234 See <xref linkend="event-triggers"> for more information.
3238 <title><structname>pg_event_trigger</> Columns</title>
3245 <entry>References</entry>
3246 <entry>Description</entry>
3252 <entry><structfield>evtname</structfield></entry>
3253 <entry><type>name</type></entry>
3255 <entry>Trigger name (must be unique)</entry>
3259 <entry><structfield>evtevent</structfield></entry>
3260 <entry><type>name</type></entry>
3262 <entry>Identifies the event for which this trigger fires</entry>
3266 <entry><structfield>evtowner</structfield></entry>
3267 <entry><type>oid</type></entry>
3268 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3269 <entry>Owner of the event trigger</entry>
3273 <entry><structfield>evtfoid</structfield></entry>
3274 <entry><type>oid</type></entry>
3275 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3276 <entry>The function to be called</entry>
3280 <entry><structfield>evtenabled</structfield></entry>
3281 <entry><type>char</type></entry>
3284 Controls in which <xref linkend="guc-session-replication-role"> modes
3285 the event trigger fires.
3286 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3287 <literal>D</> = trigger is disabled,
3288 <literal>R</> = trigger fires in <quote>replica</> mode,
3289 <literal>A</> = trigger fires always.
3294 <entry><structfield>evttags</structfield></entry>
3295 <entry><type>text[]</type></entry>
3298 Command tags for which this trigger will fire. If NULL, the firing
3299 of this trigger is not restricted on the basis of the command tag.
3308 <sect1 id="catalog-pg-extension">
3309 <title><structname>pg_extension</structname></title>
3311 <indexterm zone="catalog-pg-extension">
3312 <primary>pg_extension</primary>
3316 The catalog <structname>pg_extension</structname> stores information
3317 about the installed extensions. See <xref linkend="extend-extensions">
3318 for details about extensions.
3322 <title><structname>pg_extension</> Columns</title>
3329 <entry>References</entry>
3330 <entry>Description</entry>
3336 <entry><structfield>oid</structfield></entry>
3337 <entry><type>oid</type></entry>
3339 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3343 <entry><structfield>extname</structfield></entry>
3344 <entry><type>name</type></entry>
3346 <entry>Name of the extension</entry>
3350 <entry><structfield>extowner</structfield></entry>
3351 <entry><type>oid</type></entry>
3352 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3353 <entry>Owner of the extension</entry>
3357 <entry><structfield>extnamespace</structfield></entry>
3358 <entry><type>oid</type></entry>
3359 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3360 <entry>Schema containing the extension's exported objects</entry>
3364 <entry><structfield>extrelocatable</structfield></entry>
3365 <entry><type>bool</type></entry>
3367 <entry>True if extension can be relocated to another schema</entry>
3371 <entry><structfield>extversion</structfield></entry>
3372 <entry><type>text</type></entry>
3374 <entry>Version name for the extension</entry>
3378 <entry><structfield>extconfig</structfield></entry>
3379 <entry><type>oid[]</type></entry>
3380 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3381 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3382 table(s), or <literal>NULL</> if none</entry>
3386 <entry><structfield>extcondition</structfield></entry>
3387 <entry><type>text[]</type></entry>
3389 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3390 extension's configuration table(s), or <literal>NULL</> if none</entry>
3398 Note that unlike most catalogs with a <quote>namespace</> column,
3399 <structfield>extnamespace</structfield> is not meant to imply
3400 that the extension belongs to that schema. Extension names are never
3401 schema-qualified. Rather, <structfield>extnamespace</structfield>
3402 indicates the schema that contains most or all of the extension's
3403 objects. If <structfield>extrelocatable</structfield> is true, then
3404 this schema must in fact contain all schema-qualifiable objects
3405 belonging to the extension.
3410 <sect1 id="catalog-pg-foreign-data-wrapper">
3411 <title><structname>pg_foreign_data_wrapper</structname></title>
3413 <indexterm zone="catalog-pg-foreign-data-wrapper">
3414 <primary>pg_foreign_data_wrapper</primary>
3418 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3419 foreign-data wrapper definitions. A foreign-data wrapper is the
3420 mechanism by which external data, residing on foreign servers, is
3425 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3432 <entry>References</entry>
3433 <entry>Description</entry>
3439 <entry><structfield>oid</structfield></entry>
3440 <entry><type>oid</type></entry>
3442 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3446 <entry><structfield>fdwname</structfield></entry>
3447 <entry><type>name</type></entry>
3449 <entry>Name of the foreign-data wrapper</entry>
3453 <entry><structfield>fdwowner</structfield></entry>
3454 <entry><type>oid</type></entry>
3455 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3456 <entry>Owner of the foreign-data wrapper</entry>
3460 <entry><structfield>fdwhandler</structfield></entry>
3461 <entry><type>oid</type></entry>
3462 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3464 References a handler function that is responsible for
3465 supplying execution routines for the foreign-data wrapper.
3466 Zero if no handler is provided
3471 <entry><structfield>fdwvalidator</structfield></entry>
3472 <entry><type>oid</type></entry>
3473 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3475 References a validator function that is responsible for
3476 checking the validity of the options given to the
3477 foreign-data wrapper, as well as options for foreign servers and user
3478 mappings using the foreign-data wrapper. Zero if no validator
3484 <entry><structfield>fdwacl</structfield></entry>
3485 <entry><type>aclitem[]</type></entry>
3488 Access privileges; see
3489 <xref linkend="sql-grant"> and
3490 <xref linkend="sql-revoke">
3496 <entry><structfield>fdwoptions</structfield></entry>
3497 <entry><type>text[]</type></entry>
3500 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3509 <sect1 id="catalog-pg-foreign-server">
3510 <title><structname>pg_foreign_server</structname></title>
3512 <indexterm zone="catalog-pg-foreign-server">
3513 <primary>pg_foreign_server</primary>
3517 The catalog <structname>pg_foreign_server</structname> stores
3518 foreign server definitions. A foreign server describes a source
3519 of external data, such as a remote server. Foreign
3520 servers are accessed via foreign-data wrappers.
3524 <title><structname>pg_foreign_server</> Columns</title>
3531 <entry>References</entry>
3532 <entry>Description</entry>
3538 <entry><structfield>oid</structfield></entry>
3539 <entry><type>oid</type></entry>
3541 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3545 <entry><structfield>srvname</structfield></entry>
3546 <entry><type>name</type></entry>
3548 <entry>Name of the foreign server</entry>
3552 <entry><structfield>srvowner</structfield></entry>
3553 <entry><type>oid</type></entry>
3554 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3555 <entry>Owner of the foreign server</entry>
3559 <entry><structfield>srvfdw</structfield></entry>
3560 <entry><type>oid</type></entry>
3561 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3562 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3566 <entry><structfield>srvtype</structfield></entry>
3567 <entry><type>text</type></entry>
3569 <entry>Type of the server (optional)</entry>
3573 <entry><structfield>srvversion</structfield></entry>
3574 <entry><type>text</type></entry>
3576 <entry>Version of the server (optional)</entry>
3580 <entry><structfield>srvacl</structfield></entry>
3581 <entry><type>aclitem[]</type></entry>
3584 Access privileges; see
3585 <xref linkend="sql-grant"> and
3586 <xref linkend="sql-revoke">
3592 <entry><structfield>srvoptions</structfield></entry>
3593 <entry><type>text[]</type></entry>
3596 Foreign server specific options, as <quote>keyword=value</> strings
3605 <sect1 id="catalog-pg-foreign-table">
3606 <title><structname>pg_foreign_table</structname></title>
3608 <indexterm zone="catalog-pg-foreign-table">
3609 <primary>pg_foreign_table</primary>
3613 The catalog <structname>pg_foreign_table</structname> contains
3614 auxiliary information about foreign tables. A foreign table is
3615 primarily represented by a <structname>pg_class</structname> entry,
3616 just like a regular table. Its <structname>pg_foreign_table</structname>
3617 entry contains the information that is pertinent only to foreign tables
3618 and not any other kind of relation.
3622 <title><structname>pg_foreign_table</> Columns</title>
3629 <entry>References</entry>
3630 <entry>Description</entry>
3636 <entry><structfield>ftrelid</structfield></entry>
3637 <entry><type>oid</type></entry>
3638 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3639 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3643 <entry><structfield>ftserver</structfield></entry>
3644 <entry><type>oid</type></entry>
3645 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3646 <entry>OID of the foreign server for this foreign table</entry>
3650 <entry><structfield>ftoptions</structfield></entry>
3651 <entry><type>text[]</type></entry>
3654 Foreign table options, as <quote>keyword=value</> strings
3663 <sect1 id="catalog-pg-index">
3664 <title><structname>pg_index</structname></title>
3666 <indexterm zone="catalog-pg-index">
3667 <primary>pg_index</primary>
3671 The catalog <structname>pg_index</structname> contains part of the information
3672 about indexes. The rest is mostly in
3673 <structname>pg_class</structname>.
3677 <title><structname>pg_index</> Columns</title>
3684 <entry>References</entry>
3685 <entry>Description</entry>
3691 <entry><structfield>indexrelid</structfield></entry>
3692 <entry><type>oid</type></entry>
3693 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3694 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3698 <entry><structfield>indrelid</structfield></entry>
3699 <entry><type>oid</type></entry>
3700 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3701 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3705 <entry><structfield>indnatts</structfield></entry>
3706 <entry><type>int2</type></entry>
3708 <entry>The number of columns in the index (duplicates
3709 <literal>pg_class.relnatts</literal>)</entry>
3713 <entry><structfield>indisunique</structfield></entry>
3714 <entry><type>bool</type></entry>
3716 <entry>If true, this is a unique index</entry>
3720 <entry><structfield>indisprimary</structfield></entry>
3721 <entry><type>bool</type></entry>
3723 <entry>If true, this index represents the primary key of the table
3724 (<structfield>indisunique</> should always be true when this is true)</entry>
3728 <entry><structfield>indisexclusion</structfield></entry>
3729 <entry><type>bool</type></entry>
3731 <entry>If true, this index supports an exclusion constraint</entry>
3735 <entry><structfield>indimmediate</structfield></entry>
3736 <entry><type>bool</type></entry>
3738 <entry>If true, the uniqueness check is enforced immediately on
3740 (irrelevant if <structfield>indisunique</> is not true)</entry>
3744 <entry><structfield>indisclustered</structfield></entry>
3745 <entry><type>bool</type></entry>
3747 <entry>If true, the table was last clustered on this index</entry>
3751 <entry><structfield>indisvalid</structfield></entry>
3752 <entry><type>bool</type></entry>
3755 If true, the index is currently valid for queries. False means the
3756 index is possibly incomplete: it must still be modified by
3757 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3758 be used for queries. If it is unique, the uniqueness property is not
3759 guaranteed true either.
3764 <entry><structfield>indcheckxmin</structfield></entry>
3765 <entry><type>bool</type></entry>
3768 If true, queries must not use the index until the <structfield>xmin</>
3769 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3770 event horizon, because the table may contain broken HOT chains with
3771 incompatible rows that they can see
3776 <entry><structfield>indisready</structfield></entry>
3777 <entry><type>bool</type></entry>
3780 If true, the index is currently ready for inserts. False means the
3781 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3787 <entry><structfield>indislive</structfield></entry>
3788 <entry><type>bool</type></entry>
3791 If false, the index is in process of being dropped, and should be
3792 ignored for all purposes (including HOT-safety decisions)
3797 <entry><structfield>indisreplident</structfield></entry>
3798 <entry><type>bool</type></entry>
3801 If true this index has been chosen as <quote>replica identity</>
3802 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3808 <entry><structfield>indkey</structfield></entry>
3809 <entry><type>int2vector</type></entry>
3810 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3812 This is an array of <structfield>indnatts</structfield> values that
3813 indicate which table columns this index indexes. For example a value
3814 of <literal>1 3</literal> would mean that the first and the third table
3815 columns make up the index key. A zero in this array indicates that the
3816 corresponding index attribute is an expression over the table columns,
3817 rather than a simple column reference.
3822 <entry><structfield>indcollation</structfield></entry>
3823 <entry><type>oidvector</type></entry>
3824 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3826 For each column in the index key, this contains the OID of the
3827 collation to use for the index.
3832 <entry><structfield>indclass</structfield></entry>
3833 <entry><type>oidvector</type></entry>
3834 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3836 For each column in the index key, this contains the OID of
3837 the operator class to use. See
3838 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3843 <entry><structfield>indoption</structfield></entry>
3844 <entry><type>int2vector</type></entry>
3847 This is an array of <structfield>indnatts</structfield> values that
3848 store per-column flag bits. The meaning of the bits is defined by
3849 the index's access method.
3854 <entry><structfield>indexprs</structfield></entry>
3855 <entry><type>pg_node_tree</type></entry>
3858 Expression trees (in <function>nodeToString()</function>
3859 representation) for index attributes that are not simple column
3860 references. This is a list with one element for each zero
3861 entry in <structfield>indkey</>. Null if all index attributes
3862 are simple references.
3867 <entry><structfield>indpred</structfield></entry>
3868 <entry><type>pg_node_tree</type></entry>
3871 Expression tree (in <function>nodeToString()</function>
3872 representation) for partial index predicate. Null if not a
3883 <sect1 id="catalog-pg-inherits">
3884 <title><structname>pg_inherits</structname></title>
3886 <indexterm zone="catalog-pg-inherits">
3887 <primary>pg_inherits</primary>
3891 The catalog <structname>pg_inherits</> records information about
3892 table inheritance hierarchies. There is one entry for each direct
3893 child table in the database. (Indirect inheritance can be determined
3894 by following chains of entries.)
3898 <title><structname>pg_inherits</> Columns</title>
3905 <entry>References</entry>
3906 <entry>Description</entry>
3912 <entry><structfield>inhrelid</structfield></entry>
3913 <entry><type>oid</type></entry>
3914 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3916 The OID of the child table
3921 <entry><structfield>inhparent</structfield></entry>
3922 <entry><type>oid</type></entry>
3923 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3925 The OID of the parent table
3930 <entry><structfield>inhseqno</structfield></entry>
3931 <entry><type>int4</type></entry>
3934 If there is more than one direct parent for a child table (multiple
3935 inheritance), this number tells the order in which the
3936 inherited columns are to be arranged. The count starts at 1.
3946 <sect1 id="catalog-pg-language">
3947 <title><structname>pg_language</structname></title>
3949 <indexterm zone="catalog-pg-language">
3950 <primary>pg_language</primary>
3954 The catalog <structname>pg_language</structname> registers
3955 languages in which you can write functions or stored procedures.
3956 See <xref linkend="sql-createlanguage">
3957 and <xref linkend="xplang"> for more information about language handlers.
3961 <title><structname>pg_language</> Columns</title>
3968 <entry>References</entry>
3969 <entry>Description</entry>
3975 <entry><structfield>oid</structfield></entry>
3976 <entry><type>oid</type></entry>
3978 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3982 <entry><structfield>lanname</structfield></entry>
3983 <entry><type>name</type></entry>
3985 <entry>Name of the language</entry>
3989 <entry><structfield>lanowner</structfield></entry>
3990 <entry><type>oid</type></entry>
3991 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3992 <entry>Owner of the language</entry>
3996 <entry><structfield>lanispl</structfield></entry>
3997 <entry><type>bool</type></entry>
4000 This is false for internal languages (such as
4001 <acronym>SQL</acronym>) and true for user-defined languages.
4002 Currently, <application>pg_dump</application> still uses this
4003 to determine which languages need to be dumped, but this might be
4004 replaced by a different mechanism in the future.
4009 <entry><structfield>lanpltrusted</structfield></entry>
4010 <entry><type>bool</type></entry>
4013 True if this is a trusted language, which means that it is believed
4014 not to grant access to anything outside the normal SQL execution
4015 environment. Only superusers can create functions in untrusted
4021 <entry><structfield>lanplcallfoid</structfield></entry>
4022 <entry><type>oid</type></entry>
4023 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4025 For noninternal languages this references the language
4026 handler, which is a special function that is responsible for
4027 executing all functions that are written in the particular
4033 <entry><structfield>laninline</structfield></entry>
4034 <entry><type>oid</type></entry>
4035 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4037 This references a function that is responsible for executing
4038 <quote>inline</> anonymous code blocks
4039 (<xref linkend="sql-do"> blocks).
4040 Zero if inline blocks are not supported.
4045 <entry><structfield>lanvalidator</structfield></entry>
4046 <entry><type>oid</type></entry>
4047 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4049 This references a language validator function that is responsible
4050 for checking the syntax and validity of new functions when they
4051 are created. Zero if no validator is provided.
4056 <entry><structfield>lanacl</structfield></entry>
4057 <entry><type>aclitem[]</type></entry>
4060 Access privileges; see
4061 <xref linkend="sql-grant"> and
4062 <xref linkend="sql-revoke">
4073 <sect1 id="catalog-pg-largeobject">
4074 <title><structname>pg_largeobject</structname></title>
4076 <indexterm zone="catalog-pg-largeobject">
4077 <primary>pg_largeobject</primary>
4081 The catalog <structname>pg_largeobject</structname> holds the data making up
4082 <quote>large objects</quote>. A large object is identified by an OID
4083 assigned when it is created. Each large object is broken into
4084 segments or <quote>pages</> small enough to be conveniently stored as rows
4085 in <structname>pg_largeobject</structname>.
4086 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4087 <literal>BLCKSZ/4</>, or typically 2 kB).
4091 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4092 associated with large objects. As a result,
4093 <structname>pg_largeobject</structname> was publicly readable and could be
4094 used to obtain the OIDs (and contents) of all large objects in the system.
4095 This is no longer the case; use
4096 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4097 to obtain a list of large object OIDs.
4101 <title><structname>pg_largeobject</> Columns</title>
4108 <entry>References</entry>
4109 <entry>Description</entry>
4115 <entry><structfield>loid</structfield></entry>
4116 <entry><type>oid</type></entry>
4117 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4118 <entry>Identifier of the large object that includes this page</entry>
4122 <entry><structfield>pageno</structfield></entry>
4123 <entry><type>int4</type></entry>
4125 <entry>Page number of this page within its large object
4126 (counting from zero)</entry>
4130 <entry><structfield>data</structfield></entry>
4131 <entry><type>bytea</type></entry>
4134 Actual data stored in the large object.
4135 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4143 Each row of <structname>pg_largeobject</structname> holds data
4144 for one page of a large object, beginning at
4145 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4146 allows sparse storage: pages might be missing, and might be shorter than
4147 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4148 Missing regions within a large object read as zeroes.
4153 <sect1 id="catalog-pg-largeobject-metadata">
4154 <title><structname>pg_largeobject_metadata</structname></title>
4156 <indexterm zone="catalog-pg-largeobject-metadata">
4157 <primary>pg_largeobject_metadata</primary>
4161 The catalog <structname>pg_largeobject_metadata</structname>
4162 holds metadata associated with large objects. The actual large object
4164 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4168 <title><structname>pg_largeobject_metadata</> Columns</title>
4175 <entry>References</entry>
4176 <entry>Description</entry>
4182 <entry><structfield>oid</structfield></entry>
4183 <entry><type>oid</type></entry>
4185 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4189 <entry><structfield>lomowner</structfield></entry>
4190 <entry><type>oid</type></entry>
4191 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4192 <entry>Owner of the large object</entry>
4196 <entry><structfield>lomacl</structfield></entry>
4197 <entry><type>aclitem[]</type></entry>
4200 Access privileges; see
4201 <xref linkend="sql-grant"> and
4202 <xref linkend="sql-revoke">
4212 <sect1 id="catalog-pg-namespace">
4213 <title><structname>pg_namespace</structname></title>
4215 <indexterm zone="catalog-pg-namespace">
4216 <primary>pg_namespace</primary>
4220 The catalog <structname>pg_namespace</> stores namespaces.
4221 A namespace is the structure underlying SQL schemas: each namespace
4222 can have a separate collection of relations, types, etc. without name
4227 <title><structname>pg_namespace</> Columns</title>
4234 <entry>References</entry>
4235 <entry>Description</entry>
4241 <entry><structfield>oid</structfield></entry>
4242 <entry><type>oid</type></entry>
4244 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4248 <entry><structfield>nspname</structfield></entry>
4249 <entry><type>name</type></entry>
4251 <entry>Name of the namespace</entry>
4255 <entry><structfield>nspowner</structfield></entry>
4256 <entry><type>oid</type></entry>
4257 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4258 <entry>Owner of the namespace</entry>
4262 <entry><structfield>nspacl</structfield></entry>
4263 <entry><type>aclitem[]</type></entry>
4266 Access privileges; see
4267 <xref linkend="sql-grant"> and
4268 <xref linkend="sql-revoke">
4279 <sect1 id="catalog-pg-opclass">
4280 <title><structname>pg_opclass</structname></title>
4282 <indexterm zone="catalog-pg-opclass">
4283 <primary>pg_opclass</primary>
4287 The catalog <structname>pg_opclass</structname> defines
4288 index access method operator classes. Each operator class defines
4289 semantics for index columns of a particular data type and a particular
4290 index access method. An operator class essentially specifies that a
4291 particular operator family is applicable to a particular indexable column
4292 data type. The set of operators from the family that are actually usable
4293 with the indexed column are whichever ones accept the column's data type
4294 as their left-hand input.
4298 Operator classes are described at length in <xref linkend="xindex">.
4302 <title><structname>pg_opclass</> Columns</title>
4309 <entry>References</entry>
4310 <entry>Description</entry>
4316 <entry><structfield>oid</structfield></entry>
4317 <entry><type>oid</type></entry>
4319 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4323 <entry><structfield>opcmethod</structfield></entry>
4324 <entry><type>oid</type></entry>
4325 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4326 <entry>Index access method operator class is for</entry>
4330 <entry><structfield>opcname</structfield></entry>
4331 <entry><type>name</type></entry>
4333 <entry>Name of this operator class</entry>
4337 <entry><structfield>opcnamespace</structfield></entry>
4338 <entry><type>oid</type></entry>
4339 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4340 <entry>Namespace of this operator class</entry>
4344 <entry><structfield>opcowner</structfield></entry>
4345 <entry><type>oid</type></entry>
4346 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4347 <entry>Owner of the operator class</entry>
4351 <entry><structfield>opcfamily</structfield></entry>
4352 <entry><type>oid</type></entry>
4353 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4354 <entry>Operator family containing the operator class</entry>
4358 <entry><structfield>opcintype</structfield></entry>
4359 <entry><type>oid</type></entry>
4360 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4361 <entry>Data type that the operator class indexes</entry>
4365 <entry><structfield>opcdefault</structfield></entry>
4366 <entry><type>bool</type></entry>
4368 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4372 <entry><structfield>opckeytype</structfield></entry>
4373 <entry><type>oid</type></entry>
4374 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4375 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4383 An operator class's <structfield>opcmethod</> must match the
4384 <structname>opfmethod</> of its containing operator family.
4385 Also, there must be no more than one <structname>pg_opclass</structname>
4386 row having <structname>opcdefault</> true for any given combination of
4387 <structname>opcmethod</> and <structname>opcintype</>.
4393 <sect1 id="catalog-pg-operator">
4394 <title><structname>pg_operator</structname></title>
4396 <indexterm zone="catalog-pg-operator">
4397 <primary>pg_operator</primary>
4401 The catalog <structname>pg_operator</> stores information about operators.
4402 See <xref linkend="sql-createoperator">
4403 and <xref linkend="xoper"> for more information.
4407 <title><structname>pg_operator</> Columns</title>
4414 <entry>References</entry>
4415 <entry>Description</entry>
4421 <entry><structfield>oid</structfield></entry>
4422 <entry><type>oid</type></entry>
4424 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4428 <entry><structfield>oprname</structfield></entry>
4429 <entry><type>name</type></entry>
4431 <entry>Name of the operator</entry>
4435 <entry><structfield>oprnamespace</structfield></entry>
4436 <entry><type>oid</type></entry>
4437 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4439 The OID of the namespace that contains this operator
4444 <entry><structfield>oprowner</structfield></entry>
4445 <entry><type>oid</type></entry>
4446 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4447 <entry>Owner of the operator</entry>
4451 <entry><structfield>oprkind</structfield></entry>
4452 <entry><type>char</type></entry>
4455 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4456 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4461 <entry><structfield>oprcanmerge</structfield></entry>
4462 <entry><type>bool</type></entry>
4464 <entry>This operator supports merge joins</entry>
4468 <entry><structfield>oprcanhash</structfield></entry>
4469 <entry><type>bool</type></entry>
4471 <entry>This operator supports hash joins</entry>
4475 <entry><structfield>oprleft</structfield></entry>
4476 <entry><type>oid</type></entry>
4477 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4478 <entry>Type of the left operand</entry>
4482 <entry><structfield>oprright</structfield></entry>
4483 <entry><type>oid</type></entry>
4484 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4485 <entry>Type of the right operand</entry>
4489 <entry><structfield>oprresult</structfield></entry>
4490 <entry><type>oid</type></entry>
4491 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4492 <entry>Type of the result</entry>
4496 <entry><structfield>oprcom</structfield></entry>
4497 <entry><type>oid</type></entry>
4498 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4499 <entry>Commutator of this operator, if any</entry>
4503 <entry><structfield>oprnegate</structfield></entry>
4504 <entry><type>oid</type></entry>
4505 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4506 <entry>Negator of this operator, if any</entry>
4510 <entry><structfield>oprcode</structfield></entry>
4511 <entry><type>regproc</type></entry>
4512 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4513 <entry>Function that implements this operator</entry>
4517 <entry><structfield>oprrest</structfield></entry>
4518 <entry><type>regproc</type></entry>
4519 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4520 <entry>Restriction selectivity estimation function for this operator</entry>
4524 <entry><structfield>oprjoin</structfield></entry>
4525 <entry><type>regproc</type></entry>
4526 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4527 <entry>Join selectivity estimation function for this operator</entry>
4534 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4535 is zero for a prefix operator.
4541 <sect1 id="catalog-pg-opfamily">
4542 <title><structname>pg_opfamily</structname></title>
4544 <indexterm zone="catalog-pg-opfamily">
4545 <primary>pg_opfamily</primary>
4549 The catalog <structname>pg_opfamily</structname> defines operator families.
4550 Each operator family is a collection of operators and associated
4551 support routines that implement the semantics specified for a particular
4552 index access method. Furthermore, the operators in a family are all
4553 <quote>compatible</>, in a way that is specified by the access method.
4554 The operator family concept allows cross-data-type operators to be used
4555 with indexes and to be reasoned about using knowledge of access method
4560 Operator families are described at length in <xref linkend="xindex">.
4564 <title><structname>pg_opfamily</> Columns</title>
4571 <entry>References</entry>
4572 <entry>Description</entry>
4578 <entry><structfield>oid</structfield></entry>
4579 <entry><type>oid</type></entry>
4581 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4585 <entry><structfield>opfmethod</structfield></entry>
4586 <entry><type>oid</type></entry>
4587 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4588 <entry>Index access method operator family is for</entry>
4592 <entry><structfield>opfname</structfield></entry>
4593 <entry><type>name</type></entry>
4595 <entry>Name of this operator family</entry>
4599 <entry><structfield>opfnamespace</structfield></entry>
4600 <entry><type>oid</type></entry>
4601 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4602 <entry>Namespace of this operator family</entry>
4606 <entry><structfield>opfowner</structfield></entry>
4607 <entry><type>oid</type></entry>
4608 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4609 <entry>Owner of the operator family</entry>
4617 The majority of the information defining an operator family is not in its
4618 <structname>pg_opfamily</structname> row, but in the associated rows in
4619 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4620 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4622 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4628 <sect1 id="catalog-pg-pltemplate">
4629 <title><structname>pg_pltemplate</structname></title>
4631 <indexterm zone="catalog-pg-pltemplate">
4632 <primary>pg_pltemplate</primary>
4636 The catalog <structname>pg_pltemplate</structname> stores
4637 <quote>template</> information for procedural languages.
4638 A template for a language allows the language to be created in a
4639 particular database by a simple <command>CREATE LANGUAGE</> command,
4640 with no need to specify implementation details.
4644 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4645 is shared across all databases of a cluster: there is only one
4646 copy of <structname>pg_pltemplate</structname> per cluster, not
4647 one per database. This allows the information to be accessible in
4648 each database as it is needed.
4652 <title><structname>pg_pltemplate</> Columns</title>
4659 <entry>Description</entry>
4665 <entry><structfield>tmplname</structfield></entry>
4666 <entry><type>name</type></entry>
4667 <entry>Name of the language this template is for</entry>
4671 <entry><structfield>tmpltrusted</structfield></entry>
4672 <entry><type>boolean</type></entry>
4673 <entry>True if language is considered trusted</entry>
4677 <entry><structfield>tmpldbacreate</structfield></entry>
4678 <entry><type>boolean</type></entry>
4679 <entry>True if language may be created by a database owner</entry>
4683 <entry><structfield>tmplhandler</structfield></entry>
4684 <entry><type>text</type></entry>
4685 <entry>Name of call handler function</entry>
4689 <entry><structfield>tmplinline</structfield></entry>
4690 <entry><type>text</type></entry>
4691 <entry>Name of anonymous-block handler function, or null if none</entry>
4695 <entry><structfield>tmplvalidator</structfield></entry>
4696 <entry><type>text</type></entry>
4697 <entry>Name of validator function, or null if none</entry>
4701 <entry><structfield>tmpllibrary</structfield></entry>
4702 <entry><type>text</type></entry>
4703 <entry>Path of shared library that implements language</entry>
4707 <entry><structfield>tmplacl</structfield></entry>
4708 <entry><type>aclitem[]</type></entry>
4709 <entry>Access privileges for template (not actually used)</entry>
4717 There are not currently any commands that manipulate procedural language
4718 templates; to change the built-in information, a superuser must modify
4719 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4720 or <command>UPDATE</command> commands.
4725 It is likely that <structname>pg_pltemplate</> will be removed in some
4726 future release of <productname>PostgreSQL</productname>, in favor of
4727 keeping this knowledge about procedural languages in their respective
4728 extension installation scripts.
4734 <sect1 id="catalog-pg-policy">
4735 <title><structname>pg_policy</structname></title>
4737 <indexterm zone="catalog-pg-policy">
4738 <primary>pg_policy</primary>
4742 The catalog <structname>pg_policy</structname> stores row level
4743 security policies for tables. A policy includes the kind of
4744 command that it applies to (possibly all commands), the roles that it
4745 applies to, the expression to be added as a security-barrier
4746 qualification to queries that include the table, and the expression
4747 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4748 add new records to the table.
4753 <title><structname>pg_policy</structname> Columns</title>
4760 <entry>References</entry>
4761 <entry>Description</entry>
4767 <entry><structfield>polname</structfield></entry>
4768 <entry><type>name</type></entry>
4770 <entry>The name of the policy</entry>
4774 <entry><structfield>polrelid</structfield></entry>
4775 <entry><type>oid</type></entry>
4776 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4777 <entry>The table to which the policy applies</entry>
4781 <entry><structfield>polcmd</structfield></entry>
4782 <entry><type>char</type></entry>
4784 <entry>The command type to which the policy is applied:
4785 <literal>r</> for <command>SELECT</>,
4786 <literal>a</> for <command>INSERT</>,
4787 <literal>w</> for <command>UPDATE</>,
4788 <literal>d</> for <command>DELETE</>,
4789 or <literal>*</> for all</entry>
4793 <entry><structfield>polroles</structfield></entry>
4794 <entry><type>oid[]</type></entry>
4795 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4796 <entry>The roles to which the policy is applied</entry>
4800 <entry><structfield>polqual</structfield></entry>
4801 <entry><type>pg_node_tree</type></entry>
4803 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4807 <entry><structfield>polwithcheck</structfield></entry>
4808 <entry><type>pg_node_tree</type></entry>
4810 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4819 Policies stored in <structname>pg_policy</> are applied only when
4820 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4827 <sect1 id="catalog-pg-proc">
4828 <title><structname>pg_proc</structname></title>
4830 <indexterm zone="catalog-pg-proc">
4831 <primary>pg_proc</primary>
4835 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4836 See <xref linkend="sql-createfunction">
4837 and <xref linkend="xfunc"> for more information.
4841 The table contains data for aggregate functions as well as plain functions.
4842 If <structfield>proisagg</structfield> is true, there should be a matching
4843 row in <structfield>pg_aggregate</structfield>.
4847 <title><structname>pg_proc</> Columns</title>
4854 <entry>References</entry>
4855 <entry>Description</entry>
4861 <entry><structfield>oid</structfield></entry>
4862 <entry><type>oid</type></entry>
4864 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4868 <entry><structfield>proname</structfield></entry>
4869 <entry><type>name</type></entry>
4871 <entry>Name of the function</entry>
4875 <entry><structfield>pronamespace</structfield></entry>
4876 <entry><type>oid</type></entry>
4877 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4879 The OID of the namespace that contains this function
4884 <entry><structfield>proowner</structfield></entry>
4885 <entry><type>oid</type></entry>
4886 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4887 <entry>Owner of the function</entry>
4891 <entry><structfield>prolang</structfield></entry>
4892 <entry><type>oid</type></entry>
4893 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4894 <entry>Implementation language or call interface of this function</entry>
4898 <entry><structfield>procost</structfield></entry>
4899 <entry><type>float4</type></entry>
4901 <entry>Estimated execution cost (in units of
4902 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4903 this is cost per row returned</entry>
4907 <entry><structfield>prorows</structfield></entry>
4908 <entry><type>float4</type></entry>
4910 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4914 <entry><structfield>provariadic</structfield></entry>
4915 <entry><type>oid</type></entry>
4916 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4917 <entry>Data type of the variadic array parameter's elements,
4918 or zero if the function does not have a variadic parameter</entry>
4922 <entry><structfield>protransform</structfield></entry>
4923 <entry><type>regproc</type></entry>
4924 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4925 <entry>Calls to this function can be simplified by this other function
4926 (see <xref linkend="xfunc-transform-functions">)</entry>
4930 <entry><structfield>proisagg</structfield></entry>
4931 <entry><type>bool</type></entry>
4933 <entry>Function is an aggregate function</entry>
4937 <entry><structfield>proiswindow</structfield></entry>
4938 <entry><type>bool</type></entry>
4940 <entry>Function is a window function</entry>
4944 <entry><structfield>prosecdef</structfield></entry>
4945 <entry><type>bool</type></entry>
4947 <entry>Function is a security definer (i.e., a <quote>setuid</>
4952 <entry><structfield>proleakproof</structfield></entry>
4953 <entry><type>bool</type></entry>
4956 The function has no side effects. No information about the
4957 arguments is conveyed except via the return value. Any function
4958 that might throw an error depending on the values of its arguments
4964 <entry><structfield>proisstrict</structfield></entry>
4965 <entry><type>bool</type></entry>
4968 Function returns null if any call argument is null. In that
4969 case the function won't actually be called at all. Functions
4970 that are not <quote>strict</quote> must be prepared to handle
4976 <entry><structfield>proretset</structfield></entry>
4977 <entry><type>bool</type></entry>
4979 <entry>Function returns a set (i.e., multiple values of the specified
4984 <entry><structfield>provolatile</structfield></entry>
4985 <entry><type>char</type></entry>
4988 <structfield>provolatile</structfield> tells whether the function's
4989 result depends only on its input arguments, or is affected by outside
4991 It is <literal>i</literal> for <quote>immutable</> functions,
4992 which always deliver the same result for the same inputs.
4993 It is <literal>s</literal> for <quote>stable</> functions,
4994 whose results (for fixed inputs) do not change within a scan.
4995 It is <literal>v</literal> for <quote>volatile</> functions,
4996 whose results might change at any time. (Use <literal>v</literal> also
4997 for functions with side-effects, so that calls to them cannot get
5003 <entry><structfield>pronargs</structfield></entry>
5004 <entry><type>int2</type></entry>
5006 <entry>Number of input arguments</entry>
5010 <entry><structfield>pronargdefaults</structfield></entry>
5011 <entry><type>int2</type></entry>
5013 <entry>Number of arguments that have defaults</entry>
5017 <entry><structfield>prorettype</structfield></entry>
5018 <entry><type>oid</type></entry>
5019 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5020 <entry>Data type of the return value</entry>
5024 <entry><structfield>proargtypes</structfield></entry>
5025 <entry><type>oidvector</type></entry>
5026 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5028 An array with the data types of the function arguments. This includes
5029 only input arguments (including <literal>INOUT</literal> and
5030 <literal>VARIADIC</> arguments), and thus represents
5031 the call signature of the function.
5036 <entry><structfield>proallargtypes</structfield></entry>
5037 <entry><type>oid[]</type></entry>
5038 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5040 An array with the data types of the function arguments. This includes
5041 all arguments (including <literal>OUT</literal> and
5042 <literal>INOUT</literal> arguments); however, if all the
5043 arguments are <literal>IN</literal> arguments, this field will be null.
5044 Note that subscripting is 1-based, whereas for historical reasons
5045 <structfield>proargtypes</> is subscripted from 0.
5050 <entry><structfield>proargmodes</structfield></entry>
5051 <entry><type>char[]</type></entry>
5054 An array with the modes of the function arguments, encoded as
5055 <literal>i</literal> for <literal>IN</> arguments,
5056 <literal>o</literal> for <literal>OUT</> arguments,
5057 <literal>b</literal> for <literal>INOUT</> arguments,
5058 <literal>v</literal> for <literal>VARIADIC</> arguments,
5059 <literal>t</literal> for <literal>TABLE</> arguments.
5060 If all the arguments are <literal>IN</literal> arguments,
5061 this field will be null.
5062 Note that subscripts correspond to positions of
5063 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5068 <entry><structfield>proargnames</structfield></entry>
5069 <entry><type>text[]</type></entry>
5072 An array with the names of the function arguments.
5073 Arguments without a name are set to empty strings in the array.
5074 If none of the arguments have a name, this field will be null.
5075 Note that subscripts correspond to positions of
5076 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5081 <entry><structfield>proargdefaults</structfield></entry>
5082 <entry><type>pg_node_tree</type></entry>
5085 Expression trees (in <function>nodeToString()</function> representation)
5086 for default values. This is a list with
5087 <structfield>pronargdefaults</> elements, corresponding to the last
5088 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5089 <replaceable>N</> <structfield>proargtypes</> positions).
5090 If none of the arguments have defaults, this field will be null.
5095 <entry><structfield>protrftypes</structfield></entry>
5096 <entry><type>oid[]</type></entry>
5099 Data type OIDs for which to apply transforms.
5104 <entry><structfield>prosrc</structfield></entry>
5105 <entry><type>text</type></entry>
5108 This tells the function handler how to invoke the function. It
5109 might be the actual source code of the function for interpreted
5110 languages, a link symbol, a file name, or just about anything
5111 else, depending on the implementation language/call convention.
5116 <entry><structfield>probin</structfield></entry>
5117 <entry><type>text</type></entry>
5120 Additional information about how to invoke the function.
5121 Again, the interpretation is language-specific.
5126 <entry><structfield>proconfig</structfield></entry>
5127 <entry><type>text[]</type></entry>
5129 <entry>Function's local settings for run-time configuration variables</entry>
5133 <entry><structfield>proacl</structfield></entry>
5134 <entry><type>aclitem[]</type></entry>
5137 Access privileges; see
5138 <xref linkend="sql-grant"> and
5139 <xref linkend="sql-revoke">
5148 For compiled functions, both built-in and dynamically loaded,
5149 <structfield>prosrc</structfield> contains the function's C-language
5150 name (link symbol). For all other currently-known language types,
5151 <structfield>prosrc</structfield> contains the function's source
5152 text. <structfield>probin</structfield> is unused except for
5153 dynamically-loaded C functions, for which it gives the name of the
5154 shared library file containing the function.
5159 <sect1 id="catalog-pg-range">
5160 <title><structname>pg_range</structname></title>
5162 <indexterm zone="catalog-pg-range">
5163 <primary>pg_range</primary>
5167 The catalog <structname>pg_range</structname> stores information about
5168 range types. This is in addition to the types' entries in
5169 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5173 <title><structname>pg_range</> Columns</title>
5180 <entry>References</entry>
5181 <entry>Description</entry>
5187 <entry><structfield>rngtypid</structfield></entry>
5188 <entry><type>oid</type></entry>
5189 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5190 <entry>OID of the range type</entry>
5194 <entry><structfield>rngsubtype</structfield></entry>
5195 <entry><type>oid</type></entry>
5196 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5197 <entry>OID of the element type (subtype) of this range type</entry>
5201 <entry><structfield>rngcollation</structfield></entry>
5202 <entry><type>oid</type></entry>
5203 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5204 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5208 <entry><structfield>rngsubopc</structfield></entry>
5209 <entry><type>oid</type></entry>
5210 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5211 <entry>OID of the subtype's operator class used for range comparisons</entry>
5215 <entry><structfield>rngcanonical</structfield></entry>
5216 <entry><type>regproc</type></entry>
5217 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5218 <entry>OID of the function to convert a range value into canonical form,
5219 or 0 if none</entry>
5223 <entry><structfield>rngsubdiff</structfield></entry>
5224 <entry><type>regproc</type></entry>
5225 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5226 <entry>OID of the function to return the difference between two element
5227 values as <type>double precision</type>, or 0 if none</entry>
5234 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5235 element type is collatable) determines the sort ordering used by the range
5236 type. <structfield>rngcanonical</> is used when the element type is
5237 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5238 improve performance of GiST indexes on the range type.
5243 <sect1 id="catalog-pg-rewrite">
5244 <title><structname>pg_rewrite</structname></title>
5246 <indexterm zone="catalog-pg-rewrite">
5247 <primary>pg_rewrite</primary>
5251 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5255 <title><structname>pg_rewrite</> Columns</title>
5262 <entry>References</entry>
5263 <entry>Description</entry>
5269 <entry><structfield>oid</structfield></entry>
5270 <entry><type>oid</type></entry>
5272 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5276 <entry><structfield>rulename</structfield></entry>
5277 <entry><type>name</type></entry>
5279 <entry>Rule name</entry>
5283 <entry><structfield>ev_class</structfield></entry>
5284 <entry><type>oid</type></entry>
5285 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5286 <entry>The table this rule is for</entry>
5290 <entry><structfield>ev_type</structfield></entry>
5291 <entry><type>char</type></entry>
5294 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5295 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5301 <entry><structfield>ev_enabled</structfield></entry>
5302 <entry><type>char</type></entry>
5305 Controls in which <xref linkend="guc-session-replication-role"> modes
5307 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5308 <literal>D</> = rule is disabled,
5309 <literal>R</> = rule fires in <quote>replica</> mode,
5310 <literal>A</> = rule fires always.
5315 <entry><structfield>is_instead</structfield></entry>
5316 <entry><type>bool</type></entry>
5318 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5322 <entry><structfield>ev_qual</structfield></entry>
5323 <entry><type>pg_node_tree</type></entry>
5326 Expression tree (in the form of a
5327 <function>nodeToString()</function> representation) for the
5328 rule's qualifying condition
5333 <entry><structfield>ev_action</structfield></entry>
5334 <entry><type>pg_node_tree</type></entry>
5337 Query tree (in the form of a
5338 <function>nodeToString()</function> representation) for the
5348 <literal>pg_class.relhasrules</literal>
5349 must be true if a table has any rules in this catalog.
5355 <sect1 id="catalog-pg-replication-origin">
5356 <title><structname>pg_replication_origin</structname></title>
5358 <indexterm zone="catalog-pg-replication-origin">
5359 <primary>pg_replication_origin</primary>
5363 The <structname>pg_replication_origin</structname> catalog contains
5364 all replication origins created. For more on replication origins
5365 see <xref linkend="replication-origins">.
5370 <title><structname>pg_replication_origin</structname> Columns</title>
5377 <entry>References</entry>
5378 <entry>Description</entry>
5384 <entry><structfield>roident</structfield></entry>
5385 <entry><type>Oid</type></entry>
5387 <entry>A unique, cluster-wide identifier for the replication
5388 origin. Should never leave the system.</entry>
5392 <entry><structfield>roname</structfield></entry>
5393 <entry><type>text</type></entry>
5395 <entry>The external, user defined, name of a replication
5403 <sect1 id="catalog-pg-replication-origin-status">
5404 <title><structname>pg_replication_origin_status</structname></title>
5406 <indexterm zone="catalog-pg-replication-origin-status">
5407 <primary>pg_replication_origin_status</primary>
5411 The <structname>pg_replication_origin_status</structname> view
5412 contains information about how far replay for a certain origin has
5413 progressed. For more on replication origins
5414 see <xref linkend="replication-origins">.
5419 <title><structname>pg_replication_origin_status</structname> Columns</title>
5426 <entry>References</entry>
5427 <entry>Description</entry>
5433 <entry><structfield>local_id</structfield></entry>
5434 <entry><type>Oid</type></entry>
5435 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
5436 <entry>internal node identifier</entry>
5440 <entry><structfield>external_id</structfield></entry>
5441 <entry><type>text</type></entry>
5442 <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
5443 <entry>external node identifier</entry>
5447 <entry><structfield>remote_lsn</structfield></entry>
5448 <entry><type>pg_lsn</type></entry>
5450 <entry>The origin node's LSN up to which data has been replicated.</entry>
5455 <entry><structfield>local_lsn</structfield></entry>
5456 <entry><type>pg_lsn</type></entry>
5458 <entry>This node's LSN that at
5459 which <literal>remote_lsn</literal> has been replicated. Used to
5460 flush commit records before persisting data to disk when using
5461 asynchronous commits.</entry>
5468 <sect1 id="catalog-pg-replication-slots">
5469 <title><structname>pg_replication_slots</structname></title>
5471 <indexterm zone="catalog-pg-replication-slots">
5472 <primary>pg_replication_slots</primary>
5476 The <structname>pg_replication_slots</structname> view provides a listing
5477 of all replication slots that currently exist on the database cluster,
5478 along with their current state.
5482 For more on replication slots,
5483 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
5488 <title><structname>pg_replication_slots</structname> Columns</title>
5495 <entry>References</entry>
5496 <entry>Description</entry>
5502 <entry><structfield>slot_name</structfield></entry>
5503 <entry><type>name</type></entry>
5505 <entry>A unique, cluster-wide identifier for the replication slot</entry>
5509 <entry><structfield>plugin</structfield></entry>
5510 <entry><type>name</type></entry>
5512 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
5516 <entry><structfield>slot_type</structfield></entry>
5517 <entry><type>text</type></entry>
5519 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
5523 <entry><structfield>datoid</structfield></entry>
5524 <entry><type>oid</type></entry>
5525 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5526 <entry>The OID of the database this slot is associated with, or
5527 null. Only logical slots have an associated database.</entry>
5531 <entry><structfield>database</structfield></entry>
5532 <entry><type>text</type></entry>
5533 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5534 <entry>The name of the database this slot is associated with, or
5535 null. Only logical slots have an associated database.</entry>
5539 <entry><structfield>active</structfield></entry>
5540 <entry><type>boolean</type></entry>
5542 <entry>True if this slot is currently actively being used</entry>
5546 <entry><structfield>active_pid</structfield></entry>
5547 <entry><type>integer</type></entry>
5549 <entry>The process ID of the session using this slot if the slot
5550 is currently actively being used. <literal>NULL</literal> if
5556 <entry><structfield>xmin</structfield></entry>
5557 <entry><type>xid</type></entry>
5559 <entry>The oldest transaction that this slot needs the database to
5560 retain. <literal>VACUUM</literal> cannot remove tuples deleted
5561 by any later transaction.
5566 <entry><structfield>catalog_xmin</structfield></entry>
5567 <entry><type>xid</type></entry>
5569 <entry>The oldest transaction affecting the system catalogs that this
5570 slot needs the database to retain. <literal>VACUUM</literal> cannot
5571 remove catalog tuples deleted by any later transaction.
5576 <entry><structfield>restart_lsn</structfield></entry>
5577 <entry><type>pg_lsn</type></entry>
5579 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
5580 might be required by the consumer of this slot and thus won't be
5581 automatically removed during checkpoints.
5589 <sect1 id="catalog-pg-seclabel">
5590 <title><structname>pg_seclabel</structname></title>
5592 <indexterm zone="catalog-pg-seclabel">
5593 <primary>pg_seclabel</primary>
5597 The catalog <structname>pg_seclabel</structname> stores security
5598 labels on database objects. Security labels can be manipulated
5599 with the <xref linkend="sql-security-label"> command. For an easier
5600 way to view security labels, see <xref linkend="view-pg-seclabels">.
5604 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5605 which performs a similar function for security labels of database objects
5606 that are shared across a database cluster.
5610 <title><structname>pg_seclabel</structname> Columns</title>
5617 <entry>References</entry>
5618 <entry>Description</entry>
5624 <entry><structfield>objoid</structfield></entry>
5625 <entry><type>oid</type></entry>
5626 <entry>any OID column</entry>
5627 <entry>The OID of the object this security label pertains to</entry>
5631 <entry><structfield>classoid</structfield></entry>
5632 <entry><type>oid</type></entry>
5633 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5634 <entry>The OID of the system catalog this object appears in</entry>
5638 <entry><structfield>objsubid</structfield></entry>
5639 <entry><type>int4</type></entry>
5642 For a security label on a table column, this is the column number (the
5643 <structfield>objoid</> and <structfield>classoid</> refer to
5644 the table itself). For all other object types, this column is
5650 <entry><structfield>provider</structfield></entry>
5651 <entry><type>text</type></entry>
5653 <entry>The label provider associated with this label.</entry>
5657 <entry><structfield>label</structfield></entry>
5658 <entry><type>text</type></entry>
5660 <entry>The security label applied to this object.</entry>
5667 <sect1 id="catalog-pg-shdepend">
5668 <title><structname>pg_shdepend</structname></title>
5670 <indexterm zone="catalog-pg-shdepend">
5671 <primary>pg_shdepend</primary>
5675 The catalog <structname>pg_shdepend</structname> records the
5676 dependency relationships between database objects and shared objects,
5677 such as roles. This information allows
5678 <productname>PostgreSQL</productname> to ensure that those objects are
5679 unreferenced before attempting to delete them.
5683 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5684 which performs a similar function for dependencies involving objects
5685 within a single database.
5689 Unlike most system catalogs, <structname>pg_shdepend</structname>
5690 is shared across all databases of a cluster: there is only one
5691 copy of <structname>pg_shdepend</structname> per cluster, not
5696 <title><structname>pg_shdepend</> Columns</title>
5703 <entry>References</entry>
5704 <entry>Description</entry>
5710 <entry><structfield>dbid</structfield></entry>
5711 <entry><type>oid</type></entry>
5712 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5713 <entry>The OID of the database the dependent object is in,
5714 or zero for a shared object</entry>
5718 <entry><structfield>classid</structfield></entry>
5719 <entry><type>oid</type></entry>
5720 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5721 <entry>The OID of the system catalog the dependent object is in</entry>
5725 <entry><structfield>objid</structfield></entry>
5726 <entry><type>oid</type></entry>
5727 <entry>any OID column</entry>
5728 <entry>The OID of the specific dependent object</entry>
5732 <entry><structfield>objsubid</structfield></entry>
5733 <entry><type>int4</type></entry>
5736 For a table column, this is the column number (the
5737 <structfield>objid</> and <structfield>classid</> refer to the
5738 table itself). For all other object types, this column is zero.
5743 <entry><structfield>refclassid</structfield></entry>
5744 <entry><type>oid</type></entry>
5745 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5746 <entry>The OID of the system catalog the referenced object is in
5747 (must be a shared catalog)</entry>
5751 <entry><structfield>refobjid</structfield></entry>
5752 <entry><type>oid</type></entry>
5753 <entry>any OID column</entry>
5754 <entry>The OID of the specific referenced object</entry>
5758 <entry><structfield>deptype</structfield></entry>
5759 <entry><type>char</type></entry>
5762 A code defining the specific semantics of this dependency relationship; see text
5771 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5772 the referenced object cannot be dropped without also dropping the dependent
5773 object. However, there are several subflavors identified by
5774 <structfield>deptype</>:
5778 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5781 The referenced object (which must be a role) is the owner of the
5788 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5791 The referenced object (which must be a role) is mentioned in the
5792 ACL (access control list, i.e., privileges list) of the
5793 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5794 not made for the owner of the object, since the owner will have
5795 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5801 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5804 There is no dependent object; this type of entry is a signal
5805 that the system itself depends on the referenced object, and so
5806 that object must never be deleted. Entries of this type are
5807 created only by <command>initdb</command>. The columns for the
5808 dependent object contain zeroes.
5814 Other dependency flavors might be needed in future. Note in particular
5815 that the current definition only supports roles as referenced objects.
5820 <sect1 id="catalog-pg-shdescription">
5821 <title><structname>pg_shdescription</structname></title>
5823 <indexterm zone="catalog-pg-shdescription">
5824 <primary>pg_shdescription</primary>
5828 The catalog <structname>pg_shdescription</structname> stores optional
5829 descriptions (comments) for shared database objects. Descriptions can be
5830 manipulated with the <xref linkend="sql-comment"> command and viewed with
5831 <application>psql</application>'s <literal>\d</literal> commands.
5835 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5836 which performs a similar function for descriptions involving objects
5837 within a single database.
5841 Unlike most system catalogs, <structname>pg_shdescription</structname>
5842 is shared across all databases of a cluster: there is only one
5843 copy of <structname>pg_shdescription</structname> per cluster, not
5848 <title><structname>pg_shdescription</> Columns</title>
5855 <entry>References</entry>
5856 <entry>Description</entry>
5862 <entry><structfield>objoid</structfield></entry>
5863 <entry><type>oid</type></entry>
5864 <entry>any OID column</entry>
5865 <entry>The OID of the object this description pertains to</entry>
5869 <entry><structfield>classoid</structfield></entry>
5870 <entry><type>oid</type></entry>
5871 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5872 <entry>The OID of the system catalog this object appears in</entry>
5876 <entry><structfield>description</structfield></entry>
5877 <entry><type>text</type></entry>
5879 <entry>Arbitrary text that serves as the description of this object</entry>
5887 <sect1 id="catalog-pg-shseclabel">
5888 <title><structname>pg_shseclabel</structname></title>
5890 <indexterm zone="catalog-pg-shseclabel">
5891 <primary>pg_shseclabel</primary>
5895 The catalog <structname>pg_shseclabel</structname> stores security
5896 labels on shared database objects. Security labels can be manipulated
5897 with the <xref linkend="sql-security-label"> command. For an easier
5898 way to view security labels, see <xref linkend="view-pg-seclabels">.
5902 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5903 which performs a similar function for security labels involving objects
5904 within a single database.
5908 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5909 is shared across all databases of a cluster: there is only one
5910 copy of <structname>pg_shseclabel</structname> per cluster, not
5915 <title><structname>pg_shseclabel</structname> Columns</title>
5921 <entry>References</entry>
5922 <entry>Description</entry>
5927 <entry><structfield>objoid</structfield></entry>
5928 <entry><type>oid</type></entry>
5929 <entry>any OID column</entry>
5930 <entry>The OID of the object this security label pertains to</entry>
5933 <entry><structfield>classoid</structfield></entry>
5934 <entry><type>oid</type></entry>
5935 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5936 <entry>The OID of the system catalog this object appears in</entry>
5939 <entry><structfield>provider</structfield></entry>
5940 <entry><type>text</type></entry>
5942 <entry>The label provider associated with this label.</entry>
5945 <entry><structfield>label</structfield></entry>
5946 <entry><type>text</type></entry>
5948 <entry>The security label applied to this object.</entry>
5955 <sect1 id="catalog-pg-statistic">
5956 <title><structname>pg_statistic</structname></title>
5958 <indexterm zone="catalog-pg-statistic">
5959 <primary>pg_statistic</primary>
5963 The catalog <structname>pg_statistic</structname> stores
5964 statistical data about the contents of the database. Entries are
5965 created by <xref linkend="sql-analyze">
5966 and subsequently used by the query planner. Note that all the
5967 statistical data is inherently approximate, even assuming that it
5972 Normally there is one entry, with <structfield>stainherit</> =
5973 <literal>false</>, for each table column that has been analyzed.
5974 If the table has inheritance children, a second entry with
5975 <structfield>stainherit</> = <literal>true</> is also created. This row
5976 represents the column's statistics over the inheritance tree, i.e.,
5977 statistics for the data you'd see with
5978 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5979 whereas the <structfield>stainherit</> = <literal>false</> row represents
5981 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5985 <structname>pg_statistic</structname> also stores statistical data about
5986 the values of index expressions. These are described as if they were
5987 actual data columns; in particular, <structfield>starelid</structfield>
5988 references the index. No entry is made for an ordinary non-expression
5989 index column, however, since it would be redundant with the entry
5990 for the underlying table column. Currently, entries for index expressions
5991 always have <structfield>stainherit</> = <literal>false</>.
5995 Since different kinds of statistics might be appropriate for different
5996 kinds of data, <structname>pg_statistic</structname> is designed not
5997 to assume very much about what sort of statistics it stores. Only
5998 extremely general statistics (such as nullness) are given dedicated
5999 columns in <structname>pg_statistic</structname>. Everything else
6000 is stored in <quote>slots</quote>, which are groups of associated columns
6001 whose content is identified by a code number in one of the slot's columns.
6002 For more information see
6003 <filename>src/include/catalog/pg_statistic.h</filename>.
6007 <structname>pg_statistic</structname> should not be readable by the
6008 public, since even statistical information about a table's contents
6009 might be considered sensitive. (Example: minimum and maximum values
6010 of a salary column might be quite interesting.)
6011 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6012 is a publicly readable view on
6013 <structname>pg_statistic</structname> that only exposes information
6014 about those tables that are readable by the current user.
6018 <title><structname>pg_statistic</> Columns</title>
6025 <entry>References</entry>
6026 <entry>Description</entry>
6032 <entry><structfield>starelid</structfield></entry>
6033 <entry><type>oid</type></entry>
6034 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6035 <entry>The table or index that the described column belongs to</entry>
6039 <entry><structfield>staattnum</structfield></entry>
6040 <entry><type>int2</type></entry>
6041 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6042 <entry>The number of the described column</entry>
6046 <entry><structfield>stainherit</structfield></entry>
6047 <entry><type>bool</type></entry>
6049 <entry>If true, the stats include inheritance child columns, not just the
6050 values in the specified relation</entry>
6054 <entry><structfield>stanullfrac</structfield></entry>
6055 <entry><type>float4</type></entry>
6057 <entry>The fraction of the column's entries that are null</entry>
6061 <entry><structfield>stawidth</structfield></entry>
6062 <entry><type>int4</type></entry>
6064 <entry>The average stored width, in bytes, of nonnull entries</entry>
6068 <entry><structfield>stadistinct</structfield></entry>
6069 <entry><type>float4</type></entry>
6071 <entry>The number of distinct nonnull data values in the column.
6072 A value greater than zero is the actual number of distinct values.
6073 A value less than zero is the negative of a multiplier for the number
6074 of rows in the table; for example, a column in which values appear about
6075 twice on the average could be represented by
6076 <structfield>stadistinct</> = -0.5.
6077 A zero value means the number of distinct values is unknown.
6082 <entry><structfield>stakind<replaceable>N</></structfield></entry>
6083 <entry><type>int2</type></entry>
6086 A code number indicating the kind of statistics stored in the
6087 <replaceable>N</>th <quote>slot</quote> of the
6088 <structname>pg_statistic</structname> row.
6093 <entry><structfield>staop<replaceable>N</></structfield></entry>
6094 <entry><type>oid</type></entry>
6095 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6097 An operator used to derive the statistics stored in the
6098 <replaceable>N</>th <quote>slot</quote>. For example, a
6099 histogram slot would show the <literal><</literal> operator
6100 that defines the sort order of the data.
6105 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6106 <entry><type>float4[]</type></entry>
6109 Numerical statistics of the appropriate kind for the
6110 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6111 kind does not involve numerical values
6116 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6117 <entry><type>anyarray</type></entry>
6120 Column data values of the appropriate kind for the
6121 <replaceable>N</>th <quote>slot</quote>, or null if the slot
6122 kind does not store any data values. Each array's element
6123 values are actually of the specific column's data type, or a related
6124 type such as an array's element type, so there is no way to define
6125 these columns' type more specifically than <type>anyarray</>.
6135 <sect1 id="catalog-pg-tablesample-method">
6136 <title><structname>pg_tabesample_method</structname></title>
6138 <indexterm zone="catalog-pg-tablesample-method">
6139 <primary>pg_am</primary>
6143 The catalog <structname>pg_tablesample_method</structname> stores
6144 information about table sampling methods which can be used in
6145 <command>TABLESAMPLE</command> clause of a <command>SELECT</command>
6150 <title><structname>pg_tablesample_method</> Columns</title>
6157 <entry>References</entry>
6158 <entry>Description</entry>
6164 <entry><structfield>oid</structfield></entry>
6165 <entry><type>oid</type></entry>
6167 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6171 <entry><structfield>tsmname</structfield></entry>
6172 <entry><type>name</type></entry>
6174 <entry>Name of the sampling method</entry>
6178 <entry><structfield>tsmseqscan</structfield></entry>
6179 <entry><type>bool</type></entry>
6181 <entry>If true, the sampling method scans the whole table sequentially.
6186 <entry><structfield>tsmpagemode</structfield></entry>
6187 <entry><type>bool</type></entry>
6189 <entry>If true, the sampling method always reads the pages completely.
6194 <entry><structfield>tsminit</structfield></entry>
6195 <entry><type>regproc</type></entry>
6196 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6197 <entry><quote>Initialize the sampling scan</quote> function</entry>
6201 <entry><structfield>tsmnextblock</structfield></entry>
6202 <entry><type>regproc</type></entry>
6203 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6204 <entry><quote>Get next block number</quote> function</entry>
6208 <entry><structfield>tsmnexttuple</structfield></entry>
6209 <entry><type>regproc</type></entry>
6210 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6211 <entry><quote>Get next tuple offset</quote> function</entry>
6215 <entry><structfield>tsmexaminetuple</structfield></entry>
6216 <entry><type>regproc</type></entry>
6217 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6218 <entry>Function which examines the tuple contents and decides if to
6219 return it, or zero if none</entry>
6223 <entry><structfield>tsmend</structfield></entry>
6224 <entry><type>regproc</type></entry>
6225 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6226 <entry><quote>End the sampling scan</quote> function</entry>
6230 <entry><structfield>tsmreset</structfield></entry>
6231 <entry><type>regproc</type></entry>
6232 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6233 <entry><quote>Restart the state of sampling scan</quote> function</entry>
6237 <entry><structfield>tsmcost</structfield></entry>
6238 <entry><type>regproc</type></entry>
6239 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6240 <entry>Costing function</entry>
6250 <sect1 id="catalog-pg-tablespace">
6251 <title><structname>pg_tablespace</structname></title>
6253 <indexterm zone="catalog-pg-tablespace">
6254 <primary>pg_tablespace</primary>
6258 The catalog <structname>pg_tablespace</structname> stores information
6259 about the available tablespaces. Tables can be placed in particular
6260 tablespaces to aid administration of disk layout.
6264 Unlike most system catalogs, <structname>pg_tablespace</structname>
6265 is shared across all databases of a cluster: there is only one
6266 copy of <structname>pg_tablespace</structname> per cluster, not
6271 <title><structname>pg_tablespace</> Columns</title>
6278 <entry>References</entry>
6279 <entry>Description</entry>
6285 <entry><structfield>oid</structfield></entry>
6286 <entry><type>oid</type></entry>
6288 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6292 <entry><structfield>spcname</structfield></entry>
6293 <entry><type>name</type></entry>
6295 <entry>Tablespace name</entry>
6299 <entry><structfield>spcowner</structfield></entry>
6300 <entry><type>oid</type></entry>
6301 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6302 <entry>Owner of the tablespace, usually the user who created it</entry>
6306 <entry><structfield>spcacl</structfield></entry>
6307 <entry><type>aclitem[]</type></entry>
6310 Access privileges; see
6311 <xref linkend="sql-grant"> and
6312 <xref linkend="sql-revoke">
6318 <entry><structfield>spcoptions</structfield></entry>
6319 <entry><type>text[]</type></entry>
6322 Tablespace-level options, as <quote>keyword=value</> strings
6331 <sect1 id="catalog-pg-transform">
6332 <title><structname>pg_transform</structname></title>
6334 <indexterm zone="catalog-pg-transform">
6335 <primary>pg_transform</primary>
6339 The catalog <structname>pg_transform</structname> stores information about
6340 transforms, which are a mechanism to adapt data types to procedural
6341 languages. See <xref linkend="sql-createtransform"> for more information.
6345 <title><structname>pg_transform</> Columns</title>
6352 <entry>References</entry>
6353 <entry>Description</entry>
6359 <entry><structfield>trftype</structfield></entry>
6360 <entry><type>oid</type></entry>
6361 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6362 <entry>OID of the data type this transform is for</entry>
6366 <entry><structfield>trflang</structfield></entry>
6367 <entry><type>oid</type></entry>
6368 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6369 <entry>OID of the language this transform is for</entry>
6373 <entry><structfield>trffromsql</structfield></entry>
6374 <entry><type>regproc</type></entry>
6375 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6377 The OID of the function to use when converting the data type for input
6378 to the procedural language (e.g., function parameters). Zero is stored
6379 if this operation is not supported.
6384 <entry><structfield>trftosql</structfield></entry>
6385 <entry><type>regproc</type></entry>
6386 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6388 The OID of the function to use when converting output from the
6389 procedural language (e.g., return values) to the data type. Zero is
6390 stored if this operation is not supported.
6399 <sect1 id="catalog-pg-trigger">
6400 <title><structname>pg_trigger</structname></title>
6402 <indexterm zone="catalog-pg-trigger">
6403 <primary>pg_trigger</primary>
6407 The catalog <structname>pg_trigger</structname> stores triggers on tables
6409 See <xref linkend="sql-createtrigger">
6410 for more information.
6414 <title><structname>pg_trigger</> Columns</title>
6421 <entry>References</entry>
6422 <entry>Description</entry>
6428 <entry><structfield>oid</structfield></entry>
6429 <entry><type>oid</type></entry>
6431 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6435 <entry><structfield>tgrelid</structfield></entry>
6436 <entry><type>oid</type></entry>
6437 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6438 <entry>The table this trigger is on</entry>
6442 <entry><structfield>tgname</structfield></entry>
6443 <entry><type>name</type></entry>
6445 <entry>Trigger name (must be unique among triggers of same table)</entry>
6449 <entry><structfield>tgfoid</structfield></entry>
6450 <entry><type>oid</type></entry>
6451 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6452 <entry>The function to be called</entry>
6456 <entry><structfield>tgtype</structfield></entry>
6457 <entry><type>int2</type></entry>
6459 <entry>Bit mask identifying trigger firing conditions</entry>
6463 <entry><structfield>tgenabled</structfield></entry>
6464 <entry><type>char</type></entry>
6467 Controls in which <xref linkend="guc-session-replication-role"> modes
6469 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6470 <literal>D</> = trigger is disabled,
6471 <literal>R</> = trigger fires in <quote>replica</> mode,
6472 <literal>A</> = trigger fires always.
6477 <entry><structfield>tgisinternal</structfield></entry>
6478 <entry><type>bool</type></entry>
6480 <entry>True if trigger is internally generated (usually, to enforce
6481 the constraint identified by <structfield>tgconstraint</>)</entry>
6485 <entry><structfield>tgconstrrelid</structfield></entry>
6486 <entry><type>oid</type></entry>
6487 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6488 <entry>The table referenced by a referential integrity constraint</entry>
6492 <entry><structfield>tgconstrindid</structfield></entry>
6493 <entry><type>oid</type></entry>
6494 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6495 <entry>The index supporting a unique, primary key, referential integrity,
6496 or exclusion constraint</entry>
6500 <entry><structfield>tgconstraint</structfield></entry>
6501 <entry><type>oid</type></entry>
6502 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6503 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6507 <entry><structfield>tgdeferrable</structfield></entry>
6508 <entry><type>bool</type></entry>
6510 <entry>True if constraint trigger is deferrable</entry>
6514 <entry><structfield>tginitdeferred</structfield></entry>
6515 <entry><type>bool</type></entry>
6517 <entry>True if constraint trigger is initially deferred</entry>
6521 <entry><structfield>tgnargs</structfield></entry>
6522 <entry><type>int2</type></entry>
6524 <entry>Number of argument strings passed to trigger function</entry>
6528 <entry><structfield>tgattr</structfield></entry>
6529 <entry><type>int2vector</type></entry>
6530 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6531 <entry>Column numbers, if trigger is column-specific; otherwise an
6536 <entry><structfield>tgargs</structfield></entry>
6537 <entry><type>bytea</type></entry>
6539 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6543 <entry><structfield>tgqual</structfield></entry>
6544 <entry><type>pg_node_tree</type></entry>
6546 <entry>Expression tree (in <function>nodeToString()</function>
6547 representation) for the trigger's <literal>WHEN</> condition, or null
6555 Currently, column-specific triggering is supported only for
6556 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6557 only for that event type. <structfield>tgtype</structfield> might
6558 contain bits for other event types as well, but those are presumed
6559 to be table-wide regardless of what is in <structfield>tgattr</>.
6564 When <structfield>tgconstraint</> is nonzero,
6565 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6566 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6567 largely redundant with the referenced <structname>pg_constraint</> entry.
6568 However, it is possible for a non-deferrable trigger to be associated
6569 with a deferrable constraint: foreign key constraints can have some
6570 deferrable and some non-deferrable triggers.
6576 <literal>pg_class.relhastriggers</literal>
6577 must be true if a relation has any triggers in this catalog.
6584 <sect1 id="catalog-pg-ts-config">
6585 <title><structname>pg_ts_config</structname></title>
6587 <indexterm zone="catalog-pg-ts-config">
6588 <primary>pg_ts_config</primary>
6592 The <structname>pg_ts_config</structname> catalog contains entries
6593 representing text search configurations. A configuration specifies
6594 a particular text search parser and a list of dictionaries to use
6595 for each of the parser's output token types. The parser is shown
6596 in the <structname>pg_ts_config</structname> entry, but the
6597 token-to-dictionary mapping is defined by subsidiary entries in <link
6598 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6602 <productname>PostgreSQL</productname>'s text search features are
6603 described at length in <xref linkend="textsearch">.
6607 <title><structname>pg_ts_config</> Columns</title>
6614 <entry>References</entry>
6615 <entry>Description</entry>
6621 <entry><structfield>oid</structfield></entry>
6622 <entry><type>oid</type></entry>
6624 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6628 <entry><structfield>cfgname</structfield></entry>
6629 <entry><type>name</type></entry>
6631 <entry>Text search configuration name</entry>
6635 <entry><structfield>cfgnamespace</structfield></entry>
6636 <entry><type>oid</type></entry>
6637 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6639 The OID of the namespace that contains this configuration
6644 <entry><structfield>cfgowner</structfield></entry>
6645 <entry><type>oid</type></entry>
6646 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6647 <entry>Owner of the configuration</entry>
6651 <entry><structfield>cfgparser</structfield></entry>
6652 <entry><type>oid</type></entry>
6653 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6654 <entry>The OID of the text search parser for this configuration</entry>
6662 <sect1 id="catalog-pg-ts-config-map">
6663 <title><structname>pg_ts_config_map</structname></title>
6665 <indexterm zone="catalog-pg-ts-config-map">
6666 <primary>pg_ts_config_map</primary>
6670 The <structname>pg_ts_config_map</structname> catalog contains entries
6671 showing which text search dictionaries should be consulted, and in
6672 what order, for each output token type of each text search configuration's
6677 <productname>PostgreSQL</productname>'s text search features are
6678 described at length in <xref linkend="textsearch">.
6682 <title><structname>pg_ts_config_map</> Columns</title>
6689 <entry>References</entry>
6690 <entry>Description</entry>
6696 <entry><structfield>mapcfg</structfield></entry>
6697 <entry><type>oid</type></entry>
6698 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6699 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6703 <entry><structfield>maptokentype</structfield></entry>
6704 <entry><type>integer</type></entry>
6706 <entry>A token type emitted by the configuration's parser</entry>
6710 <entry><structfield>mapseqno</structfield></entry>
6711 <entry><type>integer</type></entry>
6713 <entry>Order in which to consult this entry (lower
6714 <structfield>mapseqno</>s first)</entry>
6718 <entry><structfield>mapdict</structfield></entry>
6719 <entry><type>oid</type></entry>
6720 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6721 <entry>The OID of the text search dictionary to consult</entry>
6729 <sect1 id="catalog-pg-ts-dict">
6730 <title><structname>pg_ts_dict</structname></title>
6732 <indexterm zone="catalog-pg-ts-dict">
6733 <primary>pg_ts_dict</primary>
6737 The <structname>pg_ts_dict</structname> catalog contains entries
6738 defining text search dictionaries. A dictionary depends on a text
6739 search template, which specifies all the implementation functions
6740 needed; the dictionary itself provides values for the user-settable
6741 parameters supported by the template. This division of labor allows
6742 dictionaries to be created by unprivileged users. The parameters
6743 are specified by a text string <structfield>dictinitoption</>,
6744 whose format and meaning vary depending on the template.
6748 <productname>PostgreSQL</productname>'s text search features are
6749 described at length in <xref linkend="textsearch">.
6753 <title><structname>pg_ts_dict</> Columns</title>
6760 <entry>References</entry>
6761 <entry>Description</entry>
6767 <entry><structfield>oid</structfield></entry>
6768 <entry><type>oid</type></entry>
6770 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6774 <entry><structfield>dictname</structfield></entry>
6775 <entry><type>name</type></entry>
6777 <entry>Text search dictionary name</entry>
6781 <entry><structfield>dictnamespace</structfield></entry>
6782 <entry><type>oid</type></entry>
6783 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6785 The OID of the namespace that contains this dictionary
6790 <entry><structfield>dictowner</structfield></entry>
6791 <entry><type>oid</type></entry>
6792 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6793 <entry>Owner of the dictionary</entry>
6797 <entry><structfield>dicttemplate</structfield></entry>
6798 <entry><type>oid</type></entry>
6799 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6800 <entry>The OID of the text search template for this dictionary</entry>
6804 <entry><structfield>dictinitoption</structfield></entry>
6805 <entry><type>text</type></entry>
6807 <entry>Initialization option string for the template</entry>
6815 <sect1 id="catalog-pg-ts-parser">
6816 <title><structname>pg_ts_parser</structname></title>
6818 <indexterm zone="catalog-pg-ts-parser">
6819 <primary>pg_ts_parser</primary>
6823 The <structname>pg_ts_parser</structname> catalog contains entries
6824 defining text search parsers. A parser is responsible for splitting
6825 input text into lexemes and assigning a token type to each lexeme.
6826 Since a parser must be implemented by C-language-level functions,
6827 creation of new parsers is restricted to database superusers.
6831 <productname>PostgreSQL</productname>'s text search features are
6832 described at length in <xref linkend="textsearch">.
6836 <title><structname>pg_ts_parser</> Columns</title>
6843 <entry>References</entry>
6844 <entry>Description</entry>
6850 <entry><structfield>oid</structfield></entry>
6851 <entry><type>oid</type></entry>
6853 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6857 <entry><structfield>prsname</structfield></entry>
6858 <entry><type>name</type></entry>
6860 <entry>Text search parser name</entry>
6864 <entry><structfield>prsnamespace</structfield></entry>
6865 <entry><type>oid</type></entry>
6866 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6868 The OID of the namespace that contains this parser
6873 <entry><structfield>prsstart</structfield></entry>
6874 <entry><type>regproc</type></entry>
6875 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6876 <entry>OID of the parser's startup function</entry>
6880 <entry><structfield>prstoken</structfield></entry>
6881 <entry><type>regproc</type></entry>
6882 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6883 <entry>OID of the parser's next-token function</entry>
6887 <entry><structfield>prsend</structfield></entry>
6888 <entry><type>regproc</type></entry>
6889 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6890 <entry>OID of the parser's shutdown function</entry>
6894 <entry><structfield>prsheadline</structfield></entry>
6895 <entry><type>regproc</type></entry>
6896 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6897 <entry>OID of the parser's headline function</entry>
6901 <entry><structfield>prslextype</structfield></entry>
6902 <entry><type>regproc</type></entry>
6903 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6904 <entry>OID of the parser's lextype function</entry>
6912 <sect1 id="catalog-pg-ts-template">
6913 <title><structname>pg_ts_template</structname></title>
6915 <indexterm zone="catalog-pg-ts-template">
6916 <primary>pg_ts_template</primary>
6920 The <structname>pg_ts_template</structname> catalog contains entries
6921 defining text search templates. A template is the implementation
6922 skeleton for a class of text search dictionaries.
6923 Since a template must be implemented by C-language-level functions,
6924 creation of new templates is restricted to database superusers.
6928 <productname>PostgreSQL</productname>'s text search features are
6929 described at length in <xref linkend="textsearch">.
6933 <title><structname>pg_ts_template</> Columns</title>
6940 <entry>References</entry>
6941 <entry>Description</entry>
6947 <entry><structfield>oid</structfield></entry>
6948 <entry><type>oid</type></entry>
6950 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6954 <entry><structfield>tmplname</structfield></entry>
6955 <entry><type>name</type></entry>
6957 <entry>Text search template name</entry>
6961 <entry><structfield>tmplnamespace</structfield></entry>
6962 <entry><type>oid</type></entry>
6963 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6965 The OID of the namespace that contains this template
6970 <entry><structfield>tmplinit</structfield></entry>
6971 <entry><type>regproc</type></entry>
6972 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6973 <entry>OID of the template's initialization function</entry>
6977 <entry><structfield>tmpllexize</structfield></entry>
6978 <entry><type>regproc</type></entry>
6979 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6980 <entry>OID of the template's lexize function</entry>
6988 <sect1 id="catalog-pg-type">
6989 <title><structname>pg_type</structname></title>
6991 <indexterm zone="catalog-pg-type">
6992 <primary>pg_type</primary>
6996 The catalog <structname>pg_type</structname> stores information about data
6997 types. Base types and enum types (scalar types) are created with
6998 <xref linkend="sql-createtype">, and
7000 <xref linkend="sql-createdomain">.
7001 A composite type is automatically created for each table in the database, to
7002 represent the row structure of the table. It is also possible to create
7003 composite types with <command>CREATE TYPE AS</command>.
7007 <title><structname>pg_type</> Columns</title>
7014 <entry>References</entry>
7015 <entry>Description</entry>
7021 <entry><structfield>oid</structfield></entry>
7022 <entry><type>oid</type></entry>
7024 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7028 <entry><structfield>typname</structfield></entry>
7029 <entry><type>name</type></entry>
7031 <entry>Data type name</entry>
7035 <entry><structfield>typnamespace</structfield></entry>
7036 <entry><type>oid</type></entry>
7037 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7039 The OID of the namespace that contains this type
7044 <entry><structfield>typowner</structfield></entry>
7045 <entry><type>oid</type></entry>
7046 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7047 <entry>Owner of the type</entry>
7051 <entry><structfield>typlen</structfield></entry>
7052 <entry><type>int2</type></entry>
7055 For a fixed-size type, <structfield>typlen</structfield> is the number
7056 of bytes in the internal representation of the type. But for a
7057 variable-length type, <structfield>typlen</structfield> is negative.
7058 -1 indicates a <quote>varlena</> type (one that has a length word),
7059 -2 indicates a null-terminated C string.
7064 <entry><structfield>typbyval</structfield></entry>
7065 <entry><type>bool</type></entry>
7068 <structfield>typbyval</structfield> determines whether internal
7069 routines pass a value of this type by value or by reference.
7070 <structfield>typbyval</structfield> had better be false if
7071 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7072 where Datum is 8 bytes).
7073 Variable-length types are always passed by reference. Note that
7074 <structfield>typbyval</structfield> can be false even if the
7075 length would allow pass-by-value.
7080 <entry><structfield>typtype</structfield></entry>
7081 <entry><type>char</type></entry>
7084 <structfield>typtype</structfield> is
7085 <literal>b</literal> for a base type,
7086 <literal>c</literal> for a composite type (e.g., a table's row type),
7087 <literal>d</literal> for a domain,
7088 <literal>e</literal> for an enum type,
7089 <literal>p</literal> for a pseudo-type, or
7090 <literal>r</literal> for a range type.
7091 See also <structfield>typrelid</structfield> and
7092 <structfield>typbasetype</structfield>.
7097 <entry><structfield>typcategory</structfield></entry>
7098 <entry><type>char</type></entry>
7101 <structfield>typcategory</structfield> is an arbitrary classification
7102 of data types that is used by the parser to determine which implicit
7103 casts should be <quote>preferred</>.
7104 See <xref linkend="catalog-typcategory-table">.
7109 <entry><structfield>typispreferred</structfield></entry>
7110 <entry><type>bool</type></entry>
7113 True if the type is a preferred cast target within its
7114 <structfield>typcategory</structfield>
7119 <entry><structfield>typisdefined</structfield></entry>
7120 <entry><type>bool</type></entry>
7123 True if the type is defined, false if this is a placeholder
7124 entry for a not-yet-defined type. When
7125 <structfield>typisdefined</structfield> is false, nothing
7126 except the type name, namespace, and OID can be relied on.
7131 <entry><structfield>typdelim</structfield></entry>
7132 <entry><type>char</type></entry>
7135 Character that separates two values of this type when parsing
7136 array input. Note that the delimiter is associated with the array
7137 element data type, not the array data type.
7142 <entry><structfield>typrelid</structfield></entry>
7143 <entry><type>oid</type></entry>
7144 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7146 If this is a composite type (see
7147 <structfield>typtype</structfield>), then this column points to
7148 the <structname>pg_class</structname> entry that defines the
7149 corresponding table. (For a free-standing composite type, the
7150 <structname>pg_class</structname> entry doesn't really represent
7151 a table, but it is needed anyway for the type's
7152 <structname>pg_attribute</structname> entries to link to.)
7153 Zero for non-composite types.
7158 <entry><structfield>typelem</structfield></entry>
7159 <entry><type>oid</type></entry>
7160 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7162 If <structfield>typelem</structfield> is not 0 then it
7163 identifies another row in <structname>pg_type</structname>.
7164 The current type can then be subscripted like an array yielding
7165 values of type <structfield>typelem</structfield>. A
7166 <quote>true</quote> array type is variable length
7167 (<structfield>typlen</structfield> = -1),
7168 but some fixed-length (<structfield>typlen</structfield> > 0) types
7169 also have nonzero <structfield>typelem</structfield>, for example
7170 <type>name</type> and <type>point</type>.
7171 If a fixed-length type has a <structfield>typelem</structfield> then
7172 its internal representation must be some number of values of the
7173 <structfield>typelem</structfield> data type with no other data.
7174 Variable-length array types have a header defined by the array
7180 <entry><structfield>typarray</structfield></entry>
7181 <entry><type>oid</type></entry>
7182 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7184 If <structfield>typarray</structfield> is not 0 then it
7185 identifies another row in <structname>pg_type</structname>, which
7186 is the <quote>true</quote> array type having this type as element
7191 <entry><structfield>typinput</structfield></entry>
7192 <entry><type>regproc</type></entry>
7193 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7194 <entry>Input conversion function (text format)</entry>
7198 <entry><structfield>typoutput</structfield></entry>
7199 <entry><type>regproc</type></entry>
7200 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7201 <entry>Output conversion function (text format)</entry>
7205 <entry><structfield>typreceive</structfield></entry>
7206 <entry><type>regproc</type></entry>
7207 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7208 <entry>Input conversion function (binary format), or 0 if none</entry>
7212 <entry><structfield>typsend</structfield></entry>
7213 <entry><type>regproc</type></entry>
7214 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7215 <entry>Output conversion function (binary format), or 0 if none</entry>
7219 <entry><structfield>typmodin</structfield></entry>
7220 <entry><type>regproc</type></entry>
7221 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7222 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7226 <entry><structfield>typmodout</structfield></entry>
7227 <entry><type>regproc</type></entry>
7228 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7229 <entry>Type modifier output function, or 0 to use the standard format</entry>
7233 <entry><structfield>typanalyze</structfield></entry>
7234 <entry><type>regproc</type></entry>
7235 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7236 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7240 <entry><structfield>typalign</structfield></entry>
7241 <entry><type>char</type></entry>
7245 <structfield>typalign</structfield> is the alignment required
7246 when storing a value of this type. It applies to storage on
7247 disk as well as most representations of the value inside
7248 <productname>PostgreSQL</>.
7249 When multiple values are stored consecutively, such
7250 as in the representation of a complete row on disk, padding is
7251 inserted before a datum of this type so that it begins on the
7252 specified boundary. The alignment reference is the beginning
7253 of the first datum in the sequence.
7257 Possible values are:
7260 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7263 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7266 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7269 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7274 For types used in system tables, it is critical that the size
7275 and alignment defined in <structname>pg_type</structname>
7276 agree with the way that the compiler will lay out the column in
7277 a structure representing a table row.
7283 <entry><structfield>typstorage</structfield></entry>
7284 <entry><type>char</type></entry>
7287 <structfield>typstorage</structfield> tells for varlena
7288 types (those with <structfield>typlen</structfield> = -1) if
7289 the type is prepared for toasting and what the default strategy
7290 for attributes of this type should be.
7294 <para><literal>p</>: Value must always be stored plain.</para>
7298 <literal>e</>: Value can be stored in a <quote>secondary</quote>
7299 relation (if relation has one, see
7300 <literal>pg_class.reltoastrelid</literal>).
7304 <para><literal>m</>: Value can be stored compressed inline.</para>
7307 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7310 Note that <literal>m</> columns can also be moved out to secondary
7311 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7317 <entry><structfield>typnotnull</structfield></entry>
7318 <entry><type>bool</type></entry>
7321 <structfield>typnotnull</structfield> represents a not-null
7322 constraint on a type. Used for domains only.
7327 <entry><structfield>typbasetype</structfield></entry>
7328 <entry><type>oid</type></entry>
7329 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7331 If this is a domain (see <structfield>typtype</structfield>), then
7332 <structfield>typbasetype</structfield> identifies the type that this
7333 one is based on. Zero if this type is not a domain.
7338 <entry><structfield>typtypmod</structfield></entry>
7339 <entry><type>int4</type></entry>
7342 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7343 to be applied to their base type (-1 if base type does not use a
7344 <literal>typmod</>). -1 if this type is not a domain.
7349 <entry><structfield>typndims</structfield></entry>
7350 <entry><type>int4</type></entry>
7353 <structfield>typndims</structfield> is the number of array dimensions
7354 for a domain over an array (that is, <structfield>typbasetype</> is
7356 Zero for types other than domains over array types.
7361 <entry><structfield>typcollation</structfield></entry>
7362 <entry><type>oid</type></entry>
7363 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7365 <structfield>typcollation</structfield> specifies the collation
7366 of the type. If the type does not support collations, this will
7367 be zero. A base type that supports collations will have
7368 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7369 collatable type can have some other collation OID, if one was
7370 specified for the domain.
7375 <entry><structfield>typdefaultbin</structfield></entry>
7376 <entry><type>pg_node_tree</type></entry>
7379 If <structfield>typdefaultbin</> is not null, it is the
7380 <function>nodeToString()</function>
7381 representation of a default expression for the type. This is
7382 only used for domains.
7387 <entry><structfield>typdefault</structfield></entry>
7388 <entry><type>text</type></entry>
7391 <structfield>typdefault</> is null if the type has no associated
7392 default value. If <structfield>typdefaultbin</> is not null,
7393 <structfield>typdefault</> must contain a human-readable version of the
7394 default expression represented by <structfield>typdefaultbin</>. If
7395 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7396 not, then <structfield>typdefault</> is the external representation of
7397 the type's default value, which can be fed to the type's input
7398 converter to produce a constant.
7403 <entry><structfield>typacl</structfield></entry>
7404 <entry><type>aclitem[]</type></entry>
7407 Access privileges; see
7408 <xref linkend="sql-grant"> and
7409 <xref linkend="sql-revoke">
7418 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7419 of <structfield>typcategory</>. Any future additions to this list will
7420 also be upper-case ASCII letters. All other ASCII characters are reserved
7421 for user-defined categories.
7424 <table id="catalog-typcategory-table">
7425 <title><structfield>typcategory</> Codes</title>
7431 <entry>Category</entry>
7437 <entry><literal>A</literal></entry>
7438 <entry>Array types</entry>
7441 <entry><literal>B</literal></entry>
7442 <entry>Boolean types</entry>
7445 <entry><literal>C</literal></entry>
7446 <entry>Composite types</entry>
7449 <entry><literal>D</literal></entry>
7450 <entry>Date/time types</entry>
7453 <entry><literal>E</literal></entry>
7454 <entry>Enum types</entry>
7457 <entry><literal>G</literal></entry>
7458 <entry>Geometric types</entry>
7461 <entry><literal>I</literal></entry>
7462 <entry>Network address types</entry>
7465 <entry><literal>N</literal></entry>
7466 <entry>Numeric types</entry>
7469 <entry><literal>P</literal></entry>
7470 <entry>Pseudo-types</entry>
7473 <entry><literal>R</literal></entry>
7474 <entry>Range types</entry>
7477 <entry><literal>S</literal></entry>
7478 <entry>String types</entry>
7481 <entry><literal>T</literal></entry>
7482 <entry>Timespan types</entry>
7485 <entry><literal>U</literal></entry>
7486 <entry>User-defined types</entry>
7489 <entry><literal>V</literal></entry>
7490 <entry>Bit-string types</entry>
7493 <entry><literal>X</literal></entry>
7494 <entry><type>unknown</> type</entry>
7503 <sect1 id="catalog-pg-user-mapping">
7504 <title><structname>pg_user_mapping</structname></title>
7506 <indexterm zone="catalog-pg-user-mapping">
7507 <primary>pg_user_mapping</primary>
7511 The catalog <structname>pg_user_mapping</structname> stores
7512 the mappings from local user to remote. Access to this catalog is
7513 restricted from normal users, use the view
7514 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7519 <title><structname>pg_user_mapping</> Columns</title>
7526 <entry>References</entry>
7527 <entry>Description</entry>
7533 <entry><structfield>oid</structfield></entry>
7534 <entry><type>oid</type></entry>
7536 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7540 <entry><structfield>umuser</structfield></entry>
7541 <entry><type>oid</type></entry>
7542 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7543 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7547 <entry><structfield>umserver</structfield></entry>
7548 <entry><type>oid</type></entry>
7549 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7551 The OID of the foreign server that contains this mapping
7556 <entry><structfield>umoptions</structfield></entry>
7557 <entry><type>text[]</type></entry>
7560 User mapping specific options, as <quote>keyword=value</> strings
7569 <sect1 id="views-overview">
7570 <title>System Views</title>
7573 In addition to the system catalogs, <productname>PostgreSQL</productname>
7574 provides a number of built-in views. Some system views provide convenient
7575 access to some commonly used queries on the system catalogs. Other views
7576 provide access to internal server state.
7580 The information schema (<xref linkend="information-schema">) provides
7581 an alternative set of views which overlap the functionality of the system
7582 views. Since the information schema is SQL-standard whereas the views
7583 described here are <productname>PostgreSQL</productname>-specific,
7584 it's usually better to use the information schema if it provides all
7585 the information you need.
7589 <xref linkend="view-table"> lists the system views described here.
7590 More detailed documentation of each view follows below.
7591 There are some additional views that provide access to the results of
7592 the statistics collector; they are described in <xref
7593 linkend="monitoring-stats-views-table">.
7597 Except where noted, all the views described here are read-only.
7600 <table id="view-table">
7601 <title>System Views</title>
7606 <entry>View Name</entry>
7607 <entry>Purpose</entry>
7613 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7614 <entry>available extensions</entry>
7618 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7619 <entry>available versions of extensions</entry>
7623 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7624 <entry>open cursors</entry>
7628 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7629 <entry>groups of database users</entry>
7633 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7634 <entry>indexes</entry>
7638 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7639 <entry>currently held locks</entry>
7643 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7644 <entry>materialized views</entry>
7648 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7649 <entry>policies</entry>
7653 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7654 <entry>prepared statements</entry>
7658 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7659 <entry>prepared transactions</entry>
7663 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7664 <entry>database roles</entry>
7668 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7669 <entry>rules</entry>
7673 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7674 <entry>security labels</entry>
7678 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7679 <entry>parameter settings</entry>
7683 <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
7684 <entry>file location of parameter settings</entry>
7688 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7689 <entry>database users</entry>
7693 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7694 <entry>planner statistics</entry>
7698 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7699 <entry>tables</entry>
7703 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7704 <entry>time zone abbreviations</entry>
7708 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7709 <entry>time zone names</entry>
7713 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7714 <entry>database users</entry>
7718 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7719 <entry>user mappings</entry>
7723 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7724 <entry>views</entry>
7732 <sect1 id="view-pg-available-extensions">
7733 <title><structname>pg_available_extensions</structname></title>
7735 <indexterm zone="view-pg-available-extensions">
7736 <primary>pg_available_extensions</primary>
7740 The <structname>pg_available_extensions</structname> view lists the
7741 extensions that are available for installation.
7743 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7744 catalog, which shows the extensions currently installed.
7748 <title><structname>pg_available_extensions</> Columns</title>
7755 <entry>Description</entry>
7761 <entry><structfield>name</structfield></entry>
7762 <entry><type>name</type></entry>
7763 <entry>Extension name</entry>
7767 <entry><structfield>default_version</structfield></entry>
7768 <entry><type>text</type></entry>
7769 <entry>Name of default version, or <literal>NULL</literal> if none is
7774 <entry><structfield>installed_version</structfield></entry>
7775 <entry><type>text</type></entry>
7776 <entry>Currently installed version of the extension,
7777 or <literal>NULL</literal> if not installed</entry>
7781 <entry><structfield>comment</structfield></entry>
7782 <entry><type>text</type></entry>
7783 <entry>Comment string from the extension's control file</entry>
7790 The <structname>pg_available_extensions</structname> view is read only.
7794 <sect1 id="view-pg-available-extension-versions">
7795 <title><structname>pg_available_extension_versions</structname></title>
7797 <indexterm zone="view-pg-available-extension-versions">
7798 <primary>pg_available_extension_versions</primary>
7802 The <structname>pg_available_extension_versions</structname> view lists the
7803 specific extension versions that are available for installation.
7805 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7806 catalog, which shows the extensions currently installed.
7810 <title><structname>pg_available_extension_versions</> Columns</title>
7817 <entry>Description</entry>
7823 <entry><structfield>name</structfield></entry>
7824 <entry><type>name</type></entry>
7825 <entry>Extension name</entry>
7829 <entry><structfield>version</structfield></entry>
7830 <entry><type>text</type></entry>
7831 <entry>Version name</entry>
7835 <entry><structfield>installed</structfield></entry>
7836 <entry><type>bool</type></entry>
7837 <entry>True if this version of this extension is currently
7842 <entry><structfield>superuser</structfield></entry>
7843 <entry><type>bool</type></entry>
7844 <entry>True if only superusers are allowed to install this extension</entry>
7848 <entry><structfield>relocatable</structfield></entry>
7849 <entry><type>bool</type></entry>
7850 <entry>True if extension can be relocated to another schema</entry>
7854 <entry><structfield>schema</structfield></entry>
7855 <entry><type>name</type></entry>
7856 <entry>Name of the schema that the extension must be installed into,
7857 or <literal>NULL</literal> if partially or fully relocatable</entry>
7861 <entry><structfield>requires</structfield></entry>
7862 <entry><type>name[]</type></entry>
7863 <entry>Names of prerequisite extensions,
7864 or <literal>NULL</literal> if none</entry>
7868 <entry><structfield>comment</structfield></entry>
7869 <entry><type>text</type></entry>
7870 <entry>Comment string from the extension's control file</entry>
7877 The <structname>pg_available_extension_versions</structname> view is read
7882 <sect1 id="view-pg-cursors">
7883 <title><structname>pg_cursors</structname></title>
7885 <indexterm zone="view-pg-cursors">
7886 <primary>pg_cursors</primary>
7890 The <structname>pg_cursors</structname> view lists the cursors that
7891 are currently available. Cursors can be defined in several ways:
7895 via the <xref linkend="sql-declare">
7902 via the Bind message in the frontend/backend protocol, as
7903 described in <xref linkend="protocol-flow-ext-query">
7909 via the Server Programming Interface (SPI), as described in
7910 <xref linkend="spi-interface">
7915 The <structname>pg_cursors</structname> view displays cursors
7916 created by any of these means. Cursors only exist for the duration
7917 of the transaction that defines them, unless they have been
7918 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7919 cursors are only present in the view until the end of their
7920 creating transaction.
7924 Cursors are used internally to implement some of the components
7925 of <productname>PostgreSQL</>, such as procedural languages.
7926 Therefore, the <structname>pg_cursors</> view might include cursors
7927 that have not been explicitly created by the user.
7933 <title><structname>pg_cursors</> Columns</title>
7940 <entry>Description</entry>
7946 <entry><structfield>name</structfield></entry>
7947 <entry><type>text</type></entry>
7948 <entry>The name of the cursor</entry>
7952 <entry><structfield>statement</structfield></entry>
7953 <entry><type>text</type></entry>
7954 <entry>The verbatim query string submitted to declare this cursor</entry>
7958 <entry><structfield>is_holdable</structfield></entry>
7959 <entry><type>boolean</type></entry>
7961 <literal>true</literal> if the cursor is holdable (that is, it
7962 can be accessed after the transaction that declared the cursor
7963 has committed); <literal>false</literal> otherwise
7968 <entry><structfield>is_binary</structfield></entry>
7969 <entry><type>boolean</type></entry>
7971 <literal>true</literal> if the cursor was declared
7972 <literal>BINARY</literal>; <literal>false</literal>
7978 <entry><structfield>is_scrollable</structfield></entry>
7979 <entry><type>boolean</type></entry>
7981 <literal>true</> if the cursor is scrollable (that is, it
7982 allows rows to be retrieved in a nonsequential manner);
7983 <literal>false</literal> otherwise
7988 <entry><structfield>creation_time</structfield></entry>
7989 <entry><type>timestamptz</type></entry>
7990 <entry>The time at which the cursor was declared</entry>
7997 The <structname>pg_cursors</structname> view is read only.
8002 <sect1 id="view-pg-group">
8003 <title><structname>pg_group</structname></title>
8005 <indexterm zone="view-pg-group">
8006 <primary>pg_group</primary>
8010 The view <structname>pg_group</structname> exists for backwards
8011 compatibility: it emulates a catalog that existed in
8012 <productname>PostgreSQL</productname> before version 8.1.
8013 It shows the names and members of all roles that are marked as not
8014 <structfield>rolcanlogin</>, which is an approximation to the set
8015 of roles that are being used as groups.
8019 <title><structname>pg_group</> Columns</title>
8026 <entry>References</entry>
8027 <entry>Description</entry>
8033 <entry><structfield>groname</structfield></entry>
8034 <entry><type>name</type></entry>
8035 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8036 <entry>Name of the group</entry>
8040 <entry><structfield>grosysid</structfield></entry>
8041 <entry><type>oid</type></entry>
8042 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8043 <entry>ID of this group</entry>
8047 <entry><structfield>grolist</structfield></entry>
8048 <entry><type>oid[]</type></entry>
8049 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8050 <entry>An array containing the IDs of the roles in this group</entry>
8058 <sect1 id="view-pg-indexes">
8059 <title><structname>pg_indexes</structname></title>
8061 <indexterm zone="view-pg-indexes">
8062 <primary>pg_indexes</primary>
8066 The view <structname>pg_indexes</structname> provides access to
8067 useful information about each index in the database.
8071 <title><structname>pg_indexes</> Columns</title>
8078 <entry>References</entry>
8079 <entry>Description</entry>
8084 <entry><structfield>schemaname</structfield></entry>
8085 <entry><type>name</type></entry>
8086 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8087 <entry>Name of schema containing table and index</entry>
8090 <entry><structfield>tablename</structfield></entry>
8091 <entry><type>name</type></entry>
8092 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8093 <entry>Name of table the index is for</entry>
8096 <entry><structfield>indexname</structfield></entry>
8097 <entry><type>name</type></entry>
8098 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8099 <entry>Name of index</entry>
8102 <entry><structfield>tablespace</structfield></entry>
8103 <entry><type>name</type></entry>
8104 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8105 <entry>Name of tablespace containing index (null if default for database)</entry>
8108 <entry><structfield>indexdef</structfield></entry>
8109 <entry><type>text</type></entry>
8111 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8120 <sect1 id="view-pg-locks">
8121 <title><structname>pg_locks</structname></title>
8123 <indexterm zone="view-pg-locks">
8124 <primary>pg_locks</primary>
8128 The view <structname>pg_locks</structname> provides access to
8129 information about the locks held by open transactions within the
8130 database server. See <xref linkend="mvcc"> for more discussion
8135 <structname>pg_locks</structname> contains one row per active lockable
8136 object, requested lock mode, and relevant transaction. Thus, the same
8137 lockable object might
8138 appear many times, if multiple transactions are holding or waiting
8139 for locks on it. However, an object that currently has no locks on it
8140 will not appear at all.
8144 There are several distinct types of lockable objects:
8145 whole relations (e.g., tables), individual pages of relations,
8146 individual tuples of relations,
8147 transaction IDs (both virtual and permanent IDs),
8148 and general database objects (identified by class OID and object OID,
8149 in the same way as in <structname>pg_description</structname> or
8150 <structname>pg_depend</structname>). Also, the right to extend a
8151 relation is represented as a separate lockable object.
8152 Also, <quote>advisory</> locks can be taken on numbers that have
8153 user-defined meanings.
8157 <title><structname>pg_locks</> Columns</title>
8164 <entry>References</entry>
8165 <entry>Description</entry>
8170 <entry><structfield>locktype</structfield></entry>
8171 <entry><type>text</type></entry>
8174 Type of the lockable object:
8175 <literal>relation</>,
8179 <literal>transactionid</>,
8180 <literal>virtualxid</>,
8182 <literal>userlock</>, or
8183 <literal>advisory</>
8187 <entry><structfield>database</structfield></entry>
8188 <entry><type>oid</type></entry>
8189 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8191 OID of the database in which the lock target exists, or
8192 zero if the target is a shared object, or
8193 null if the target is a transaction ID
8197 <entry><structfield>relation</structfield></entry>
8198 <entry><type>oid</type></entry>
8199 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8201 OID of the relation targeted by the lock, or null if the target is not
8202 a relation or part of a relation
8206 <entry><structfield>page</structfield></entry>
8207 <entry><type>integer</type></entry>
8210 Page number targeted by the lock within the relation,
8211 or null if the target is not a relation page or tuple
8215 <entry><structfield>tuple</structfield></entry>
8216 <entry><type>smallint</type></entry>
8219 Tuple number targeted by the lock within the page,
8220 or null if the target is not a tuple
8224 <entry><structfield>virtualxid</structfield></entry>
8225 <entry><type>text</type></entry>
8228 Virtual ID of the transaction targeted by the lock,
8229 or null if the target is not a virtual transaction ID
8233 <entry><structfield>transactionid</structfield></entry>
8234 <entry><type>xid</type></entry>
8237 ID of the transaction targeted by the lock,
8238 or null if the target is not a transaction ID
8242 <entry><structfield>classid</structfield></entry>
8243 <entry><type>oid</type></entry>
8244 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8246 OID of the system catalog containing the lock target, or null if the
8247 target is not a general database object
8251 <entry><structfield>objid</structfield></entry>
8252 <entry><type>oid</type></entry>
8253 <entry>any OID column</entry>
8255 OID of the lock target within its system catalog, or null if the
8256 target is not a general database object
8260 <entry><structfield>objsubid</structfield></entry>
8261 <entry><type>smallint</type></entry>
8264 Column number targeted by the lock (the
8265 <structfield>classid</> and <structfield>objid</> refer to the
8267 or zero if the target is some other general database object,
8268 or null if the target is not a general database object
8272 <entry><structfield>virtualtransaction</structfield></entry>
8273 <entry><type>text</type></entry>
8276 Virtual ID of the transaction that is holding or awaiting this lock
8280 <entry><structfield>pid</structfield></entry>
8281 <entry><type>integer</type></entry>
8284 Process ID of the server process holding or awaiting this
8285 lock, or null if the lock is held by a prepared transaction
8289 <entry><structfield>mode</structfield></entry>
8290 <entry><type>text</type></entry>
8292 <entry>Name of the lock mode held or desired by this process (see <xref
8293 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8296 <entry><structfield>granted</structfield></entry>
8297 <entry><type>boolean</type></entry>
8299 <entry>True if lock is held, false if lock is awaited</entry>
8302 <entry><structfield>fastpath</structfield></entry>
8303 <entry><type>boolean</type></entry>
8305 <entry>True if lock was taken via fast path, false if taken via main
8313 <structfield>granted</structfield> is true in a row representing a lock
8314 held by the indicated transaction. False indicates that this transaction is
8315 currently waiting to acquire this lock, which implies that some other
8316 transaction is holding a conflicting lock mode on the same lockable object.
8317 The waiting transaction will sleep until the other lock is released (or a
8318 deadlock situation is detected). A single transaction can be waiting to
8319 acquire at most one lock at a time.
8323 Every transaction holds an exclusive lock on its virtual transaction ID for
8324 its entire duration. If a permanent ID is assigned to the transaction
8325 (which normally happens only if the transaction changes the state of the
8326 database), it also holds an exclusive lock on its permanent transaction ID
8327 until it ends. When one transaction finds it necessary to wait specifically
8328 for another transaction, it does so by attempting to acquire share lock on
8329 the other transaction ID (either virtual or permanent ID depending on the
8330 situation). That will succeed only when the other transaction
8331 terminates and releases its locks.
8335 Although tuples are a lockable type of object,
8336 information about row-level locks is stored on disk, not in memory,
8337 and therefore row-level locks normally do not appear in this view.
8338 If a transaction is waiting for a
8339 row-level lock, it will usually appear in the view as waiting for the
8340 permanent transaction ID of the current holder of that row lock.
8344 Advisory locks can be acquired on keys consisting of either a single
8345 <type>bigint</type> value or two integer values.
8346 A <type>bigint</type> key is displayed with its
8347 high-order half in the <structfield>classid</> column, its low-order half
8348 in the <structfield>objid</> column, and <structfield>objsubid</> equal
8349 to 1. The original <type>bigint</type> value can be reassembled with the
8350 expression <literal>(classid::bigint << 32) |
8351 objid::bigint</literal>. Integer keys are displayed with the
8353 <structfield>classid</> column, the second key in the <structfield>objid</>
8354 column, and <structfield>objsubid</> equal to 2. The actual meaning of
8355 the keys is up to the user. Advisory locks are local to each database,
8356 so the <structfield>database</> column is meaningful for an advisory lock.
8360 <structname>pg_locks</structname> provides a global view of all locks
8361 in the database cluster, not only those relevant to the current database.
8362 Although its <structfield>relation</structfield> column can be joined
8363 against <structname>pg_class</>.<structfield>oid</> to identify locked
8364 relations, this will only work correctly for relations in the current
8365 database (those for which the <structfield>database</structfield> column
8366 is either the current database's OID or zero).
8370 The <structfield>pid</structfield> column can be joined to the
8371 <structfield>pid</structfield> column of the <link
8372 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8374 information on the session holding or waiting to hold each lock,
8377 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8378 ON pl.pid = psa.pid;
8380 Also, if you are using prepared transactions, the
8381 <structfield>virtualtransaction</> column can be joined to the
8382 <structfield>transaction</structfield> column of the <link
8383 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8384 view to get more information on prepared transactions that hold locks.
8385 (A prepared transaction can never be waiting for a lock,
8386 but it continues to hold the locks it acquired while running.)
8389 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8390 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8395 The <structname>pg_locks</structname> view displays data from both the
8396 regular lock manager and the predicate lock manager, which are
8397 separate systems; in addition, the regular lock manager subdivides its
8398 locks into regular and <firstterm>fast-path</> locks.
8399 This data is not guaranteed to be entirely consistent.
8400 When the view is queried,
8401 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8402 is gathered from each backend one at a time, without freezing the state of
8403 the entire lock manager, so it is possible for locks to be taken or
8404 released while information is gathered. Note, however, that these locks are
8405 known not to conflict with any other lock currently in place. After
8406 all backends have been queried for fast-path locks, the remainder of the
8407 regular lock manager is locked as a unit, and a consistent snapshot of all
8408 remaining locks is collected as an atomic action. After unlocking the
8409 regular lock manager, the predicate lock manager is similarly locked and all
8410 predicate locks are collected as an atomic action. Thus, with the exception
8411 of fast-path locks, each lock manager will deliver a consistent set of
8412 results, but as we do not lock both lock managers simultaneously, it is
8413 possible for locks to be taken or released after we interrogate the regular
8414 lock manager and before we interrogate the predicate lock manager.
8418 Locking the regular and/or predicate lock manager could have some
8419 impact on database performance if this view is very frequently accessed.
8420 The locks are held only for the minimum amount of time necessary to
8421 obtain data from the lock managers, but this does not completely eliminate
8422 the possibility of a performance impact.
8427 <sect1 id="view-pg-matviews">
8428 <title><structname>pg_matviews</structname></title>
8430 <indexterm zone="view-pg-matviews">
8431 <primary>pg_matviews</primary>
8434 <indexterm zone="view-pg-matviews">
8435 <primary>materialized views</primary>
8439 The view <structname>pg_matviews</structname> provides access to
8440 useful information about each materialized view in the database.
8444 <title><structname>pg_matviews</> Columns</title>
8451 <entry>References</entry>
8452 <entry>Description</entry>
8457 <entry><structfield>schemaname</structfield></entry>
8458 <entry><type>name</type></entry>
8459 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8460 <entry>Name of schema containing materialized view</entry>
8463 <entry><structfield>matviewname</structfield></entry>
8464 <entry><type>name</type></entry>
8465 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8466 <entry>Name of materialized view</entry>
8469 <entry><structfield>matviewowner</structfield></entry>
8470 <entry><type>name</type></entry>
8471 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8472 <entry>Name of materialized view's owner</entry>
8475 <entry><structfield>tablespace</structfield></entry>
8476 <entry><type>name</type></entry>
8477 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8478 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8481 <entry><structfield>hasindexes</structfield></entry>
8482 <entry><type>boolean</type></entry>
8484 <entry>True if materialized view has (or recently had) any indexes</entry>
8487 <entry><structfield>ispopulated</structfield></entry>
8488 <entry><type>boolean</type></entry>
8490 <entry>True if materialized view is currently populated</entry>
8493 <entry><structfield>definition</structfield></entry>
8494 <entry><type>text</type></entry>
8496 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8504 <sect1 id="view-pg-policies">
8505 <title><structname>pg_policies</structname></title>
8507 <indexterm zone="view-pg-policies">
8508 <primary>pg_policies</primary>
8512 The view <structname>pg_policies</structname> provides access to
8513 useful information about each row-level security policy in the database.
8517 <title><structname>pg_policies</> Columns</title>
8524 <entry>References</entry>
8525 <entry>Description</entry>
8530 <entry><structfield>schemaname</structfield></entry>
8531 <entry><type>name</type></entry>
8532 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8533 <entry>Name of schema containing table policy is on</entry>
8536 <entry><structfield>tablename</structfield></entry>
8537 <entry><type>name</type></entry>
8538 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8539 <entry>Name of table policy is on</entry>
8542 <entry><structfield>policyname</structfield></entry>
8543 <entry><type>name</type></entry>
8544 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
8545 <entry>Name of policy</entry>
8548 <entry><structfield>roles</structfield></entry>
8549 <entry><type>name[]</type></entry>
8551 <entry>The roles to which this policy applies</entry>
8554 <entry><structfield>cmd</structfield></entry>
8555 <entry><type>text</type></entry>
8557 <entry>The command type to which the policy is applied</entry>
8560 <entry><structfield>qual</structfield></entry>
8561 <entry><type>text</type></entry>
8563 <entry>The expression added to the security barrier qualifications for
8564 queries that this policy applies to</entry>
8567 <entry><structfield>with_check</structfield></entry>
8568 <entry><type>text</type></entry>
8570 <entry>The expression added to the WITH CHECK qualifications for
8571 queries that attempt to add rows to this table</entry>
8579 <sect1 id="view-pg-prepared-statements">
8580 <title><structname>pg_prepared_statements</structname></title>
8582 <indexterm zone="view-pg-prepared-statements">
8583 <primary>pg_prepared_statements</primary>
8587 The <structname>pg_prepared_statements</structname> view displays
8588 all the prepared statements that are available in the current
8589 session. See <xref linkend="sql-prepare"> for more information about prepared
8594 <structname>pg_prepared_statements</structname> contains one row
8595 for each prepared statement. Rows are added to the view when a new
8596 prepared statement is created and removed when a prepared statement
8597 is released (for example, via the <xref linkend="sql-deallocate"> command).
8601 <title><structname>pg_prepared_statements</> Columns</title>
8608 <entry>Description</entry>
8613 <entry><structfield>name</structfield></entry>
8614 <entry><type>text</type></entry>
8616 The identifier of the prepared statement
8620 <entry><structfield>statement</structfield></entry>
8621 <entry><type>text</type></entry>
8623 The query string submitted by the client to create this
8624 prepared statement. For prepared statements created via SQL,
8625 this is the <command>PREPARE</command> statement submitted by
8626 the client. For prepared statements created via the
8627 frontend/backend protocol, this is the text of the prepared
8632 <entry><structfield>prepare_time</structfield></entry>
8633 <entry><type>timestamptz</type></entry>
8635 The time at which the prepared statement was created
8639 <entry><structfield>parameter_types</structfield></entry>
8640 <entry><type>regtype[]</type></entry>
8642 The expected parameter types for the prepared statement in the
8643 form of an array of <type>regtype</type>. The OID corresponding
8644 to an element of this array can be obtained by casting the
8645 <type>regtype</type> value to <type>oid</type>.
8649 <entry><structfield>from_sql</structfield></entry>
8650 <entry><type>boolean</type></entry>
8652 <literal>true</literal> if the prepared statement was created
8653 via the <command>PREPARE</command> SQL statement;
8654 <literal>false</literal> if the statement was prepared via the
8655 frontend/backend protocol
8663 The <structname>pg_prepared_statements</structname> view is read only.
8667 <sect1 id="view-pg-prepared-xacts">
8668 <title><structname>pg_prepared_xacts</structname></title>
8670 <indexterm zone="view-pg-prepared-xacts">
8671 <primary>pg_prepared_xacts</primary>
8675 The view <structname>pg_prepared_xacts</structname> displays
8676 information about transactions that are currently prepared for two-phase
8677 commit (see <xref linkend="sql-prepare-transaction"> for details).
8681 <structname>pg_prepared_xacts</structname> contains one row per prepared
8682 transaction. An entry is removed when the transaction is committed or
8687 <title><structname>pg_prepared_xacts</> Columns</title>
8694 <entry>References</entry>
8695 <entry>Description</entry>
8700 <entry><structfield>transaction</structfield></entry>
8701 <entry><type>xid</type></entry>
8704 Numeric transaction identifier of the prepared transaction
8708 <entry><structfield>gid</structfield></entry>
8709 <entry><type>text</type></entry>
8712 Global transaction identifier that was assigned to the transaction
8716 <entry><structfield>prepared</structfield></entry>
8717 <entry><type>timestamp with time zone</type></entry>
8720 Time at which the transaction was prepared for commit
8724 <entry><structfield>owner</structfield></entry>
8725 <entry><type>name</type></entry>
8726 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8728 Name of the user that executed the transaction
8732 <entry><structfield>database</structfield></entry>
8733 <entry><type>name</type></entry>
8734 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8736 Name of the database in which the transaction was executed
8744 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8745 internal transaction manager data structures are momentarily locked, and
8746 a copy is made for the view to display. This ensures that the
8747 view produces a consistent set of results, while not blocking
8748 normal operations longer than necessary. Nonetheless
8749 there could be some impact on database performance if this view is
8750 frequently accessed.
8755 <sect1 id="view-pg-roles">
8756 <title><structname>pg_roles</structname></title>
8758 <indexterm zone="view-pg-roles">
8759 <primary>pg_roles</primary>
8763 The view <structname>pg_roles</structname> provides access to
8764 information about database roles. This is simply a publicly
8766 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8767 that blanks out the password field.
8771 This view explicitly exposes the OID column of the underlying table,
8772 since that is needed to do joins to other catalogs.
8776 <title><structname>pg_roles</> Columns</title>
8783 <entry>References</entry>
8784 <entry>Description</entry>
8790 <entry><structfield>rolname</structfield></entry>
8791 <entry><type>name</type></entry>
8793 <entry>Role name</entry>
8797 <entry><structfield>rolsuper</structfield></entry>
8798 <entry><type>bool</type></entry>
8800 <entry>Role has superuser privileges</entry>
8804 <entry><structfield>rolinherit</structfield></entry>
8805 <entry><type>bool</type></entry>
8807 <entry>Role automatically inherits privileges of roles it is a
8812 <entry><structfield>rolcreaterole</structfield></entry>
8813 <entry><type>bool</type></entry>
8815 <entry>Role can create more roles</entry>
8819 <entry><structfield>rolcreatedb</structfield></entry>
8820 <entry><type>bool</type></entry>
8822 <entry>Role can create databases</entry>
8826 <entry><structfield>rolcanlogin</structfield></entry>
8827 <entry><type>bool</type></entry>
8830 Role can log in. That is, this role can be given as the initial
8831 session authorization identifier
8836 <entry><structfield>rolreplication</structfield></entry>
8837 <entry><type>bool</type></entry>
8840 Role is a replication role. That is, this role can initiate streaming
8841 replication (see <xref linkend="streaming-replication">) and set/unset
8842 the system backup mode using <function>pg_start_backup</> and
8843 <function>pg_stop_backup</>
8848 <entry><structfield>rolconnlimit</structfield></entry>
8849 <entry><type>int4</type></entry>
8852 For roles that can log in, this sets maximum number of concurrent
8853 connections this role can make. -1 means no limit.
8858 <entry><structfield>rolpassword</structfield></entry>
8859 <entry><type>text</type></entry>
8861 <entry>Not the password (always reads as <literal>********</>)</entry>
8865 <entry><structfield>rolvaliduntil</structfield></entry>
8866 <entry><type>timestamptz</type></entry>
8868 <entry>Password expiry time (only used for password authentication);
8869 null if no expiration</entry>
8873 <entry><structfield>rolconfig</structfield></entry>
8874 <entry><type>text[]</type></entry>
8876 <entry>Role-specific defaults for run-time configuration variables</entry>
8880 <entry><structfield>oid</structfield></entry>
8881 <entry><type>oid</type></entry>
8882 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8883 <entry>ID of role</entry>
8891 <sect1 id="view-pg-rules">
8892 <title><structname>pg_rules</structname></title>
8894 <indexterm zone="view-pg-rules">
8895 <primary>pg_rules</primary>
8899 The view <structname>pg_rules</structname> provides access to
8900 useful information about query rewrite rules.
8904 <title><structname>pg_rules</> Columns</title>
8911 <entry>References</entry>
8912 <entry>Description</entry>
8917 <entry><structfield>schemaname</structfield></entry>
8918 <entry><type>name</type></entry>
8919 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8920 <entry>Name of schema containing table</entry>
8923 <entry><structfield>tablename</structfield></entry>
8924 <entry><type>name</type></entry>
8925 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8926 <entry>Name of table the rule is for</entry>
8929 <entry><structfield>rulename</structfield></entry>
8930 <entry><type>name</type></entry>
8931 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8932 <entry>Name of rule</entry>
8935 <entry><structfield>definition</structfield></entry>
8936 <entry><type>text</type></entry>
8938 <entry>Rule definition (a reconstructed creation command)</entry>
8945 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8946 of views and materialized views; those can be seen in
8947 <structname>pg_views</> and <structname>pg_matviews</>.
8952 <sect1 id="view-pg-seclabels">
8953 <title><structname>pg_seclabels</structname></title>
8955 <indexterm zone="view-pg-seclabels">
8956 <primary>pg_seclabels</primary>
8960 The view <structname>pg_seclabels</structname> provides information about
8961 security labels. It as an easier-to-query version of the
8962 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
8966 <title><structname>pg_seclabels</> Columns</title>
8973 <entry>References</entry>
8974 <entry>Description</entry>
8979 <entry><structfield>objoid</structfield></entry>
8980 <entry><type>oid</type></entry>
8981 <entry>any OID column</entry>
8982 <entry>The OID of the object this security label pertains to</entry>
8985 <entry><structfield>classoid</structfield></entry>
8986 <entry><type>oid</type></entry>
8987 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8988 <entry>The OID of the system catalog this object appears in</entry>
8991 <entry><structfield>objsubid</structfield></entry>
8992 <entry><type>int4</type></entry>
8995 For a security label on a table column, this is the column number (the
8996 <structfield>objoid</> and <structfield>classoid</> refer to
8997 the table itself). For all other object types, this column is
9002 <entry><structfield>objtype</structfield></entry>
9003 <entry><type>text</type></entry>
9006 The type of object to which this label applies, as text.
9010 <entry><structfield>objnamespace</structfield></entry>
9011 <entry><type>oid</type></entry>
9012 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9014 The OID of the namespace for this object, if applicable;
9019 <entry><structfield>objname</structfield></entry>
9020 <entry><type>text</type></entry>
9023 The name of the object to which this label applies, as text.
9027 <entry><structfield>provider</structfield></entry>
9028 <entry><type>text</type></entry>
9029 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9030 <entry>The label provider associated with this label.</entry>
9033 <entry><structfield>label</structfield></entry>
9034 <entry><type>text</type></entry>
9035 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
9036 <entry>The security label applied to this object.</entry>
9043 <sect1 id="view-pg-settings">
9044 <title><structname>pg_settings</structname></title>
9046 <indexterm zone="view-pg-settings">
9047 <primary>pg_settings</primary>
9051 The view <structname>pg_settings</structname> provides access to
9052 run-time parameters of the server. It is essentially an alternative
9053 interface to the <xref linkend="sql-show">
9054 and <xref linkend="sql-set"> commands.
9055 It also provides access to some facts about each parameter that are
9056 not directly available from <command>SHOW</>, such as minimum and
9061 <title><structname>pg_settings</> Columns</title>
9068 <entry>Description</entry>
9073 <entry><structfield>name</structfield></entry>
9074 <entry><type>text</type></entry>
9075 <entry>Run-time configuration parameter name</entry>
9078 <entry><structfield>setting</structfield></entry>
9079 <entry><type>text</type></entry>
9080 <entry>Current value of the parameter</entry>
9083 <entry><structfield>unit</structfield></entry>
9084 <entry><type>text</type></entry>
9085 <entry>Implicit unit of the parameter</entry>
9088 <entry><structfield>category</structfield></entry>
9089 <entry><type>text</type></entry>
9090 <entry>Logical group of the parameter</entry>
9093 <entry><structfield>short_desc</structfield></entry>
9094 <entry><type>text</type></entry>
9095 <entry>A brief description of the parameter</entry>
9098 <entry><structfield>extra_desc</structfield></entry>
9099 <entry><type>text</type></entry>
9100 <entry>Additional, more detailed, description of the parameter</entry>
9103 <entry><structfield>context</structfield></entry>
9104 <entry><type>text</type></entry>
9105 <entry>Context required to set the parameter's value (see below)</entry>
9108 <entry><structfield>vartype</structfield></entry>
9109 <entry><type>text</type></entry>
9110 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
9111 <literal>integer</>, <literal>real</>, or <literal>string</>)
9115 <entry><structfield>source</structfield></entry>
9116 <entry><type>text</type></entry>
9117 <entry>Source of the current parameter value</entry>
9120 <entry><structfield>min_val</structfield></entry>
9121 <entry><type>text</type></entry>
9122 <entry>Minimum allowed value of the parameter (null for non-numeric
9126 <entry><structfield>max_val</structfield></entry>
9127 <entry><type>text</type></entry>
9128 <entry>Maximum allowed value of the parameter (null for non-numeric
9132 <entry><structfield>enumvals</structfield></entry>
9133 <entry><type>text[]</type></entry>
9134 <entry>Allowed values of an enum parameter (null for non-enum
9138 <entry><structfield>boot_val</structfield></entry>
9139 <entry><type>text</type></entry>
9140 <entry>Parameter value assumed at server startup if the parameter is
9141 not otherwise set</entry>
9144 <entry><structfield>reset_val</structfield></entry>
9145 <entry><type>text</type></entry>
9146 <entry>Value that <command>RESET</command> would reset the parameter to
9147 in the current session</entry>
9150 <entry><structfield>sourcefile</structfield></entry>
9151 <entry><type>text</type></entry>
9152 <entry>Configuration file the current value was set in (null for
9153 values set from sources other than configuration files, or when
9154 examined by a non-superuser);
9155 helpful when using <literal>include</> directives in configuration files</entry>
9158 <entry><structfield>sourceline</structfield></entry>
9159 <entry><type>integer</type></entry>
9160 <entry>Line number within the configuration file the current value was
9161 set at (null for values set from sources other than configuration files,
9162 or when examined by a non-superuser)
9166 <entry><structfield>pending_restart</structfield></entry>
9167 <entry><type>boolean</type></entry>
9168 <entry><literal>true</literal> if the value has been changed in the
9169 configuration file but needs a restart; or <literal>false</literal>
9178 There are several possible values of <structfield>context</structfield>.
9179 In order of decreasing difficulty of changing the setting, they are:
9184 <!-- PGC_INTERNAL -->
9185 <term><literal>internal</literal></term>
9188 These settings cannot be changed directly; they reflect internally
9189 determined values. Some of them may be adjustable by rebuilding the
9190 server with different configuration options, or by changing options
9191 supplied to <command>initdb</command>.
9196 <!-- PGC_POSTMASTER -->
9197 <term><literal>postmaster</literal></term>
9200 These settings can only be applied when the server starts, so any change
9201 requires restarting the server. Values for these settings are typically
9202 stored in the <filename>postgresql.conf</filename> file, or passed on
9203 the command line when starting the server. Of course, settings with any
9204 of the lower <structfield>context</structfield> types can also be
9205 set at server start time.
9211 <term><literal>sighup</literal></term>
9214 Changes to these settings can be made in
9215 <filename>postgresql.conf</filename> without restarting the server.
9216 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
9217 cause it to re-read <filename>postgresql.conf</filename> and apply
9218 the changes. The postmaster will also forward the
9219 <systemitem>SIGHUP</systemitem> signal to its child processes so that
9220 they all pick up the new value.
9225 <!-- PGC_SU_BACKEND -->
9226 <term><literal>superuser-backend</literal></term>
9229 Changes to these settings can be made in
9230 <filename>postgresql.conf</filename> without restarting the server.
9231 They can also be set for a particular session in the connection request
9232 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9233 environment variable), but only if the connecting user is a superuser.
9234 However, these settings never change in a session after it is started.
9235 If you change them in <filename>postgresql.conf</filename>, send a
9236 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9237 re-read <filename>postgresql.conf</filename>. The new values will only
9238 affect subsequently-launched sessions.
9243 <!-- PGC_BACKEND -->
9244 <term><literal>backend</literal></term>
9247 Changes to these settings can be made in
9248 <filename>postgresql.conf</filename> without restarting the server.
9249 They can also be set for a particular session in the connection request
9250 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9251 environment variable); any user can make such a change for his session.
9252 However, these settings never change in a session after it is started.
9253 If you change them in <filename>postgresql.conf</filename>, send a
9254 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9255 re-read <filename>postgresql.conf</filename>. The new values will only
9256 affect subsequently-launched sessions.
9262 <term><literal>superuser</literal></term>
9265 These settings can be set from <filename>postgresql.conf</filename>,
9266 or within a session via the <command>SET</> command; but only superusers
9267 can change them via <command>SET</>. Changes in
9268 <filename>postgresql.conf</filename> will affect existing sessions
9269 only if no session-local value has been established with <command>SET</>.
9274 <!-- PGC_USERSET -->
9275 <term><literal>user</literal></term>
9278 These settings can be set from <filename>postgresql.conf</filename>,
9279 or within a session via the <command>SET</> command. Any user is
9280 allowed to change his session-local value. Changes in
9281 <filename>postgresql.conf</filename> will affect existing sessions
9282 only if no session-local value has been established with <command>SET</>.
9289 See <xref linkend="config-setting"> for more information about the various
9290 ways to change these parameters.
9294 The <structname>pg_settings</structname> view cannot be inserted into or
9295 deleted from, but it can be updated. An <command>UPDATE</command> applied
9296 to a row of <structname>pg_settings</structname> is equivalent to executing
9297 the <xref linkend="sql-set"> command on that named
9298 parameter. The change only affects the value used by the current
9299 session. If an <command>UPDATE</command> is issued within a transaction
9300 that is later aborted, the effects of the <command>UPDATE</command> command
9301 disappear when the transaction is rolled back. Once the surrounding
9302 transaction is committed, the effects will persist until the end of the
9303 session, unless overridden by another <command>UPDATE</command> or
9304 <command>SET</command>.
9309 <sect1 id="view-pg-file-settings">
9310 <title><structname>pg_file_settings</structname></title>
9312 <indexterm zone="view-pg-file-settings">
9313 <primary>pg_file_settings</primary>
9317 The view <structname>pg_file_settings</structname> provides the file
9318 name, line number and value of all parameters which are set through
9319 configuration files.
9320 In contrast to <structname>pg_settings</structname>, a row is provided for
9321 each occurrence of the parameter across all configuration files. This is helpful
9322 for discovering why one value may have been used in preference to another
9323 when the parameters were loaded.
9327 <title><structname>pg_file_settings</> Columns</title>
9334 <entry>Description</entry>
9339 <entry><structfield>sourcefile</structfield></entry>
9340 <entry><structfield>text</structfield></entry>
9341 <entry>Path to and name of the configration file</entry>
9344 <entry><structfield>sourceline</structfield></entry>
9345 <entry><structfield>integer</structfield></entry>
9347 Line number within the configuration file where the value was set
9351 <entry><structfield>seqno</structfield></entry>
9352 <entry><structfield>integer</structfield></entry>
9353 <entry>Order in which the setting was loaded</entry>
9356 <entry><structfield>name</structfield></entry>
9357 <entry><structfield>text</structfield></entry>
9358 <entry>Run-time configuration parameter name</entry>
9361 <entry><structfield>setting</structfield></entry>
9362 <entry><structfield>text</structfield></entry>
9363 <entry>value of the parameter</entry>
9370 See <xref linkend="config-setting"> for more information about the various
9371 ways to change these parameters.
9375 The <structname>pg_file_settings</structname> view cannot be modified
9376 directly as it represents information, as read in at server start or
9377 reload time, about all parameter settings across all configuration files.
9382 <sect1 id="view-pg-shadow">
9383 <title><structname>pg_shadow</structname></title>
9385 <indexterm zone="view-pg-shadow">
9386 <primary>pg_shadow</primary>
9390 The view <structname>pg_shadow</structname> exists for backwards
9391 compatibility: it emulates a catalog that existed in
9392 <productname>PostgreSQL</productname> before version 8.1.
9393 It shows properties of all roles that are marked as
9394 <structfield>rolcanlogin</> in
9395 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
9399 The name stems from the fact that this table
9400 should not be readable by the public since it contains passwords.
9401 <link linkend="view-pg-user"><structname>pg_user</structname></link>
9402 is a publicly readable view on
9403 <structname>pg_shadow</structname> that blanks out the password field.
9407 <title><structname>pg_shadow</> Columns</title>
9414 <entry>References</entry>
9415 <entry>Description</entry>
9421 <entry><structfield>usename</structfield></entry>
9422 <entry><type>name</type></entry>
9423 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9424 <entry>User name</entry>
9428 <entry><structfield>usesysid</structfield></entry>
9429 <entry><type>oid</type></entry>
9430 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9431 <entry>ID of this user</entry>
9435 <entry><structfield>usecreatedb</structfield></entry>
9436 <entry><type>bool</type></entry>
9438 <entry>User can create databases</entry>
9442 <entry><structfield>usesuper</structfield></entry>
9443 <entry><type>bool</type></entry>
9445 <entry>User is a superuser</entry>
9449 <entry><structfield>userepl</structfield></entry>
9450 <entry><type>bool</type></entry>
9453 User can initiate streaming replication and put the system in and
9459 <entry><structfield>usebypassrls</structfield></entry>
9460 <entry><type>bool</type></entry>
9463 User can bypass row level security policies, see
9464 <xref linkend="ddl-rowsecurity"> for more information.
9469 <entry><structfield>passwd</structfield></entry>
9470 <entry><type>text</type></entry>
9472 <entry>Password (possibly encrypted); null if none. See
9473 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9474 for details of how encrypted passwords are stored.</entry>
9478 <entry><structfield>valuntil</structfield></entry>
9479 <entry><type>abstime</type></entry>
9481 <entry>Password expiry time (only used for password authentication)</entry>
9485 <entry><structfield>useconfig</structfield></entry>
9486 <entry><type>text[]</type></entry>
9488 <entry>Session defaults for run-time configuration variables</entry>
9496 <sect1 id="view-pg-stats">
9497 <title><structname>pg_stats</structname></title>
9499 <indexterm zone="view-pg-stats">
9500 <primary>pg_stats</primary>
9504 The view <structname>pg_stats</structname> provides access to
9505 the information stored in the <link
9506 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
9507 catalog. This view allows access only to rows of
9508 <structname>pg_statistic</structname> that correspond to tables the
9509 user has permission to read, and therefore it is safe to allow public
9510 read access to this view.
9514 <structname>pg_stats</structname> is also designed to present the
9515 information in a more readable format than the underlying catalog
9516 — at the cost that its schema must be extended whenever new slot types
9517 are defined for <structname>pg_statistic</structname>.
9521 <title><structname>pg_stats</> Columns</title>
9528 <entry>References</entry>
9529 <entry>Description</entry>
9534 <entry><structfield>schemaname</structfield></entry>
9535 <entry><type>name</type></entry>
9536 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9537 <entry>Name of schema containing table</entry>
9541 <entry><structfield>tablename</structfield></entry>
9542 <entry><type>name</type></entry>
9543 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9544 <entry>Name of table</entry>
9548 <entry><structfield>attname</structfield></entry>
9549 <entry><type>name</type></entry>
9550 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9551 <entry>Name of the column described by this row</entry>
9555 <entry><structfield>inherited</structfield></entry>
9556 <entry><type>bool</type></entry>
9558 <entry>If true, this row includes inheritance child columns, not just the
9559 values in the specified table</entry>
9563 <entry><structfield>null_frac</structfield></entry>
9564 <entry><type>real</type></entry>
9566 <entry>Fraction of column entries that are null</entry>
9570 <entry><structfield>avg_width</structfield></entry>
9571 <entry><type>integer</type></entry>
9573 <entry>Average width in bytes of column's entries</entry>
9577 <entry><structfield>n_distinct</structfield></entry>
9578 <entry><type>real</type></entry>
9581 If greater than zero, the estimated number of distinct values in the
9582 column. If less than zero, the negative of the number of distinct
9583 values divided by the number of rows. (The negated form is used when
9584 <command>ANALYZE</> believes that the number of distinct values is
9585 likely to increase as the table grows; the positive form is used when
9586 the column seems to have a fixed number of possible values.) For
9587 example, -1 indicates a unique column in which the number of distinct
9588 values is the same as the number of rows.
9593 <entry><structfield>most_common_vals</structfield></entry>
9594 <entry><type>anyarray</type></entry>
9597 A list of the most common values in the column. (Null if
9598 no values seem to be more common than any others.)
9603 <entry><structfield>most_common_freqs</structfield></entry>
9604 <entry><type>real[]</type></entry>
9607 A list of the frequencies of the most common values,
9608 i.e., number of occurrences of each divided by total number of rows.
9609 (Null when <structfield>most_common_vals</structfield> is.)
9614 <entry><structfield>histogram_bounds</structfield></entry>
9615 <entry><type>anyarray</type></entry>
9618 A list of values that divide the column's values into groups of
9619 approximately equal population. The values in
9620 <structfield>most_common_vals</>, if present, are omitted from this
9621 histogram calculation. (This column is null if the column data type
9622 does not have a <literal><</> operator or if the
9623 <structfield>most_common_vals</> list accounts for the entire
9629 <entry><structfield>correlation</structfield></entry>
9630 <entry><type>real</type></entry>
9633 Statistical correlation between physical row ordering and
9634 logical ordering of the column values. This ranges from -1 to +1.
9635 When the value is near -1 or +1, an index scan on the column will
9636 be estimated to be cheaper than when it is near zero, due to reduction
9637 of random access to the disk. (This column is null if the column data
9638 type does not have a <literal><</> operator.)
9643 <entry><structfield>most_common_elems</structfield></entry>
9644 <entry><type>anyarray</type></entry>
9647 A list of non-null element values most often appearing within values of
9648 the column. (Null for scalar types.)
9653 <entry><structfield>most_common_elem_freqs</structfield></entry>
9654 <entry><type>real[]</type></entry>
9657 A list of the frequencies of the most common element values, i.e., the
9658 fraction of rows containing at least one instance of the given value.
9659 Two or three additional values follow the per-element frequencies;
9660 these are the minimum and maximum of the preceding per-element
9661 frequencies, and optionally the frequency of null elements.
9662 (Null when <structfield>most_common_elems</structfield> is.)
9667 <entry><structfield>elem_count_histogram</structfield></entry>
9668 <entry><type>real[]</type></entry>
9671 A histogram of the counts of distinct non-null element values within the
9672 values of the column, followed by the average number of distinct
9673 non-null elements. (Null for scalar types.)
9681 The maximum number of entries in the array fields can be controlled on a
9682 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9683 command, or globally by setting the
9684 <xref linkend="guc-default-statistics-target"> run-time parameter.
9689 <sect1 id="view-pg-tables">
9690 <title><structname>pg_tables</structname></title>
9692 <indexterm zone="view-pg-tables">
9693 <primary>pg_tables</primary>
9697 The view <structname>pg_tables</structname> provides access to
9698 useful information about each table in the database.
9702 <title><structname>pg_tables</> Columns</title>
9709 <entry>References</entry>
9710 <entry>Description</entry>
9715 <entry><structfield>schemaname</structfield></entry>
9716 <entry><type>name</type></entry>
9717 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9718 <entry>Name of schema containing table</entry>
9721 <entry><structfield>tablename</structfield></entry>
9722 <entry><type>name</type></entry>
9723 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9724 <entry>Name of table</entry>
9727 <entry><structfield>tableowner</structfield></entry>
9728 <entry><type>name</type></entry>
9729 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9730 <entry>Name of table's owner</entry>
9733 <entry><structfield>tablespace</structfield></entry>
9734 <entry><type>name</type></entry>
9735 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9736 <entry>Name of tablespace containing table (null if default for database)</entry>
9739 <entry><structfield>hasindexes</structfield></entry>
9740 <entry><type>boolean</type></entry>
9741 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9742 <entry>True if table has (or recently had) any indexes</entry>
9745 <entry><structfield>hasrules</structfield></entry>
9746 <entry><type>boolean</type></entry>
9747 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9748 <entry>True if table has (or once had) rules</entry>
9751 <entry><structfield>hastriggers</structfield></entry>
9752 <entry><type>boolean</type></entry>
9753 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9754 <entry>True if table has (or once had) triggers</entry>
9757 <entry><structfield>rowsecurity</structfield></entry>
9758 <entry><type>boolean</type></entry>
9759 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
9760 <entry>True if row security is enabled on the table</entry>
9768 <sect1 id="view-pg-timezone-abbrevs">
9769 <title><structname>pg_timezone_abbrevs</structname></title>
9771 <indexterm zone="view-pg-timezone-abbrevs">
9772 <primary>pg_timezone_abbrevs</primary>
9776 The view <structname>pg_timezone_abbrevs</structname> provides a list
9777 of time zone abbreviations that are currently recognized by the datetime
9778 input routines. The contents of this view change when the
9779 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9783 <title><structname>pg_timezone_abbrevs</> Columns</title>
9790 <entry>Description</entry>
9795 <entry><structfield>abbrev</structfield></entry>
9796 <entry><type>text</type></entry>
9797 <entry>Time zone abbreviation</entry>
9800 <entry><structfield>utc_offset</structfield></entry>
9801 <entry><type>interval</type></entry>
9802 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9805 <entry><structfield>is_dst</structfield></entry>
9806 <entry><type>boolean</type></entry>
9807 <entry>True if this is a daylight-savings abbreviation</entry>
9815 <sect1 id="view-pg-timezone-names">
9816 <title><structname>pg_timezone_names</structname></title>
9818 <indexterm zone="view-pg-timezone-names">
9819 <primary>pg_timezone_names</primary>
9823 The view <structname>pg_timezone_names</structname> provides a list
9824 of time zone names that are recognized by <command>SET TIMEZONE</>,
9825 along with their associated abbreviations, UTC offsets,
9826 and daylight-savings status. (Technically,
9827 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9828 than UTC because leap seconds are not handled.)
9829 Unlike the abbreviations shown in <link
9830 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9831 date rules. Therefore, the associated information changes across local DST
9832 boundaries. The displayed information is computed based on the current
9833 value of <function>CURRENT_TIMESTAMP</>.
9837 <title><structname>pg_timezone_names</> Columns</title>
9844 <entry>Description</entry>
9849 <entry><structfield>name</structfield></entry>
9850 <entry><type>text</type></entry>
9851 <entry>Time zone name</entry>
9854 <entry><structfield>abbrev</structfield></entry>
9855 <entry><type>text</type></entry>
9856 <entry>Time zone abbreviation</entry>
9859 <entry><structfield>utc_offset</structfield></entry>
9860 <entry><type>interval</type></entry>
9861 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9864 <entry><structfield>is_dst</structfield></entry>
9865 <entry><type>boolean</type></entry>
9866 <entry>True if currently observing daylight savings</entry>
9874 <sect1 id="view-pg-user">
9875 <title><structname>pg_user</structname></title>
9877 <indexterm zone="view-pg-user">
9878 <primary>pg_user</primary>
9882 The view <structname>pg_user</structname> provides access to
9883 information about database users. This is simply a publicly
9885 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9886 that blanks out the password field.
9890 <title><structname>pg_user</> Columns</title>
9897 <entry>Description</entry>
9902 <entry><structfield>usename</structfield></entry>
9903 <entry><type>name</type></entry>
9904 <entry>User name</entry>
9908 <entry><structfield>usesysid</structfield></entry>
9909 <entry><type>oid</type></entry>
9910 <entry>ID of this user</entry>
9914 <entry><structfield>usecreatedb</structfield></entry>
9915 <entry><type>bool</type></entry>
9916 <entry>User can create databases</entry>
9920 <entry><structfield>usesuper</structfield></entry>
9921 <entry><type>bool</type></entry>
9922 <entry>User is a superuser</entry>
9926 <entry><structfield>userepl</structfield></entry>
9927 <entry><type>bool</type></entry>
9929 User can initiate streaming replication and put the system in and
9935 <entry><structfield>usebypassrls</structfield></entry>
9936 <entry><type>bool</type></entry>
9938 User can bypass row level security policies, see
9939 <xref linkend="ddl-rowsecurity"> for more information.
9944 <entry><structfield>passwd</structfield></entry>
9945 <entry><type>text</type></entry>
9946 <entry>Not the password (always reads as <literal>********</>)</entry>
9950 <entry><structfield>valuntil</structfield></entry>
9951 <entry><type>abstime</type></entry>
9952 <entry>Password expiry time (only used for password authentication)</entry>
9956 <entry><structfield>useconfig</structfield></entry>
9957 <entry><type>text[]</type></entry>
9958 <entry>Session defaults for run-time configuration variables</entry>
9966 <sect1 id="view-pg-user-mappings">
9967 <title><structname>pg_user_mappings</structname></title>
9969 <indexterm zone="view-pg-user-mappings">
9970 <primary>pg_user_mappings</primary>
9974 The view <structname>pg_user_mappings</structname> provides access
9975 to information about user mappings. This is essentially a publicly
9977 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9978 that leaves out the options field if the user has no rights to use
9983 <title><structname>pg_user_mappings</> Columns</title>
9990 <entry>References</entry>
9991 <entry>Description</entry>
9997 <entry><structfield>umid</structfield></entry>
9998 <entry><type>oid</type></entry>
9999 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
10000 <entry>OID of the user mapping</entry>
10004 <entry><structfield>srvid</structfield></entry>
10005 <entry><type>oid</type></entry>
10006 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
10008 The OID of the foreign server that contains this mapping
10013 <entry><structfield>srvname</structfield></entry>
10014 <entry><type>name</type></entry>
10015 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
10017 Name of the foreign server
10022 <entry><structfield>umuser</structfield></entry>
10023 <entry><type>oid</type></entry>
10024 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10025 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
10029 <entry><structfield>usename</structfield></entry>
10030 <entry><type>name</type></entry>
10032 <entry>Name of the local user to be mapped</entry>
10036 <entry><structfield>umoptions</structfield></entry>
10037 <entry><type>text[]</type></entry>
10040 User mapping specific options, as <quote>keyword=value</>
10041 strings, if the current user is the owner of the foreign
10051 <sect1 id="view-pg-views">
10052 <title><structname>pg_views</structname></title>
10054 <indexterm zone="view-pg-views">
10055 <primary>pg_views</primary>
10059 The view <structname>pg_views</structname> provides access to
10060 useful information about each view in the database.
10064 <title><structname>pg_views</> Columns</title>
10069 <entry>Name</entry>
10070 <entry>Type</entry>
10071 <entry>References</entry>
10072 <entry>Description</entry>
10077 <entry><structfield>schemaname</structfield></entry>
10078 <entry><type>name</type></entry>
10079 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10080 <entry>Name of schema containing view</entry>
10083 <entry><structfield>viewname</structfield></entry>
10084 <entry><type>name</type></entry>
10085 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10086 <entry>Name of view</entry>
10089 <entry><structfield>viewowner</structfield></entry>
10090 <entry><type>name</type></entry>
10091 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10092 <entry>Name of view's owner</entry>
10095 <entry><structfield>definition</structfield></entry>
10096 <entry><type>text</type></entry>
10098 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>