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-slots"><structname>pg_replication_slots</structname></link></entry>
243 <entry>replication slot information</entry>
247 <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
248 <entry>security labels on database objects</entry>
252 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
253 <entry>dependencies on shared objects</entry>
257 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
258 <entry>comments on shared objects</entry>
262 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
263 <entry>security labels on shared database objects</entry>
267 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
268 <entry>planner statistics</entry>
272 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
273 <entry>tablespaces within this database cluster</entry>
277 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
278 <entry>triggers</entry>
282 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
283 <entry>text search configurations</entry>
287 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
288 <entry>text search configurations' token mappings</entry>
292 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
293 <entry>text search dictionaries</entry>
297 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
298 <entry>text search parsers</entry>
302 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
303 <entry>text search templates</entry>
307 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
308 <entry>data types</entry>
312 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
313 <entry>mappings of users to foreign servers</entry>
321 <sect1 id="catalog-pg-aggregate">
322 <title><structname>pg_aggregate</structname></title>
324 <indexterm zone="catalog-pg-aggregate">
325 <primary>pg_aggregate</primary>
329 The catalog <structname>pg_aggregate</structname> stores information about
330 aggregate functions. An aggregate function is a function that
331 operates on a set of values (typically one column from each row
332 that matches a query condition) and returns a single value computed
333 from all these values. Typical aggregate functions are
334 <function>sum</function>, <function>count</function>, and
335 <function>max</function>. Each entry in
336 <structname>pg_aggregate</structname> is an extension of an entry
337 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
338 entry carries the aggregate's name, input and output data types, and
339 other information that is similar to ordinary functions.
343 <title><structname>pg_aggregate</> Columns</title>
350 <entry>References</entry>
351 <entry>Description</entry>
356 <entry><structfield>aggfnoid</structfield></entry>
357 <entry><type>regproc</type></entry>
358 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
359 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
362 <entry><structfield>aggkind</structfield></entry>
363 <entry><type>char</type></entry>
365 <entry>Aggregate kind:
366 <literal>n</literal> for <quote>normal</> aggregates,
367 <literal>o</literal> for <quote>ordered-set</> aggregates, or
368 <literal>h</literal> for <quote>hypothetical-set</> aggregates
372 <entry><structfield>aggnumdirectargs</structfield></entry>
373 <entry><type>int2</type></entry>
375 <entry>Number of direct (non-aggregated) arguments of an ordered-set or
376 hypothetical-set aggregate, counting a variadic array as one argument.
377 If equal to <structfield>pronargs</>, the aggregate must be variadic
378 and the variadic array describes the aggregated arguments as well as
379 the final direct arguments.
380 Always zero for normal aggregates.</entry>
383 <entry><structfield>aggtransfn</structfield></entry>
384 <entry><type>regproc</type></entry>
385 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
386 <entry>Transition function</entry>
389 <entry><structfield>aggfinalfn</structfield></entry>
390 <entry><type>regproc</type></entry>
391 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
392 <entry>Final function (zero if none)</entry>
395 <entry><structfield>aggmtransfn</structfield></entry>
396 <entry><type>regproc</type></entry>
397 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
398 <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
401 <entry><structfield>aggminvtransfn</structfield></entry>
402 <entry><type>regproc</type></entry>
403 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
404 <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
407 <entry><structfield>aggmfinalfn</structfield></entry>
408 <entry><type>regproc</type></entry>
409 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
410 <entry>Final function for moving-aggregate mode (zero if none)</entry>
413 <entry><structfield>aggfinalextra</structfield></entry>
414 <entry><type>bool</type></entry>
416 <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
419 <entry><structfield>aggmfinalextra</structfield></entry>
420 <entry><type>bool</type></entry>
422 <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
425 <entry><structfield>aggsortop</structfield></entry>
426 <entry><type>oid</type></entry>
427 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
428 <entry>Associated sort operator (zero if none)</entry>
431 <entry><structfield>aggtranstype</structfield></entry>
432 <entry><type>oid</type></entry>
433 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
434 <entry>Data type of the aggregate function's internal transition (state) data</entry>
437 <entry><structfield>aggtransspace</structfield></entry>
438 <entry><type>int4</type></entry>
440 <entry>Approximate average size (in bytes) of the transition state
441 data, or zero to use a default estimate</entry>
444 <entry><structfield>aggmtranstype</structfield></entry>
445 <entry><type>oid</type></entry>
446 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
447 <entry>Data type of the aggregate function's internal transition (state)
448 data for moving-aggregate mode (zero if none)</entry>
451 <entry><structfield>aggmtransspace</structfield></entry>
452 <entry><type>int4</type></entry>
454 <entry>Approximate average size (in bytes) of the transition state data
455 for moving-aggregate mode, or zero to use a default estimate</entry>
458 <entry><structfield>agginitval</structfield></entry>
459 <entry><type>text</type></entry>
462 The initial value of the transition state. This is a text
463 field containing the initial value in its external string
464 representation. If this field is null, the transition state
465 value starts out null.
469 <entry><structfield>aggminitval</structfield></entry>
470 <entry><type>text</type></entry>
473 The initial value of the transition state for moving-aggregate mode.
474 This is a text field containing the initial value in its external
475 string representation. If this field is null, the transition state
476 value starts out null.
484 New aggregate functions are registered with the <xref
485 linkend="sql-createaggregate">
486 command. See <xref linkend="xaggr"> for more information about
487 writing aggregate functions and the meaning of the transition
494 <sect1 id="catalog-pg-am">
495 <title><structname>pg_am</structname></title>
497 <indexterm zone="catalog-pg-am">
498 <primary>pg_am</primary>
502 The catalog <structname>pg_am</structname> stores information about index
503 access methods. There is one row for each index access method supported by
504 the system. The contents of this catalog are discussed in detail in
505 <xref linkend="indexam">.
509 <title><structname>pg_am</> Columns</title>
516 <entry>References</entry>
517 <entry>Description</entry>
523 <entry><structfield>oid</structfield></entry>
524 <entry><type>oid</type></entry>
526 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
530 <entry><structfield>amname</structfield></entry>
531 <entry><type>name</type></entry>
533 <entry>Name of the access method</entry>
537 <entry><structfield>amstrategies</structfield></entry>
538 <entry><type>int2</type></entry>
540 <entry>Number of operator strategies for this access method,
541 or zero if access method does not have a fixed set of operator
546 <entry><structfield>amsupport</structfield></entry>
547 <entry><type>int2</type></entry>
549 <entry>Number of support routines for this access method</entry>
553 <entry><structfield>amcanorder</structfield></entry>
554 <entry><type>bool</type></entry>
556 <entry>Does the access method support ordered scans sorted by the
557 indexed column's value?</entry>
561 <entry><structfield>amcanorderbyop</structfield></entry>
562 <entry><type>bool</type></entry>
564 <entry>Does the access method support ordered scans sorted by the result
565 of an operator on the indexed column?</entry>
569 <entry><structfield>amcanbackward</structfield></entry>
570 <entry><type>bool</type></entry>
572 <entry>Does the access method support backward scanning?</entry>
576 <entry><structfield>amcanunique</structfield></entry>
577 <entry><type>bool</type></entry>
579 <entry>Does the access method support unique indexes?</entry>
583 <entry><structfield>amcanmulticol</structfield></entry>
584 <entry><type>bool</type></entry>
586 <entry>Does the access method support multicolumn indexes?</entry>
590 <entry><structfield>amoptionalkey</structfield></entry>
591 <entry><type>bool</type></entry>
593 <entry>Does the access method support a scan without any constraint
594 for the first index column?</entry>
598 <entry><structfield>amsearcharray</structfield></entry>
599 <entry><type>bool</type></entry>
601 <entry>Does the access method support <literal>ScalarArrayOpExpr</> searches?</entry>
605 <entry><structfield>amsearchnulls</structfield></entry>
606 <entry><type>bool</type></entry>
608 <entry>Does the access method support <literal>IS NULL</>/<literal>NOT NULL</> searches?</entry>
612 <entry><structfield>amstorage</structfield></entry>
613 <entry><type>bool</type></entry>
615 <entry>Can index storage data type differ from column data type?</entry>
619 <entry><structfield>amclusterable</structfield></entry>
620 <entry><type>bool</type></entry>
622 <entry>Can an index of this type be clustered on?</entry>
626 <entry><structfield>ampredlocks</structfield></entry>
627 <entry><type>bool</type></entry>
629 <entry>Does an index of this type manage fine-grained predicate locks?</entry>
633 <entry><structfield>amkeytype</structfield></entry>
634 <entry><type>oid</type></entry>
635 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
636 <entry>Type of data stored in index, or zero if not a fixed type</entry>
640 <entry><structfield>aminsert</structfield></entry>
641 <entry><type>regproc</type></entry>
642 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
643 <entry><quote>Insert this tuple</quote> function</entry>
647 <entry><structfield>ambeginscan</structfield></entry>
648 <entry><type>regproc</type></entry>
649 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
650 <entry><quote>Prepare for index scan</quote> function</entry>
654 <entry><structfield>amgettuple</structfield></entry>
655 <entry><type>regproc</type></entry>
656 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
657 <entry><quote>Next valid tuple</quote> function, or zero if none</entry>
661 <entry><structfield>amgetbitmap</structfield></entry>
662 <entry><type>regproc</type></entry>
663 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
664 <entry><quote>Fetch all valid tuples</quote> function, or zero if none</entry>
668 <entry><structfield>amrescan</structfield></entry>
669 <entry><type>regproc</type></entry>
670 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
671 <entry><quote>(Re)start index scan</quote> function</entry>
675 <entry><structfield>amendscan</structfield></entry>
676 <entry><type>regproc</type></entry>
677 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
678 <entry><quote>Clean up after index scan</quote> function</entry>
682 <entry><structfield>ammarkpos</structfield></entry>
683 <entry><type>regproc</type></entry>
684 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
685 <entry><quote>Mark current scan position</quote> function</entry>
689 <entry><structfield>amrestrpos</structfield></entry>
690 <entry><type>regproc</type></entry>
691 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
692 <entry><quote>Restore marked scan position</quote> function</entry>
696 <entry><structfield>ambuild</structfield></entry>
697 <entry><type>regproc</type></entry>
698 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
699 <entry><quote>Build new index</quote> function</entry>
703 <entry><structfield>ambuildempty</structfield></entry>
704 <entry><type>regproc</type></entry>
705 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
706 <entry><quote>Build empty index</quote> function</entry>
710 <entry><structfield>ambulkdelete</structfield></entry>
711 <entry><type>regproc</type></entry>
712 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
713 <entry>Bulk-delete function</entry>
717 <entry><structfield>amvacuumcleanup</structfield></entry>
718 <entry><type>regproc</type></entry>
719 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
720 <entry>Post-<command>VACUUM</command> cleanup function</entry>
724 <entry><structfield>amcanreturn</structfield></entry>
725 <entry><type>regproc</type></entry>
726 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
727 <entry>Function to check whether an index column supports index-only
728 scans. Can be zero if index-only scans are never supported.</entry>
732 <entry><structfield>amcostestimate</structfield></entry>
733 <entry><type>regproc</type></entry>
734 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
735 <entry>Function to estimate cost of an index scan</entry>
739 <entry><structfield>amoptions</structfield></entry>
740 <entry><type>regproc</type></entry>
741 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
742 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
752 <sect1 id="catalog-pg-amop">
753 <title><structname>pg_amop</structname></title>
755 <indexterm zone="catalog-pg-amop">
756 <primary>pg_amop</primary>
760 The catalog <structname>pg_amop</structname> stores information about
761 operators associated with access method operator families. There is one
762 row for each operator that is a member of an operator family. A family
763 member can be either a <firstterm>search</> operator or an
764 <firstterm>ordering</> operator. An operator
765 can appear in more than one family, but cannot appear in more than one
766 search position nor more than one ordering position within a family.
767 (It is allowed, though unlikely, for an operator to be used for both
768 search and ordering purposes.)
772 <title><structname>pg_amop</> Columns</title>
779 <entry>References</entry>
780 <entry>Description</entry>
786 <entry><structfield>oid</structfield></entry>
787 <entry><type>oid</type></entry>
789 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
793 <entry><structfield>amopfamily</structfield></entry>
794 <entry><type>oid</type></entry>
795 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
796 <entry>The operator family this entry is for</entry>
800 <entry><structfield>amoplefttype</structfield></entry>
801 <entry><type>oid</type></entry>
802 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
803 <entry>Left-hand input data type of operator</entry>
807 <entry><structfield>amoprighttype</structfield></entry>
808 <entry><type>oid</type></entry>
809 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
810 <entry>Right-hand input data type of operator</entry>
814 <entry><structfield>amopstrategy</structfield></entry>
815 <entry><type>int2</type></entry>
817 <entry>Operator strategy number</entry>
821 <entry><structfield>amoppurpose</structfield></entry>
822 <entry><type>char</type></entry>
824 <entry>Operator purpose, either <literal>s</> for search or
825 <literal>o</> for ordering</entry>
829 <entry><structfield>amopopr</structfield></entry>
830 <entry><type>oid</type></entry>
831 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
832 <entry>OID of the operator</entry>
836 <entry><structfield>amopmethod</structfield></entry>
837 <entry><type>oid</type></entry>
838 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
839 <entry>Index access method operator family is for</entry>
843 <entry><structfield>amopsortfamily</structfield></entry>
844 <entry><type>oid</type></entry>
845 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
846 <entry>The B-tree operator family this entry sorts according to, if an
847 ordering operator; zero if a search operator</entry>
855 A <quote>search</> operator entry indicates that an index of this operator
856 family can be searched to find all rows satisfying
858 <replaceable>indexed_column</>
859 <replaceable>operator</>
860 <replaceable>constant</>.
861 Obviously, such an operator must return <type>boolean</type>, and its left-hand input
862 type must match the index's column data type.
866 An <quote>ordering</> operator entry indicates that an index of this
867 operator family can be scanned to return rows in the order represented by
869 <replaceable>indexed_column</>
870 <replaceable>operator</>
871 <replaceable>constant</>.
872 Such an operator could return any sortable data type, though again
873 its left-hand input type must match the index's column data type.
874 The exact semantics of the <literal>ORDER BY</> are specified by the
875 <structfield>amopsortfamily</structfield> column, which must reference
876 a B-tree operator family for the operator's result type.
881 At present, it's assumed that the sort order for an ordering operator
882 is the default for the referenced operator family, i.e., <literal>ASC NULLS
883 LAST</>. This might someday be relaxed by adding additional columns
884 to specify sort options explicitly.
889 An entry's <structfield>amopmethod</> must match the
890 <structname>opfmethod</> of its containing operator family (including
891 <structfield>amopmethod</> here is an intentional denormalization of the
892 catalog structure for performance reasons). Also,
893 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
894 the <structfield>oprleft</> and <structfield>oprright</> fields of the
895 referenced <structname>pg_operator</> entry.
901 <sect1 id="catalog-pg-amproc">
902 <title><structname>pg_amproc</structname></title>
904 <indexterm zone="catalog-pg-amproc">
905 <primary>pg_amproc</primary>
909 The catalog <structname>pg_amproc</structname> stores information about
910 support procedures associated with access method operator families. There
911 is one row for each support procedure belonging to an operator family.
915 <title><structname>pg_amproc</structname> Columns</title>
922 <entry>References</entry>
923 <entry>Description</entry>
929 <entry><structfield>oid</structfield></entry>
930 <entry><type>oid</type></entry>
932 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
936 <entry><structfield>amprocfamily</structfield></entry>
937 <entry><type>oid</type></entry>
938 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
939 <entry>The operator family this entry is for</entry>
943 <entry><structfield>amproclefttype</structfield></entry>
944 <entry><type>oid</type></entry>
945 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
946 <entry>Left-hand input data type of associated operator</entry>
950 <entry><structfield>amprocrighttype</structfield></entry>
951 <entry><type>oid</type></entry>
952 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
953 <entry>Right-hand input data type of associated operator</entry>
957 <entry><structfield>amprocnum</structfield></entry>
958 <entry><type>int2</type></entry>
960 <entry>Support procedure number</entry>
964 <entry><structfield>amproc</structfield></entry>
965 <entry><type>regproc</type></entry>
966 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
967 <entry>OID of the procedure</entry>
975 The usual interpretation of the
976 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
977 is that they identify the left and right input types of the operator(s)
978 that a particular support procedure supports. For some access methods
979 these match the input data type(s) of the support procedure itself, for
980 others not. There is a notion of <quote>default</> support procedures for
981 an index, which are those with <structfield>amproclefttype</> and
982 <structfield>amprocrighttype</> both equal to the index operator class's
983 <structfield>opcintype</>.
989 <sect1 id="catalog-pg-attrdef">
990 <title><structname>pg_attrdef</structname></title>
992 <indexterm zone="catalog-pg-attrdef">
993 <primary>pg_attrdef</primary>
997 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
998 about columns is stored in <structname>pg_attribute</structname>
999 (see below). Only columns that explicitly specify a default value
1000 (when the table is created or the column is added) will have an
1005 <title><structname>pg_attrdef</> Columns</title>
1012 <entry>References</entry>
1013 <entry>Description</entry>
1019 <entry><structfield>oid</structfield></entry>
1020 <entry><type>oid</type></entry>
1022 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1026 <entry><structfield>adrelid</structfield></entry>
1027 <entry><type>oid</type></entry>
1028 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1029 <entry>The table this column belongs to</entry>
1033 <entry><structfield>adnum</structfield></entry>
1034 <entry><type>int2</type></entry>
1035 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
1036 <entry>The number of the column</entry>
1040 <entry><structfield>adbin</structfield></entry>
1041 <entry><type>pg_node_tree</type></entry>
1043 <entry>The internal representation of the column default value</entry>
1047 <entry><structfield>adsrc</structfield></entry>
1048 <entry><type>text</type></entry>
1050 <entry>A human-readable representation of the default value</entry>
1057 The <structfield>adsrc</structfield> field is historical, and is best
1058 not used, because it does not track outside changes that might affect
1059 the representation of the default value. Reverse-compiling the
1060 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
1061 example) is a better way to display the default value.
1067 <sect1 id="catalog-pg-attribute">
1068 <title><structname>pg_attribute</structname></title>
1070 <indexterm zone="catalog-pg-attribute">
1071 <primary>pg_attribute</primary>
1075 The catalog <structname>pg_attribute</structname> stores information about
1076 table columns. There will be exactly one
1077 <structname>pg_attribute</structname> row for every column in every
1078 table in the database. (There will also be attribute entries for
1079 indexes, and indeed all objects that have <structname>pg_class</structname>
1084 The term attribute is equivalent to column and is used for
1089 <title><structname>pg_attribute</> Columns</title>
1096 <entry>References</entry>
1097 <entry>Description</entry>
1103 <entry><structfield>attrelid</structfield></entry>
1104 <entry><type>oid</type></entry>
1105 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1106 <entry>The table this column belongs to</entry>
1110 <entry><structfield>attname</structfield></entry>
1111 <entry><type>name</type></entry>
1113 <entry>The column name</entry>
1117 <entry><structfield>atttypid</structfield></entry>
1118 <entry><type>oid</type></entry>
1119 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1120 <entry>The data type of this column</entry>
1124 <entry><structfield>attstattarget</structfield></entry>
1125 <entry><type>int4</type></entry>
1128 <structfield>attstattarget</structfield> controls the level of detail
1129 of statistics accumulated for this column by
1130 <xref linkend="sql-analyze">.
1131 A zero value indicates that no statistics should be collected.
1132 A negative value says to use the system default statistics target.
1133 The exact meaning of positive values is data type-dependent.
1134 For scalar data types, <structfield>attstattarget</structfield>
1135 is both the target number of <quote>most common values</quote>
1136 to collect, and the target number of histogram bins to create.
1141 <entry><structfield>attlen</structfield></entry>
1142 <entry><type>int2</type></entry>
1145 A copy of <literal>pg_type.typlen</literal> of this column's
1151 <entry><structfield>attnum</structfield></entry>
1152 <entry><type>int2</type></entry>
1155 The number of the column. Ordinary columns are numbered from 1
1156 up. System columns, such as <structfield>oid</structfield>,
1157 have (arbitrary) negative numbers.
1162 <entry><structfield>attndims</structfield></entry>
1163 <entry><type>int4</type></entry>
1166 Number of dimensions, if the column is an array type; otherwise 0.
1167 (Presently, the number of dimensions of an array is not enforced,
1168 so any nonzero value effectively means <quote>it's an array</>.)
1173 <entry><structfield>attcacheoff</structfield></entry>
1174 <entry><type>int4</type></entry>
1177 Always -1 in storage, but when loaded into a row descriptor
1178 in memory this might be updated to cache the offset of the attribute
1184 <entry><structfield>atttypmod</structfield></entry>
1185 <entry><type>int4</type></entry>
1188 <structfield>atttypmod</structfield> records type-specific data
1189 supplied at table creation time (for example, the maximum
1190 length of a <type>varchar</type> column). It is passed to
1191 type-specific input functions and length coercion functions.
1192 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1197 <entry><structfield>attbyval</structfield></entry>
1198 <entry><type>bool</type></entry>
1201 A copy of <literal>pg_type.typbyval</> of this column's type
1206 <entry><structfield>attstorage</structfield></entry>
1207 <entry><type>char</type></entry>
1210 Normally a copy of <literal>pg_type.typstorage</> of this
1211 column's type. For TOAST-able data types, this can be altered
1212 after column creation to control storage policy.
1217 <entry><structfield>attalign</structfield></entry>
1218 <entry><type>char</type></entry>
1221 A copy of <literal>pg_type.typalign</> of this column's type
1226 <entry><structfield>attnotnull</structfield></entry>
1227 <entry><type>bool</type></entry>
1230 This represents a not-null constraint.
1235 <entry><structfield>atthasdef</structfield></entry>
1236 <entry><type>bool</type></entry>
1239 This column has a default value, in which case there will be a
1240 corresponding entry in the <structname>pg_attrdef</structname>
1241 catalog that actually defines the value.
1246 <entry><structfield>attisdropped</structfield></entry>
1247 <entry><type>bool</type></entry>
1250 This column has been dropped and is no longer valid. A dropped
1251 column is still physically present in the table, but is
1252 ignored by the parser and so cannot be accessed via SQL.
1257 <entry><structfield>attislocal</structfield></entry>
1258 <entry><type>bool</type></entry>
1261 This column is defined locally in the relation. Note that a column can
1262 be locally defined and inherited simultaneously.
1267 <entry><structfield>attinhcount</structfield></entry>
1268 <entry><type>int4</type></entry>
1271 The number of direct ancestors this column has. A column with a
1272 nonzero number of ancestors cannot be dropped nor renamed.
1277 <entry><structfield>attcollation</structfield></entry>
1278 <entry><type>oid</type></entry>
1279 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1281 The defined collation of the column, or zero if the column is
1282 not of a collatable data type.
1287 <entry><structfield>attacl</structfield></entry>
1288 <entry><type>aclitem[]</type></entry>
1291 Column-level access privileges, if any have been granted specifically
1297 <entry><structfield>attoptions</structfield></entry>
1298 <entry><type>text[]</type></entry>
1301 Attribute-level options, as <quote>keyword=value</> strings
1306 <entry><structfield>attfdwoptions</structfield></entry>
1307 <entry><type>text[]</type></entry>
1310 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1319 In a dropped column's <structname>pg_attribute</structname> entry,
1320 <structfield>atttypid</structfield> is reset to zero, but
1321 <structfield>attlen</structfield> and the other fields copied from
1322 <structname>pg_type</> are still valid. This arrangement is needed
1323 to cope with the situation where the dropped column's data type was
1324 later dropped, and so there is no <structname>pg_type</> row anymore.
1325 <structfield>attlen</structfield> and the other fields can be used
1326 to interpret the contents of a row of the table.
1331 <sect1 id="catalog-pg-authid">
1332 <title><structname>pg_authid</structname></title>
1334 <indexterm zone="catalog-pg-authid">
1335 <primary>pg_authid</primary>
1339 The catalog <structname>pg_authid</structname> contains information about
1340 database authorization identifiers (roles). A role subsumes the concepts
1341 of <quote>users</> and <quote>groups</>. A user is essentially just a
1342 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1343 without <structfield>rolcanlogin</>) can have other roles as members; see
1344 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1348 Since this catalog contains passwords, it must not be publicly readable.
1349 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1350 is a publicly readable view on
1351 <structname>pg_authid</structname> that blanks out the password field.
1355 <xref linkend="user-manag"> contains detailed information about user and
1356 privilege management.
1360 Because user identities are cluster-wide,
1361 <structname>pg_authid</structname>
1362 is shared across all databases of a cluster: there is only one
1363 copy of <structname>pg_authid</structname> per cluster, not
1368 <title><structname>pg_authid</> Columns</title>
1375 <entry>Description</entry>
1382 <entry><structfield>oid</structfield></entry>
1383 <entry><type>oid</type></entry>
1384 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1388 <entry><structfield>rolname</structfield></entry>
1389 <entry><type>name</type></entry>
1390 <entry>Role name</entry>
1394 <entry><structfield>rolsuper</structfield></entry>
1395 <entry><type>bool</type></entry>
1396 <entry>Role has superuser privileges</entry>
1400 <entry><structfield>rolinherit</structfield></entry>
1401 <entry><type>bool</type></entry>
1402 <entry>Role automatically inherits privileges of roles it is a
1407 <entry><structfield>rolcreaterole</structfield></entry>
1408 <entry><type>bool</type></entry>
1409 <entry>Role can create more roles</entry>
1413 <entry><structfield>rolcreatedb</structfield></entry>
1414 <entry><type>bool</type></entry>
1415 <entry>Role can create databases</entry>
1419 <entry><structfield>rolcanlogin</structfield></entry>
1420 <entry><type>bool</type></entry>
1422 Role can log in. That is, this role can be given as the initial
1423 session authorization identifier
1428 <entry><structfield>rolreplication</structfield></entry>
1429 <entry><type>bool</type></entry>
1431 Role is a replication role. That is, this role can initiate streaming
1432 replication (see <xref linkend="streaming-replication">) and set/unset
1433 the system backup mode using <function>pg_start_backup</> and
1434 <function>pg_stop_backup</>
1439 <entry><structfield>rolbypassrls</structfield></entry>
1440 <entry><type>bool</type></entry>
1442 Role can bypass row level security policies, see
1443 <xref linkend="ddl-rowsecurity"> for more information.
1448 <entry><structfield>rolconnlimit</structfield></entry>
1449 <entry><type>int4</type></entry>
1451 For roles that can log in, this sets maximum number of concurrent
1452 connections this role can make. -1 means no limit.
1457 <entry><structfield>rolpassword</structfield></entry>
1458 <entry><type>text</type></entry>
1460 Password (possibly encrypted); null if none. If the password
1461 is encrypted, this column will begin with the string <literal>md5</>
1462 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1463 will be of the user's password concatenated to their user name.
1464 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1465 <productname>PostgreSQL</> will store the md5 hash of
1466 <literal>xyzzyjoe</>. A password that does not follow that
1467 format is assumed to be unencrypted.
1472 <entry><structfield>rolvaliduntil</structfield></entry>
1473 <entry><type>timestamptz</type></entry>
1474 <entry>Password expiry time (only used for password authentication);
1475 null if no expiration</entry>
1484 <sect1 id="catalog-pg-auth-members">
1485 <title><structname>pg_auth_members</structname></title>
1487 <indexterm zone="catalog-pg-auth-members">
1488 <primary>pg_auth_members</primary>
1492 The catalog <structname>pg_auth_members</structname> shows the membership
1493 relations between roles. Any non-circular set of relationships is allowed.
1497 Because user identities are cluster-wide,
1498 <structname>pg_auth_members</structname>
1499 is shared across all databases of a cluster: there is only one
1500 copy of <structname>pg_auth_members</structname> per cluster, not
1505 <title><structname>pg_auth_members</> Columns</title>
1512 <entry>References</entry>
1513 <entry>Description</entry>
1519 <entry><structfield>roleid</structfield></entry>
1520 <entry><type>oid</type></entry>
1521 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1522 <entry>ID of a role that has a member</entry>
1526 <entry><structfield>member</structfield></entry>
1527 <entry><type>oid</type></entry>
1528 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1529 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1533 <entry><structfield>grantor</structfield></entry>
1534 <entry><type>oid</type></entry>
1535 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1536 <entry>ID of the role that granted this membership</entry>
1540 <entry><structfield>admin_option</structfield></entry>
1541 <entry><type>bool</type></entry>
1543 <entry>True if <structfield>member</> can grant membership in
1544 <structfield>roleid</> to others</entry>
1553 <sect1 id="catalog-pg-cast">
1554 <title><structname>pg_cast</structname></title>
1556 <indexterm zone="catalog-pg-cast">
1557 <primary>pg_cast</primary>
1561 The catalog <structname>pg_cast</structname> stores data type conversion
1562 paths, both built-in and user-defined.
1566 It should be noted that <structname>pg_cast</structname> does not represent
1567 every type conversion that the system knows how to perform; only those that
1568 cannot be deduced from some generic rule. For example, casting between a
1569 domain and its base type is not explicitly represented in
1570 <structname>pg_cast</structname>. Another important exception is that
1571 <quote>automatic I/O conversion casts</>, those performed using a data
1572 type's own I/O functions to convert to or from <type>text</> or other
1573 string types, are not explicitly represented in
1574 <structname>pg_cast</structname>.
1578 <title><structname>pg_cast</> Columns</title>
1585 <entry>References</entry>
1586 <entry>Description</entry>
1592 <entry><structfield>oid</structfield></entry>
1593 <entry><type>oid</type></entry>
1595 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1599 <entry><structfield>castsource</structfield></entry>
1600 <entry><type>oid</type></entry>
1601 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1602 <entry>OID of the source data type</entry>
1606 <entry><structfield>casttarget</structfield></entry>
1607 <entry><type>oid</type></entry>
1608 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1609 <entry>OID of the target data type</entry>
1613 <entry><structfield>castfunc</structfield></entry>
1614 <entry><type>oid</type></entry>
1615 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1617 The OID of the function to use to perform this cast. Zero is
1618 stored if the cast method doesn't require a function.
1623 <entry><structfield>castcontext</structfield></entry>
1624 <entry><type>char</type></entry>
1627 Indicates what contexts the cast can be invoked in.
1628 <literal>e</> means only as an explicit cast (using
1629 <literal>CAST</> or <literal>::</> syntax).
1630 <literal>a</> means implicitly in assignment
1631 to a target column, as well as explicitly.
1632 <literal>i</> means implicitly in expressions, as well as the
1637 <entry><structfield>castmethod</structfield></entry>
1638 <entry><type>char</type></entry>
1641 Indicates how the cast is performed.
1642 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1643 <literal>i</> means that the input/output functions are used.
1644 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1652 The cast functions listed in <structname>pg_cast</structname> must
1653 always take the cast source type as their first argument type, and
1654 return the cast destination type as their result type. A cast
1655 function can have up to three arguments. The second argument,
1656 if present, must be type <type>integer</>; it receives the type
1657 modifier associated with the destination type, or -1
1658 if there is none. The third argument,
1659 if present, must be type <type>boolean</>; it receives <literal>true</>
1660 if the cast is an explicit cast, <literal>false</> otherwise.
1664 It is legitimate to create a <structname>pg_cast</structname> entry
1665 in which the source and target types are the same, if the associated
1666 function takes more than one argument. Such entries represent
1667 <quote>length coercion functions</> that coerce values of the type
1668 to be legal for a particular type modifier value.
1672 When a <structname>pg_cast</structname> entry has different source and
1673 target types and a function that takes more than one argument, it
1674 represents converting from one type to another and applying a length
1675 coercion in a single step. When no such entry is available, coercion
1676 to a type that uses a type modifier involves two steps, one to
1677 convert between data types and a second to apply the modifier.
1681 <sect1 id="catalog-pg-class">
1682 <title><structname>pg_class</structname></title>
1684 <indexterm zone="catalog-pg-class">
1685 <primary>pg_class</primary>
1689 The catalog <structname>pg_class</structname> catalogs tables and most
1690 everything else that has columns or is otherwise similar to a
1691 table. This includes indexes (but see also
1692 <structname>pg_index</structname>), sequences, views, materialized
1693 views, composite types, and TOAST tables; see <structfield>relkind</>.
1694 Below, when we mean all of these
1695 kinds of objects we speak of <quote>relations</quote>. Not all
1696 columns are meaningful for all relation types.
1700 <title><structname>pg_class</> Columns</title>
1707 <entry>References</entry>
1708 <entry>Description</entry>
1714 <entry><structfield>oid</structfield></entry>
1715 <entry><type>oid</type></entry>
1717 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1721 <entry><structfield>relname</structfield></entry>
1722 <entry><type>name</type></entry>
1724 <entry>Name of the table, index, view, etc.</entry>
1728 <entry><structfield>relnamespace</structfield></entry>
1729 <entry><type>oid</type></entry>
1730 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1732 The OID of the namespace that contains this relation
1737 <entry><structfield>reltype</structfield></entry>
1738 <entry><type>oid</type></entry>
1739 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1741 The OID of the data type that corresponds to this table's row type,
1742 if any (zero for indexes, which have no <structname>pg_type</> entry)
1747 <entry><structfield>reloftype</structfield></entry>
1748 <entry><type>oid</type></entry>
1749 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1751 For typed tables, the OID of the underlying composite type,
1752 zero for all other relations
1757 <entry><structfield>relowner</structfield></entry>
1758 <entry><type>oid</type></entry>
1759 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1760 <entry>Owner of the relation</entry>
1764 <entry><structfield>relam</structfield></entry>
1765 <entry><type>oid</type></entry>
1766 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1767 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1771 <entry><structfield>relfilenode</structfield></entry>
1772 <entry><type>oid</type></entry>
1774 <entry>Name of the on-disk file of this relation; zero means this
1775 is a <quote>mapped</> relation whose disk file name is determined
1776 by low-level state</entry>
1780 <entry><structfield>reltablespace</structfield></entry>
1781 <entry><type>oid</type></entry>
1782 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1784 The tablespace in which this relation is stored. If zero,
1785 the database's default tablespace is implied. (Not meaningful
1786 if the relation has no on-disk file.)
1791 <entry><structfield>relpages</structfield></entry>
1792 <entry><type>int4</type></entry>
1795 Size of the on-disk representation of this table in pages (of size
1796 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1797 planner. It is updated by <command>VACUUM</command>,
1798 <command>ANALYZE</command>, and a few DDL commands such as
1799 <command>CREATE INDEX</command>.
1804 <entry><structfield>reltuples</structfield></entry>
1805 <entry><type>float4</type></entry>
1808 Number of rows in the table. This is only an estimate used by the
1809 planner. It is updated by <command>VACUUM</command>,
1810 <command>ANALYZE</command>, and a few DDL commands such as
1811 <command>CREATE INDEX</command>.
1816 <entry><structfield>relallvisible</structfield></entry>
1817 <entry><type>int4</type></entry>
1820 Number of pages that are marked all-visible in the table's
1821 visibility map. This is only an estimate used by the
1822 planner. It is updated by <command>VACUUM</command>,
1823 <command>ANALYZE</command>, and a few DDL commands such as
1824 <command>CREATE INDEX</command>.
1829 <entry><structfield>reltoastrelid</structfield></entry>
1830 <entry><type>oid</type></entry>
1831 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1833 OID of the TOAST table associated with this table, 0 if none. The
1834 TOAST table stores large attributes <quote>out of line</quote> in a
1840 <entry><structfield>relhasindex</structfield></entry>
1841 <entry><type>bool</type></entry>
1844 True if this is a table and it has (or recently had) any indexes
1849 <entry><structfield>relisshared</structfield></entry>
1850 <entry><type>bool</type></entry>
1853 True if this table is shared across all databases in the cluster. Only
1854 certain system catalogs (such as <structname>pg_database</structname>)
1860 <entry><structfield>relpersistence</structfield></entry>
1861 <entry><type>char</type></entry>
1864 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1865 <literal>t</> = temporary table
1870 <entry><structfield>relkind</structfield></entry>
1871 <entry><type>char</type></entry>
1874 <literal>r</> = ordinary table, <literal>i</> = index,
1875 <literal>S</> = sequence, <literal>v</> = view,
1876 <literal>m</> = materialized view,
1877 <literal>c</> = composite type, <literal>t</> = TOAST table,
1878 <literal>f</> = foreign table
1883 <entry><structfield>relnatts</structfield></entry>
1884 <entry><type>int2</type></entry>
1887 Number of user columns in the relation (system columns not
1888 counted). There must be this many corresponding entries in
1889 <structname>pg_attribute</structname>. See also
1890 <literal>pg_attribute.attnum</literal>.
1895 <entry><structfield>relchecks</structfield></entry>
1896 <entry><type>int2</type></entry>
1899 Number of <literal>CHECK</> constraints on the table; see
1900 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1905 <entry><structfield>relhasoids</structfield></entry>
1906 <entry><type>bool</type></entry>
1909 True if we generate an OID for each row of the relation
1914 <entry><structfield>relhaspkey</structfield></entry>
1915 <entry><type>bool</type></entry>
1918 True if the table has (or once had) a primary key
1923 <entry><structfield>relhasrules</structfield></entry>
1924 <entry><type>bool</type></entry>
1927 True if table has (or once had) rules; see
1928 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1933 <entry><structfield>relhastriggers</structfield></entry>
1934 <entry><type>bool</type></entry>
1937 True if table has (or once had) triggers; see
1938 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1943 <entry><structfield>relhassubclass</structfield></entry>
1944 <entry><type>bool</type></entry>
1946 <entry>True if table has (or once had) any inheritance children</entry>
1950 <entry><structfield>relrowsecurity</structfield></entry>
1951 <entry><type>bool</type></entry>
1954 True if table has row level security enabled; see
1955 <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1960 <entry><structfield>relispopulated</structfield></entry>
1961 <entry><type>bool</type></entry>
1963 <entry>True if relation is populated (this is true for all
1964 relations other than some materialized views)</entry>
1968 <entry><structfield>relreplident</structfield></entry>
1969 <entry><type>char</type></entry>
1972 Columns used to form <quote>replica identity</> for rows:
1973 <literal>d</> = default (primary key, if any),
1974 <literal>n</> = nothing,
1975 <literal>f</> = all columns
1976 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1981 <entry><structfield>relfrozenxid</structfield></entry>
1982 <entry><type>xid</type></entry>
1985 All transaction IDs before this one have been replaced with a permanent
1986 (<quote>frozen</>) transaction ID in this table. This is used to track
1987 whether the table needs to be vacuumed in order to prevent transaction
1988 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1989 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1994 <entry><structfield>relminmxid</structfield></entry>
1995 <entry><type>xid</type></entry>
1998 All multitransaction IDs before this one have been replaced by a
1999 transaction ID in this table. This is used to track
2000 whether the table needs to be vacuumed in order to prevent multitransaction ID
2001 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
2002 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2007 <entry><structfield>relacl</structfield></entry>
2008 <entry><type>aclitem[]</type></entry>
2011 Access privileges; see
2012 <xref linkend="sql-grant"> and
2013 <xref linkend="sql-revoke">
2019 <entry><structfield>reloptions</structfield></entry>
2020 <entry><type>text[]</type></entry>
2023 Access-method-specific options, as <quote>keyword=value</> strings
2031 Several of the Boolean flags in <structname>pg_class</> are maintained
2032 lazily: they are guaranteed to be true if that's the correct state, but
2033 may not be reset to false immediately when the condition is no longer
2034 true. For example, <structfield>relhasindex</> is set by
2035 <command>CREATE INDEX</command>, but it is never cleared by
2036 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
2037 <structfield>relhasindex</> if it finds the table has no indexes. This
2038 arrangement avoids race conditions and improves concurrency.
2042 <sect1 id="catalog-pg-collation">
2043 <title><structname>pg_collation</structname></title>
2045 <indexterm zone="catalog-pg-collation">
2046 <primary>pg_collation</primary>
2050 The catalog <structname>pg_collation</structname> describes the
2051 available collations, which are essentially mappings from an SQL
2052 name to operating system locale categories.
2053 See <xref linkend="collation"> for more information.
2057 <title><structname>pg_collation</> Columns</title>
2064 <entry>References</entry>
2065 <entry>Description</entry>
2071 <entry><structfield>oid</structfield></entry>
2072 <entry><type>oid</type></entry>
2074 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2078 <entry><structfield>collname</structfield></entry>
2079 <entry><type>name</type></entry>
2081 <entry>Collation name (unique per namespace and encoding)</entry>
2085 <entry><structfield>collnamespace</structfield></entry>
2086 <entry><type>oid</type></entry>
2087 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2089 The OID of the namespace that contains this collation
2094 <entry><structfield>collowner</structfield></entry>
2095 <entry><type>oid</type></entry>
2096 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2097 <entry>Owner of the collation</entry>
2101 <entry><structfield>collencoding</structfield></entry>
2102 <entry><type>int4</type></entry>
2104 <entry>Encoding in which the collation is applicable, or -1 if it
2105 works for any encoding</entry>
2109 <entry><structfield>collcollate</structfield></entry>
2110 <entry><type>name</type></entry>
2112 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2116 <entry><structfield>collctype</structfield></entry>
2117 <entry><type>name</type></entry>
2119 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2126 Note that the unique key on this catalog is (<structfield>collname</>,
2127 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2128 (<structfield>collname</>, <structfield>collnamespace</>).
2129 <productname>PostgreSQL</productname> generally ignores all
2130 collations that do not have <structfield>collencoding</> equal to
2131 either the current database's encoding or -1, and creation of new entries
2132 with the same name as an entry with <structfield>collencoding</> = -1
2133 is forbidden. Therefore it is sufficient to use a qualified SQL name
2134 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2135 even though this is not unique according to the catalog definition.
2136 The reason for defining the catalog this way is that
2137 <application>initdb</> fills it in at cluster initialization time with
2138 entries for all locales available on the system, so it must be able to
2139 hold entries for all encodings that might ever be used in the cluster.
2143 In the <literal>template0</> database, it could be useful to create
2144 collations whose encoding does not match the database encoding,
2145 since they could match the encodings of databases later cloned from
2146 <literal>template0</>. This would currently have to be done manually.
2150 <sect1 id="catalog-pg-constraint">
2151 <title><structname>pg_constraint</structname></title>
2153 <indexterm zone="catalog-pg-constraint">
2154 <primary>pg_constraint</primary>
2158 The catalog <structname>pg_constraint</structname> stores check, primary
2159 key, unique, foreign key, and exclusion constraints on tables.
2160 (Column constraints are not treated specially. Every column constraint is
2161 equivalent to some table constraint.)
2162 Not-null constraints are represented in the <structname>pg_attribute</>
2167 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2168 TRIGGER</>) also give rise to an entry in this table.
2172 Check constraints on domains are stored here, too.
2176 <title><structname>pg_constraint</> Columns</title>
2183 <entry>References</entry>
2184 <entry>Description</entry>
2190 <entry><structfield>oid</structfield></entry>
2191 <entry><type>oid</type></entry>
2193 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2197 <entry><structfield>conname</structfield></entry>
2198 <entry><type>name</type></entry>
2200 <entry>Constraint name (not necessarily unique!)</entry>
2204 <entry><structfield>connamespace</structfield></entry>
2205 <entry><type>oid</type></entry>
2206 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2208 The OID of the namespace that contains this constraint
2213 <entry><structfield>contype</structfield></entry>
2214 <entry><type>char</type></entry>
2217 <literal>c</> = check constraint,
2218 <literal>f</> = foreign key constraint,
2219 <literal>p</> = primary key constraint,
2220 <literal>u</> = unique constraint,
2221 <literal>t</> = constraint trigger,
2222 <literal>x</> = exclusion constraint
2227 <entry><structfield>condeferrable</structfield></entry>
2228 <entry><type>bool</type></entry>
2230 <entry>Is the constraint deferrable?</entry>
2234 <entry><structfield>condeferred</structfield></entry>
2235 <entry><type>bool</type></entry>
2237 <entry>Is the constraint deferred by default?</entry>
2241 <entry><structfield>convalidated</structfield></entry>
2242 <entry><type>bool</type></entry>
2244 <entry>Has the constraint been validated?
2245 Currently, can only be false for foreign keys and CHECK constraints</entry>
2249 <entry><structfield>conrelid</structfield></entry>
2250 <entry><type>oid</type></entry>
2251 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2252 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2256 <entry><structfield>contypid</structfield></entry>
2257 <entry><type>oid</type></entry>
2258 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2259 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2263 <entry><structfield>conindid</structfield></entry>
2264 <entry><type>oid</type></entry>
2265 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2266 <entry>The index supporting this constraint, if it's a unique, primary
2267 key, foreign key, or exclusion constraint; else 0</entry>
2271 <entry><structfield>confrelid</structfield></entry>
2272 <entry><type>oid</type></entry>
2273 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2274 <entry>If a foreign key, the referenced table; else 0</entry>
2278 <entry><structfield>confupdtype</structfield></entry>
2279 <entry><type>char</type></entry>
2281 <entry>Foreign key update action code:
2282 <literal>a</> = no action,
2283 <literal>r</> = restrict,
2284 <literal>c</> = cascade,
2285 <literal>n</> = set null,
2286 <literal>d</> = set default
2291 <entry><structfield>confdeltype</structfield></entry>
2292 <entry><type>char</type></entry>
2294 <entry>Foreign key deletion action code:
2295 <literal>a</> = no action,
2296 <literal>r</> = restrict,
2297 <literal>c</> = cascade,
2298 <literal>n</> = set null,
2299 <literal>d</> = set default
2304 <entry><structfield>confmatchtype</structfield></entry>
2305 <entry><type>char</type></entry>
2307 <entry>Foreign key match type:
2308 <literal>f</> = full,
2309 <literal>p</> = partial,
2310 <literal>s</> = simple
2315 <entry><structfield>conislocal</structfield></entry>
2316 <entry><type>bool</type></entry>
2319 This constraint is defined locally for the relation. Note that a
2320 constraint can be locally defined and inherited simultaneously.
2325 <entry><structfield>coninhcount</structfield></entry>
2326 <entry><type>int4</type></entry>
2329 The number of direct inheritance ancestors this constraint has.
2331 a nonzero number of ancestors cannot be dropped nor renamed.
2336 <entry><structfield>connoinherit</structfield></entry>
2337 <entry><type>bool</type></entry>
2340 This constraint is defined locally for the relation. It is a
2341 non-inheritable constraint.
2346 <entry><structfield>conkey</structfield></entry>
2347 <entry><type>int2[]</type></entry>
2348 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2349 <entry>If a table constraint (including foreign keys, but not constraint
2350 triggers), list of the constrained columns</entry>
2354 <entry><structfield>confkey</structfield></entry>
2355 <entry><type>int2[]</type></entry>
2356 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2357 <entry>If a foreign key, list of the referenced columns</entry>
2361 <entry><structfield>conpfeqop</structfield></entry>
2362 <entry><type>oid[]</type></entry>
2363 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2364 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2368 <entry><structfield>conppeqop</structfield></entry>
2369 <entry><type>oid[]</type></entry>
2370 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2371 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2375 <entry><structfield>conffeqop</structfield></entry>
2376 <entry><type>oid[]</type></entry>
2377 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2378 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2382 <entry><structfield>conexclop</structfield></entry>
2383 <entry><type>oid[]</type></entry>
2384 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2385 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2389 <entry><structfield>conbin</structfield></entry>
2390 <entry><type>pg_node_tree</type></entry>
2392 <entry>If a check constraint, an internal representation of the expression</entry>
2396 <entry><structfield>consrc</structfield></entry>
2397 <entry><type>text</type></entry>
2399 <entry>If a check constraint, a human-readable representation of the expression</entry>
2406 In the case of an exclusion constraint, <structfield>conkey</structfield>
2407 is only useful for constraint elements that are simple column references.
2408 For other cases, a zero appears in <structfield>conkey</structfield>
2409 and the associated index must be consulted to discover the expression
2410 that is constrained. (<structfield>conkey</structfield> thus has the
2411 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2417 <structfield>consrc</structfield> is not updated when referenced objects
2418 change; for example, it won't track renaming of columns. Rather than
2419 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2420 to extract the definition of a check constraint.
2426 <literal>pg_class.relchecks</literal> needs to agree with the
2427 number of check-constraint entries found in this table for each
2434 <sect1 id="catalog-pg-conversion">
2435 <title><structname>pg_conversion</structname></title>
2437 <indexterm zone="catalog-pg-conversion">
2438 <primary>pg_conversion</primary>
2442 The catalog <structname>pg_conversion</structname> describes
2443 encoding conversion procedures. See <xref linkend="sql-createconversion">
2444 for more information.
2448 <title><structname>pg_conversion</> Columns</title>
2455 <entry>References</entry>
2456 <entry>Description</entry>
2462 <entry><structfield>oid</structfield></entry>
2463 <entry><type>oid</type></entry>
2465 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2469 <entry><structfield>conname</structfield></entry>
2470 <entry><type>name</type></entry>
2472 <entry>Conversion name (unique within a namespace)</entry>
2476 <entry><structfield>connamespace</structfield></entry>
2477 <entry><type>oid</type></entry>
2478 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2480 The OID of the namespace that contains this conversion
2485 <entry><structfield>conowner</structfield></entry>
2486 <entry><type>oid</type></entry>
2487 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2488 <entry>Owner of the conversion</entry>
2492 <entry><structfield>conforencoding</structfield></entry>
2493 <entry><type>int4</type></entry>
2495 <entry>Source encoding ID</entry>
2499 <entry><structfield>contoencoding</structfield></entry>
2500 <entry><type>int4</type></entry>
2502 <entry>Destination encoding ID</entry>
2506 <entry><structfield>conproc</structfield></entry>
2507 <entry><type>regproc</type></entry>
2508 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2509 <entry>Conversion procedure</entry>
2513 <entry><structfield>condefault</structfield></entry>
2514 <entry><type>bool</type></entry>
2516 <entry>True if this is the default conversion</entry>
2525 <sect1 id="catalog-pg-database">
2526 <title><structname>pg_database</structname></title>
2528 <indexterm zone="catalog-pg-database">
2529 <primary>pg_database</primary>
2533 The catalog <structname>pg_database</structname> stores information about
2534 the available databases. Databases are created with the <xref
2535 linkend="sql-createdatabase"> command.
2536 Consult <xref linkend="managing-databases"> for details about the meaning
2537 of some of the parameters.
2541 Unlike most system catalogs, <structname>pg_database</structname>
2542 is shared across all databases of a cluster: there is only one
2543 copy of <structname>pg_database</structname> per cluster, not
2548 <title><structname>pg_database</> Columns</title>
2555 <entry>References</entry>
2556 <entry>Description</entry>
2562 <entry><structfield>oid</structfield></entry>
2563 <entry><type>oid</type></entry>
2565 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2569 <entry><structfield>datname</structfield></entry>
2570 <entry><type>name</type></entry>
2572 <entry>Database name</entry>
2576 <entry><structfield>datdba</structfield></entry>
2577 <entry><type>oid</type></entry>
2578 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2579 <entry>Owner of the database, usually the user who created it</entry>
2583 <entry><structfield>encoding</structfield></entry>
2584 <entry><type>int4</type></entry>
2586 <entry>Character encoding for this database
2587 (<function>pg_encoding_to_char()</function> can translate
2588 this number to the encoding name)</entry>
2592 <entry><structfield>datcollate</structfield></entry>
2593 <entry><type>name</type></entry>
2595 <entry>LC_COLLATE for this database</entry>
2599 <entry><structfield>datctype</structfield></entry>
2600 <entry><type>name</type></entry>
2602 <entry>LC_CTYPE for this database</entry>
2606 <entry><structfield>datistemplate</structfield></entry>
2607 <entry><type>bool</type></entry>
2610 If true, then this database can be cloned by
2611 any user with <literal>CREATEDB</> privileges;
2612 if false, then only superusers or the owner of
2613 the database can clone it.
2618 <entry><structfield>datallowconn</structfield></entry>
2619 <entry><type>bool</type></entry>
2622 If false then no one can connect to this database. This is
2623 used to protect the <literal>template0</> database from being altered.
2628 <entry><structfield>datconnlimit</structfield></entry>
2629 <entry><type>int4</type></entry>
2632 Sets maximum number of concurrent connections that can be made
2633 to this database. -1 means no limit.
2638 <entry><structfield>datlastsysoid</structfield></entry>
2639 <entry><type>oid</type></entry>
2642 Last system OID in the database; useful
2643 particularly to <application>pg_dump</application>
2648 <entry><structfield>datfrozenxid</structfield></entry>
2649 <entry><type>xid</type></entry>
2652 All transaction IDs before this one have been replaced with a permanent
2653 (<quote>frozen</>) transaction ID in this database. This is used to
2654 track whether the database needs to be vacuumed in order to prevent
2655 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2656 It is the minimum of the per-table
2657 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2662 <entry><structfield>datminmxid</structfield></entry>
2663 <entry><type>xid</type></entry>
2666 All multitransaction IDs before this one have been replaced with a
2667 transaction ID in this database. This is used to
2668 track whether the database needs to be vacuumed in order to prevent
2669 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2670 It is the minimum of the per-table
2671 <structname>pg_class</>.<structfield>relminmxid</> values.
2676 <entry><structfield>dattablespace</structfield></entry>
2677 <entry><type>oid</type></entry>
2678 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2680 The default tablespace for the database.
2681 Within this database, all tables for which
2682 <structname>pg_class</>.<structfield>reltablespace</> is zero
2683 will be stored in this tablespace; in particular, all the non-shared
2684 system catalogs will be there.
2689 <entry><structfield>datacl</structfield></entry>
2690 <entry><type>aclitem[]</type></entry>
2693 Access privileges; see
2694 <xref linkend="sql-grant"> and
2695 <xref linkend="sql-revoke">
2705 <sect1 id="catalog-pg-db-role-setting">
2706 <title><structname>pg_db_role_setting</structname></title>
2708 <indexterm zone="catalog-pg-db-role-setting">
2709 <primary>pg_db_role_setting</primary>
2713 The catalog <structname>pg_db_role_setting</structname> records the default
2714 values that have been set for run-time configuration variables,
2715 for each role and database combination.
2719 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2720 is shared across all databases of a cluster: there is only one
2721 copy of <structname>pg_db_role_setting</structname> per cluster, not
2726 <title><structname>pg_db_role_setting</> Columns</title>
2733 <entry>References</entry>
2734 <entry>Description</entry>
2740 <entry><structfield>setdatabase</structfield></entry>
2741 <entry><type>oid</type></entry>
2742 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2743 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2747 <entry><structfield>setrole</structfield></entry>
2748 <entry><type>oid</type></entry>
2749 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2750 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2754 <entry><structfield>setconfig</structfield></entry>
2755 <entry><type>text[]</type></entry>
2757 <entry>Defaults for run-time configuration variables</entry>
2765 <sect1 id="catalog-pg-default-acl">
2766 <title><structname>pg_default_acl</structname></title>
2768 <indexterm zone="catalog-pg-default-acl">
2769 <primary>pg_default_acl</primary>
2773 The catalog <structname>pg_default_acl</> stores initial
2774 privileges to be assigned to newly created objects.
2778 <title><structname>pg_default_acl</> Columns</title>
2785 <entry>References</entry>
2786 <entry>Description</entry>
2792 <entry><structfield>oid</structfield></entry>
2793 <entry><type>oid</type></entry>
2795 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2799 <entry><structfield>defaclrole</structfield></entry>
2800 <entry><type>oid</type></entry>
2801 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2802 <entry>The OID of the role associated with this entry</entry>
2806 <entry><structfield>defaclnamespace</structfield></entry>
2807 <entry><type>oid</type></entry>
2808 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2809 <entry>The OID of the namespace associated with this entry,
2810 or 0 if none</entry>
2814 <entry><structfield>defaclobjtype</structfield></entry>
2815 <entry><type>char</type></entry>
2818 Type of object this entry is for:
2819 <literal>r</> = relation (table, view),
2820 <literal>S</> = sequence,
2821 <literal>f</> = function,
2822 <literal>T</> = type
2827 <entry><structfield>defaclacl</structfield></entry>
2828 <entry><type>aclitem[]</type></entry>
2831 Access privileges that this type of object should have on creation
2839 A <structname>pg_default_acl</> entry shows the initial privileges to
2840 be assigned to an object belonging to the indicated user. There are
2841 currently two types of entry: <quote>global</> entries with
2842 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2843 that reference a particular schema. If a global entry is present then
2844 it <emphasis>overrides</> the normal hard-wired default privileges
2845 for the object type. A per-schema entry, if present, represents privileges
2846 to be <emphasis>added to</> the global or hard-wired default privileges.
2850 Note that when an ACL entry in another catalog is null, it is taken
2851 to represent the hard-wired default privileges for its object,
2852 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2853 at the moment. <structname>pg_default_acl</> is only consulted during
2860 <sect1 id="catalog-pg-depend">
2861 <title><structname>pg_depend</structname></title>
2863 <indexterm zone="catalog-pg-depend">
2864 <primary>pg_depend</primary>
2868 The catalog <structname>pg_depend</structname> records the dependency
2869 relationships between database objects. This information allows
2870 <command>DROP</> commands to find which other objects must be dropped
2871 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2876 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2877 which performs a similar function for dependencies involving objects
2878 that are shared across a database cluster.
2882 <title><structname>pg_depend</> Columns</title>
2889 <entry>References</entry>
2890 <entry>Description</entry>
2896 <entry><structfield>classid</structfield></entry>
2897 <entry><type>oid</type></entry>
2898 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2899 <entry>The OID of the system catalog the dependent object is in</entry>
2903 <entry><structfield>objid</structfield></entry>
2904 <entry><type>oid</type></entry>
2905 <entry>any OID column</entry>
2906 <entry>The OID of the specific dependent object</entry>
2910 <entry><structfield>objsubid</structfield></entry>
2911 <entry><type>int4</type></entry>
2914 For a table column, this is the column number (the
2915 <structfield>objid</> and <structfield>classid</> refer to the
2916 table itself). For all other object types, this column is
2922 <entry><structfield>refclassid</structfield></entry>
2923 <entry><type>oid</type></entry>
2924 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2925 <entry>The OID of the system catalog the referenced object is in</entry>
2929 <entry><structfield>refobjid</structfield></entry>
2930 <entry><type>oid</type></entry>
2931 <entry>any OID column</entry>
2932 <entry>The OID of the specific referenced object</entry>
2936 <entry><structfield>refobjsubid</structfield></entry>
2937 <entry><type>int4</type></entry>
2940 For a table column, this is the column number (the
2941 <structfield>refobjid</> and <structfield>refclassid</> refer
2942 to the table itself). For all other object types, this column
2948 <entry><structfield>deptype</structfield></entry>
2949 <entry><type>char</type></entry>
2952 A code defining the specific semantics of this dependency relationship; see text
2961 In all cases, a <structname>pg_depend</structname> entry indicates that the
2962 referenced object cannot be dropped without also dropping the dependent
2963 object. However, there are several subflavors identified by
2964 <structfield>deptype</>:
2968 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2971 A normal relationship between separately-created objects. The
2972 dependent object can be dropped without affecting the
2973 referenced object. The referenced object can only be dropped
2974 by specifying <literal>CASCADE</>, in which case the dependent
2975 object is dropped, too. Example: a table column has a normal
2976 dependency on its data type.
2982 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2985 The dependent object can be dropped separately from the
2986 referenced object, and should be automatically dropped
2987 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2988 mode) if the referenced object is dropped. Example: a named
2989 constraint on a table is made autodependent on the table, so
2990 that it will go away if the table is dropped.
2996 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2999 The dependent object was created as part of creation of the
3000 referenced object, and is really just a part of its internal
3001 implementation. A <command>DROP</> of the dependent object
3002 will be disallowed outright (we'll tell the user to issue a
3003 <command>DROP</> against the referenced object, instead). A
3004 <command>DROP</> of the referenced object will be propagated
3005 through to drop the dependent object whether
3006 <command>CASCADE</> is specified or not. Example: a trigger
3007 that's created to enforce a foreign-key constraint is made
3008 internally dependent on the constraint's
3009 <structname>pg_constraint</> entry.
3015 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
3018 The dependent object is a member of the <firstterm>extension</> that is
3019 the referenced object (see
3020 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3021 The dependent object can be dropped only via
3022 <command>DROP EXTENSION</> on the referenced object. Functionally
3023 this dependency type acts the same as an internal dependency, but
3024 it's kept separate for clarity and to simplify <application>pg_dump</>.
3030 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3033 There is no dependent object; this type of entry is a signal
3034 that the system itself depends on the referenced object, and so
3035 that object must never be deleted. Entries of this type are
3036 created only by <command>initdb</command>. The columns for the
3037 dependent object contain zeroes.
3043 Other dependency flavors might be needed in future.
3049 <sect1 id="catalog-pg-description">
3050 <title><structname>pg_description</structname></title>
3052 <indexterm zone="catalog-pg-description">
3053 <primary>pg_description</primary>
3057 The catalog <structname>pg_description</> stores optional descriptions
3058 (comments) for each database object. Descriptions can be manipulated
3059 with the <xref linkend="sql-comment"> command and viewed with
3060 <application>psql</application>'s <literal>\d</literal> commands.
3061 Descriptions of many built-in system objects are provided in the initial
3062 contents of <structname>pg_description</structname>.
3066 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3067 which performs a similar function for descriptions involving objects that
3068 are shared across a database cluster.
3072 <title><structname>pg_description</> Columns</title>
3079 <entry>References</entry>
3080 <entry>Description</entry>
3086 <entry><structfield>objoid</structfield></entry>
3087 <entry><type>oid</type></entry>
3088 <entry>any OID column</entry>
3089 <entry>The OID of the object this description pertains to</entry>
3093 <entry><structfield>classoid</structfield></entry>
3094 <entry><type>oid</type></entry>
3095 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3096 <entry>The OID of the system catalog this object appears in</entry>
3100 <entry><structfield>objsubid</structfield></entry>
3101 <entry><type>int4</type></entry>
3104 For a comment on a table column, this is the column number (the
3105 <structfield>objoid</> and <structfield>classoid</> refer to
3106 the table itself). For all other object types, this column is
3112 <entry><structfield>description</structfield></entry>
3113 <entry><type>text</type></entry>
3115 <entry>Arbitrary text that serves as the description of this object</entry>
3124 <sect1 id="catalog-pg-enum">
3125 <title><structname>pg_enum</structname></title>
3127 <indexterm zone="catalog-pg-enum">
3128 <primary>pg_enum</primary>
3132 The <structname>pg_enum</structname> catalog contains entries
3133 showing the values and labels for each enum type. The
3134 internal representation of a given enum value is actually the OID
3135 of its associated row in <structname>pg_enum</structname>.
3139 <title><structname>pg_enum</> Columns</title>
3146 <entry>References</entry>
3147 <entry>Description</entry>
3153 <entry><structfield>oid</structfield></entry>
3154 <entry><type>oid</type></entry>
3156 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3160 <entry><structfield>enumtypid</structfield></entry>
3161 <entry><type>oid</type></entry>
3162 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3163 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3167 <entry><structfield>enumsortorder</structfield></entry>
3168 <entry><type>float4</type></entry>
3170 <entry>The sort position of this enum value within its enum type</entry>
3174 <entry><structfield>enumlabel</structfield></entry>
3175 <entry><type>name</type></entry>
3177 <entry>The textual label for this enum value</entry>
3184 The OIDs for <structname>pg_enum</structname> rows follow a special
3185 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3186 as the sort ordering of their enum type. That is, if two even OIDs
3187 belong to the same enum type, the smaller OID must have the smaller
3188 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3189 need bear no relationship to the sort order. This rule allows the
3190 enum comparison routines to avoid catalog lookups in many common cases.
3191 The routines that create and alter enum types attempt to assign even
3192 OIDs to enum values whenever possible.
3196 When an enum type is created, its members are assigned sort-order
3197 positions 1..<replaceable>n</>. But members added later might be given
3198 negative or fractional values of <structfield>enumsortorder</structfield>.
3199 The only requirement on these values is that they be correctly
3200 ordered and unique within each enum type.
3205 <sect1 id="catalog-pg-event-trigger">
3206 <title><structname>pg_event_trigger</structname></title>
3208 <indexterm zone="catalog-pg-event-trigger">
3209 <primary>pg_event_trigger</primary>
3213 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3214 See <xref linkend="event-triggers"> for more information.
3218 <title><structname>pg_event_trigger</> Columns</title>
3225 <entry>References</entry>
3226 <entry>Description</entry>
3232 <entry><structfield>evtname</structfield></entry>
3233 <entry><type>name</type></entry>
3235 <entry>Trigger name (must be unique)</entry>
3239 <entry><structfield>evtevent</structfield></entry>
3240 <entry><type>name</type></entry>
3242 <entry>Identifies the event for which this trigger fires</entry>
3246 <entry><structfield>evtowner</structfield></entry>
3247 <entry><type>oid</type></entry>
3248 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3249 <entry>Owner of the event trigger</entry>
3253 <entry><structfield>evtfoid</structfield></entry>
3254 <entry><type>oid</type></entry>
3255 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3256 <entry>The function to be called</entry>
3260 <entry><structfield>evtenabled</structfield></entry>
3261 <entry><type>char</type></entry>
3264 Controls in which <xref linkend="guc-session-replication-role"> modes
3265 the event trigger fires.
3266 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3267 <literal>D</> = trigger is disabled,
3268 <literal>R</> = trigger fires in <quote>replica</> mode,
3269 <literal>A</> = trigger fires always.
3274 <entry><structfield>evttags</structfield></entry>
3275 <entry><type>text[]</type></entry>
3278 Command tags for which this trigger will fire. If NULL, the firing
3279 of this trigger is not restricted on the basis of the command tag.
3288 <sect1 id="catalog-pg-extension">
3289 <title><structname>pg_extension</structname></title>
3291 <indexterm zone="catalog-pg-extension">
3292 <primary>pg_extension</primary>
3296 The catalog <structname>pg_extension</structname> stores information
3297 about the installed extensions. See <xref linkend="extend-extensions">
3298 for details about extensions.
3302 <title><structname>pg_extension</> Columns</title>
3309 <entry>References</entry>
3310 <entry>Description</entry>
3316 <entry><structfield>oid</structfield></entry>
3317 <entry><type>oid</type></entry>
3319 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3323 <entry><structfield>extname</structfield></entry>
3324 <entry><type>name</type></entry>
3326 <entry>Name of the extension</entry>
3330 <entry><structfield>extowner</structfield></entry>
3331 <entry><type>oid</type></entry>
3332 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3333 <entry>Owner of the extension</entry>
3337 <entry><structfield>extnamespace</structfield></entry>
3338 <entry><type>oid</type></entry>
3339 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3340 <entry>Schema containing the extension's exported objects</entry>
3344 <entry><structfield>extrelocatable</structfield></entry>
3345 <entry><type>bool</type></entry>
3347 <entry>True if extension can be relocated to another schema</entry>
3351 <entry><structfield>extversion</structfield></entry>
3352 <entry><type>text</type></entry>
3354 <entry>Version name for the extension</entry>
3358 <entry><structfield>extconfig</structfield></entry>
3359 <entry><type>oid[]</type></entry>
3360 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3361 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3362 table(s), or <literal>NULL</> if none</entry>
3366 <entry><structfield>extcondition</structfield></entry>
3367 <entry><type>text[]</type></entry>
3369 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3370 extension's configuration table(s), or <literal>NULL</> if none</entry>
3378 Note that unlike most catalogs with a <quote>namespace</> column,
3379 <structfield>extnamespace</structfield> is not meant to imply
3380 that the extension belongs to that schema. Extension names are never
3381 schema-qualified. Rather, <structfield>extnamespace</structfield>
3382 indicates the schema that contains most or all of the extension's
3383 objects. If <structfield>extrelocatable</structfield> is true, then
3384 this schema must in fact contain all schema-qualifiable objects
3385 belonging to the extension.
3390 <sect1 id="catalog-pg-foreign-data-wrapper">
3391 <title><structname>pg_foreign_data_wrapper</structname></title>
3393 <indexterm zone="catalog-pg-foreign-data-wrapper">
3394 <primary>pg_foreign_data_wrapper</primary>
3398 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3399 foreign-data wrapper definitions. A foreign-data wrapper is the
3400 mechanism by which external data, residing on foreign servers, is
3405 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3412 <entry>References</entry>
3413 <entry>Description</entry>
3419 <entry><structfield>oid</structfield></entry>
3420 <entry><type>oid</type></entry>
3422 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3426 <entry><structfield>fdwname</structfield></entry>
3427 <entry><type>name</type></entry>
3429 <entry>Name of the foreign-data wrapper</entry>
3433 <entry><structfield>fdwowner</structfield></entry>
3434 <entry><type>oid</type></entry>
3435 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3436 <entry>Owner of the foreign-data wrapper</entry>
3440 <entry><structfield>fdwhandler</structfield></entry>
3441 <entry><type>oid</type></entry>
3442 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3444 References a handler function that is responsible for
3445 supplying execution routines for the foreign-data wrapper.
3446 Zero if no handler is provided
3451 <entry><structfield>fdwvalidator</structfield></entry>
3452 <entry><type>oid</type></entry>
3453 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3455 References a validator function that is responsible for
3456 checking the validity of the options given to the
3457 foreign-data wrapper, as well as options for foreign servers and user
3458 mappings using the foreign-data wrapper. Zero if no validator
3464 <entry><structfield>fdwacl</structfield></entry>
3465 <entry><type>aclitem[]</type></entry>
3468 Access privileges; see
3469 <xref linkend="sql-grant"> and
3470 <xref linkend="sql-revoke">
3476 <entry><structfield>fdwoptions</structfield></entry>
3477 <entry><type>text[]</type></entry>
3480 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3489 <sect1 id="catalog-pg-foreign-server">
3490 <title><structname>pg_foreign_server</structname></title>
3492 <indexterm zone="catalog-pg-foreign-server">
3493 <primary>pg_foreign_server</primary>
3497 The catalog <structname>pg_foreign_server</structname> stores
3498 foreign server definitions. A foreign server describes a source
3499 of external data, such as a remote server. Foreign
3500 servers are accessed via foreign-data wrappers.
3504 <title><structname>pg_foreign_server</> Columns</title>
3511 <entry>References</entry>
3512 <entry>Description</entry>
3518 <entry><structfield>oid</structfield></entry>
3519 <entry><type>oid</type></entry>
3521 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3525 <entry><structfield>srvname</structfield></entry>
3526 <entry><type>name</type></entry>
3528 <entry>Name of the foreign server</entry>
3532 <entry><structfield>srvowner</structfield></entry>
3533 <entry><type>oid</type></entry>
3534 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3535 <entry>Owner of the foreign server</entry>
3539 <entry><structfield>srvfdw</structfield></entry>
3540 <entry><type>oid</type></entry>
3541 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3542 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3546 <entry><structfield>srvtype</structfield></entry>
3547 <entry><type>text</type></entry>
3549 <entry>Type of the server (optional)</entry>
3553 <entry><structfield>srvversion</structfield></entry>
3554 <entry><type>text</type></entry>
3556 <entry>Version of the server (optional)</entry>
3560 <entry><structfield>srvacl</structfield></entry>
3561 <entry><type>aclitem[]</type></entry>
3564 Access privileges; see
3565 <xref linkend="sql-grant"> and
3566 <xref linkend="sql-revoke">
3572 <entry><structfield>srvoptions</structfield></entry>
3573 <entry><type>text[]</type></entry>
3576 Foreign server specific options, as <quote>keyword=value</> strings
3585 <sect1 id="catalog-pg-foreign-table">
3586 <title><structname>pg_foreign_table</structname></title>
3588 <indexterm zone="catalog-pg-foreign-table">
3589 <primary>pg_foreign_table</primary>
3593 The catalog <structname>pg_foreign_table</structname> contains
3594 auxiliary information about foreign tables. A foreign table is
3595 primarily represented by a <structname>pg_class</structname> entry,
3596 just like a regular table. Its <structname>pg_foreign_table</structname>
3597 entry contains the information that is pertinent only to foreign tables
3598 and not any other kind of relation.
3602 <title><structname>pg_foreign_table</> Columns</title>
3609 <entry>References</entry>
3610 <entry>Description</entry>
3616 <entry><structfield>ftrelid</structfield></entry>
3617 <entry><type>oid</type></entry>
3618 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3619 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3623 <entry><structfield>ftserver</structfield></entry>
3624 <entry><type>oid</type></entry>
3625 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3626 <entry>OID of the foreign server for this foreign table</entry>
3630 <entry><structfield>ftoptions</structfield></entry>
3631 <entry><type>text[]</type></entry>
3634 Foreign table options, as <quote>keyword=value</> strings
3643 <sect1 id="catalog-pg-index">
3644 <title><structname>pg_index</structname></title>
3646 <indexterm zone="catalog-pg-index">
3647 <primary>pg_index</primary>
3651 The catalog <structname>pg_index</structname> contains part of the information
3652 about indexes. The rest is mostly in
3653 <structname>pg_class</structname>.
3657 <title><structname>pg_index</> Columns</title>
3664 <entry>References</entry>
3665 <entry>Description</entry>
3671 <entry><structfield>indexrelid</structfield></entry>
3672 <entry><type>oid</type></entry>
3673 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3674 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3678 <entry><structfield>indrelid</structfield></entry>
3679 <entry><type>oid</type></entry>
3680 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3681 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3685 <entry><structfield>indnatts</structfield></entry>
3686 <entry><type>int2</type></entry>
3688 <entry>The number of columns in the index (duplicates
3689 <literal>pg_class.relnatts</literal>)</entry>
3693 <entry><structfield>indisunique</structfield></entry>
3694 <entry><type>bool</type></entry>
3696 <entry>If true, this is a unique index</entry>
3700 <entry><structfield>indisprimary</structfield></entry>
3701 <entry><type>bool</type></entry>
3703 <entry>If true, this index represents the primary key of the table
3704 (<structfield>indisunique</> should always be true when this is true)</entry>
3708 <entry><structfield>indisexclusion</structfield></entry>
3709 <entry><type>bool</type></entry>
3711 <entry>If true, this index supports an exclusion constraint</entry>
3715 <entry><structfield>indimmediate</structfield></entry>
3716 <entry><type>bool</type></entry>
3718 <entry>If true, the uniqueness check is enforced immediately on
3720 (irrelevant if <structfield>indisunique</> is not true)</entry>
3724 <entry><structfield>indisclustered</structfield></entry>
3725 <entry><type>bool</type></entry>
3727 <entry>If true, the table was last clustered on this index</entry>
3731 <entry><structfield>indisvalid</structfield></entry>
3732 <entry><type>bool</type></entry>
3735 If true, the index is currently valid for queries. False means the
3736 index is possibly incomplete: it must still be modified by
3737 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3738 be used for queries. If it is unique, the uniqueness property is not
3739 guaranteed true either.
3744 <entry><structfield>indcheckxmin</structfield></entry>
3745 <entry><type>bool</type></entry>
3748 If true, queries must not use the index until the <structfield>xmin</>
3749 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3750 event horizon, because the table may contain broken HOT chains with
3751 incompatible rows that they can see
3756 <entry><structfield>indisready</structfield></entry>
3757 <entry><type>bool</type></entry>
3760 If true, the index is currently ready for inserts. False means the
3761 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3767 <entry><structfield>indislive</structfield></entry>
3768 <entry><type>bool</type></entry>
3771 If false, the index is in process of being dropped, and should be
3772 ignored for all purposes (including HOT-safety decisions)
3777 <entry><structfield>indisreplident</structfield></entry>
3778 <entry><type>bool</type></entry>
3781 If true this index has been chosen as <quote>replica identity</>
3782 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3788 <entry><structfield>indkey</structfield></entry>
3789 <entry><type>int2vector</type></entry>
3790 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3792 This is an array of <structfield>indnatts</structfield> values that
3793 indicate which table columns this index indexes. For example a value
3794 of <literal>1 3</literal> would mean that the first and the third table
3795 columns make up the index key. A zero in this array indicates that the
3796 corresponding index attribute is an expression over the table columns,
3797 rather than a simple column reference.
3802 <entry><structfield>indcollation</structfield></entry>
3803 <entry><type>oidvector</type></entry>
3804 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3806 For each column in the index key, this contains the OID of the
3807 collation to use for the index.
3812 <entry><structfield>indclass</structfield></entry>
3813 <entry><type>oidvector</type></entry>
3814 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3816 For each column in the index key, this contains the OID of
3817 the operator class to use. See
3818 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3823 <entry><structfield>indoption</structfield></entry>
3824 <entry><type>int2vector</type></entry>
3827 This is an array of <structfield>indnatts</structfield> values that
3828 store per-column flag bits. The meaning of the bits is defined by
3829 the index's access method.
3834 <entry><structfield>indexprs</structfield></entry>
3835 <entry><type>pg_node_tree</type></entry>
3838 Expression trees (in <function>nodeToString()</function>
3839 representation) for index attributes that are not simple column
3840 references. This is a list with one element for each zero
3841 entry in <structfield>indkey</>. Null if all index attributes
3842 are simple references.
3847 <entry><structfield>indpred</structfield></entry>
3848 <entry><type>pg_node_tree</type></entry>
3851 Expression tree (in <function>nodeToString()</function>
3852 representation) for partial index predicate. Null if not a
3863 <sect1 id="catalog-pg-inherits">
3864 <title><structname>pg_inherits</structname></title>
3866 <indexterm zone="catalog-pg-inherits">
3867 <primary>pg_inherits</primary>
3871 The catalog <structname>pg_inherits</> records information about
3872 table inheritance hierarchies. There is one entry for each direct
3873 child table in the database. (Indirect inheritance can be determined
3874 by following chains of entries.)
3878 <title><structname>pg_inherits</> Columns</title>
3885 <entry>References</entry>
3886 <entry>Description</entry>
3892 <entry><structfield>inhrelid</structfield></entry>
3893 <entry><type>oid</type></entry>
3894 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3896 The OID of the child table
3901 <entry><structfield>inhparent</structfield></entry>
3902 <entry><type>oid</type></entry>
3903 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3905 The OID of the parent table
3910 <entry><structfield>inhseqno</structfield></entry>
3911 <entry><type>int4</type></entry>
3914 If there is more than one direct parent for a child table (multiple
3915 inheritance), this number tells the order in which the
3916 inherited columns are to be arranged. The count starts at 1.
3926 <sect1 id="catalog-pg-language">
3927 <title><structname>pg_language</structname></title>
3929 <indexterm zone="catalog-pg-language">
3930 <primary>pg_language</primary>
3934 The catalog <structname>pg_language</structname> registers
3935 languages in which you can write functions or stored procedures.
3936 See <xref linkend="sql-createlanguage">
3937 and <xref linkend="xplang"> for more information about language handlers.
3941 <title><structname>pg_language</> Columns</title>
3948 <entry>References</entry>
3949 <entry>Description</entry>
3955 <entry><structfield>oid</structfield></entry>
3956 <entry><type>oid</type></entry>
3958 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3962 <entry><structfield>lanname</structfield></entry>
3963 <entry><type>name</type></entry>
3965 <entry>Name of the language</entry>
3969 <entry><structfield>lanowner</structfield></entry>
3970 <entry><type>oid</type></entry>
3971 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3972 <entry>Owner of the language</entry>
3976 <entry><structfield>lanispl</structfield></entry>
3977 <entry><type>bool</type></entry>
3980 This is false for internal languages (such as
3981 <acronym>SQL</acronym>) and true for user-defined languages.
3982 Currently, <application>pg_dump</application> still uses this
3983 to determine which languages need to be dumped, but this might be
3984 replaced by a different mechanism in the future.
3989 <entry><structfield>lanpltrusted</structfield></entry>
3990 <entry><type>bool</type></entry>
3993 True if this is a trusted language, which means that it is believed
3994 not to grant access to anything outside the normal SQL execution
3995 environment. Only superusers can create functions in untrusted
4001 <entry><structfield>lanplcallfoid</structfield></entry>
4002 <entry><type>oid</type></entry>
4003 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4005 For noninternal languages this references the language
4006 handler, which is a special function that is responsible for
4007 executing all functions that are written in the particular
4013 <entry><structfield>laninline</structfield></entry>
4014 <entry><type>oid</type></entry>
4015 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4017 This references a function that is responsible for executing
4018 <quote>inline</> anonymous code blocks
4019 (<xref linkend="sql-do"> blocks).
4020 Zero if inline blocks are not supported.
4025 <entry><structfield>lanvalidator</structfield></entry>
4026 <entry><type>oid</type></entry>
4027 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4029 This references a language validator function that is responsible
4030 for checking the syntax and validity of new functions when they
4031 are created. Zero if no validator is provided.
4036 <entry><structfield>lanacl</structfield></entry>
4037 <entry><type>aclitem[]</type></entry>
4040 Access privileges; see
4041 <xref linkend="sql-grant"> and
4042 <xref linkend="sql-revoke">
4053 <sect1 id="catalog-pg-largeobject">
4054 <title><structname>pg_largeobject</structname></title>
4056 <indexterm zone="catalog-pg-largeobject">
4057 <primary>pg_largeobject</primary>
4061 The catalog <structname>pg_largeobject</structname> holds the data making up
4062 <quote>large objects</quote>. A large object is identified by an OID
4063 assigned when it is created. Each large object is broken into
4064 segments or <quote>pages</> small enough to be conveniently stored as rows
4065 in <structname>pg_largeobject</structname>.
4066 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4067 <literal>BLCKSZ/4</>, or typically 2 kB).
4071 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4072 associated with large objects. As a result,
4073 <structname>pg_largeobject</structname> was publicly readable and could be
4074 used to obtain the OIDs (and contents) of all large objects in the system.
4075 This is no longer the case; use
4076 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4077 to obtain a list of large object OIDs.
4081 <title><structname>pg_largeobject</> Columns</title>
4088 <entry>References</entry>
4089 <entry>Description</entry>
4095 <entry><structfield>loid</structfield></entry>
4096 <entry><type>oid</type></entry>
4097 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4098 <entry>Identifier of the large object that includes this page</entry>
4102 <entry><structfield>pageno</structfield></entry>
4103 <entry><type>int4</type></entry>
4105 <entry>Page number of this page within its large object
4106 (counting from zero)</entry>
4110 <entry><structfield>data</structfield></entry>
4111 <entry><type>bytea</type></entry>
4114 Actual data stored in the large object.
4115 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4123 Each row of <structname>pg_largeobject</structname> holds data
4124 for one page of a large object, beginning at
4125 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4126 allows sparse storage: pages might be missing, and might be shorter than
4127 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4128 Missing regions within a large object read as zeroes.
4133 <sect1 id="catalog-pg-largeobject-metadata">
4134 <title><structname>pg_largeobject_metadata</structname></title>
4136 <indexterm zone="catalog-pg-largeobject-metadata">
4137 <primary>pg_largeobject_metadata</primary>
4141 The catalog <structname>pg_largeobject_metadata</structname>
4142 holds metadata associated with large objects. The actual large object
4144 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4148 <title><structname>pg_largeobject_metadata</> Columns</title>
4155 <entry>References</entry>
4156 <entry>Description</entry>
4162 <entry><structfield>oid</structfield></entry>
4163 <entry><type>oid</type></entry>
4165 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4169 <entry><structfield>lomowner</structfield></entry>
4170 <entry><type>oid</type></entry>
4171 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4172 <entry>Owner of the large object</entry>
4176 <entry><structfield>lomacl</structfield></entry>
4177 <entry><type>aclitem[]</type></entry>
4180 Access privileges; see
4181 <xref linkend="sql-grant"> and
4182 <xref linkend="sql-revoke">
4192 <sect1 id="catalog-pg-namespace">
4193 <title><structname>pg_namespace</structname></title>
4195 <indexterm zone="catalog-pg-namespace">
4196 <primary>pg_namespace</primary>
4200 The catalog <structname>pg_namespace</> stores namespaces.
4201 A namespace is the structure underlying SQL schemas: each namespace
4202 can have a separate collection of relations, types, etc. without name
4207 <title><structname>pg_namespace</> Columns</title>
4214 <entry>References</entry>
4215 <entry>Description</entry>
4221 <entry><structfield>oid</structfield></entry>
4222 <entry><type>oid</type></entry>
4224 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4228 <entry><structfield>nspname</structfield></entry>
4229 <entry><type>name</type></entry>
4231 <entry>Name of the namespace</entry>
4235 <entry><structfield>nspowner</structfield></entry>
4236 <entry><type>oid</type></entry>
4237 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4238 <entry>Owner of the namespace</entry>
4242 <entry><structfield>nspacl</structfield></entry>
4243 <entry><type>aclitem[]</type></entry>
4246 Access privileges; see
4247 <xref linkend="sql-grant"> and
4248 <xref linkend="sql-revoke">
4259 <sect1 id="catalog-pg-opclass">
4260 <title><structname>pg_opclass</structname></title>
4262 <indexterm zone="catalog-pg-opclass">
4263 <primary>pg_opclass</primary>
4267 The catalog <structname>pg_opclass</structname> defines
4268 index access method operator classes. Each operator class defines
4269 semantics for index columns of a particular data type and a particular
4270 index access method. An operator class essentially specifies that a
4271 particular operator family is applicable to a particular indexable column
4272 data type. The set of operators from the family that are actually usable
4273 with the indexed column are whichever ones accept the column's data type
4274 as their left-hand input.
4278 Operator classes are described at length in <xref linkend="xindex">.
4282 <title><structname>pg_opclass</> Columns</title>
4289 <entry>References</entry>
4290 <entry>Description</entry>
4296 <entry><structfield>oid</structfield></entry>
4297 <entry><type>oid</type></entry>
4299 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4303 <entry><structfield>opcmethod</structfield></entry>
4304 <entry><type>oid</type></entry>
4305 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4306 <entry>Index access method operator class is for</entry>
4310 <entry><structfield>opcname</structfield></entry>
4311 <entry><type>name</type></entry>
4313 <entry>Name of this operator class</entry>
4317 <entry><structfield>opcnamespace</structfield></entry>
4318 <entry><type>oid</type></entry>
4319 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4320 <entry>Namespace of this operator class</entry>
4324 <entry><structfield>opcowner</structfield></entry>
4325 <entry><type>oid</type></entry>
4326 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4327 <entry>Owner of the operator class</entry>
4331 <entry><structfield>opcfamily</structfield></entry>
4332 <entry><type>oid</type></entry>
4333 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4334 <entry>Operator family containing the operator class</entry>
4338 <entry><structfield>opcintype</structfield></entry>
4339 <entry><type>oid</type></entry>
4340 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4341 <entry>Data type that the operator class indexes</entry>
4345 <entry><structfield>opcdefault</structfield></entry>
4346 <entry><type>bool</type></entry>
4348 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4352 <entry><structfield>opckeytype</structfield></entry>
4353 <entry><type>oid</type></entry>
4354 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4355 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4363 An operator class's <structfield>opcmethod</> must match the
4364 <structname>opfmethod</> of its containing operator family.
4365 Also, there must be no more than one <structname>pg_opclass</structname>
4366 row having <structname>opcdefault</> true for any given combination of
4367 <structname>opcmethod</> and <structname>opcintype</>.
4373 <sect1 id="catalog-pg-operator">
4374 <title><structname>pg_operator</structname></title>
4376 <indexterm zone="catalog-pg-operator">
4377 <primary>pg_operator</primary>
4381 The catalog <structname>pg_operator</> stores information about operators.
4382 See <xref linkend="sql-createoperator">
4383 and <xref linkend="xoper"> for more information.
4387 <title><structname>pg_operator</> Columns</title>
4394 <entry>References</entry>
4395 <entry>Description</entry>
4401 <entry><structfield>oid</structfield></entry>
4402 <entry><type>oid</type></entry>
4404 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4408 <entry><structfield>oprname</structfield></entry>
4409 <entry><type>name</type></entry>
4411 <entry>Name of the operator</entry>
4415 <entry><structfield>oprnamespace</structfield></entry>
4416 <entry><type>oid</type></entry>
4417 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4419 The OID of the namespace that contains this operator
4424 <entry><structfield>oprowner</structfield></entry>
4425 <entry><type>oid</type></entry>
4426 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4427 <entry>Owner of the operator</entry>
4431 <entry><structfield>oprkind</structfield></entry>
4432 <entry><type>char</type></entry>
4435 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4436 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4441 <entry><structfield>oprcanmerge</structfield></entry>
4442 <entry><type>bool</type></entry>
4444 <entry>This operator supports merge joins</entry>
4448 <entry><structfield>oprcanhash</structfield></entry>
4449 <entry><type>bool</type></entry>
4451 <entry>This operator supports hash joins</entry>
4455 <entry><structfield>oprleft</structfield></entry>
4456 <entry><type>oid</type></entry>
4457 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4458 <entry>Type of the left operand</entry>
4462 <entry><structfield>oprright</structfield></entry>
4463 <entry><type>oid</type></entry>
4464 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4465 <entry>Type of the right operand</entry>
4469 <entry><structfield>oprresult</structfield></entry>
4470 <entry><type>oid</type></entry>
4471 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4472 <entry>Type of the result</entry>
4476 <entry><structfield>oprcom</structfield></entry>
4477 <entry><type>oid</type></entry>
4478 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4479 <entry>Commutator of this operator, if any</entry>
4483 <entry><structfield>oprnegate</structfield></entry>
4484 <entry><type>oid</type></entry>
4485 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4486 <entry>Negator of this operator, if any</entry>
4490 <entry><structfield>oprcode</structfield></entry>
4491 <entry><type>regproc</type></entry>
4492 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4493 <entry>Function that implements this operator</entry>
4497 <entry><structfield>oprrest</structfield></entry>
4498 <entry><type>regproc</type></entry>
4499 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4500 <entry>Restriction selectivity estimation function for this operator</entry>
4504 <entry><structfield>oprjoin</structfield></entry>
4505 <entry><type>regproc</type></entry>
4506 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4507 <entry>Join selectivity estimation function for this operator</entry>
4514 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4515 is zero for a prefix operator.
4521 <sect1 id="catalog-pg-opfamily">
4522 <title><structname>pg_opfamily</structname></title>
4524 <indexterm zone="catalog-pg-opfamily">
4525 <primary>pg_opfamily</primary>
4529 The catalog <structname>pg_opfamily</structname> defines operator families.
4530 Each operator family is a collection of operators and associated
4531 support routines that implement the semantics specified for a particular
4532 index access method. Furthermore, the operators in a family are all
4533 <quote>compatible</>, in a way that is specified by the access method.
4534 The operator family concept allows cross-data-type operators to be used
4535 with indexes and to be reasoned about using knowledge of access method
4540 Operator families are described at length in <xref linkend="xindex">.
4544 <title><structname>pg_opfamily</> Columns</title>
4551 <entry>References</entry>
4552 <entry>Description</entry>
4558 <entry><structfield>oid</structfield></entry>
4559 <entry><type>oid</type></entry>
4561 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4565 <entry><structfield>opfmethod</structfield></entry>
4566 <entry><type>oid</type></entry>
4567 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4568 <entry>Index access method operator family is for</entry>
4572 <entry><structfield>opfname</structfield></entry>
4573 <entry><type>name</type></entry>
4575 <entry>Name of this operator family</entry>
4579 <entry><structfield>opfnamespace</structfield></entry>
4580 <entry><type>oid</type></entry>
4581 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4582 <entry>Namespace of this operator family</entry>
4586 <entry><structfield>opfowner</structfield></entry>
4587 <entry><type>oid</type></entry>
4588 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4589 <entry>Owner of the operator family</entry>
4597 The majority of the information defining an operator family is not in its
4598 <structname>pg_opfamily</structname> row, but in the associated rows in
4599 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4600 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4602 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4608 <sect1 id="catalog-pg-pltemplate">
4609 <title><structname>pg_pltemplate</structname></title>
4611 <indexterm zone="catalog-pg-pltemplate">
4612 <primary>pg_pltemplate</primary>
4616 The catalog <structname>pg_pltemplate</structname> stores
4617 <quote>template</> information for procedural languages.
4618 A template for a language allows the language to be created in a
4619 particular database by a simple <command>CREATE LANGUAGE</> command,
4620 with no need to specify implementation details.
4624 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4625 is shared across all databases of a cluster: there is only one
4626 copy of <structname>pg_pltemplate</structname> per cluster, not
4627 one per database. This allows the information to be accessible in
4628 each database as it is needed.
4632 <title><structname>pg_pltemplate</> Columns</title>
4639 <entry>Description</entry>
4645 <entry><structfield>tmplname</structfield></entry>
4646 <entry><type>name</type></entry>
4647 <entry>Name of the language this template is for</entry>
4651 <entry><structfield>tmpltrusted</structfield></entry>
4652 <entry><type>boolean</type></entry>
4653 <entry>True if language is considered trusted</entry>
4657 <entry><structfield>tmpldbacreate</structfield></entry>
4658 <entry><type>boolean</type></entry>
4659 <entry>True if language may be created by a database owner</entry>
4663 <entry><structfield>tmplhandler</structfield></entry>
4664 <entry><type>text</type></entry>
4665 <entry>Name of call handler function</entry>
4669 <entry><structfield>tmplinline</structfield></entry>
4670 <entry><type>text</type></entry>
4671 <entry>Name of anonymous-block handler function, or null if none</entry>
4675 <entry><structfield>tmplvalidator</structfield></entry>
4676 <entry><type>text</type></entry>
4677 <entry>Name of validator function, or null if none</entry>
4681 <entry><structfield>tmpllibrary</structfield></entry>
4682 <entry><type>text</type></entry>
4683 <entry>Path of shared library that implements language</entry>
4687 <entry><structfield>tmplacl</structfield></entry>
4688 <entry><type>aclitem[]</type></entry>
4689 <entry>Access privileges for template (not actually used)</entry>
4697 There are not currently any commands that manipulate procedural language
4698 templates; to change the built-in information, a superuser must modify
4699 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4700 or <command>UPDATE</command> commands.
4705 It is likely that <structname>pg_pltemplate</> will be removed in some
4706 future release of <productname>PostgreSQL</productname>, in favor of
4707 keeping this knowledge about procedural languages in their respective
4708 extension installation scripts.
4714 <sect1 id="catalog-pg-policy">
4715 <title><structname>pg_policy</structname></title>
4717 <indexterm zone="catalog-pg-policy">
4718 <primary>pg_policy</primary>
4722 The catalog <structname>pg_policy</structname> stores row level
4723 security policies for tables. A policy includes the kind of
4724 command that it applies to (possibly all commands), the roles that it
4725 applies to, the expression to be added as a security-barrier
4726 qualification to queries that include the table, and the expression
4727 to be added as a <literal>WITH CHECK</> option for queries that attempt to
4728 add new records to the table.
4733 <title><structname>pg_policy</structname> Columns</title>
4740 <entry>References</entry>
4741 <entry>Description</entry>
4747 <entry><structfield>polname</structfield></entry>
4748 <entry><type>name</type></entry>
4750 <entry>The name of the policy</entry>
4754 <entry><structfield>polrelid</structfield></entry>
4755 <entry><type>oid</type></entry>
4756 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4757 <entry>The table to which the policy applies</entry>
4761 <entry><structfield>polcmd</structfield></entry>
4762 <entry><type>char</type></entry>
4764 <entry>The command type to which the policy is applied:
4765 <literal>r</> for <command>SELECT</>,
4766 <literal>a</> for <command>INSERT</>,
4767 <literal>w</> for <command>UPDATE</>,
4768 <literal>d</> for <command>DELETE</>,
4769 or <literal>*</> for all</entry>
4773 <entry><structfield>polroles</structfield></entry>
4774 <entry><type>oid[]</type></entry>
4775 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4776 <entry>The roles to which the policy is applied</entry>
4780 <entry><structfield>polqual</structfield></entry>
4781 <entry><type>pg_node_tree</type></entry>
4783 <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4787 <entry><structfield>polwithcheck</structfield></entry>
4788 <entry><type>pg_node_tree</type></entry>
4790 <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4799 Policies stored in <structname>pg_policy</> are applied only when
4800 <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4807 <sect1 id="catalog-pg-proc">
4808 <title><structname>pg_proc</structname></title>
4810 <indexterm zone="catalog-pg-proc">
4811 <primary>pg_proc</primary>
4815 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4816 See <xref linkend="sql-createfunction">
4817 and <xref linkend="xfunc"> for more information.
4821 The table contains data for aggregate functions as well as plain functions.
4822 If <structfield>proisagg</structfield> is true, there should be a matching
4823 row in <structfield>pg_aggregate</structfield>.
4827 <title><structname>pg_proc</> Columns</title>
4834 <entry>References</entry>
4835 <entry>Description</entry>
4841 <entry><structfield>oid</structfield></entry>
4842 <entry><type>oid</type></entry>
4844 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4848 <entry><structfield>proname</structfield></entry>
4849 <entry><type>name</type></entry>
4851 <entry>Name of the function</entry>
4855 <entry><structfield>pronamespace</structfield></entry>
4856 <entry><type>oid</type></entry>
4857 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4859 The OID of the namespace that contains this function
4864 <entry><structfield>proowner</structfield></entry>
4865 <entry><type>oid</type></entry>
4866 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4867 <entry>Owner of the function</entry>
4871 <entry><structfield>prolang</structfield></entry>
4872 <entry><type>oid</type></entry>
4873 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4874 <entry>Implementation language or call interface of this function</entry>
4878 <entry><structfield>procost</structfield></entry>
4879 <entry><type>float4</type></entry>
4881 <entry>Estimated execution cost (in units of
4882 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4883 this is cost per row returned</entry>
4887 <entry><structfield>prorows</structfield></entry>
4888 <entry><type>float4</type></entry>
4890 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4894 <entry><structfield>provariadic</structfield></entry>
4895 <entry><type>oid</type></entry>
4896 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4897 <entry>Data type of the variadic array parameter's elements,
4898 or zero if the function does not have a variadic parameter</entry>
4902 <entry><structfield>protransform</structfield></entry>
4903 <entry><type>regproc</type></entry>
4904 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4905 <entry>Calls to this function can be simplified by this other function
4906 (see <xref linkend="xfunc-transform-functions">)</entry>
4910 <entry><structfield>proisagg</structfield></entry>
4911 <entry><type>bool</type></entry>
4913 <entry>Function is an aggregate function</entry>
4917 <entry><structfield>proiswindow</structfield></entry>
4918 <entry><type>bool</type></entry>
4920 <entry>Function is a window function</entry>
4924 <entry><structfield>prosecdef</structfield></entry>
4925 <entry><type>bool</type></entry>
4927 <entry>Function is a security definer (i.e., a <quote>setuid</>
4932 <entry><structfield>proleakproof</structfield></entry>
4933 <entry><type>bool</type></entry>
4936 The function has no side effects. No information about the
4937 arguments is conveyed except via the return value. Any function
4938 that might throw an error depending on the values of its arguments
4944 <entry><structfield>proisstrict</structfield></entry>
4945 <entry><type>bool</type></entry>
4948 Function returns null if any call argument is null. In that
4949 case the function won't actually be called at all. Functions
4950 that are not <quote>strict</quote> must be prepared to handle
4956 <entry><structfield>proretset</structfield></entry>
4957 <entry><type>bool</type></entry>
4959 <entry>Function returns a set (i.e., multiple values of the specified
4964 <entry><structfield>provolatile</structfield></entry>
4965 <entry><type>char</type></entry>
4968 <structfield>provolatile</structfield> tells whether the function's
4969 result depends only on its input arguments, or is affected by outside
4971 It is <literal>i</literal> for <quote>immutable</> functions,
4972 which always deliver the same result for the same inputs.
4973 It is <literal>s</literal> for <quote>stable</> functions,
4974 whose results (for fixed inputs) do not change within a scan.
4975 It is <literal>v</literal> for <quote>volatile</> functions,
4976 whose results might change at any time. (Use <literal>v</literal> also
4977 for functions with side-effects, so that calls to them cannot get
4983 <entry><structfield>pronargs</structfield></entry>
4984 <entry><type>int2</type></entry>
4986 <entry>Number of input arguments</entry>
4990 <entry><structfield>pronargdefaults</structfield></entry>
4991 <entry><type>int2</type></entry>
4993 <entry>Number of arguments that have defaults</entry>
4997 <entry><structfield>prorettype</structfield></entry>
4998 <entry><type>oid</type></entry>
4999 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5000 <entry>Data type of the return value</entry>
5004 <entry><structfield>proargtypes</structfield></entry>
5005 <entry><type>oidvector</type></entry>
5006 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5008 An array with the data types of the function arguments. This includes
5009 only input arguments (including <literal>INOUT</literal> and
5010 <literal>VARIADIC</> arguments), and thus represents
5011 the call signature of the function.
5016 <entry><structfield>proallargtypes</structfield></entry>
5017 <entry><type>oid[]</type></entry>
5018 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5020 An array with the data types of the function arguments. This includes
5021 all arguments (including <literal>OUT</literal> and
5022 <literal>INOUT</literal> arguments); however, if all the
5023 arguments are <literal>IN</literal> arguments, this field will be null.
5024 Note that subscripting is 1-based, whereas for historical reasons
5025 <structfield>proargtypes</> is subscripted from 0.
5030 <entry><structfield>proargmodes</structfield></entry>
5031 <entry><type>char[]</type></entry>
5034 An array with the modes of the function arguments, encoded as
5035 <literal>i</literal> for <literal>IN</> arguments,
5036 <literal>o</literal> for <literal>OUT</> arguments,
5037 <literal>b</literal> for <literal>INOUT</> arguments,
5038 <literal>v</literal> for <literal>VARIADIC</> arguments,
5039 <literal>t</literal> for <literal>TABLE</> arguments.
5040 If all the arguments are <literal>IN</literal> arguments,
5041 this field will be null.
5042 Note that subscripts correspond to positions of
5043 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5048 <entry><structfield>proargnames</structfield></entry>
5049 <entry><type>text[]</type></entry>
5052 An array with the names of the function arguments.
5053 Arguments without a name are set to empty strings in the array.
5054 If none of the arguments have a name, this field will be null.
5055 Note that subscripts correspond to positions of
5056 <structfield>proallargtypes</> not <structfield>proargtypes</>.
5061 <entry><structfield>proargdefaults</structfield></entry>
5062 <entry><type>pg_node_tree</type></entry>
5065 Expression trees (in <function>nodeToString()</function> representation)
5066 for default values. This is a list with
5067 <structfield>pronargdefaults</> elements, corresponding to the last
5068 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5069 <replaceable>N</> <structfield>proargtypes</> positions).
5070 If none of the arguments have defaults, this field will be null.
5075 <entry><structfield>prosrc</structfield></entry>
5076 <entry><type>text</type></entry>
5079 This tells the function handler how to invoke the function. It
5080 might be the actual source code of the function for interpreted
5081 languages, a link symbol, a file name, or just about anything
5082 else, depending on the implementation language/call convention.
5087 <entry><structfield>probin</structfield></entry>
5088 <entry><type>text</type></entry>
5091 Additional information about how to invoke the function.
5092 Again, the interpretation is language-specific.
5097 <entry><structfield>proconfig</structfield></entry>
5098 <entry><type>text[]</type></entry>
5100 <entry>Function's local settings for run-time configuration variables</entry>
5104 <entry><structfield>proacl</structfield></entry>
5105 <entry><type>aclitem[]</type></entry>
5108 Access privileges; see
5109 <xref linkend="sql-grant"> and
5110 <xref linkend="sql-revoke">
5119 For compiled functions, both built-in and dynamically loaded,
5120 <structfield>prosrc</structfield> contains the function's C-language
5121 name (link symbol). For all other currently-known language types,
5122 <structfield>prosrc</structfield> contains the function's source
5123 text. <structfield>probin</structfield> is unused except for
5124 dynamically-loaded C functions, for which it gives the name of the
5125 shared library file containing the function.
5130 <sect1 id="catalog-pg-range">
5131 <title><structname>pg_range</structname></title>
5133 <indexterm zone="catalog-pg-range">
5134 <primary>pg_range</primary>
5138 The catalog <structname>pg_range</structname> stores information about
5139 range types. This is in addition to the types' entries in
5140 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5144 <title><structname>pg_range</> Columns</title>
5151 <entry>References</entry>
5152 <entry>Description</entry>
5158 <entry><structfield>rngtypid</structfield></entry>
5159 <entry><type>oid</type></entry>
5160 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5161 <entry>OID of the range type</entry>
5165 <entry><structfield>rngsubtype</structfield></entry>
5166 <entry><type>oid</type></entry>
5167 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5168 <entry>OID of the element type (subtype) of this range type</entry>
5172 <entry><structfield>rngcollation</structfield></entry>
5173 <entry><type>oid</type></entry>
5174 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5175 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5179 <entry><structfield>rngsubopc</structfield></entry>
5180 <entry><type>oid</type></entry>
5181 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5182 <entry>OID of the subtype's operator class used for range comparisons</entry>
5186 <entry><structfield>rngcanonical</structfield></entry>
5187 <entry><type>regproc</type></entry>
5188 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5189 <entry>OID of the function to convert a range value into canonical form,
5190 or 0 if none</entry>
5194 <entry><structfield>rngsubdiff</structfield></entry>
5195 <entry><type>regproc</type></entry>
5196 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5197 <entry>OID of the function to return the difference between two element
5198 values as <type>double precision</type>, or 0 if none</entry>
5205 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5206 element type is collatable) determines the sort ordering used by the range
5207 type. <structfield>rngcanonical</> is used when the element type is
5208 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5209 improve performance of GiST indexes on the range type.
5214 <sect1 id="catalog-pg-rewrite">
5215 <title><structname>pg_rewrite</structname></title>
5217 <indexterm zone="catalog-pg-rewrite">
5218 <primary>pg_rewrite</primary>
5222 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5226 <title><structname>pg_rewrite</> Columns</title>
5233 <entry>References</entry>
5234 <entry>Description</entry>
5240 <entry><structfield>oid</structfield></entry>
5241 <entry><type>oid</type></entry>
5243 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5247 <entry><structfield>rulename</structfield></entry>
5248 <entry><type>name</type></entry>
5250 <entry>Rule name</entry>
5254 <entry><structfield>ev_class</structfield></entry>
5255 <entry><type>oid</type></entry>
5256 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5257 <entry>The table this rule is for</entry>
5261 <entry><structfield>ev_type</structfield></entry>
5262 <entry><type>char</type></entry>
5265 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5266 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5272 <entry><structfield>ev_enabled</structfield></entry>
5273 <entry><type>char</type></entry>
5276 Controls in which <xref linkend="guc-session-replication-role"> modes
5278 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5279 <literal>D</> = rule is disabled,
5280 <literal>R</> = rule fires in <quote>replica</> mode,
5281 <literal>A</> = rule fires always.
5286 <entry><structfield>is_instead</structfield></entry>
5287 <entry><type>bool</type></entry>
5289 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5293 <entry><structfield>ev_qual</structfield></entry>
5294 <entry><type>pg_node_tree</type></entry>
5297 Expression tree (in the form of a
5298 <function>nodeToString()</function> representation) for the
5299 rule's qualifying condition
5304 <entry><structfield>ev_action</structfield></entry>
5305 <entry><type>pg_node_tree</type></entry>
5308 Query tree (in the form of a
5309 <function>nodeToString()</function> representation) for the
5319 <literal>pg_class.relhasrules</literal>
5320 must be true if a table has any rules in this catalog.
5326 <sect1 id="catalog-pg-replication-slots">
5327 <title><structname>pg_replication_slots</structname></title>
5329 <indexterm zone="catalog-pg-replication-slots">
5330 <primary>pg_replication_slots</primary>
5334 The <structname>pg_replication_slots</structname> view provides a listing
5335 of all replication slots that currently exist on the database cluster,
5336 along with their current state.
5340 For more on replication slots,
5341 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
5346 <title><structname>pg_replication_slots</structname> Columns</title>
5353 <entry>References</entry>
5354 <entry>Description</entry>
5360 <entry><structfield>slot_name</structfield></entry>
5361 <entry><type>name</type></entry>
5363 <entry>A unique, cluster-wide identifier for the replication slot</entry>
5367 <entry><structfield>plugin</structfield></entry>
5368 <entry><type>name</type></entry>
5370 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
5374 <entry><structfield>slot_type</structfield></entry>
5375 <entry><type>text</type></entry>
5377 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
5381 <entry><structfield>datoid</structfield></entry>
5382 <entry><type>oid</type></entry>
5383 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5384 <entry>The OID of the database this slot is associated with, or
5385 null. Only logical slots have an associated database.</entry>
5389 <entry><structfield>database</structfield></entry>
5390 <entry><type>text</type></entry>
5391 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5392 <entry>The name of the database this slot is associated with, or
5393 null. Only logical slots have an associated database.</entry>
5397 <entry><structfield>active</structfield></entry>
5398 <entry><type>boolean</type></entry>
5400 <entry>True if this slot is currently actively being used</entry>
5404 <entry><structfield>active_in</structfield></entry>
5405 <entry><type>integer</type></entry>
5407 <entry>The process ID of the session using this slot if the slot
5408 is currently actively being used. <literal>NULL</literal> if
5414 <entry><structfield>xmin</structfield></entry>
5415 <entry><type>xid</type></entry>
5417 <entry>The oldest transaction that this slot needs the database to
5418 retain. <literal>VACUUM</literal> cannot remove tuples deleted
5419 by any later transaction.
5424 <entry><structfield>catalog_xmin</structfield></entry>
5425 <entry><type>xid</type></entry>
5427 <entry>The oldest transaction affecting the system catalogs that this
5428 slot needs the database to retain. <literal>VACUUM</literal> cannot
5429 remove catalog tuples deleted by any later transaction.
5434 <entry><structfield>restart_lsn</structfield></entry>
5435 <entry><type>pg_lsn</type></entry>
5437 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
5438 might be required by the consumer of this slot and thus won't be
5439 automatically removed during checkpoints.
5447 <sect1 id="catalog-pg-seclabel">
5448 <title><structname>pg_seclabel</structname></title>
5450 <indexterm zone="catalog-pg-seclabel">
5451 <primary>pg_seclabel</primary>
5455 The catalog <structname>pg_seclabel</structname> stores security
5456 labels on database objects. Security labels can be manipulated
5457 with the <xref linkend="sql-security-label"> command. For an easier
5458 way to view security labels, see <xref linkend="view-pg-seclabels">.
5462 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5463 which performs a similar function for security labels of database objects
5464 that are shared across a database cluster.
5468 <title><structname>pg_seclabel</structname> Columns</title>
5475 <entry>References</entry>
5476 <entry>Description</entry>
5482 <entry><structfield>objoid</structfield></entry>
5483 <entry><type>oid</type></entry>
5484 <entry>any OID column</entry>
5485 <entry>The OID of the object this security label pertains to</entry>
5489 <entry><structfield>classoid</structfield></entry>
5490 <entry><type>oid</type></entry>
5491 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5492 <entry>The OID of the system catalog this object appears in</entry>
5496 <entry><structfield>objsubid</structfield></entry>
5497 <entry><type>int4</type></entry>
5500 For a security label on a table column, this is the column number (the
5501 <structfield>objoid</> and <structfield>classoid</> refer to
5502 the table itself). For all other object types, this column is
5508 <entry><structfield>provider</structfield></entry>
5509 <entry><type>text</type></entry>
5511 <entry>The label provider associated with this label.</entry>
5515 <entry><structfield>label</structfield></entry>
5516 <entry><type>text</type></entry>
5518 <entry>The security label applied to this object.</entry>
5525 <sect1 id="catalog-pg-shdepend">
5526 <title><structname>pg_shdepend</structname></title>
5528 <indexterm zone="catalog-pg-shdepend">
5529 <primary>pg_shdepend</primary>
5533 The catalog <structname>pg_shdepend</structname> records the
5534 dependency relationships between database objects and shared objects,
5535 such as roles. This information allows
5536 <productname>PostgreSQL</productname> to ensure that those objects are
5537 unreferenced before attempting to delete them.
5541 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5542 which performs a similar function for dependencies involving objects
5543 within a single database.
5547 Unlike most system catalogs, <structname>pg_shdepend</structname>
5548 is shared across all databases of a cluster: there is only one
5549 copy of <structname>pg_shdepend</structname> per cluster, not
5554 <title><structname>pg_shdepend</> Columns</title>
5561 <entry>References</entry>
5562 <entry>Description</entry>
5568 <entry><structfield>dbid</structfield></entry>
5569 <entry><type>oid</type></entry>
5570 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5571 <entry>The OID of the database the dependent object is in,
5572 or zero for a shared object</entry>
5576 <entry><structfield>classid</structfield></entry>
5577 <entry><type>oid</type></entry>
5578 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5579 <entry>The OID of the system catalog the dependent object is in</entry>
5583 <entry><structfield>objid</structfield></entry>
5584 <entry><type>oid</type></entry>
5585 <entry>any OID column</entry>
5586 <entry>The OID of the specific dependent object</entry>
5590 <entry><structfield>objsubid</structfield></entry>
5591 <entry><type>int4</type></entry>
5594 For a table column, this is the column number (the
5595 <structfield>objid</> and <structfield>classid</> refer to the
5596 table itself). For all other object types, this column is zero.
5601 <entry><structfield>refclassid</structfield></entry>
5602 <entry><type>oid</type></entry>
5603 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5604 <entry>The OID of the system catalog the referenced object is in
5605 (must be a shared catalog)</entry>
5609 <entry><structfield>refobjid</structfield></entry>
5610 <entry><type>oid</type></entry>
5611 <entry>any OID column</entry>
5612 <entry>The OID of the specific referenced object</entry>
5616 <entry><structfield>deptype</structfield></entry>
5617 <entry><type>char</type></entry>
5620 A code defining the specific semantics of this dependency relationship; see text
5629 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5630 the referenced object cannot be dropped without also dropping the dependent
5631 object. However, there are several subflavors identified by
5632 <structfield>deptype</>:
5636 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5639 The referenced object (which must be a role) is the owner of the
5646 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5649 The referenced object (which must be a role) is mentioned in the
5650 ACL (access control list, i.e., privileges list) of the
5651 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5652 not made for the owner of the object, since the owner will have
5653 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5659 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5662 There is no dependent object; this type of entry is a signal
5663 that the system itself depends on the referenced object, and so
5664 that object must never be deleted. Entries of this type are
5665 created only by <command>initdb</command>. The columns for the
5666 dependent object contain zeroes.
5672 Other dependency flavors might be needed in future. Note in particular
5673 that the current definition only supports roles as referenced objects.
5678 <sect1 id="catalog-pg-shdescription">
5679 <title><structname>pg_shdescription</structname></title>
5681 <indexterm zone="catalog-pg-shdescription">
5682 <primary>pg_shdescription</primary>
5686 The catalog <structname>pg_shdescription</structname> stores optional
5687 descriptions (comments) for shared database objects. Descriptions can be
5688 manipulated with the <xref linkend="sql-comment"> command and viewed with
5689 <application>psql</application>'s <literal>\d</literal> commands.
5693 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5694 which performs a similar function for descriptions involving objects
5695 within a single database.
5699 Unlike most system catalogs, <structname>pg_shdescription</structname>
5700 is shared across all databases of a cluster: there is only one
5701 copy of <structname>pg_shdescription</structname> per cluster, not
5706 <title><structname>pg_shdescription</> Columns</title>
5713 <entry>References</entry>
5714 <entry>Description</entry>
5720 <entry><structfield>objoid</structfield></entry>
5721 <entry><type>oid</type></entry>
5722 <entry>any OID column</entry>
5723 <entry>The OID of the object this description pertains to</entry>
5727 <entry><structfield>classoid</structfield></entry>
5728 <entry><type>oid</type></entry>
5729 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5730 <entry>The OID of the system catalog this object appears in</entry>
5734 <entry><structfield>description</structfield></entry>
5735 <entry><type>text</type></entry>
5737 <entry>Arbitrary text that serves as the description of this object</entry>
5745 <sect1 id="catalog-pg-shseclabel">
5746 <title><structname>pg_shseclabel</structname></title>
5748 <indexterm zone="catalog-pg-shseclabel">
5749 <primary>pg_shseclabel</primary>
5753 The catalog <structname>pg_shseclabel</structname> stores security
5754 labels on shared database objects. Security labels can be manipulated
5755 with the <xref linkend="sql-security-label"> command. For an easier
5756 way to view security labels, see <xref linkend="view-pg-seclabels">.
5760 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5761 which performs a similar function for security labels involving objects
5762 within a single database.
5766 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5767 is shared across all databases of a cluster: there is only one
5768 copy of <structname>pg_shseclabel</structname> per cluster, not
5773 <title><structname>pg_shseclabel</structname> Columns</title>
5779 <entry>References</entry>
5780 <entry>Description</entry>
5785 <entry><structfield>objoid</structfield></entry>
5786 <entry><type>oid</type></entry>
5787 <entry>any OID column</entry>
5788 <entry>The OID of the object this security label pertains to</entry>
5791 <entry><structfield>classoid</structfield></entry>
5792 <entry><type>oid</type></entry>
5793 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5794 <entry>The OID of the system catalog this object appears in</entry>
5797 <entry><structfield>provider</structfield></entry>
5798 <entry><type>text</type></entry>
5800 <entry>The label provider associated with this label.</entry>
5803 <entry><structfield>label</structfield></entry>
5804 <entry><type>text</type></entry>
5806 <entry>The security label applied to this object.</entry>
5813 <sect1 id="catalog-pg-statistic">
5814 <title><structname>pg_statistic</structname></title>
5816 <indexterm zone="catalog-pg-statistic">
5817 <primary>pg_statistic</primary>
5821 The catalog <structname>pg_statistic</structname> stores
5822 statistical data about the contents of the database. Entries are
5823 created by <xref linkend="sql-analyze">
5824 and subsequently used by the query planner. Note that all the
5825 statistical data is inherently approximate, even assuming that it
5830 Normally there is one entry, with <structfield>stainherit</> =
5831 <literal>false</>, for each table column that has been analyzed.
5832 If the table has inheritance children, a second entry with
5833 <structfield>stainherit</> = <literal>true</> is also created. This row
5834 represents the column's statistics over the inheritance tree, i.e.,
5835 statistics for the data you'd see with
5836 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5837 whereas the <structfield>stainherit</> = <literal>false</> row represents
5839 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5843 <structname>pg_statistic</structname> also stores statistical data about
5844 the values of index expressions. These are described as if they were
5845 actual data columns; in particular, <structfield>starelid</structfield>
5846 references the index. No entry is made for an ordinary non-expression
5847 index column, however, since it would be redundant with the entry
5848 for the underlying table column. Currently, entries for index expressions
5849 always have <structfield>stainherit</> = <literal>false</>.
5853 Since different kinds of statistics might be appropriate for different
5854 kinds of data, <structname>pg_statistic</structname> is designed not
5855 to assume very much about what sort of statistics it stores. Only
5856 extremely general statistics (such as nullness) are given dedicated
5857 columns in <structname>pg_statistic</structname>. Everything else
5858 is stored in <quote>slots</quote>, which are groups of associated columns
5859 whose content is identified by a code number in one of the slot's columns.
5860 For more information see
5861 <filename>src/include/catalog/pg_statistic.h</filename>.
5865 <structname>pg_statistic</structname> should not be readable by the
5866 public, since even statistical information about a table's contents
5867 might be considered sensitive. (Example: minimum and maximum values
5868 of a salary column might be quite interesting.)
5869 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
5870 is a publicly readable view on
5871 <structname>pg_statistic</structname> that only exposes information
5872 about those tables that are readable by the current user.
5876 <title><structname>pg_statistic</> Columns</title>
5883 <entry>References</entry>
5884 <entry>Description</entry>
5890 <entry><structfield>starelid</structfield></entry>
5891 <entry><type>oid</type></entry>
5892 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5893 <entry>The table or index that the described column belongs to</entry>
5897 <entry><structfield>staattnum</structfield></entry>
5898 <entry><type>int2</type></entry>
5899 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5900 <entry>The number of the described column</entry>
5904 <entry><structfield>stainherit</structfield></entry>
5905 <entry><type>bool</type></entry>
5907 <entry>If true, the stats include inheritance child columns, not just the
5908 values in the specified relation</entry>
5912 <entry><structfield>stanullfrac</structfield></entry>
5913 <entry><type>float4</type></entry>
5915 <entry>The fraction of the column's entries that are null</entry>
5919 <entry><structfield>stawidth</structfield></entry>
5920 <entry><type>int4</type></entry>
5922 <entry>The average stored width, in bytes, of nonnull entries</entry>
5926 <entry><structfield>stadistinct</structfield></entry>
5927 <entry><type>float4</type></entry>
5929 <entry>The number of distinct nonnull data values in the column.
5930 A value greater than zero is the actual number of distinct values.
5931 A value less than zero is the negative of a multiplier for the number
5932 of rows in the table; for example, a column in which values appear about
5933 twice on the average could be represented by
5934 <structfield>stadistinct</> = -0.5.
5935 A zero value means the number of distinct values is unknown.
5940 <entry><structfield>stakind<replaceable>N</></structfield></entry>
5941 <entry><type>int2</type></entry>
5944 A code number indicating the kind of statistics stored in the
5945 <replaceable>N</>th <quote>slot</quote> of the
5946 <structname>pg_statistic</structname> row.
5951 <entry><structfield>staop<replaceable>N</></structfield></entry>
5952 <entry><type>oid</type></entry>
5953 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
5955 An operator used to derive the statistics stored in the
5956 <replaceable>N</>th <quote>slot</quote>. For example, a
5957 histogram slot would show the <literal><</literal> operator
5958 that defines the sort order of the data.
5963 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
5964 <entry><type>float4[]</type></entry>
5967 Numerical statistics of the appropriate kind for the
5968 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5969 kind does not involve numerical values
5974 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
5975 <entry><type>anyarray</type></entry>
5978 Column data values of the appropriate kind for the
5979 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5980 kind does not store any data values. Each array's element
5981 values are actually of the specific column's data type, or a related
5982 type such as an array's element type, so there is no way to define
5983 these columns' type more specifically than <type>anyarray</>.
5993 <sect1 id="catalog-pg-tablespace">
5994 <title><structname>pg_tablespace</structname></title>
5996 <indexterm zone="catalog-pg-tablespace">
5997 <primary>pg_tablespace</primary>
6001 The catalog <structname>pg_tablespace</structname> stores information
6002 about the available tablespaces. Tables can be placed in particular
6003 tablespaces to aid administration of disk layout.
6007 Unlike most system catalogs, <structname>pg_tablespace</structname>
6008 is shared across all databases of a cluster: there is only one
6009 copy of <structname>pg_tablespace</structname> per cluster, not
6014 <title><structname>pg_tablespace</> Columns</title>
6021 <entry>References</entry>
6022 <entry>Description</entry>
6028 <entry><structfield>oid</structfield></entry>
6029 <entry><type>oid</type></entry>
6031 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6035 <entry><structfield>spcname</structfield></entry>
6036 <entry><type>name</type></entry>
6038 <entry>Tablespace name</entry>
6042 <entry><structfield>spcowner</structfield></entry>
6043 <entry><type>oid</type></entry>
6044 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6045 <entry>Owner of the tablespace, usually the user who created it</entry>
6049 <entry><structfield>spcacl</structfield></entry>
6050 <entry><type>aclitem[]</type></entry>
6053 Access privileges; see
6054 <xref linkend="sql-grant"> and
6055 <xref linkend="sql-revoke">
6061 <entry><structfield>spcoptions</structfield></entry>
6062 <entry><type>text[]</type></entry>
6065 Tablespace-level options, as <quote>keyword=value</> strings
6074 <sect1 id="catalog-pg-trigger">
6075 <title><structname>pg_trigger</structname></title>
6077 <indexterm zone="catalog-pg-trigger">
6078 <primary>pg_trigger</primary>
6082 The catalog <structname>pg_trigger</structname> stores triggers on tables
6084 See <xref linkend="sql-createtrigger">
6085 for more information.
6089 <title><structname>pg_trigger</> Columns</title>
6096 <entry>References</entry>
6097 <entry>Description</entry>
6103 <entry><structfield>oid</structfield></entry>
6104 <entry><type>oid</type></entry>
6106 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6110 <entry><structfield>tgrelid</structfield></entry>
6111 <entry><type>oid</type></entry>
6112 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6113 <entry>The table this trigger is on</entry>
6117 <entry><structfield>tgname</structfield></entry>
6118 <entry><type>name</type></entry>
6120 <entry>Trigger name (must be unique among triggers of same table)</entry>
6124 <entry><structfield>tgfoid</structfield></entry>
6125 <entry><type>oid</type></entry>
6126 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6127 <entry>The function to be called</entry>
6131 <entry><structfield>tgtype</structfield></entry>
6132 <entry><type>int2</type></entry>
6134 <entry>Bit mask identifying trigger firing conditions</entry>
6138 <entry><structfield>tgenabled</structfield></entry>
6139 <entry><type>char</type></entry>
6142 Controls in which <xref linkend="guc-session-replication-role"> modes
6144 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6145 <literal>D</> = trigger is disabled,
6146 <literal>R</> = trigger fires in <quote>replica</> mode,
6147 <literal>A</> = trigger fires always.
6152 <entry><structfield>tgisinternal</structfield></entry>
6153 <entry><type>bool</type></entry>
6155 <entry>True if trigger is internally generated (usually, to enforce
6156 the constraint identified by <structfield>tgconstraint</>)</entry>
6160 <entry><structfield>tgconstrrelid</structfield></entry>
6161 <entry><type>oid</type></entry>
6162 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6163 <entry>The table referenced by a referential integrity constraint</entry>
6167 <entry><structfield>tgconstrindid</structfield></entry>
6168 <entry><type>oid</type></entry>
6169 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6170 <entry>The index supporting a unique, primary key, referential integrity,
6171 or exclusion constraint</entry>
6175 <entry><structfield>tgconstraint</structfield></entry>
6176 <entry><type>oid</type></entry>
6177 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6178 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6182 <entry><structfield>tgdeferrable</structfield></entry>
6183 <entry><type>bool</type></entry>
6185 <entry>True if constraint trigger is deferrable</entry>
6189 <entry><structfield>tginitdeferred</structfield></entry>
6190 <entry><type>bool</type></entry>
6192 <entry>True if constraint trigger is initially deferred</entry>
6196 <entry><structfield>tgnargs</structfield></entry>
6197 <entry><type>int2</type></entry>
6199 <entry>Number of argument strings passed to trigger function</entry>
6203 <entry><structfield>tgattr</structfield></entry>
6204 <entry><type>int2vector</type></entry>
6205 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6206 <entry>Column numbers, if trigger is column-specific; otherwise an
6211 <entry><structfield>tgargs</structfield></entry>
6212 <entry><type>bytea</type></entry>
6214 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6218 <entry><structfield>tgqual</structfield></entry>
6219 <entry><type>pg_node_tree</type></entry>
6221 <entry>Expression tree (in <function>nodeToString()</function>
6222 representation) for the trigger's <literal>WHEN</> condition, or null
6230 Currently, column-specific triggering is supported only for
6231 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6232 only for that event type. <structfield>tgtype</structfield> might
6233 contain bits for other event types as well, but those are presumed
6234 to be table-wide regardless of what is in <structfield>tgattr</>.
6239 When <structfield>tgconstraint</> is nonzero,
6240 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6241 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6242 largely redundant with the referenced <structname>pg_constraint</> entry.
6243 However, it is possible for a non-deferrable trigger to be associated
6244 with a deferrable constraint: foreign key constraints can have some
6245 deferrable and some non-deferrable triggers.
6251 <literal>pg_class.relhastriggers</literal>
6252 must be true if a relation has any triggers in this catalog.
6259 <sect1 id="catalog-pg-ts-config">
6260 <title><structname>pg_ts_config</structname></title>
6262 <indexterm zone="catalog-pg-ts-config">
6263 <primary>pg_ts_config</primary>
6267 The <structname>pg_ts_config</structname> catalog contains entries
6268 representing text search configurations. A configuration specifies
6269 a particular text search parser and a list of dictionaries to use
6270 for each of the parser's output token types. The parser is shown
6271 in the <structname>pg_ts_config</structname> entry, but the
6272 token-to-dictionary mapping is defined by subsidiary entries in <link
6273 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6277 <productname>PostgreSQL</productname>'s text search features are
6278 described at length in <xref linkend="textsearch">.
6282 <title><structname>pg_ts_config</> Columns</title>
6289 <entry>References</entry>
6290 <entry>Description</entry>
6296 <entry><structfield>oid</structfield></entry>
6297 <entry><type>oid</type></entry>
6299 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6303 <entry><structfield>cfgname</structfield></entry>
6304 <entry><type>name</type></entry>
6306 <entry>Text search configuration name</entry>
6310 <entry><structfield>cfgnamespace</structfield></entry>
6311 <entry><type>oid</type></entry>
6312 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6314 The OID of the namespace that contains this configuration
6319 <entry><structfield>cfgowner</structfield></entry>
6320 <entry><type>oid</type></entry>
6321 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6322 <entry>Owner of the configuration</entry>
6326 <entry><structfield>cfgparser</structfield></entry>
6327 <entry><type>oid</type></entry>
6328 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6329 <entry>The OID of the text search parser for this configuration</entry>
6337 <sect1 id="catalog-pg-ts-config-map">
6338 <title><structname>pg_ts_config_map</structname></title>
6340 <indexterm zone="catalog-pg-ts-config-map">
6341 <primary>pg_ts_config_map</primary>
6345 The <structname>pg_ts_config_map</structname> catalog contains entries
6346 showing which text search dictionaries should be consulted, and in
6347 what order, for each output token type of each text search configuration's
6352 <productname>PostgreSQL</productname>'s text search features are
6353 described at length in <xref linkend="textsearch">.
6357 <title><structname>pg_ts_config_map</> Columns</title>
6364 <entry>References</entry>
6365 <entry>Description</entry>
6371 <entry><structfield>mapcfg</structfield></entry>
6372 <entry><type>oid</type></entry>
6373 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6374 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6378 <entry><structfield>maptokentype</structfield></entry>
6379 <entry><type>integer</type></entry>
6381 <entry>A token type emitted by the configuration's parser</entry>
6385 <entry><structfield>mapseqno</structfield></entry>
6386 <entry><type>integer</type></entry>
6388 <entry>Order in which to consult this entry (lower
6389 <structfield>mapseqno</>s first)</entry>
6393 <entry><structfield>mapdict</structfield></entry>
6394 <entry><type>oid</type></entry>
6395 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6396 <entry>The OID of the text search dictionary to consult</entry>
6404 <sect1 id="catalog-pg-ts-dict">
6405 <title><structname>pg_ts_dict</structname></title>
6407 <indexterm zone="catalog-pg-ts-dict">
6408 <primary>pg_ts_dict</primary>
6412 The <structname>pg_ts_dict</structname> catalog contains entries
6413 defining text search dictionaries. A dictionary depends on a text
6414 search template, which specifies all the implementation functions
6415 needed; the dictionary itself provides values for the user-settable
6416 parameters supported by the template. This division of labor allows
6417 dictionaries to be created by unprivileged users. The parameters
6418 are specified by a text string <structfield>dictinitoption</>,
6419 whose format and meaning vary depending on the template.
6423 <productname>PostgreSQL</productname>'s text search features are
6424 described at length in <xref linkend="textsearch">.
6428 <title><structname>pg_ts_dict</> Columns</title>
6435 <entry>References</entry>
6436 <entry>Description</entry>
6442 <entry><structfield>oid</structfield></entry>
6443 <entry><type>oid</type></entry>
6445 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6449 <entry><structfield>dictname</structfield></entry>
6450 <entry><type>name</type></entry>
6452 <entry>Text search dictionary name</entry>
6456 <entry><structfield>dictnamespace</structfield></entry>
6457 <entry><type>oid</type></entry>
6458 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6460 The OID of the namespace that contains this dictionary
6465 <entry><structfield>dictowner</structfield></entry>
6466 <entry><type>oid</type></entry>
6467 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6468 <entry>Owner of the dictionary</entry>
6472 <entry><structfield>dicttemplate</structfield></entry>
6473 <entry><type>oid</type></entry>
6474 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6475 <entry>The OID of the text search template for this dictionary</entry>
6479 <entry><structfield>dictinitoption</structfield></entry>
6480 <entry><type>text</type></entry>
6482 <entry>Initialization option string for the template</entry>
6490 <sect1 id="catalog-pg-ts-parser">
6491 <title><structname>pg_ts_parser</structname></title>
6493 <indexterm zone="catalog-pg-ts-parser">
6494 <primary>pg_ts_parser</primary>
6498 The <structname>pg_ts_parser</structname> catalog contains entries
6499 defining text search parsers. A parser is responsible for splitting
6500 input text into lexemes and assigning a token type to each lexeme.
6501 Since a parser must be implemented by C-language-level functions,
6502 creation of new parsers is restricted to database superusers.
6506 <productname>PostgreSQL</productname>'s text search features are
6507 described at length in <xref linkend="textsearch">.
6511 <title><structname>pg_ts_parser</> Columns</title>
6518 <entry>References</entry>
6519 <entry>Description</entry>
6525 <entry><structfield>oid</structfield></entry>
6526 <entry><type>oid</type></entry>
6528 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6532 <entry><structfield>prsname</structfield></entry>
6533 <entry><type>name</type></entry>
6535 <entry>Text search parser name</entry>
6539 <entry><structfield>prsnamespace</structfield></entry>
6540 <entry><type>oid</type></entry>
6541 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6543 The OID of the namespace that contains this parser
6548 <entry><structfield>prsstart</structfield></entry>
6549 <entry><type>regproc</type></entry>
6550 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6551 <entry>OID of the parser's startup function</entry>
6555 <entry><structfield>prstoken</structfield></entry>
6556 <entry><type>regproc</type></entry>
6557 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6558 <entry>OID of the parser's next-token function</entry>
6562 <entry><structfield>prsend</structfield></entry>
6563 <entry><type>regproc</type></entry>
6564 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6565 <entry>OID of the parser's shutdown function</entry>
6569 <entry><structfield>prsheadline</structfield></entry>
6570 <entry><type>regproc</type></entry>
6571 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6572 <entry>OID of the parser's headline function</entry>
6576 <entry><structfield>prslextype</structfield></entry>
6577 <entry><type>regproc</type></entry>
6578 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6579 <entry>OID of the parser's lextype function</entry>
6587 <sect1 id="catalog-pg-ts-template">
6588 <title><structname>pg_ts_template</structname></title>
6590 <indexterm zone="catalog-pg-ts-template">
6591 <primary>pg_ts_template</primary>
6595 The <structname>pg_ts_template</structname> catalog contains entries
6596 defining text search templates. A template is the implementation
6597 skeleton for a class of text search dictionaries.
6598 Since a template must be implemented by C-language-level functions,
6599 creation of new templates is restricted to database superusers.
6603 <productname>PostgreSQL</productname>'s text search features are
6604 described at length in <xref linkend="textsearch">.
6608 <title><structname>pg_ts_template</> Columns</title>
6615 <entry>References</entry>
6616 <entry>Description</entry>
6622 <entry><structfield>oid</structfield></entry>
6623 <entry><type>oid</type></entry>
6625 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6629 <entry><structfield>tmplname</structfield></entry>
6630 <entry><type>name</type></entry>
6632 <entry>Text search template name</entry>
6636 <entry><structfield>tmplnamespace</structfield></entry>
6637 <entry><type>oid</type></entry>
6638 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6640 The OID of the namespace that contains this template
6645 <entry><structfield>tmplinit</structfield></entry>
6646 <entry><type>regproc</type></entry>
6647 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6648 <entry>OID of the template's initialization function</entry>
6652 <entry><structfield>tmpllexize</structfield></entry>
6653 <entry><type>regproc</type></entry>
6654 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6655 <entry>OID of the template's lexize function</entry>
6663 <sect1 id="catalog-pg-type">
6664 <title><structname>pg_type</structname></title>
6666 <indexterm zone="catalog-pg-type">
6667 <primary>pg_type</primary>
6671 The catalog <structname>pg_type</structname> stores information about data
6672 types. Base types and enum types (scalar types) are created with
6673 <xref linkend="sql-createtype">, and
6675 <xref linkend="sql-createdomain">.
6676 A composite type is automatically created for each table in the database, to
6677 represent the row structure of the table. It is also possible to create
6678 composite types with <command>CREATE TYPE AS</command>.
6682 <title><structname>pg_type</> Columns</title>
6689 <entry>References</entry>
6690 <entry>Description</entry>
6696 <entry><structfield>oid</structfield></entry>
6697 <entry><type>oid</type></entry>
6699 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6703 <entry><structfield>typname</structfield></entry>
6704 <entry><type>name</type></entry>
6706 <entry>Data type name</entry>
6710 <entry><structfield>typnamespace</structfield></entry>
6711 <entry><type>oid</type></entry>
6712 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6714 The OID of the namespace that contains this type
6719 <entry><structfield>typowner</structfield></entry>
6720 <entry><type>oid</type></entry>
6721 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6722 <entry>Owner of the type</entry>
6726 <entry><structfield>typlen</structfield></entry>
6727 <entry><type>int2</type></entry>
6730 For a fixed-size type, <structfield>typlen</structfield> is the number
6731 of bytes in the internal representation of the type. But for a
6732 variable-length type, <structfield>typlen</structfield> is negative.
6733 -1 indicates a <quote>varlena</> type (one that has a length word),
6734 -2 indicates a null-terminated C string.
6739 <entry><structfield>typbyval</structfield></entry>
6740 <entry><type>bool</type></entry>
6743 <structfield>typbyval</structfield> determines whether internal
6744 routines pass a value of this type by value or by reference.
6745 <structfield>typbyval</structfield> had better be false if
6746 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6747 where Datum is 8 bytes).
6748 Variable-length types are always passed by reference. Note that
6749 <structfield>typbyval</structfield> can be false even if the
6750 length would allow pass-by-value.
6755 <entry><structfield>typtype</structfield></entry>
6756 <entry><type>char</type></entry>
6759 <structfield>typtype</structfield> is
6760 <literal>b</literal> for a base type,
6761 <literal>c</literal> for a composite type (e.g., a table's row type),
6762 <literal>d</literal> for a domain,
6763 <literal>e</literal> for an enum type,
6764 <literal>p</literal> for a pseudo-type, or
6765 <literal>r</literal> for a range type.
6766 See also <structfield>typrelid</structfield> and
6767 <structfield>typbasetype</structfield>.
6772 <entry><structfield>typcategory</structfield></entry>
6773 <entry><type>char</type></entry>
6776 <structfield>typcategory</structfield> is an arbitrary classification
6777 of data types that is used by the parser to determine which implicit
6778 casts should be <quote>preferred</>.
6779 See <xref linkend="catalog-typcategory-table">.
6784 <entry><structfield>typispreferred</structfield></entry>
6785 <entry><type>bool</type></entry>
6788 True if the type is a preferred cast target within its
6789 <structfield>typcategory</structfield>
6794 <entry><structfield>typisdefined</structfield></entry>
6795 <entry><type>bool</type></entry>
6798 True if the type is defined, false if this is a placeholder
6799 entry for a not-yet-defined type. When
6800 <structfield>typisdefined</structfield> is false, nothing
6801 except the type name, namespace, and OID can be relied on.
6806 <entry><structfield>typdelim</structfield></entry>
6807 <entry><type>char</type></entry>
6810 Character that separates two values of this type when parsing
6811 array input. Note that the delimiter is associated with the array
6812 element data type, not the array data type.
6817 <entry><structfield>typrelid</structfield></entry>
6818 <entry><type>oid</type></entry>
6819 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6821 If this is a composite type (see
6822 <structfield>typtype</structfield>), then this column points to
6823 the <structname>pg_class</structname> entry that defines the
6824 corresponding table. (For a free-standing composite type, the
6825 <structname>pg_class</structname> entry doesn't really represent
6826 a table, but it is needed anyway for the type's
6827 <structname>pg_attribute</structname> entries to link to.)
6828 Zero for non-composite types.
6833 <entry><structfield>typelem</structfield></entry>
6834 <entry><type>oid</type></entry>
6835 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6837 If <structfield>typelem</structfield> is not 0 then it
6838 identifies another row in <structname>pg_type</structname>.
6839 The current type can then be subscripted like an array yielding
6840 values of type <structfield>typelem</structfield>. A
6841 <quote>true</quote> array type is variable length
6842 (<structfield>typlen</structfield> = -1),
6843 but some fixed-length (<structfield>typlen</structfield> > 0) types
6844 also have nonzero <structfield>typelem</structfield>, for example
6845 <type>name</type> and <type>point</type>.
6846 If a fixed-length type has a <structfield>typelem</structfield> then
6847 its internal representation must be some number of values of the
6848 <structfield>typelem</structfield> data type with no other data.
6849 Variable-length array types have a header defined by the array
6855 <entry><structfield>typarray</structfield></entry>
6856 <entry><type>oid</type></entry>
6857 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6859 If <structfield>typarray</structfield> is not 0 then it
6860 identifies another row in <structname>pg_type</structname>, which
6861 is the <quote>true</quote> array type having this type as element
6866 <entry><structfield>typinput</structfield></entry>
6867 <entry><type>regproc</type></entry>
6868 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6869 <entry>Input conversion function (text format)</entry>
6873 <entry><structfield>typoutput</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>Output conversion function (text format)</entry>
6880 <entry><structfield>typreceive</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>Input conversion function (binary format), or 0 if none</entry>
6887 <entry><structfield>typsend</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>Output conversion function (binary format), or 0 if none</entry>
6894 <entry><structfield>typmodin</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>Type modifier input function, or 0 if type does not support modifiers</entry>
6901 <entry><structfield>typmodout</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>Type modifier output function, or 0 to use the standard format</entry>
6908 <entry><structfield>typanalyze</structfield></entry>
6909 <entry><type>regproc</type></entry>
6910 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6911 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
6915 <entry><structfield>typalign</structfield></entry>
6916 <entry><type>char</type></entry>
6920 <structfield>typalign</structfield> is the alignment required
6921 when storing a value of this type. It applies to storage on
6922 disk as well as most representations of the value inside
6923 <productname>PostgreSQL</>.
6924 When multiple values are stored consecutively, such
6925 as in the representation of a complete row on disk, padding is
6926 inserted before a datum of this type so that it begins on the
6927 specified boundary. The alignment reference is the beginning
6928 of the first datum in the sequence.
6932 Possible values are:
6935 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
6938 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
6941 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
6944 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
6949 For types used in system tables, it is critical that the size
6950 and alignment defined in <structname>pg_type</structname>
6951 agree with the way that the compiler will lay out the column in
6952 a structure representing a table row.
6958 <entry><structfield>typstorage</structfield></entry>
6959 <entry><type>char</type></entry>
6962 <structfield>typstorage</structfield> tells for varlena
6963 types (those with <structfield>typlen</structfield> = -1) if
6964 the type is prepared for toasting and what the default strategy
6965 for attributes of this type should be.
6969 <para><literal>p</>: Value must always be stored plain.</para>
6973 <literal>e</>: Value can be stored in a <quote>secondary</quote>
6974 relation (if relation has one, see
6975 <literal>pg_class.reltoastrelid</literal>).
6979 <para><literal>m</>: Value can be stored compressed inline.</para>
6982 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
6985 Note that <literal>m</> columns can also be moved out to secondary
6986 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
6992 <entry><structfield>typnotnull</structfield></entry>
6993 <entry><type>bool</type></entry>
6996 <structfield>typnotnull</structfield> represents a not-null
6997 constraint on a type. Used for domains only.
7002 <entry><structfield>typbasetype</structfield></entry>
7003 <entry><type>oid</type></entry>
7004 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7006 If this is a domain (see <structfield>typtype</structfield>), then
7007 <structfield>typbasetype</structfield> identifies the type that this
7008 one is based on. Zero if this type is not a domain.
7013 <entry><structfield>typtypmod</structfield></entry>
7014 <entry><type>int4</type></entry>
7017 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7018 to be applied to their base type (-1 if base type does not use a
7019 <literal>typmod</>). -1 if this type is not a domain.
7024 <entry><structfield>typndims</structfield></entry>
7025 <entry><type>int4</type></entry>
7028 <structfield>typndims</structfield> is the number of array dimensions
7029 for a domain over an array (that is, <structfield>typbasetype</> is
7031 Zero for types other than domains over array types.
7036 <entry><structfield>typcollation</structfield></entry>
7037 <entry><type>oid</type></entry>
7038 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7040 <structfield>typcollation</structfield> specifies the collation
7041 of the type. If the type does not support collations, this will
7042 be zero. A base type that supports collations will have
7043 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7044 collatable type can have some other collation OID, if one was
7045 specified for the domain.
7050 <entry><structfield>typdefaultbin</structfield></entry>
7051 <entry><type>pg_node_tree</type></entry>
7054 If <structfield>typdefaultbin</> is not null, it is the
7055 <function>nodeToString()</function>
7056 representation of a default expression for the type. This is
7057 only used for domains.
7062 <entry><structfield>typdefault</structfield></entry>
7063 <entry><type>text</type></entry>
7066 <structfield>typdefault</> is null if the type has no associated
7067 default value. If <structfield>typdefaultbin</> is not null,
7068 <structfield>typdefault</> must contain a human-readable version of the
7069 default expression represented by <structfield>typdefaultbin</>. If
7070 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7071 not, then <structfield>typdefault</> is the external representation of
7072 the type's default value, which can be fed to the type's input
7073 converter to produce a constant.
7078 <entry><structfield>typacl</structfield></entry>
7079 <entry><type>aclitem[]</type></entry>
7082 Access privileges; see
7083 <xref linkend="sql-grant"> and
7084 <xref linkend="sql-revoke">
7093 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7094 of <structfield>typcategory</>. Any future additions to this list will
7095 also be upper-case ASCII letters. All other ASCII characters are reserved
7096 for user-defined categories.
7099 <table id="catalog-typcategory-table">
7100 <title><structfield>typcategory</> Codes</title>
7106 <entry>Category</entry>
7112 <entry><literal>A</literal></entry>
7113 <entry>Array types</entry>
7116 <entry><literal>B</literal></entry>
7117 <entry>Boolean types</entry>
7120 <entry><literal>C</literal></entry>
7121 <entry>Composite types</entry>
7124 <entry><literal>D</literal></entry>
7125 <entry>Date/time types</entry>
7128 <entry><literal>E</literal></entry>
7129 <entry>Enum types</entry>
7132 <entry><literal>G</literal></entry>
7133 <entry>Geometric types</entry>
7136 <entry><literal>I</literal></entry>
7137 <entry>Network address types</entry>
7140 <entry><literal>N</literal></entry>
7141 <entry>Numeric types</entry>
7144 <entry><literal>P</literal></entry>
7145 <entry>Pseudo-types</entry>
7148 <entry><literal>R</literal></entry>
7149 <entry>Range types</entry>
7152 <entry><literal>S</literal></entry>
7153 <entry>String types</entry>
7156 <entry><literal>T</literal></entry>
7157 <entry>Timespan types</entry>
7160 <entry><literal>U</literal></entry>
7161 <entry>User-defined types</entry>
7164 <entry><literal>V</literal></entry>
7165 <entry>Bit-string types</entry>
7168 <entry><literal>X</literal></entry>
7169 <entry><type>unknown</> type</entry>
7178 <sect1 id="catalog-pg-user-mapping">
7179 <title><structname>pg_user_mapping</structname></title>
7181 <indexterm zone="catalog-pg-user-mapping">
7182 <primary>pg_user_mapping</primary>
7186 The catalog <structname>pg_user_mapping</structname> stores
7187 the mappings from local user to remote. Access to this catalog is
7188 restricted from normal users, use the view
7189 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7194 <title><structname>pg_user_mapping</> Columns</title>
7201 <entry>References</entry>
7202 <entry>Description</entry>
7208 <entry><structfield>oid</structfield></entry>
7209 <entry><type>oid</type></entry>
7211 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7215 <entry><structfield>umuser</structfield></entry>
7216 <entry><type>oid</type></entry>
7217 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7218 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7222 <entry><structfield>umserver</structfield></entry>
7223 <entry><type>oid</type></entry>
7224 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7226 The OID of the foreign server that contains this mapping
7231 <entry><structfield>umoptions</structfield></entry>
7232 <entry><type>text[]</type></entry>
7235 User mapping specific options, as <quote>keyword=value</> strings
7244 <sect1 id="views-overview">
7245 <title>System Views</title>
7248 In addition to the system catalogs, <productname>PostgreSQL</productname>
7249 provides a number of built-in views. Some system views provide convenient
7250 access to some commonly used queries on the system catalogs. Other views
7251 provide access to internal server state.
7255 The information schema (<xref linkend="information-schema">) provides
7256 an alternative set of views which overlap the functionality of the system
7257 views. Since the information schema is SQL-standard whereas the views
7258 described here are <productname>PostgreSQL</productname>-specific,
7259 it's usually better to use the information schema if it provides all
7260 the information you need.
7264 <xref linkend="view-table"> lists the system views described here.
7265 More detailed documentation of each view follows below.
7266 There are some additional views that provide access to the results of
7267 the statistics collector; they are described in <xref
7268 linkend="monitoring-stats-views-table">.
7272 Except where noted, all the views described here are read-only.
7275 <table id="view-table">
7276 <title>System Views</title>
7281 <entry>View Name</entry>
7282 <entry>Purpose</entry>
7288 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7289 <entry>available extensions</entry>
7293 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7294 <entry>available versions of extensions</entry>
7298 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7299 <entry>open cursors</entry>
7303 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7304 <entry>groups of database users</entry>
7308 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7309 <entry>indexes</entry>
7313 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7314 <entry>currently held locks</entry>
7318 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7319 <entry>materialized views</entry>
7323 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7324 <entry>policies</entry>
7328 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7329 <entry>prepared statements</entry>
7333 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7334 <entry>prepared transactions</entry>
7338 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7339 <entry>database roles</entry>
7343 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7344 <entry>rules</entry>
7348 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7349 <entry>security labels</entry>
7353 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7354 <entry>parameter settings</entry>
7358 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7359 <entry>database users</entry>
7363 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7364 <entry>planner statistics</entry>
7368 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7369 <entry>tables</entry>
7373 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7374 <entry>time zone abbreviations</entry>
7378 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7379 <entry>time zone names</entry>
7383 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7384 <entry>database users</entry>
7388 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7389 <entry>user mappings</entry>
7393 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7394 <entry>views</entry>
7402 <sect1 id="view-pg-available-extensions">
7403 <title><structname>pg_available_extensions</structname></title>
7405 <indexterm zone="view-pg-available-extensions">
7406 <primary>pg_available_extensions</primary>
7410 The <structname>pg_available_extensions</structname> view lists the
7411 extensions that are available for installation.
7413 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7414 catalog, which shows the extensions currently installed.
7418 <title><structname>pg_available_extensions</> Columns</title>
7425 <entry>Description</entry>
7431 <entry><structfield>name</structfield></entry>
7432 <entry><type>name</type></entry>
7433 <entry>Extension name</entry>
7437 <entry><structfield>default_version</structfield></entry>
7438 <entry><type>text</type></entry>
7439 <entry>Name of default version, or <literal>NULL</literal> if none is
7444 <entry><structfield>installed_version</structfield></entry>
7445 <entry><type>text</type></entry>
7446 <entry>Currently installed version of the extension,
7447 or <literal>NULL</literal> if not installed</entry>
7451 <entry><structfield>comment</structfield></entry>
7452 <entry><type>text</type></entry>
7453 <entry>Comment string from the extension's control file</entry>
7460 The <structname>pg_available_extensions</structname> view is read only.
7464 <sect1 id="view-pg-available-extension-versions">
7465 <title><structname>pg_available_extension_versions</structname></title>
7467 <indexterm zone="view-pg-available-extension-versions">
7468 <primary>pg_available_extension_versions</primary>
7472 The <structname>pg_available_extension_versions</structname> view lists the
7473 specific extension versions that are available for installation.
7475 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7476 catalog, which shows the extensions currently installed.
7480 <title><structname>pg_available_extension_versions</> Columns</title>
7487 <entry>Description</entry>
7493 <entry><structfield>name</structfield></entry>
7494 <entry><type>name</type></entry>
7495 <entry>Extension name</entry>
7499 <entry><structfield>version</structfield></entry>
7500 <entry><type>text</type></entry>
7501 <entry>Version name</entry>
7505 <entry><structfield>installed</structfield></entry>
7506 <entry><type>bool</type></entry>
7507 <entry>True if this version of this extension is currently
7512 <entry><structfield>superuser</structfield></entry>
7513 <entry><type>bool</type></entry>
7514 <entry>True if only superusers are allowed to install this extension</entry>
7518 <entry><structfield>relocatable</structfield></entry>
7519 <entry><type>bool</type></entry>
7520 <entry>True if extension can be relocated to another schema</entry>
7524 <entry><structfield>schema</structfield></entry>
7525 <entry><type>name</type></entry>
7526 <entry>Name of the schema that the extension must be installed into,
7527 or <literal>NULL</literal> if partially or fully relocatable</entry>
7531 <entry><structfield>requires</structfield></entry>
7532 <entry><type>name[]</type></entry>
7533 <entry>Names of prerequisite extensions,
7534 or <literal>NULL</literal> if none</entry>
7538 <entry><structfield>comment</structfield></entry>
7539 <entry><type>text</type></entry>
7540 <entry>Comment string from the extension's control file</entry>
7547 The <structname>pg_available_extension_versions</structname> view is read
7552 <sect1 id="view-pg-cursors">
7553 <title><structname>pg_cursors</structname></title>
7555 <indexterm zone="view-pg-cursors">
7556 <primary>pg_cursors</primary>
7560 The <structname>pg_cursors</structname> view lists the cursors that
7561 are currently available. Cursors can be defined in several ways:
7565 via the <xref linkend="sql-declare">
7572 via the Bind message in the frontend/backend protocol, as
7573 described in <xref linkend="protocol-flow-ext-query">
7579 via the Server Programming Interface (SPI), as described in
7580 <xref linkend="spi-interface">
7585 The <structname>pg_cursors</structname> view displays cursors
7586 created by any of these means. Cursors only exist for the duration
7587 of the transaction that defines them, unless they have been
7588 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7589 cursors are only present in the view until the end of their
7590 creating transaction.
7594 Cursors are used internally to implement some of the components
7595 of <productname>PostgreSQL</>, such as procedural languages.
7596 Therefore, the <structname>pg_cursors</> view might include cursors
7597 that have not been explicitly created by the user.
7603 <title><structname>pg_cursors</> Columns</title>
7610 <entry>Description</entry>
7616 <entry><structfield>name</structfield></entry>
7617 <entry><type>text</type></entry>
7618 <entry>The name of the cursor</entry>
7622 <entry><structfield>statement</structfield></entry>
7623 <entry><type>text</type></entry>
7624 <entry>The verbatim query string submitted to declare this cursor</entry>
7628 <entry><structfield>is_holdable</structfield></entry>
7629 <entry><type>boolean</type></entry>
7631 <literal>true</literal> if the cursor is holdable (that is, it
7632 can be accessed after the transaction that declared the cursor
7633 has committed); <literal>false</literal> otherwise
7638 <entry><structfield>is_binary</structfield></entry>
7639 <entry><type>boolean</type></entry>
7641 <literal>true</literal> if the cursor was declared
7642 <literal>BINARY</literal>; <literal>false</literal>
7648 <entry><structfield>is_scrollable</structfield></entry>
7649 <entry><type>boolean</type></entry>
7651 <literal>true</> if the cursor is scrollable (that is, it
7652 allows rows to be retrieved in a nonsequential manner);
7653 <literal>false</literal> otherwise
7658 <entry><structfield>creation_time</structfield></entry>
7659 <entry><type>timestamptz</type></entry>
7660 <entry>The time at which the cursor was declared</entry>
7667 The <structname>pg_cursors</structname> view is read only.
7672 <sect1 id="view-pg-group">
7673 <title><structname>pg_group</structname></title>
7675 <indexterm zone="view-pg-group">
7676 <primary>pg_group</primary>
7680 The view <structname>pg_group</structname> exists for backwards
7681 compatibility: it emulates a catalog that existed in
7682 <productname>PostgreSQL</productname> before version 8.1.
7683 It shows the names and members of all roles that are marked as not
7684 <structfield>rolcanlogin</>, which is an approximation to the set
7685 of roles that are being used as groups.
7689 <title><structname>pg_group</> Columns</title>
7696 <entry>References</entry>
7697 <entry>Description</entry>
7703 <entry><structfield>groname</structfield></entry>
7704 <entry><type>name</type></entry>
7705 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7706 <entry>Name of the group</entry>
7710 <entry><structfield>grosysid</structfield></entry>
7711 <entry><type>oid</type></entry>
7712 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7713 <entry>ID of this group</entry>
7717 <entry><structfield>grolist</structfield></entry>
7718 <entry><type>oid[]</type></entry>
7719 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7720 <entry>An array containing the IDs of the roles in this group</entry>
7728 <sect1 id="view-pg-indexes">
7729 <title><structname>pg_indexes</structname></title>
7731 <indexterm zone="view-pg-indexes">
7732 <primary>pg_indexes</primary>
7736 The view <structname>pg_indexes</structname> provides access to
7737 useful information about each index in the database.
7741 <title><structname>pg_indexes</> Columns</title>
7748 <entry>References</entry>
7749 <entry>Description</entry>
7754 <entry><structfield>schemaname</structfield></entry>
7755 <entry><type>name</type></entry>
7756 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7757 <entry>Name of schema containing table and index</entry>
7760 <entry><structfield>tablename</structfield></entry>
7761 <entry><type>name</type></entry>
7762 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7763 <entry>Name of table the index is for</entry>
7766 <entry><structfield>indexname</structfield></entry>
7767 <entry><type>name</type></entry>
7768 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7769 <entry>Name of index</entry>
7772 <entry><structfield>tablespace</structfield></entry>
7773 <entry><type>name</type></entry>
7774 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7775 <entry>Name of tablespace containing index (null if default for database)</entry>
7778 <entry><structfield>indexdef</structfield></entry>
7779 <entry><type>text</type></entry>
7781 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
7790 <sect1 id="view-pg-locks">
7791 <title><structname>pg_locks</structname></title>
7793 <indexterm zone="view-pg-locks">
7794 <primary>pg_locks</primary>
7798 The view <structname>pg_locks</structname> provides access to
7799 information about the locks held by open transactions within the
7800 database server. See <xref linkend="mvcc"> for more discussion
7805 <structname>pg_locks</structname> contains one row per active lockable
7806 object, requested lock mode, and relevant transaction. Thus, the same
7807 lockable object might
7808 appear many times, if multiple transactions are holding or waiting
7809 for locks on it. However, an object that currently has no locks on it
7810 will not appear at all.
7814 There are several distinct types of lockable objects:
7815 whole relations (e.g., tables), individual pages of relations,
7816 individual tuples of relations,
7817 transaction IDs (both virtual and permanent IDs),
7818 and general database objects (identified by class OID and object OID,
7819 in the same way as in <structname>pg_description</structname> or
7820 <structname>pg_depend</structname>). Also, the right to extend a
7821 relation is represented as a separate lockable object.
7822 Also, <quote>advisory</> locks can be taken on numbers that have
7823 user-defined meanings.
7827 <title><structname>pg_locks</> Columns</title>
7834 <entry>References</entry>
7835 <entry>Description</entry>
7840 <entry><structfield>locktype</structfield></entry>
7841 <entry><type>text</type></entry>
7844 Type of the lockable object:
7845 <literal>relation</>,
7849 <literal>transactionid</>,
7850 <literal>virtualxid</>,
7852 <literal>userlock</>, or
7853 <literal>advisory</>
7857 <entry><structfield>database</structfield></entry>
7858 <entry><type>oid</type></entry>
7859 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
7861 OID of the database in which the lock target exists, or
7862 zero if the target is a shared object, or
7863 null if the target is a transaction ID
7867 <entry><structfield>relation</structfield></entry>
7868 <entry><type>oid</type></entry>
7869 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7871 OID of the relation targeted by the lock, or null if the target is not
7872 a relation or part of a relation
7876 <entry><structfield>page</structfield></entry>
7877 <entry><type>integer</type></entry>
7880 Page number targeted by the lock within the relation,
7881 or null if the target is not a relation page or tuple
7885 <entry><structfield>tuple</structfield></entry>
7886 <entry><type>smallint</type></entry>
7889 Tuple number targeted by the lock within the page,
7890 or null if the target is not a tuple
7894 <entry><structfield>virtualxid</structfield></entry>
7895 <entry><type>text</type></entry>
7898 Virtual ID of the transaction targeted by the lock,
7899 or null if the target is not a virtual transaction ID
7903 <entry><structfield>transactionid</structfield></entry>
7904 <entry><type>xid</type></entry>
7907 ID of the transaction targeted by the lock,
7908 or null if the target is not a transaction ID
7912 <entry><structfield>classid</structfield></entry>
7913 <entry><type>oid</type></entry>
7914 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7916 OID of the system catalog containing the lock target, or null if the
7917 target is not a general database object
7921 <entry><structfield>objid</structfield></entry>
7922 <entry><type>oid</type></entry>
7923 <entry>any OID column</entry>
7925 OID of the lock target within its system catalog, or null if the
7926 target is not a general database object
7930 <entry><structfield>objsubid</structfield></entry>
7931 <entry><type>smallint</type></entry>
7934 Column number targeted by the lock (the
7935 <structfield>classid</> and <structfield>objid</> refer to the
7937 or zero if the target is some other general database object,
7938 or null if the target is not a general database object
7942 <entry><structfield>virtualtransaction</structfield></entry>
7943 <entry><type>text</type></entry>
7946 Virtual ID of the transaction that is holding or awaiting this lock
7950 <entry><structfield>pid</structfield></entry>
7951 <entry><type>integer</type></entry>
7954 Process ID of the server process holding or awaiting this
7955 lock, or null if the lock is held by a prepared transaction
7959 <entry><structfield>mode</structfield></entry>
7960 <entry><type>text</type></entry>
7962 <entry>Name of the lock mode held or desired by this process (see <xref
7963 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
7966 <entry><structfield>granted</structfield></entry>
7967 <entry><type>boolean</type></entry>
7969 <entry>True if lock is held, false if lock is awaited</entry>
7972 <entry><structfield>fastpath</structfield></entry>
7973 <entry><type>boolean</type></entry>
7975 <entry>True if lock was taken via fast path, false if taken via main
7983 <structfield>granted</structfield> is true in a row representing a lock
7984 held by the indicated transaction. False indicates that this transaction is
7985 currently waiting to acquire this lock, which implies that some other
7986 transaction is holding a conflicting lock mode on the same lockable object.
7987 The waiting transaction will sleep until the other lock is released (or a
7988 deadlock situation is detected). A single transaction can be waiting to
7989 acquire at most one lock at a time.
7993 Every transaction holds an exclusive lock on its virtual transaction ID for
7994 its entire duration. If a permanent ID is assigned to the transaction
7995 (which normally happens only if the transaction changes the state of the
7996 database), it also holds an exclusive lock on its permanent transaction ID
7997 until it ends. When one transaction finds it necessary to wait specifically
7998 for another transaction, it does so by attempting to acquire share lock on
7999 the other transaction ID (either virtual or permanent ID depending on the
8000 situation). That will succeed only when the other transaction
8001 terminates and releases its locks.
8005 Although tuples are a lockable type of object,
8006 information about row-level locks is stored on disk, not in memory,
8007 and therefore row-level locks normally do not appear in this view.
8008 If a transaction is waiting for a
8009 row-level lock, it will usually appear in the view as waiting for the
8010 permanent transaction ID of the current holder of that row lock.
8014 Advisory locks can be acquired on keys consisting of either a single
8015 <type>bigint</type> value or two integer values.
8016 A <type>bigint</type> key is displayed with its
8017 high-order half in the <structfield>classid</> column, its low-order half
8018 in the <structfield>objid</> column, and <structfield>objsubid</> equal
8019 to 1. The original <type>bigint</type> value can be reassembled with the
8020 expression <literal>(classid::bigint << 32) |
8021 objid::bigint</literal>. Integer keys are displayed with the
8023 <structfield>classid</> column, the second key in the <structfield>objid</>
8024 column, and <structfield>objsubid</> equal to 2. The actual meaning of
8025 the keys is up to the user. Advisory locks are local to each database,
8026 so the <structfield>database</> column is meaningful for an advisory lock.
8030 <structname>pg_locks</structname> provides a global view of all locks
8031 in the database cluster, not only those relevant to the current database.
8032 Although its <structfield>relation</structfield> column can be joined
8033 against <structname>pg_class</>.<structfield>oid</> to identify locked
8034 relations, this will only work correctly for relations in the current
8035 database (those for which the <structfield>database</structfield> column
8036 is either the current database's OID or zero).
8040 The <structfield>pid</structfield> column can be joined to the
8041 <structfield>pid</structfield> column of the <link
8042 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8044 information on the session holding or waiting to hold each lock,
8047 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8048 ON pl.pid = psa.pid;
8050 Also, if you are using prepared transactions, the
8051 <structfield>virtualtransaction</> column can be joined to the
8052 <structfield>transaction</structfield> column of the <link
8053 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8054 view to get more information on prepared transactions that hold locks.
8055 (A prepared transaction can never be waiting for a lock,
8056 but it continues to hold the locks it acquired while running.)
8059 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8060 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8065 The <structname>pg_locks</structname> view displays data from both the
8066 regular lock manager and the predicate lock manager, which are
8067 separate systems; in addition, the regular lock manager subdivides its
8068 locks into regular and <firstterm>fast-path</> locks.
8069 This data is not guaranteed to be entirely consistent.
8070 When the view is queried,
8071 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8072 is gathered from each backend one at a time, without freezing the state of
8073 the entire lock manager, so it is possible for locks to be taken or
8074 released while information is gathered. Note, however, that these locks are
8075 known not to conflict with any other lock currently in place. After
8076 all backends have been queried for fast-path locks, the remainder of the
8077 regular lock manager is locked as a unit, and a consistent snapshot of all
8078 remaining locks is collected as an atomic action. After unlocking the
8079 regular lock manager, the predicate lock manager is similarly locked and all
8080 predicate locks are collected as an atomic action. Thus, with the exception
8081 of fast-path locks, each lock manager will deliver a consistent set of
8082 results, but as we do not lock both lock managers simultaneously, it is
8083 possible for locks to be taken or released after we interrogate the regular
8084 lock manager and before we interrogate the predicate lock manager.
8088 Locking the regular and/or predicate lock manager could have some
8089 impact on database performance if this view is very frequently accessed.
8090 The locks are held only for the minimum amount of time necessary to
8091 obtain data from the lock managers, but this does not completely eliminate
8092 the possibility of a performance impact.
8097 <sect1 id="view-pg-matviews">
8098 <title><structname>pg_matviews</structname></title>
8100 <indexterm zone="view-pg-matviews">
8101 <primary>pg_matviews</primary>
8104 <indexterm zone="view-pg-matviews">
8105 <primary>materialized views</primary>
8109 The view <structname>pg_matviews</structname> provides access to
8110 useful information about each materialized view in the database.
8114 <title><structname>pg_matviews</> Columns</title>
8121 <entry>References</entry>
8122 <entry>Description</entry>
8127 <entry><structfield>schemaname</structfield></entry>
8128 <entry><type>name</type></entry>
8129 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8130 <entry>Name of schema containing materialized view</entry>
8133 <entry><structfield>matviewname</structfield></entry>
8134 <entry><type>name</type></entry>
8135 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8136 <entry>Name of materialized view</entry>
8139 <entry><structfield>matviewowner</structfield></entry>
8140 <entry><type>name</type></entry>
8141 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8142 <entry>Name of materialized view's owner</entry>
8145 <entry><structfield>tablespace</structfield></entry>
8146 <entry><type>name</type></entry>
8147 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8148 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8151 <entry><structfield>hasindexes</structfield></entry>
8152 <entry><type>boolean</type></entry>
8154 <entry>True if materialized view has (or recently had) any indexes</entry>
8157 <entry><structfield>ispopulated</structfield></entry>
8158 <entry><type>boolean</type></entry>
8160 <entry>True if materialized view is currently populated</entry>
8163 <entry><structfield>definition</structfield></entry>
8164 <entry><type>text</type></entry>
8166 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8174 <sect1 id="view-pg-policies">
8175 <title><structname>pg_policies</structname></title>
8177 <indexterm zone="view-pg-policies">
8178 <primary>pg_policies</primary>
8182 The view <structname>pg_policies</structname> provides access to
8183 useful information about each row-level security policy in the database.
8187 <title><structname>pg_policies</> Columns</title>
8194 <entry>References</entry>
8195 <entry>Description</entry>
8200 <entry><structfield>schemaname</structfield></entry>
8201 <entry><type>name</type></entry>
8202 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8203 <entry>Name of schema containing table policy is on</entry>
8206 <entry><structfield>tablename</structfield></entry>
8207 <entry><type>name</type></entry>
8208 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8209 <entry>Name of table policy is on</entry>
8212 <entry><structfield>policyname</structfield></entry>
8213 <entry><type>name</type></entry>
8214 <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
8215 <entry>Name of policy</entry>
8218 <entry><structfield>roles</structfield></entry>
8219 <entry><type>name[]</type></entry>
8221 <entry>The roles to which this policy applies</entry>
8224 <entry><structfield>cmd</structfield></entry>
8225 <entry><type>text</type></entry>
8227 <entry>The command type to which the policy is applied</entry>
8230 <entry><structfield>qual</structfield></entry>
8231 <entry><type>text</type></entry>
8233 <entry>The expression added to the security barrier qualifications for
8234 queries that this policy applies to</entry>
8237 <entry><structfield>with_check</structfield></entry>
8238 <entry><type>text</type></entry>
8240 <entry>The expression added to the WITH CHECK qualifications for
8241 queries that attempt to add rows to this table</entry>
8249 <sect1 id="view-pg-prepared-statements">
8250 <title><structname>pg_prepared_statements</structname></title>
8252 <indexterm zone="view-pg-prepared-statements">
8253 <primary>pg_prepared_statements</primary>
8257 The <structname>pg_prepared_statements</structname> view displays
8258 all the prepared statements that are available in the current
8259 session. See <xref linkend="sql-prepare"> for more information about prepared
8264 <structname>pg_prepared_statements</structname> contains one row
8265 for each prepared statement. Rows are added to the view when a new
8266 prepared statement is created and removed when a prepared statement
8267 is released (for example, via the <xref linkend="sql-deallocate"> command).
8271 <title><structname>pg_prepared_statements</> Columns</title>
8278 <entry>Description</entry>
8283 <entry><structfield>name</structfield></entry>
8284 <entry><type>text</type></entry>
8286 The identifier of the prepared statement
8290 <entry><structfield>statement</structfield></entry>
8291 <entry><type>text</type></entry>
8293 The query string submitted by the client to create this
8294 prepared statement. For prepared statements created via SQL,
8295 this is the <command>PREPARE</command> statement submitted by
8296 the client. For prepared statements created via the
8297 frontend/backend protocol, this is the text of the prepared
8302 <entry><structfield>prepare_time</structfield></entry>
8303 <entry><type>timestamptz</type></entry>
8305 The time at which the prepared statement was created
8309 <entry><structfield>parameter_types</structfield></entry>
8310 <entry><type>regtype[]</type></entry>
8312 The expected parameter types for the prepared statement in the
8313 form of an array of <type>regtype</type>. The OID corresponding
8314 to an element of this array can be obtained by casting the
8315 <type>regtype</type> value to <type>oid</type>.
8319 <entry><structfield>from_sql</structfield></entry>
8320 <entry><type>boolean</type></entry>
8322 <literal>true</literal> if the prepared statement was created
8323 via the <command>PREPARE</command> SQL statement;
8324 <literal>false</literal> if the statement was prepared via the
8325 frontend/backend protocol
8333 The <structname>pg_prepared_statements</structname> view is read only.
8337 <sect1 id="view-pg-prepared-xacts">
8338 <title><structname>pg_prepared_xacts</structname></title>
8340 <indexterm zone="view-pg-prepared-xacts">
8341 <primary>pg_prepared_xacts</primary>
8345 The view <structname>pg_prepared_xacts</structname> displays
8346 information about transactions that are currently prepared for two-phase
8347 commit (see <xref linkend="sql-prepare-transaction"> for details).
8351 <structname>pg_prepared_xacts</structname> contains one row per prepared
8352 transaction. An entry is removed when the transaction is committed or
8357 <title><structname>pg_prepared_xacts</> Columns</title>
8364 <entry>References</entry>
8365 <entry>Description</entry>
8370 <entry><structfield>transaction</structfield></entry>
8371 <entry><type>xid</type></entry>
8374 Numeric transaction identifier of the prepared transaction
8378 <entry><structfield>gid</structfield></entry>
8379 <entry><type>text</type></entry>
8382 Global transaction identifier that was assigned to the transaction
8386 <entry><structfield>prepared</structfield></entry>
8387 <entry><type>timestamp with time zone</type></entry>
8390 Time at which the transaction was prepared for commit
8394 <entry><structfield>owner</structfield></entry>
8395 <entry><type>name</type></entry>
8396 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8398 Name of the user that executed the transaction
8402 <entry><structfield>database</structfield></entry>
8403 <entry><type>name</type></entry>
8404 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8406 Name of the database in which the transaction was executed
8414 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8415 internal transaction manager data structures are momentarily locked, and
8416 a copy is made for the view to display. This ensures that the
8417 view produces a consistent set of results, while not blocking
8418 normal operations longer than necessary. Nonetheless
8419 there could be some impact on database performance if this view is
8420 frequently accessed.
8425 <sect1 id="view-pg-roles">
8426 <title><structname>pg_roles</structname></title>
8428 <indexterm zone="view-pg-roles">
8429 <primary>pg_roles</primary>
8433 The view <structname>pg_roles</structname> provides access to
8434 information about database roles. This is simply a publicly
8436 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8437 that blanks out the password field.
8441 This view explicitly exposes the OID column of the underlying table,
8442 since that is needed to do joins to other catalogs.
8446 <title><structname>pg_roles</> Columns</title>
8453 <entry>References</entry>
8454 <entry>Description</entry>
8460 <entry><structfield>rolname</structfield></entry>
8461 <entry><type>name</type></entry>
8463 <entry>Role name</entry>
8467 <entry><structfield>rolsuper</structfield></entry>
8468 <entry><type>bool</type></entry>
8470 <entry>Role has superuser privileges</entry>
8474 <entry><structfield>rolinherit</structfield></entry>
8475 <entry><type>bool</type></entry>
8477 <entry>Role automatically inherits privileges of roles it is a
8482 <entry><structfield>rolcreaterole</structfield></entry>
8483 <entry><type>bool</type></entry>
8485 <entry>Role can create more roles</entry>
8489 <entry><structfield>rolcreatedb</structfield></entry>
8490 <entry><type>bool</type></entry>
8492 <entry>Role can create databases</entry>
8496 <entry><structfield>rolcanlogin</structfield></entry>
8497 <entry><type>bool</type></entry>
8500 Role can log in. That is, this role can be given as the initial
8501 session authorization identifier
8506 <entry><structfield>rolreplication</structfield></entry>
8507 <entry><type>bool</type></entry>
8510 Role is a replication role. That is, this role can initiate streaming
8511 replication (see <xref linkend="streaming-replication">) and set/unset
8512 the system backup mode using <function>pg_start_backup</> and
8513 <function>pg_stop_backup</>
8518 <entry><structfield>rolconnlimit</structfield></entry>
8519 <entry><type>int4</type></entry>
8522 For roles that can log in, this sets maximum number of concurrent
8523 connections this role can make. -1 means no limit.
8528 <entry><structfield>rolpassword</structfield></entry>
8529 <entry><type>text</type></entry>
8531 <entry>Not the password (always reads as <literal>********</>)</entry>
8535 <entry><structfield>rolvaliduntil</structfield></entry>
8536 <entry><type>timestamptz</type></entry>
8538 <entry>Password expiry time (only used for password authentication);
8539 null if no expiration</entry>
8543 <entry><structfield>rolconfig</structfield></entry>
8544 <entry><type>text[]</type></entry>
8546 <entry>Role-specific defaults for run-time configuration variables</entry>
8550 <entry><structfield>oid</structfield></entry>
8551 <entry><type>oid</type></entry>
8552 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8553 <entry>ID of role</entry>
8561 <sect1 id="view-pg-rules">
8562 <title><structname>pg_rules</structname></title>
8564 <indexterm zone="view-pg-rules">
8565 <primary>pg_rules</primary>
8569 The view <structname>pg_rules</structname> provides access to
8570 useful information about query rewrite rules.
8574 <title><structname>pg_rules</> Columns</title>
8581 <entry>References</entry>
8582 <entry>Description</entry>
8587 <entry><structfield>schemaname</structfield></entry>
8588 <entry><type>name</type></entry>
8589 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8590 <entry>Name of schema containing table</entry>
8593 <entry><structfield>tablename</structfield></entry>
8594 <entry><type>name</type></entry>
8595 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8596 <entry>Name of table the rule is for</entry>
8599 <entry><structfield>rulename</structfield></entry>
8600 <entry><type>name</type></entry>
8601 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8602 <entry>Name of rule</entry>
8605 <entry><structfield>definition</structfield></entry>
8606 <entry><type>text</type></entry>
8608 <entry>Rule definition (a reconstructed creation command)</entry>
8615 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8616 of views and materialized views; those can be seen in
8617 <structname>pg_views</> and <structname>pg_matviews</>.
8622 <sect1 id="view-pg-seclabels">
8623 <title><structname>pg_seclabels</structname></title>
8625 <indexterm zone="view-pg-seclabels">
8626 <primary>pg_seclabels</primary>
8630 The view <structname>pg_seclabels</structname> provides information about
8631 security labels. It as an easier-to-query version of the
8632 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
8636 <title><structname>pg_seclabels</> Columns</title>
8643 <entry>References</entry>
8644 <entry>Description</entry>
8649 <entry><structfield>objoid</structfield></entry>
8650 <entry><type>oid</type></entry>
8651 <entry>any OID column</entry>
8652 <entry>The OID of the object this security label pertains to</entry>
8655 <entry><structfield>classoid</structfield></entry>
8656 <entry><type>oid</type></entry>
8657 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8658 <entry>The OID of the system catalog this object appears in</entry>
8661 <entry><structfield>objsubid</structfield></entry>
8662 <entry><type>int4</type></entry>
8665 For a security label on a table column, this is the column number (the
8666 <structfield>objoid</> and <structfield>classoid</> refer to
8667 the table itself). For all other object types, this column is
8672 <entry><structfield>objtype</structfield></entry>
8673 <entry><type>text</type></entry>
8676 The type of object to which this label applies, as text.
8680 <entry><structfield>objnamespace</structfield></entry>
8681 <entry><type>oid</type></entry>
8682 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
8684 The OID of the namespace for this object, if applicable;
8689 <entry><structfield>objname</structfield></entry>
8690 <entry><type>text</type></entry>
8693 The name of the object to which this label applies, as text.
8697 <entry><structfield>provider</structfield></entry>
8698 <entry><type>text</type></entry>
8699 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
8700 <entry>The label provider associated with this label.</entry>
8703 <entry><structfield>label</structfield></entry>
8704 <entry><type>text</type></entry>
8705 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
8706 <entry>The security label applied to this object.</entry>
8713 <sect1 id="view-pg-settings">
8714 <title><structname>pg_settings</structname></title>
8716 <indexterm zone="view-pg-settings">
8717 <primary>pg_settings</primary>
8721 The view <structname>pg_settings</structname> provides access to
8722 run-time parameters of the server. It is essentially an alternative
8723 interface to the <xref linkend="sql-show">
8724 and <xref linkend="sql-set"> commands.
8725 It also provides access to some facts about each parameter that are
8726 not directly available from <command>SHOW</>, such as minimum and
8731 <title><structname>pg_settings</> Columns</title>
8738 <entry>Description</entry>
8743 <entry><structfield>name</structfield></entry>
8744 <entry><type>text</type></entry>
8745 <entry>Run-time configuration parameter name</entry>
8748 <entry><structfield>setting</structfield></entry>
8749 <entry><type>text</type></entry>
8750 <entry>Current value of the parameter</entry>
8753 <entry><structfield>unit</structfield></entry>
8754 <entry><type>text</type></entry>
8755 <entry>Implicit unit of the parameter</entry>
8758 <entry><structfield>category</structfield></entry>
8759 <entry><type>text</type></entry>
8760 <entry>Logical group of the parameter</entry>
8763 <entry><structfield>short_desc</structfield></entry>
8764 <entry><type>text</type></entry>
8765 <entry>A brief description of the parameter</entry>
8768 <entry><structfield>extra_desc</structfield></entry>
8769 <entry><type>text</type></entry>
8770 <entry>Additional, more detailed, description of the parameter</entry>
8773 <entry><structfield>context</structfield></entry>
8774 <entry><type>text</type></entry>
8775 <entry>Context required to set the parameter's value (see below)</entry>
8778 <entry><structfield>vartype</structfield></entry>
8779 <entry><type>text</type></entry>
8780 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
8781 <literal>integer</>, <literal>real</>, or <literal>string</>)
8785 <entry><structfield>source</structfield></entry>
8786 <entry><type>text</type></entry>
8787 <entry>Source of the current parameter value</entry>
8790 <entry><structfield>min_val</structfield></entry>
8791 <entry><type>text</type></entry>
8792 <entry>Minimum allowed value of the parameter (null for non-numeric
8796 <entry><structfield>max_val</structfield></entry>
8797 <entry><type>text</type></entry>
8798 <entry>Maximum allowed value of the parameter (null for non-numeric
8802 <entry><structfield>enumvals</structfield></entry>
8803 <entry><type>text[]</type></entry>
8804 <entry>Allowed values of an enum parameter (null for non-enum
8808 <entry><structfield>boot_val</structfield></entry>
8809 <entry><type>text</type></entry>
8810 <entry>Parameter value assumed at server startup if the parameter is
8811 not otherwise set</entry>
8814 <entry><structfield>reset_val</structfield></entry>
8815 <entry><type>text</type></entry>
8816 <entry>Value that <command>RESET</command> would reset the parameter to
8817 in the current session</entry>
8820 <entry><structfield>sourcefile</structfield></entry>
8821 <entry><type>text</type></entry>
8822 <entry>Configuration file the current value was set in (null for
8823 values set from sources other than configuration files, or when
8824 examined by a non-superuser);
8825 helpful when using <literal>include</> directives in configuration files</entry>
8828 <entry><structfield>sourceline</structfield></entry>
8829 <entry><type>integer</type></entry>
8830 <entry>Line number within the configuration file the current value was
8831 set at (null for values set from sources other than configuration files,
8832 or when examined by a non-superuser)
8840 There are several possible values of <structfield>context</structfield>.
8841 In order of decreasing difficulty of changing the setting, they are:
8846 <!-- PGC_INTERNAL -->
8847 <term><literal>internal</literal></term>
8850 These settings cannot be changed directly; they reflect internally
8851 determined values. Some of them may be adjustable by rebuilding the
8852 server with different configuration options, or by changing options
8853 supplied to <command>initdb</command>.
8858 <!-- PGC_POSTMASTER -->
8859 <term><literal>postmaster</literal></term>
8862 These settings can only be applied when the server starts, so any change
8863 requires restarting the server. Values for these settings are typically
8864 stored in the <filename>postgresql.conf</filename> file, or passed on
8865 the command line when starting the server. Of course, settings with any
8866 of the lower <structfield>context</structfield> types can also be
8867 set at server start time.
8873 <term><literal>sighup</literal></term>
8876 Changes to these settings can be made in
8877 <filename>postgresql.conf</filename> without restarting the server.
8878 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
8879 cause it to re-read <filename>postgresql.conf</filename> and apply
8880 the changes. The postmaster will also forward the
8881 <systemitem>SIGHUP</systemitem> signal to its child processes so that
8882 they all pick up the new value.
8887 <!-- PGC_SU_BACKEND -->
8888 <term><literal>superuser-backend</literal></term>
8891 Changes to these settings can be made in
8892 <filename>postgresql.conf</filename> without restarting the server.
8893 They can also be set for a particular session in the connection request
8894 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
8895 environment variable), but only if the connecting user is a superuser.
8896 However, these settings never change in a session after it is started.
8897 If you change them in <filename>postgresql.conf</filename>, send a
8898 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
8899 re-read <filename>postgresql.conf</filename>. The new values will only
8900 affect subsequently-launched sessions.
8905 <!-- PGC_BACKEND -->
8906 <term><literal>backend</literal></term>
8909 Changes to these settings can be made in
8910 <filename>postgresql.conf</filename> without restarting the server.
8911 They can also be set for a particular session in the connection request
8912 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
8913 environment variable); any user can make such a change for his session.
8914 However, these settings never change in a session after it is started.
8915 If you change them in <filename>postgresql.conf</filename>, send a
8916 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
8917 re-read <filename>postgresql.conf</filename>. The new values will only
8918 affect subsequently-launched sessions.
8924 <term><literal>superuser</literal></term>
8927 These settings can be set from <filename>postgresql.conf</filename>,
8928 or within a session via the <command>SET</> command; but only superusers
8929 can change them via <command>SET</>. Changes in
8930 <filename>postgresql.conf</filename> will affect existing sessions
8931 only if no session-local value has been established with <command>SET</>.
8936 <!-- PGC_USERSET -->
8937 <term><literal>user</literal></term>
8940 These settings can be set from <filename>postgresql.conf</filename>,
8941 or within a session via the <command>SET</> command. Any user is
8942 allowed to change his session-local value. Changes in
8943 <filename>postgresql.conf</filename> will affect existing sessions
8944 only if no session-local value has been established with <command>SET</>.
8951 See <xref linkend="config-setting"> for more information about the various
8952 ways to change these parameters.
8956 The <structname>pg_settings</structname> view cannot be inserted into or
8957 deleted from, but it can be updated. An <command>UPDATE</command> applied
8958 to a row of <structname>pg_settings</structname> is equivalent to executing
8959 the <xref linkend="sql-set"> command on that named
8960 parameter. The change only affects the value used by the current
8961 session. If an <command>UPDATE</command> is issued within a transaction
8962 that is later aborted, the effects of the <command>UPDATE</command> command
8963 disappear when the transaction is rolled back. Once the surrounding
8964 transaction is committed, the effects will persist until the end of the
8965 session, unless overridden by another <command>UPDATE</command> or
8966 <command>SET</command>.
8971 <sect1 id="view-pg-shadow">
8972 <title><structname>pg_shadow</structname></title>
8974 <indexterm zone="view-pg-shadow">
8975 <primary>pg_shadow</primary>
8979 The view <structname>pg_shadow</structname> exists for backwards
8980 compatibility: it emulates a catalog that existed in
8981 <productname>PostgreSQL</productname> before version 8.1.
8982 It shows properties of all roles that are marked as
8983 <structfield>rolcanlogin</> in
8984 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
8988 The name stems from the fact that this table
8989 should not be readable by the public since it contains passwords.
8990 <link linkend="view-pg-user"><structname>pg_user</structname></link>
8991 is a publicly readable view on
8992 <structname>pg_shadow</structname> that blanks out the password field.
8996 <title><structname>pg_shadow</> Columns</title>
9003 <entry>References</entry>
9004 <entry>Description</entry>
9010 <entry><structfield>usename</structfield></entry>
9011 <entry><type>name</type></entry>
9012 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9013 <entry>User name</entry>
9017 <entry><structfield>usesysid</structfield></entry>
9018 <entry><type>oid</type></entry>
9019 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9020 <entry>ID of this user</entry>
9024 <entry><structfield>usecreatedb</structfield></entry>
9025 <entry><type>bool</type></entry>
9027 <entry>User can create databases</entry>
9031 <entry><structfield>usesuper</structfield></entry>
9032 <entry><type>bool</type></entry>
9034 <entry>User is a superuser</entry>
9038 <entry><structfield>userepl</structfield></entry>
9039 <entry><type>bool</type></entry>
9042 User can initiate streaming replication and put the system in and
9048 <entry><structfield>usebypassrls</structfield></entry>
9049 <entry><type>bool</type></entry>
9052 User can bypass row level security policies, see
9053 <xref linkend="ddl-rowsecurity"> for more information.
9058 <entry><structfield>passwd</structfield></entry>
9059 <entry><type>text</type></entry>
9061 <entry>Password (possibly encrypted); null if none. See
9062 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9063 for details of how encrypted passwords are stored.</entry>
9067 <entry><structfield>valuntil</structfield></entry>
9068 <entry><type>abstime</type></entry>
9070 <entry>Password expiry time (only used for password authentication)</entry>
9074 <entry><structfield>useconfig</structfield></entry>
9075 <entry><type>text[]</type></entry>
9077 <entry>Session defaults for run-time configuration variables</entry>
9085 <sect1 id="view-pg-stats">
9086 <title><structname>pg_stats</structname></title>
9088 <indexterm zone="view-pg-stats">
9089 <primary>pg_stats</primary>
9093 The view <structname>pg_stats</structname> provides access to
9094 the information stored in the <link
9095 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
9096 catalog. This view allows access only to rows of
9097 <structname>pg_statistic</structname> that correspond to tables the
9098 user has permission to read, and therefore it is safe to allow public
9099 read access to this view.
9103 <structname>pg_stats</structname> is also designed to present the
9104 information in a more readable format than the underlying catalog
9105 — at the cost that its schema must be extended whenever new slot types
9106 are defined for <structname>pg_statistic</structname>.
9110 <title><structname>pg_stats</> Columns</title>
9117 <entry>References</entry>
9118 <entry>Description</entry>
9123 <entry><structfield>schemaname</structfield></entry>
9124 <entry><type>name</type></entry>
9125 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9126 <entry>Name of schema containing table</entry>
9130 <entry><structfield>tablename</structfield></entry>
9131 <entry><type>name</type></entry>
9132 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9133 <entry>Name of table</entry>
9137 <entry><structfield>attname</structfield></entry>
9138 <entry><type>name</type></entry>
9139 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9140 <entry>Name of the column described by this row</entry>
9144 <entry><structfield>inherited</structfield></entry>
9145 <entry><type>bool</type></entry>
9147 <entry>If true, this row includes inheritance child columns, not just the
9148 values in the specified table</entry>
9152 <entry><structfield>null_frac</structfield></entry>
9153 <entry><type>real</type></entry>
9155 <entry>Fraction of column entries that are null</entry>
9159 <entry><structfield>avg_width</structfield></entry>
9160 <entry><type>integer</type></entry>
9162 <entry>Average width in bytes of column's entries</entry>
9166 <entry><structfield>n_distinct</structfield></entry>
9167 <entry><type>real</type></entry>
9170 If greater than zero, the estimated number of distinct values in the
9171 column. If less than zero, the negative of the number of distinct
9172 values divided by the number of rows. (The negated form is used when
9173 <command>ANALYZE</> believes that the number of distinct values is
9174 likely to increase as the table grows; the positive form is used when
9175 the column seems to have a fixed number of possible values.) For
9176 example, -1 indicates a unique column in which the number of distinct
9177 values is the same as the number of rows.
9182 <entry><structfield>most_common_vals</structfield></entry>
9183 <entry><type>anyarray</type></entry>
9186 A list of the most common values in the column. (Null if
9187 no values seem to be more common than any others.)
9192 <entry><structfield>most_common_freqs</structfield></entry>
9193 <entry><type>real[]</type></entry>
9196 A list of the frequencies of the most common values,
9197 i.e., number of occurrences of each divided by total number of rows.
9198 (Null when <structfield>most_common_vals</structfield> is.)
9203 <entry><structfield>histogram_bounds</structfield></entry>
9204 <entry><type>anyarray</type></entry>
9207 A list of values that divide the column's values into groups of
9208 approximately equal population. The values in
9209 <structfield>most_common_vals</>, if present, are omitted from this
9210 histogram calculation. (This column is null if the column data type
9211 does not have a <literal><</> operator or if the
9212 <structfield>most_common_vals</> list accounts for the entire
9218 <entry><structfield>correlation</structfield></entry>
9219 <entry><type>real</type></entry>
9222 Statistical correlation between physical row ordering and
9223 logical ordering of the column values. This ranges from -1 to +1.
9224 When the value is near -1 or +1, an index scan on the column will
9225 be estimated to be cheaper than when it is near zero, due to reduction
9226 of random access to the disk. (This column is null if the column data
9227 type does not have a <literal><</> operator.)
9232 <entry><structfield>most_common_elems</structfield></entry>
9233 <entry><type>anyarray</type></entry>
9236 A list of non-null element values most often appearing within values of
9237 the column. (Null for scalar types.)
9242 <entry><structfield>most_common_elem_freqs</structfield></entry>
9243 <entry><type>real[]</type></entry>
9246 A list of the frequencies of the most common element values, i.e., the
9247 fraction of rows containing at least one instance of the given value.
9248 Two or three additional values follow the per-element frequencies;
9249 these are the minimum and maximum of the preceding per-element
9250 frequencies, and optionally the frequency of null elements.
9251 (Null when <structfield>most_common_elems</structfield> is.)
9256 <entry><structfield>elem_count_histogram</structfield></entry>
9257 <entry><type>real[]</type></entry>
9260 A histogram of the counts of distinct non-null element values within the
9261 values of the column, followed by the average number of distinct
9262 non-null elements. (Null for scalar types.)
9270 The maximum number of entries in the array fields can be controlled on a
9271 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9272 command, or globally by setting the
9273 <xref linkend="guc-default-statistics-target"> run-time parameter.
9278 <sect1 id="view-pg-tables">
9279 <title><structname>pg_tables</structname></title>
9281 <indexterm zone="view-pg-tables">
9282 <primary>pg_tables</primary>
9286 The view <structname>pg_tables</structname> provides access to
9287 useful information about each table in the database.
9291 <title><structname>pg_tables</> Columns</title>
9298 <entry>References</entry>
9299 <entry>Description</entry>
9304 <entry><structfield>schemaname</structfield></entry>
9305 <entry><type>name</type></entry>
9306 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9307 <entry>Name of schema containing table</entry>
9310 <entry><structfield>tablename</structfield></entry>
9311 <entry><type>name</type></entry>
9312 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9313 <entry>Name of table</entry>
9316 <entry><structfield>tableowner</structfield></entry>
9317 <entry><type>name</type></entry>
9318 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9319 <entry>Name of table's owner</entry>
9322 <entry><structfield>tablespace</structfield></entry>
9323 <entry><type>name</type></entry>
9324 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9325 <entry>Name of tablespace containing table (null if default for database)</entry>
9328 <entry><structfield>hasindexes</structfield></entry>
9329 <entry><type>boolean</type></entry>
9330 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9331 <entry>True if table has (or recently had) any indexes</entry>
9334 <entry><structfield>hasrules</structfield></entry>
9335 <entry><type>boolean</type></entry>
9336 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9337 <entry>True if table has (or once had) rules</entry>
9340 <entry><structfield>hastriggers</structfield></entry>
9341 <entry><type>boolean</type></entry>
9342 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9343 <entry>True if table has (or once had) triggers</entry>
9346 <entry><structfield>rowsecurity</structfield></entry>
9347 <entry><type>boolean</type></entry>
9348 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
9349 <entry>True if row security is enabled on the table</entry>
9357 <sect1 id="view-pg-timezone-abbrevs">
9358 <title><structname>pg_timezone_abbrevs</structname></title>
9360 <indexterm zone="view-pg-timezone-abbrevs">
9361 <primary>pg_timezone_abbrevs</primary>
9365 The view <structname>pg_timezone_abbrevs</structname> provides a list
9366 of time zone abbreviations that are currently recognized by the datetime
9367 input routines. The contents of this view change when the
9368 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9372 <title><structname>pg_timezone_abbrevs</> Columns</title>
9379 <entry>Description</entry>
9384 <entry><structfield>abbrev</structfield></entry>
9385 <entry><type>text</type></entry>
9386 <entry>Time zone abbreviation</entry>
9389 <entry><structfield>utc_offset</structfield></entry>
9390 <entry><type>interval</type></entry>
9391 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9394 <entry><structfield>is_dst</structfield></entry>
9395 <entry><type>boolean</type></entry>
9396 <entry>True if this is a daylight-savings abbreviation</entry>
9404 <sect1 id="view-pg-timezone-names">
9405 <title><structname>pg_timezone_names</structname></title>
9407 <indexterm zone="view-pg-timezone-names">
9408 <primary>pg_timezone_names</primary>
9412 The view <structname>pg_timezone_names</structname> provides a list
9413 of time zone names that are recognized by <command>SET TIMEZONE</>,
9414 along with their associated abbreviations, UTC offsets,
9415 and daylight-savings status. (Technically,
9416 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9417 than UTC because leap seconds are not handled.)
9418 Unlike the abbreviations shown in <link
9419 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9420 date rules. Therefore, the associated information changes across local DST
9421 boundaries. The displayed information is computed based on the current
9422 value of <function>CURRENT_TIMESTAMP</>.
9426 <title><structname>pg_timezone_names</> Columns</title>
9433 <entry>Description</entry>
9438 <entry><structfield>name</structfield></entry>
9439 <entry><type>text</type></entry>
9440 <entry>Time zone name</entry>
9443 <entry><structfield>abbrev</structfield></entry>
9444 <entry><type>text</type></entry>
9445 <entry>Time zone abbreviation</entry>
9448 <entry><structfield>utc_offset</structfield></entry>
9449 <entry><type>interval</type></entry>
9450 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9453 <entry><structfield>is_dst</structfield></entry>
9454 <entry><type>boolean</type></entry>
9455 <entry>True if currently observing daylight savings</entry>
9463 <sect1 id="view-pg-user">
9464 <title><structname>pg_user</structname></title>
9466 <indexterm zone="view-pg-user">
9467 <primary>pg_user</primary>
9471 The view <structname>pg_user</structname> provides access to
9472 information about database users. This is simply a publicly
9474 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9475 that blanks out the password field.
9479 <title><structname>pg_user</> Columns</title>
9486 <entry>Description</entry>
9491 <entry><structfield>usename</structfield></entry>
9492 <entry><type>name</type></entry>
9493 <entry>User name</entry>
9497 <entry><structfield>usesysid</structfield></entry>
9498 <entry><type>oid</type></entry>
9499 <entry>ID of this user</entry>
9503 <entry><structfield>usecreatedb</structfield></entry>
9504 <entry><type>bool</type></entry>
9505 <entry>User can create databases</entry>
9509 <entry><structfield>usesuper</structfield></entry>
9510 <entry><type>bool</type></entry>
9511 <entry>User is a superuser</entry>
9515 <entry><structfield>userepl</structfield></entry>
9516 <entry><type>bool</type></entry>
9518 User can initiate streaming replication and put the system in and
9524 <entry><structfield>usebypassrls</structfield></entry>
9525 <entry><type>bool</type></entry>
9527 User can bypass row level security policies, see
9528 <xref linkend="ddl-rowsecurity"> for more information.
9533 <entry><structfield>passwd</structfield></entry>
9534 <entry><type>text</type></entry>
9535 <entry>Not the password (always reads as <literal>********</>)</entry>
9539 <entry><structfield>valuntil</structfield></entry>
9540 <entry><type>abstime</type></entry>
9541 <entry>Password expiry time (only used for password authentication)</entry>
9545 <entry><structfield>useconfig</structfield></entry>
9546 <entry><type>text[]</type></entry>
9547 <entry>Session defaults for run-time configuration variables</entry>
9555 <sect1 id="view-pg-user-mappings">
9556 <title><structname>pg_user_mappings</structname></title>
9558 <indexterm zone="view-pg-user-mappings">
9559 <primary>pg_user_mappings</primary>
9563 The view <structname>pg_user_mappings</structname> provides access
9564 to information about user mappings. This is essentially a publicly
9566 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9567 that leaves out the options field if the user has no rights to use
9572 <title><structname>pg_user_mappings</> Columns</title>
9579 <entry>References</entry>
9580 <entry>Description</entry>
9586 <entry><structfield>umid</structfield></entry>
9587 <entry><type>oid</type></entry>
9588 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
9589 <entry>OID of the user mapping</entry>
9593 <entry><structfield>srvid</structfield></entry>
9594 <entry><type>oid</type></entry>
9595 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
9597 The OID of the foreign server that contains this mapping
9602 <entry><structfield>srvname</structfield></entry>
9603 <entry><type>name</type></entry>
9604 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
9606 Name of the foreign server
9611 <entry><structfield>umuser</structfield></entry>
9612 <entry><type>oid</type></entry>
9613 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9614 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
9618 <entry><structfield>usename</structfield></entry>
9619 <entry><type>name</type></entry>
9621 <entry>Name of the local user to be mapped</entry>
9625 <entry><structfield>umoptions</structfield></entry>
9626 <entry><type>text[]</type></entry>
9629 User mapping specific options, as <quote>keyword=value</>
9630 strings, if the current user is the owner of the foreign
9640 <sect1 id="view-pg-views">
9641 <title><structname>pg_views</structname></title>
9643 <indexterm zone="view-pg-views">
9644 <primary>pg_views</primary>
9648 The view <structname>pg_views</structname> provides access to
9649 useful information about each view in the database.
9653 <title><structname>pg_views</> Columns</title>
9660 <entry>References</entry>
9661 <entry>Description</entry>
9666 <entry><structfield>schemaname</structfield></entry>
9667 <entry><type>name</type></entry>
9668 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9669 <entry>Name of schema containing view</entry>
9672 <entry><structfield>viewname</structfield></entry>
9673 <entry><type>name</type></entry>
9674 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9675 <entry>Name of view</entry>
9678 <entry><structfield>viewowner</structfield></entry>
9679 <entry><type>name</type></entry>
9680 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9681 <entry>Name of view's owner</entry>
9684 <entry><structfield>definition</structfield></entry>
9685 <entry><type>text</type></entry>
9687 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>