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-proc"><structname>pg_proc</structname></link></entry>
223 <entry>functions and procedures</entry>
227 <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
228 <entry>information about range types</entry>
232 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
233 <entry>query rewrite rules</entry>
237 <entry><link linkend="catalog-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
238 <entry>replication slot information</entry>
242 <entry><link linkend="catalog-pg-rowsecurity"><structname>pg_rowsecurity</structname></link></entry>
243 <entry>table row-level security policies</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 index supports index-only scans,
728 or zero if none</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. It is possible to
1231 change this column to enable or disable the constraint.
1236 <entry><structfield>atthasdef</structfield></entry>
1237 <entry><type>bool</type></entry>
1240 This column has a default value, in which case there will be a
1241 corresponding entry in the <structname>pg_attrdef</structname>
1242 catalog that actually defines the value.
1247 <entry><structfield>attisdropped</structfield></entry>
1248 <entry><type>bool</type></entry>
1251 This column has been dropped and is no longer valid. A dropped
1252 column is still physically present in the table, but is
1253 ignored by the parser and so cannot be accessed via SQL.
1258 <entry><structfield>attislocal</structfield></entry>
1259 <entry><type>bool</type></entry>
1262 This column is defined locally in the relation. Note that a column can
1263 be locally defined and inherited simultaneously.
1268 <entry><structfield>attinhcount</structfield></entry>
1269 <entry><type>int4</type></entry>
1272 The number of direct ancestors this column has. A column with a
1273 nonzero number of ancestors cannot be dropped nor renamed.
1278 <entry><structfield>attcollation</structfield></entry>
1279 <entry><type>oid</type></entry>
1280 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1282 The defined collation of the column, or zero if the column is
1283 not of a collatable data type.
1288 <entry><structfield>attacl</structfield></entry>
1289 <entry><type>aclitem[]</type></entry>
1292 Column-level access privileges, if any have been granted specifically
1298 <entry><structfield>attoptions</structfield></entry>
1299 <entry><type>text[]</type></entry>
1302 Attribute-level options, as <quote>keyword=value</> strings
1307 <entry><structfield>attfdwoptions</structfield></entry>
1308 <entry><type>text[]</type></entry>
1311 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1320 In a dropped column's <structname>pg_attribute</structname> entry,
1321 <structfield>atttypid</structfield> is reset to zero, but
1322 <structfield>attlen</structfield> and the other fields copied from
1323 <structname>pg_type</> are still valid. This arrangement is needed
1324 to cope with the situation where the dropped column's data type was
1325 later dropped, and so there is no <structname>pg_type</> row anymore.
1326 <structfield>attlen</structfield> and the other fields can be used
1327 to interpret the contents of a row of the table.
1332 <sect1 id="catalog-pg-authid">
1333 <title><structname>pg_authid</structname></title>
1335 <indexterm zone="catalog-pg-authid">
1336 <primary>pg_authid</primary>
1340 The catalog <structname>pg_authid</structname> contains information about
1341 database authorization identifiers (roles). A role subsumes the concepts
1342 of <quote>users</> and <quote>groups</>. A user is essentially just a
1343 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1344 without <structfield>rolcanlogin</>) can have other roles as members; see
1345 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1349 Since this catalog contains passwords, it must not be publicly readable.
1350 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1351 is a publicly readable view on
1352 <structname>pg_authid</structname> that blanks out the password field.
1356 <xref linkend="user-manag"> contains detailed information about user and
1357 privilege management.
1361 Because user identities are cluster-wide,
1362 <structname>pg_authid</structname>
1363 is shared across all databases of a cluster: there is only one
1364 copy of <structname>pg_authid</structname> per cluster, not
1369 <title><structname>pg_authid</> Columns</title>
1376 <entry>Description</entry>
1383 <entry><structfield>oid</structfield></entry>
1384 <entry><type>oid</type></entry>
1385 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1389 <entry><structfield>rolname</structfield></entry>
1390 <entry><type>name</type></entry>
1391 <entry>Role name</entry>
1395 <entry><structfield>rolsuper</structfield></entry>
1396 <entry><type>bool</type></entry>
1397 <entry>Role has superuser privileges</entry>
1401 <entry><structfield>rolinherit</structfield></entry>
1402 <entry><type>bool</type></entry>
1403 <entry>Role automatically inherits privileges of roles it is a
1408 <entry><structfield>rolcreaterole</structfield></entry>
1409 <entry><type>bool</type></entry>
1410 <entry>Role can create more roles</entry>
1414 <entry><structfield>rolcreatedb</structfield></entry>
1415 <entry><type>bool</type></entry>
1416 <entry>Role can create databases</entry>
1420 <entry><structfield>rolcatupdate</structfield></entry>
1421 <entry><type>bool</type></entry>
1423 Role can update system catalogs directly. (Even a superuser cannot do
1424 this unless this column is true)
1429 <entry><structfield>rolcanlogin</structfield></entry>
1430 <entry><type>bool</type></entry>
1432 Role can log in. That is, this role can be given as the initial
1433 session authorization identifier
1438 <entry><structfield>rolreplication</structfield></entry>
1439 <entry><type>bool</type></entry>
1441 Role is a replication role. That is, this role can initiate streaming
1442 replication (see <xref linkend="streaming-replication">) and set/unset
1443 the system backup mode using <function>pg_start_backup</> and
1444 <function>pg_stop_backup</>
1449 <entry><structfield>rolconnlimit</structfield></entry>
1450 <entry><type>int4</type></entry>
1452 For roles that can log in, this sets maximum number of concurrent
1453 connections this role can make. -1 means no limit.
1458 <entry><structfield>rolpassword</structfield></entry>
1459 <entry><type>text</type></entry>
1461 Password (possibly encrypted); null if none. If the password
1462 is encrypted, this column will begin with the string <literal>md5</>
1463 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1464 will be of the user's password concatenated to their user name.
1465 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1466 <productname>PostgreSQL</> will store the md5 hash of
1467 <literal>xyzzyjoe</>. A password that does not follow that
1468 format is assumed to be unencrypted.
1473 <entry><structfield>rolvaliduntil</structfield></entry>
1474 <entry><type>timestamptz</type></entry>
1475 <entry>Password expiry time (only used for password authentication);
1476 null if no expiration</entry>
1485 <sect1 id="catalog-pg-auth-members">
1486 <title><structname>pg_auth_members</structname></title>
1488 <indexterm zone="catalog-pg-auth-members">
1489 <primary>pg_auth_members</primary>
1493 The catalog <structname>pg_auth_members</structname> shows the membership
1494 relations between roles. Any non-circular set of relationships is allowed.
1498 Because user identities are cluster-wide,
1499 <structname>pg_auth_members</structname>
1500 is shared across all databases of a cluster: there is only one
1501 copy of <structname>pg_auth_members</structname> per cluster, not
1506 <title><structname>pg_auth_members</> Columns</title>
1513 <entry>References</entry>
1514 <entry>Description</entry>
1520 <entry><structfield>roleid</structfield></entry>
1521 <entry><type>oid</type></entry>
1522 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1523 <entry>ID of a role that has a member</entry>
1527 <entry><structfield>member</structfield></entry>
1528 <entry><type>oid</type></entry>
1529 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1530 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1534 <entry><structfield>grantor</structfield></entry>
1535 <entry><type>oid</type></entry>
1536 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1537 <entry>ID of the role that granted this membership</entry>
1541 <entry><structfield>admin_option</structfield></entry>
1542 <entry><type>bool</type></entry>
1544 <entry>True if <structfield>member</> can grant membership in
1545 <structfield>roleid</> to others</entry>
1554 <sect1 id="catalog-pg-cast">
1555 <title><structname>pg_cast</structname></title>
1557 <indexterm zone="catalog-pg-cast">
1558 <primary>pg_cast</primary>
1562 The catalog <structname>pg_cast</structname> stores data type conversion
1563 paths, both built-in and user-defined.
1567 It should be noted that <structname>pg_cast</structname> does not represent
1568 every type conversion that the system knows how to perform; only those that
1569 cannot be deduced from some generic rule. For example, casting between a
1570 domain and its base type is not explicitly represented in
1571 <structname>pg_cast</structname>. Another important exception is that
1572 <quote>automatic I/O conversion casts</>, those performed using a data
1573 type's own I/O functions to convert to or from <type>text</> or other
1574 string types, are not explicitly represented in
1575 <structname>pg_cast</structname>.
1579 <title><structname>pg_cast</> Columns</title>
1586 <entry>References</entry>
1587 <entry>Description</entry>
1593 <entry><structfield>oid</structfield></entry>
1594 <entry><type>oid</type></entry>
1596 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1600 <entry><structfield>castsource</structfield></entry>
1601 <entry><type>oid</type></entry>
1602 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1603 <entry>OID of the source data type</entry>
1607 <entry><structfield>casttarget</structfield></entry>
1608 <entry><type>oid</type></entry>
1609 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1610 <entry>OID of the target data type</entry>
1614 <entry><structfield>castfunc</structfield></entry>
1615 <entry><type>oid</type></entry>
1616 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1618 The OID of the function to use to perform this cast. Zero is
1619 stored if the cast method doesn't require a function.
1624 <entry><structfield>castcontext</structfield></entry>
1625 <entry><type>char</type></entry>
1628 Indicates what contexts the cast can be invoked in.
1629 <literal>e</> means only as an explicit cast (using
1630 <literal>CAST</> or <literal>::</> syntax).
1631 <literal>a</> means implicitly in assignment
1632 to a target column, as well as explicitly.
1633 <literal>i</> means implicitly in expressions, as well as the
1638 <entry><structfield>castmethod</structfield></entry>
1639 <entry><type>char</type></entry>
1642 Indicates how the cast is performed.
1643 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1644 <literal>i</> means that the input/output functions are used.
1645 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1653 The cast functions listed in <structname>pg_cast</structname> must
1654 always take the cast source type as their first argument type, and
1655 return the cast destination type as their result type. A cast
1656 function can have up to three arguments. The second argument,
1657 if present, must be type <type>integer</>; it receives the type
1658 modifier associated with the destination type, or -1
1659 if there is none. The third argument,
1660 if present, must be type <type>boolean</>; it receives <literal>true</>
1661 if the cast is an explicit cast, <literal>false</> otherwise.
1665 It is legitimate to create a <structname>pg_cast</structname> entry
1666 in which the source and target types are the same, if the associated
1667 function takes more than one argument. Such entries represent
1668 <quote>length coercion functions</> that coerce values of the type
1669 to be legal for a particular type modifier value.
1673 When a <structname>pg_cast</structname> entry has different source and
1674 target types and a function that takes more than one argument, it
1675 represents converting from one type to another and applying a length
1676 coercion in a single step. When no such entry is available, coercion
1677 to a type that uses a type modifier involves two steps, one to
1678 convert between data types and a second to apply the modifier.
1682 <sect1 id="catalog-pg-class">
1683 <title><structname>pg_class</structname></title>
1685 <indexterm zone="catalog-pg-class">
1686 <primary>pg_class</primary>
1690 The catalog <structname>pg_class</structname> catalogs tables and most
1691 everything else that has columns or is otherwise similar to a
1692 table. This includes indexes (but see also
1693 <structname>pg_index</structname>), sequences, views, materialized
1694 views, composite types, and TOAST tables; see <structfield>relkind</>.
1695 Below, when we mean all of these
1696 kinds of objects we speak of <quote>relations</quote>. Not all
1697 columns are meaningful for all relation types.
1701 <title><structname>pg_class</> Columns</title>
1708 <entry>References</entry>
1709 <entry>Description</entry>
1715 <entry><structfield>oid</structfield></entry>
1716 <entry><type>oid</type></entry>
1718 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1722 <entry><structfield>relname</structfield></entry>
1723 <entry><type>name</type></entry>
1725 <entry>Name of the table, index, view, etc.</entry>
1729 <entry><structfield>relnamespace</structfield></entry>
1730 <entry><type>oid</type></entry>
1731 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1733 The OID of the namespace that contains this relation
1738 <entry><structfield>reltype</structfield></entry>
1739 <entry><type>oid</type></entry>
1740 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1742 The OID of the data type that corresponds to this table's row type,
1743 if any (zero for indexes, which have no <structname>pg_type</> entry)
1748 <entry><structfield>reloftype</structfield></entry>
1749 <entry><type>oid</type></entry>
1750 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1752 For typed tables, the OID of the underlying composite type,
1753 zero for all other relations
1758 <entry><structfield>relowner</structfield></entry>
1759 <entry><type>oid</type></entry>
1760 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1761 <entry>Owner of the relation</entry>
1765 <entry><structfield>relam</structfield></entry>
1766 <entry><type>oid</type></entry>
1767 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1768 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1772 <entry><structfield>relfilenode</structfield></entry>
1773 <entry><type>oid</type></entry>
1775 <entry>Name of the on-disk file of this relation; zero means this
1776 is a <quote>mapped</> relation whose disk file name is determined
1777 by low-level state</entry>
1781 <entry><structfield>reltablespace</structfield></entry>
1782 <entry><type>oid</type></entry>
1783 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1785 The tablespace in which this relation is stored. If zero,
1786 the database's default tablespace is implied. (Not meaningful
1787 if the relation has no on-disk file.)
1792 <entry><structfield>relpages</structfield></entry>
1793 <entry><type>int4</type></entry>
1796 Size of the on-disk representation of this table in pages (of size
1797 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1798 planner. It is updated by <command>VACUUM</command>,
1799 <command>ANALYZE</command>, and a few DDL commands such as
1800 <command>CREATE INDEX</command>.
1805 <entry><structfield>reltuples</structfield></entry>
1806 <entry><type>float4</type></entry>
1809 Number of rows in the table. This is only an estimate used by the
1810 planner. It is updated by <command>VACUUM</command>,
1811 <command>ANALYZE</command>, and a few DDL commands such as
1812 <command>CREATE INDEX</command>.
1817 <entry><structfield>relallvisible</structfield></entry>
1818 <entry><type>int4</type></entry>
1821 Number of pages that are marked all-visible in the table's
1822 visibility map. This is only an estimate used by the
1823 planner. It is updated by <command>VACUUM</command>,
1824 <command>ANALYZE</command>, and a few DDL commands such as
1825 <command>CREATE INDEX</command>.
1830 <entry><structfield>reltoastrelid</structfield></entry>
1831 <entry><type>oid</type></entry>
1832 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1834 OID of the TOAST table associated with this table, 0 if none. The
1835 TOAST table stores large attributes <quote>out of line</quote> in a
1841 <entry><structfield>relhasindex</structfield></entry>
1842 <entry><type>bool</type></entry>
1845 True if this is a table and it has (or recently had) any indexes
1850 <entry><structfield>relisshared</structfield></entry>
1851 <entry><type>bool</type></entry>
1854 True if this table is shared across all databases in the cluster. Only
1855 certain system catalogs (such as <structname>pg_database</structname>)
1861 <entry><structfield>relpersistence</structfield></entry>
1862 <entry><type>char</type></entry>
1865 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1866 <literal>t</> = temporary table
1871 <entry><structfield>relkind</structfield></entry>
1872 <entry><type>char</type></entry>
1875 <literal>r</> = ordinary table, <literal>i</> = index,
1876 <literal>S</> = sequence, <literal>v</> = view,
1877 <literal>m</> = materialized view,
1878 <literal>c</> = composite type, <literal>t</> = TOAST table,
1879 <literal>f</> = foreign table
1884 <entry><structfield>relnatts</structfield></entry>
1885 <entry><type>int2</type></entry>
1888 Number of user columns in the relation (system columns not
1889 counted). There must be this many corresponding entries in
1890 <structname>pg_attribute</structname>. See also
1891 <literal>pg_attribute.attnum</literal>.
1896 <entry><structfield>relchecks</structfield></entry>
1897 <entry><type>int2</type></entry>
1900 Number of <literal>CHECK</> constraints on the table; see
1901 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1906 <entry><structfield>relhasoids</structfield></entry>
1907 <entry><type>bool</type></entry>
1910 True if we generate an OID for each row of the relation
1915 <entry><structfield>relhaspkey</structfield></entry>
1916 <entry><type>bool</type></entry>
1919 True if the table has (or once had) a primary key
1924 <entry><structfield>relhasrules</structfield></entry>
1925 <entry><type>bool</type></entry>
1928 True if table has (or once had) rules; see
1929 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1934 <entry><structfield>relhastriggers</structfield></entry>
1935 <entry><type>bool</type></entry>
1938 True if table has (or once had) triggers; see
1939 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1944 <entry><structfield>relrowsecurity</structfield></entry>
1945 <entry><type>bool</type></entry>
1948 True if table has row-security enabled; see
1949 <link linkend="catalog-pg-rowsecurity"><structname>pg_rowsecurity</structname></link> catalog
1954 <entry><structfield>relhassubclass</structfield></entry>
1955 <entry><type>bool</type></entry>
1957 <entry>True if table has (or once had) any inheritance children</entry>
1961 <entry><structfield>relispopulated</structfield></entry>
1962 <entry><type>bool</type></entry>
1964 <entry>True if relation is populated (this is true for all
1965 relations other than some materialized views)</entry>
1969 <entry><structfield>relreplident</structfield></entry>
1970 <entry><type>char</type></entry>
1973 Columns used to form <quote>replica identity</> for rows:
1974 <literal>d</> = default (primary key, if any),
1975 <literal>n</> = nothing,
1976 <literal>f</> = all columns
1977 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1982 <entry><structfield>relfrozenxid</structfield></entry>
1983 <entry><type>xid</type></entry>
1986 All transaction IDs before this one have been replaced with a permanent
1987 (<quote>frozen</>) transaction ID in this table. This is used to track
1988 whether the table needs to be vacuumed in order to prevent transaction
1989 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1990 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1995 <entry><structfield>relminmxid</structfield></entry>
1996 <entry><type>xid</type></entry>
1999 All multitransaction IDs before this one have been replaced by a
2000 transaction ID in this table. This is used to track
2001 whether the table needs to be vacuumed in order to prevent multitransaction ID
2002 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
2003 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2008 <entry><structfield>relacl</structfield></entry>
2009 <entry><type>aclitem[]</type></entry>
2012 Access privileges; see
2013 <xref linkend="sql-grant"> and
2014 <xref linkend="sql-revoke">
2020 <entry><structfield>reloptions</structfield></entry>
2021 <entry><type>text[]</type></entry>
2024 Access-method-specific options, as <quote>keyword=value</> strings
2032 Several of the Boolean flags in <structname>pg_class</> are maintained
2033 lazily: they are guaranteed to be true if that's the correct state, but
2034 may not be reset to false immediately when the condition is no longer
2035 true. For example, <structfield>relhasindex</> is set by
2036 <command>CREATE INDEX</command>, but it is never cleared by
2037 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
2038 <structfield>relhasindex</> if it finds the table has no indexes. This
2039 arrangement avoids race conditions and improves concurrency.
2043 <sect1 id="catalog-pg-collation">
2044 <title><structname>pg_collation</structname></title>
2046 <indexterm zone="catalog-pg-collation">
2047 <primary>pg_collation</primary>
2051 The catalog <structname>pg_collation</structname> describes the
2052 available collations, which are essentially mappings from an SQL
2053 name to operating system locale categories.
2054 See <xref linkend="collation"> for more information.
2058 <title><structname>pg_collation</> Columns</title>
2065 <entry>References</entry>
2066 <entry>Description</entry>
2072 <entry><structfield>oid</structfield></entry>
2073 <entry><type>oid</type></entry>
2075 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2079 <entry><structfield>collname</structfield></entry>
2080 <entry><type>name</type></entry>
2082 <entry>Collation name (unique per namespace and encoding)</entry>
2086 <entry><structfield>collnamespace</structfield></entry>
2087 <entry><type>oid</type></entry>
2088 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2090 The OID of the namespace that contains this collation
2095 <entry><structfield>collowner</structfield></entry>
2096 <entry><type>oid</type></entry>
2097 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2098 <entry>Owner of the collation</entry>
2102 <entry><structfield>collencoding</structfield></entry>
2103 <entry><type>int4</type></entry>
2105 <entry>Encoding in which the collation is applicable, or -1 if it
2106 works for any encoding</entry>
2110 <entry><structfield>collcollate</structfield></entry>
2111 <entry><type>name</type></entry>
2113 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2117 <entry><structfield>collctype</structfield></entry>
2118 <entry><type>name</type></entry>
2120 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2127 Note that the unique key on this catalog is (<structfield>collname</>,
2128 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2129 (<structfield>collname</>, <structfield>collnamespace</>).
2130 <productname>PostgreSQL</productname> generally ignores all
2131 collations that do not have <structfield>collencoding</> equal to
2132 either the current database's encoding or -1, and creation of new entries
2133 with the same name as an entry with <structfield>collencoding</> = -1
2134 is forbidden. Therefore it is sufficient to use a qualified SQL name
2135 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2136 even though this is not unique according to the catalog definition.
2137 The reason for defining the catalog this way is that
2138 <application>initdb</> fills it in at cluster initialization time with
2139 entries for all locales available on the system, so it must be able to
2140 hold entries for all encodings that might ever be used in the cluster.
2144 In the <literal>template0</> database, it could be useful to create
2145 collations whose encoding does not match the database encoding,
2146 since they could match the encodings of databases later cloned from
2147 <literal>template0</>. This would currently have to be done manually.
2151 <sect1 id="catalog-pg-constraint">
2152 <title><structname>pg_constraint</structname></title>
2154 <indexterm zone="catalog-pg-constraint">
2155 <primary>pg_constraint</primary>
2159 The catalog <structname>pg_constraint</structname> stores check, primary
2160 key, unique, foreign key, and exclusion constraints on tables.
2161 (Column constraints are not treated specially. Every column constraint is
2162 equivalent to some table constraint.)
2163 Not-null constraints are represented in the <structname>pg_attribute</>
2168 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2169 TRIGGER</>) also give rise to an entry in this table.
2173 Check constraints on domains are stored here, too.
2177 <title><structname>pg_constraint</> Columns</title>
2184 <entry>References</entry>
2185 <entry>Description</entry>
2191 <entry><structfield>oid</structfield></entry>
2192 <entry><type>oid</type></entry>
2194 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2198 <entry><structfield>conname</structfield></entry>
2199 <entry><type>name</type></entry>
2201 <entry>Constraint name (not necessarily unique!)</entry>
2205 <entry><structfield>connamespace</structfield></entry>
2206 <entry><type>oid</type></entry>
2207 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2209 The OID of the namespace that contains this constraint
2214 <entry><structfield>contype</structfield></entry>
2215 <entry><type>char</type></entry>
2218 <literal>c</> = check constraint,
2219 <literal>f</> = foreign key constraint,
2220 <literal>p</> = primary key constraint,
2221 <literal>u</> = unique constraint,
2222 <literal>t</> = constraint trigger,
2223 <literal>x</> = exclusion constraint
2228 <entry><structfield>condeferrable</structfield></entry>
2229 <entry><type>bool</type></entry>
2231 <entry>Is the constraint deferrable?</entry>
2235 <entry><structfield>condeferred</structfield></entry>
2236 <entry><type>bool</type></entry>
2238 <entry>Is the constraint deferred by default?</entry>
2242 <entry><structfield>convalidated</structfield></entry>
2243 <entry><type>bool</type></entry>
2245 <entry>Has the constraint been validated?
2246 Currently, can only be false for foreign keys and CHECK constraints</entry>
2250 <entry><structfield>conrelid</structfield></entry>
2251 <entry><type>oid</type></entry>
2252 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2253 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2257 <entry><structfield>contypid</structfield></entry>
2258 <entry><type>oid</type></entry>
2259 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2260 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2264 <entry><structfield>conindid</structfield></entry>
2265 <entry><type>oid</type></entry>
2266 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2267 <entry>The index supporting this constraint, if it's a unique, primary
2268 key, foreign key, or exclusion constraint; else 0</entry>
2272 <entry><structfield>confrelid</structfield></entry>
2273 <entry><type>oid</type></entry>
2274 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2275 <entry>If a foreign key, the referenced table; else 0</entry>
2279 <entry><structfield>confupdtype</structfield></entry>
2280 <entry><type>char</type></entry>
2282 <entry>Foreign key update action code:
2283 <literal>a</> = no action,
2284 <literal>r</> = restrict,
2285 <literal>c</> = cascade,
2286 <literal>n</> = set null,
2287 <literal>d</> = set default
2292 <entry><structfield>confdeltype</structfield></entry>
2293 <entry><type>char</type></entry>
2295 <entry>Foreign key deletion action code:
2296 <literal>a</> = no action,
2297 <literal>r</> = restrict,
2298 <literal>c</> = cascade,
2299 <literal>n</> = set null,
2300 <literal>d</> = set default
2305 <entry><structfield>confmatchtype</structfield></entry>
2306 <entry><type>char</type></entry>
2308 <entry>Foreign key match type:
2309 <literal>f</> = full,
2310 <literal>p</> = partial,
2311 <literal>s</> = simple
2316 <entry><structfield>conislocal</structfield></entry>
2317 <entry><type>bool</type></entry>
2320 This constraint is defined locally for the relation. Note that a
2321 constraint can be locally defined and inherited simultaneously.
2326 <entry><structfield>coninhcount</structfield></entry>
2327 <entry><type>int4</type></entry>
2330 The number of direct inheritance ancestors this constraint has.
2332 a nonzero number of ancestors cannot be dropped nor renamed.
2337 <entry><structfield>connoinherit</structfield></entry>
2338 <entry><type>bool</type></entry>
2341 This constraint is defined locally for the relation. It is a
2342 non-inheritable constraint.
2347 <entry><structfield>conkey</structfield></entry>
2348 <entry><type>int2[]</type></entry>
2349 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2350 <entry>If a table constraint (including foreign keys, but not constraint
2351 triggers), list of the constrained columns</entry>
2355 <entry><structfield>confkey</structfield></entry>
2356 <entry><type>int2[]</type></entry>
2357 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2358 <entry>If a foreign key, list of the referenced columns</entry>
2362 <entry><structfield>conpfeqop</structfield></entry>
2363 <entry><type>oid[]</type></entry>
2364 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2365 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2369 <entry><structfield>conppeqop</structfield></entry>
2370 <entry><type>oid[]</type></entry>
2371 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2372 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2376 <entry><structfield>conffeqop</structfield></entry>
2377 <entry><type>oid[]</type></entry>
2378 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2379 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2383 <entry><structfield>conexclop</structfield></entry>
2384 <entry><type>oid[]</type></entry>
2385 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2386 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2390 <entry><structfield>conbin</structfield></entry>
2391 <entry><type>pg_node_tree</type></entry>
2393 <entry>If a check constraint, an internal representation of the expression</entry>
2397 <entry><structfield>consrc</structfield></entry>
2398 <entry><type>text</type></entry>
2400 <entry>If a check constraint, a human-readable representation of the expression</entry>
2407 In the case of an exclusion constraint, <structfield>conkey</structfield>
2408 is only useful for constraint elements that are simple column references.
2409 For other cases, a zero appears in <structfield>conkey</structfield>
2410 and the associated index must be consulted to discover the expression
2411 that is constrained. (<structfield>conkey</structfield> thus has the
2412 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2418 <structfield>consrc</structfield> is not updated when referenced objects
2419 change; for example, it won't track renaming of columns. Rather than
2420 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2421 to extract the definition of a check constraint.
2427 <literal>pg_class.relchecks</literal> needs to agree with the
2428 number of check-constraint entries found in this table for each
2435 <sect1 id="catalog-pg-conversion">
2436 <title><structname>pg_conversion</structname></title>
2438 <indexterm zone="catalog-pg-conversion">
2439 <primary>pg_conversion</primary>
2443 The catalog <structname>pg_conversion</structname> describes
2444 encoding conversion procedures. See <xref linkend="sql-createconversion">
2445 for more information.
2449 <title><structname>pg_conversion</> Columns</title>
2456 <entry>References</entry>
2457 <entry>Description</entry>
2463 <entry><structfield>oid</structfield></entry>
2464 <entry><type>oid</type></entry>
2466 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2470 <entry><structfield>conname</structfield></entry>
2471 <entry><type>name</type></entry>
2473 <entry>Conversion name (unique within a namespace)</entry>
2477 <entry><structfield>connamespace</structfield></entry>
2478 <entry><type>oid</type></entry>
2479 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2481 The OID of the namespace that contains this conversion
2486 <entry><structfield>conowner</structfield></entry>
2487 <entry><type>oid</type></entry>
2488 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2489 <entry>Owner of the conversion</entry>
2493 <entry><structfield>conforencoding</structfield></entry>
2494 <entry><type>int4</type></entry>
2496 <entry>Source encoding ID</entry>
2500 <entry><structfield>contoencoding</structfield></entry>
2501 <entry><type>int4</type></entry>
2503 <entry>Destination encoding ID</entry>
2507 <entry><structfield>conproc</structfield></entry>
2508 <entry><type>regproc</type></entry>
2509 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2510 <entry>Conversion procedure</entry>
2514 <entry><structfield>condefault</structfield></entry>
2515 <entry><type>bool</type></entry>
2517 <entry>True if this is the default conversion</entry>
2526 <sect1 id="catalog-pg-database">
2527 <title><structname>pg_database</structname></title>
2529 <indexterm zone="catalog-pg-database">
2530 <primary>pg_database</primary>
2534 The catalog <structname>pg_database</structname> stores information about
2535 the available databases. Databases are created with the <xref
2536 linkend="sql-createdatabase"> command.
2537 Consult <xref linkend="managing-databases"> for details about the meaning
2538 of some of the parameters.
2542 Unlike most system catalogs, <structname>pg_database</structname>
2543 is shared across all databases of a cluster: there is only one
2544 copy of <structname>pg_database</structname> per cluster, not
2549 <title><structname>pg_database</> Columns</title>
2556 <entry>References</entry>
2557 <entry>Description</entry>
2563 <entry><structfield>oid</structfield></entry>
2564 <entry><type>oid</type></entry>
2566 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2570 <entry><structfield>datname</structfield></entry>
2571 <entry><type>name</type></entry>
2573 <entry>Database name</entry>
2577 <entry><structfield>datdba</structfield></entry>
2578 <entry><type>oid</type></entry>
2579 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2580 <entry>Owner of the database, usually the user who created it</entry>
2584 <entry><structfield>encoding</structfield></entry>
2585 <entry><type>int4</type></entry>
2587 <entry>Character encoding for this database
2588 (<function>pg_encoding_to_char()</function> can translate
2589 this number to the encoding name)</entry>
2593 <entry><structfield>datcollate</structfield></entry>
2594 <entry><type>name</type></entry>
2596 <entry>LC_COLLATE for this database</entry>
2600 <entry><structfield>datctype</structfield></entry>
2601 <entry><type>name</type></entry>
2603 <entry>LC_CTYPE for this database</entry>
2607 <entry><structfield>datistemplate</structfield></entry>
2608 <entry><type>bool</type></entry>
2611 If true, then this database can be cloned by
2612 any user with <literal>CREATEDB</> privileges;
2613 if false, then only superusers or the owner of
2614 the database can clone it.
2619 <entry><structfield>datallowconn</structfield></entry>
2620 <entry><type>bool</type></entry>
2623 If false then no one can connect to this database. This is
2624 used to protect the <literal>template0</> database from being altered.
2629 <entry><structfield>datconnlimit</structfield></entry>
2630 <entry><type>int4</type></entry>
2633 Sets maximum number of concurrent connections that can be made
2634 to this database. -1 means no limit.
2639 <entry><structfield>datlastsysoid</structfield></entry>
2640 <entry><type>oid</type></entry>
2643 Last system OID in the database; useful
2644 particularly to <application>pg_dump</application>
2649 <entry><structfield>datfrozenxid</structfield></entry>
2650 <entry><type>xid</type></entry>
2653 All transaction IDs before this one have been replaced with a permanent
2654 (<quote>frozen</>) transaction ID in this database. This is used to
2655 track whether the database needs to be vacuumed in order to prevent
2656 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2657 It is the minimum of the per-table
2658 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2663 <entry><structfield>datminmxid</structfield></entry>
2664 <entry><type>xid</type></entry>
2667 All multitransaction IDs before this one have been replaced with a
2668 transaction ID in this database. This is used to
2669 track whether the database needs to be vacuumed in order to prevent
2670 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2671 It is the minimum of the per-table
2672 <structname>pg_class</>.<structfield>relminmxid</> values.
2677 <entry><structfield>dattablespace</structfield></entry>
2678 <entry><type>oid</type></entry>
2679 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2681 The default tablespace for the database.
2682 Within this database, all tables for which
2683 <structname>pg_class</>.<structfield>reltablespace</> is zero
2684 will be stored in this tablespace; in particular, all the non-shared
2685 system catalogs will be there.
2690 <entry><structfield>datacl</structfield></entry>
2691 <entry><type>aclitem[]</type></entry>
2694 Access privileges; see
2695 <xref linkend="sql-grant"> and
2696 <xref linkend="sql-revoke">
2706 <sect1 id="catalog-pg-db-role-setting">
2707 <title><structname>pg_db_role_setting</structname></title>
2709 <indexterm zone="catalog-pg-db-role-setting">
2710 <primary>pg_db_role_setting</primary>
2714 The catalog <structname>pg_db_role_setting</structname> records the default
2715 values that have been set for run-time configuration variables,
2716 for each role and database combination.
2720 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2721 is shared across all databases of a cluster: there is only one
2722 copy of <structname>pg_db_role_setting</structname> per cluster, not
2727 <title><structname>pg_db_role_setting</> Columns</title>
2734 <entry>References</entry>
2735 <entry>Description</entry>
2741 <entry><structfield>setdatabase</structfield></entry>
2742 <entry><type>oid</type></entry>
2743 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2744 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2748 <entry><structfield>setrole</structfield></entry>
2749 <entry><type>oid</type></entry>
2750 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2751 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2755 <entry><structfield>setconfig</structfield></entry>
2756 <entry><type>text[]</type></entry>
2758 <entry>Defaults for run-time configuration variables</entry>
2766 <sect1 id="catalog-pg-default-acl">
2767 <title><structname>pg_default_acl</structname></title>
2769 <indexterm zone="catalog-pg-default-acl">
2770 <primary>pg_default_acl</primary>
2774 The catalog <structname>pg_default_acl</> stores initial
2775 privileges to be assigned to newly created objects.
2779 <title><structname>pg_default_acl</> Columns</title>
2786 <entry>References</entry>
2787 <entry>Description</entry>
2793 <entry><structfield>oid</structfield></entry>
2794 <entry><type>oid</type></entry>
2796 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2800 <entry><structfield>defaclrole</structfield></entry>
2801 <entry><type>oid</type></entry>
2802 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2803 <entry>The OID of the role associated with this entry</entry>
2807 <entry><structfield>defaclnamespace</structfield></entry>
2808 <entry><type>oid</type></entry>
2809 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2810 <entry>The OID of the namespace associated with this entry,
2811 or 0 if none</entry>
2815 <entry><structfield>defaclobjtype</structfield></entry>
2816 <entry><type>char</type></entry>
2819 Type of object this entry is for:
2820 <literal>r</> = relation (table, view),
2821 <literal>S</> = sequence,
2822 <literal>f</> = function,
2823 <literal>T</> = type
2828 <entry><structfield>defaclacl</structfield></entry>
2829 <entry><type>aclitem[]</type></entry>
2832 Access privileges that this type of object should have on creation
2840 A <structname>pg_default_acl</> entry shows the initial privileges to
2841 be assigned to an object belonging to the indicated user. There are
2842 currently two types of entry: <quote>global</> entries with
2843 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2844 that reference a particular schema. If a global entry is present then
2845 it <emphasis>overrides</> the normal hard-wired default privileges
2846 for the object type. A per-schema entry, if present, represents privileges
2847 to be <emphasis>added to</> the global or hard-wired default privileges.
2851 Note that when an ACL entry in another catalog is null, it is taken
2852 to represent the hard-wired default privileges for its object,
2853 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2854 at the moment. <structname>pg_default_acl</> is only consulted during
2861 <sect1 id="catalog-pg-depend">
2862 <title><structname>pg_depend</structname></title>
2864 <indexterm zone="catalog-pg-depend">
2865 <primary>pg_depend</primary>
2869 The catalog <structname>pg_depend</structname> records the dependency
2870 relationships between database objects. This information allows
2871 <command>DROP</> commands to find which other objects must be dropped
2872 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2877 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2878 which performs a similar function for dependencies involving objects
2879 that are shared across a database cluster.
2883 <title><structname>pg_depend</> Columns</title>
2890 <entry>References</entry>
2891 <entry>Description</entry>
2897 <entry><structfield>classid</structfield></entry>
2898 <entry><type>oid</type></entry>
2899 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2900 <entry>The OID of the system catalog the dependent object is in</entry>
2904 <entry><structfield>objid</structfield></entry>
2905 <entry><type>oid</type></entry>
2906 <entry>any OID column</entry>
2907 <entry>The OID of the specific dependent object</entry>
2911 <entry><structfield>objsubid</structfield></entry>
2912 <entry><type>int4</type></entry>
2915 For a table column, this is the column number (the
2916 <structfield>objid</> and <structfield>classid</> refer to the
2917 table itself). For all other object types, this column is
2923 <entry><structfield>refclassid</structfield></entry>
2924 <entry><type>oid</type></entry>
2925 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2926 <entry>The OID of the system catalog the referenced object is in</entry>
2930 <entry><structfield>refobjid</structfield></entry>
2931 <entry><type>oid</type></entry>
2932 <entry>any OID column</entry>
2933 <entry>The OID of the specific referenced object</entry>
2937 <entry><structfield>refobjsubid</structfield></entry>
2938 <entry><type>int4</type></entry>
2941 For a table column, this is the column number (the
2942 <structfield>refobjid</> and <structfield>refclassid</> refer
2943 to the table itself). For all other object types, this column
2949 <entry><structfield>deptype</structfield></entry>
2950 <entry><type>char</type></entry>
2953 A code defining the specific semantics of this dependency relationship; see text
2962 In all cases, a <structname>pg_depend</structname> entry indicates that the
2963 referenced object cannot be dropped without also dropping the dependent
2964 object. However, there are several subflavors identified by
2965 <structfield>deptype</>:
2969 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2972 A normal relationship between separately-created objects. The
2973 dependent object can be dropped without affecting the
2974 referenced object. The referenced object can only be dropped
2975 by specifying <literal>CASCADE</>, in which case the dependent
2976 object is dropped, too. Example: a table column has a normal
2977 dependency on its data type.
2983 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2986 The dependent object can be dropped separately from the
2987 referenced object, and should be automatically dropped
2988 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2989 mode) if the referenced object is dropped. Example: a named
2990 constraint on a table is made autodependent on the table, so
2991 that it will go away if the table is dropped.
2997 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
3000 The dependent object was created as part of creation of the
3001 referenced object, and is really just a part of its internal
3002 implementation. A <command>DROP</> of the dependent object
3003 will be disallowed outright (we'll tell the user to issue a
3004 <command>DROP</> against the referenced object, instead). A
3005 <command>DROP</> of the referenced object will be propagated
3006 through to drop the dependent object whether
3007 <command>CASCADE</> is specified or not. Example: a trigger
3008 that's created to enforce a foreign-key constraint is made
3009 internally dependent on the constraint's
3010 <structname>pg_constraint</> entry.
3016 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
3019 The dependent object is a member of the <firstterm>extension</> that is
3020 the referenced object (see
3021 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3022 The dependent object can be dropped only via
3023 <command>DROP EXTENSION</> on the referenced object. Functionally
3024 this dependency type acts the same as an internal dependency, but
3025 it's kept separate for clarity and to simplify <application>pg_dump</>.
3031 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3034 There is no dependent object; this type of entry is a signal
3035 that the system itself depends on the referenced object, and so
3036 that object must never be deleted. Entries of this type are
3037 created only by <command>initdb</command>. The columns for the
3038 dependent object contain zeroes.
3044 Other dependency flavors might be needed in future.
3050 <sect1 id="catalog-pg-description">
3051 <title><structname>pg_description</structname></title>
3053 <indexterm zone="catalog-pg-description">
3054 <primary>pg_description</primary>
3058 The catalog <structname>pg_description</> stores optional descriptions
3059 (comments) for each database object. Descriptions can be manipulated
3060 with the <xref linkend="sql-comment"> command and viewed with
3061 <application>psql</application>'s <literal>\d</literal> commands.
3062 Descriptions of many built-in system objects are provided in the initial
3063 contents of <structname>pg_description</structname>.
3067 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3068 which performs a similar function for descriptions involving objects that
3069 are shared across a database cluster.
3073 <title><structname>pg_description</> Columns</title>
3080 <entry>References</entry>
3081 <entry>Description</entry>
3087 <entry><structfield>objoid</structfield></entry>
3088 <entry><type>oid</type></entry>
3089 <entry>any OID column</entry>
3090 <entry>The OID of the object this description pertains to</entry>
3094 <entry><structfield>classoid</structfield></entry>
3095 <entry><type>oid</type></entry>
3096 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3097 <entry>The OID of the system catalog this object appears in</entry>
3101 <entry><structfield>objsubid</structfield></entry>
3102 <entry><type>int4</type></entry>
3105 For a comment on a table column, this is the column number (the
3106 <structfield>objoid</> and <structfield>classoid</> refer to
3107 the table itself). For all other object types, this column is
3113 <entry><structfield>description</structfield></entry>
3114 <entry><type>text</type></entry>
3116 <entry>Arbitrary text that serves as the description of this object</entry>
3125 <sect1 id="catalog-pg-enum">
3126 <title><structname>pg_enum</structname></title>
3128 <indexterm zone="catalog-pg-enum">
3129 <primary>pg_enum</primary>
3133 The <structname>pg_enum</structname> catalog contains entries
3134 showing the values and labels for each enum type. The
3135 internal representation of a given enum value is actually the OID
3136 of its associated row in <structname>pg_enum</structname>.
3140 <title><structname>pg_enum</> Columns</title>
3147 <entry>References</entry>
3148 <entry>Description</entry>
3154 <entry><structfield>oid</structfield></entry>
3155 <entry><type>oid</type></entry>
3157 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3161 <entry><structfield>enumtypid</structfield></entry>
3162 <entry><type>oid</type></entry>
3163 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3164 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3168 <entry><structfield>enumsortorder</structfield></entry>
3169 <entry><type>float4</type></entry>
3171 <entry>The sort position of this enum value within its enum type</entry>
3175 <entry><structfield>enumlabel</structfield></entry>
3176 <entry><type>name</type></entry>
3178 <entry>The textual label for this enum value</entry>
3185 The OIDs for <structname>pg_enum</structname> rows follow a special
3186 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3187 as the sort ordering of their enum type. That is, if two even OIDs
3188 belong to the same enum type, the smaller OID must have the smaller
3189 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3190 need bear no relationship to the sort order. This rule allows the
3191 enum comparison routines to avoid catalog lookups in many common cases.
3192 The routines that create and alter enum types attempt to assign even
3193 OIDs to enum values whenever possible.
3197 When an enum type is created, its members are assigned sort-order
3198 positions 1..<replaceable>n</>. But members added later might be given
3199 negative or fractional values of <structfield>enumsortorder</structfield>.
3200 The only requirement on these values is that they be correctly
3201 ordered and unique within each enum type.
3206 <sect1 id="catalog-pg-event-trigger">
3207 <title><structname>pg_event_trigger</structname></title>
3209 <indexterm zone="catalog-pg-event-trigger">
3210 <primary>pg_event_trigger</primary>
3214 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3215 See <xref linkend="event-triggers"> for more information.
3219 <title><structname>pg_event_trigger</> Columns</title>
3226 <entry>References</entry>
3227 <entry>Description</entry>
3233 <entry><structfield>evtname</structfield></entry>
3234 <entry><type>name</type></entry>
3236 <entry>Trigger name (must be unique)</entry>
3240 <entry><structfield>evtevent</structfield></entry>
3241 <entry><type>name</type></entry>
3243 <entry>Identifies the event for which this trigger fires</entry>
3247 <entry><structfield>evtowner</structfield></entry>
3248 <entry><type>oid</type></entry>
3249 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3250 <entry>Owner of the event trigger</entry>
3254 <entry><structfield>evtfoid</structfield></entry>
3255 <entry><type>oid</type></entry>
3256 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3257 <entry>The function to be called</entry>
3261 <entry><structfield>evtenabled</structfield></entry>
3262 <entry><type>char</type></entry>
3265 Controls in which <xref linkend="guc-session-replication-role"> modes
3266 the event trigger fires.
3267 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3268 <literal>D</> = trigger is disabled,
3269 <literal>R</> = trigger fires in <quote>replica</> mode,
3270 <literal>A</> = trigger fires always.
3275 <entry><structfield>evttags</structfield></entry>
3276 <entry><type>text[]</type></entry>
3279 Command tags for which this trigger will fire. If NULL, the firing
3280 of this trigger is not restricted on the basis of the command tag.
3289 <sect1 id="catalog-pg-extension">
3290 <title><structname>pg_extension</structname></title>
3292 <indexterm zone="catalog-pg-extension">
3293 <primary>pg_extension</primary>
3297 The catalog <structname>pg_extension</structname> stores information
3298 about the installed extensions. See <xref linkend="extend-extensions">
3299 for details about extensions.
3303 <title><structname>pg_extension</> Columns</title>
3310 <entry>References</entry>
3311 <entry>Description</entry>
3317 <entry><structfield>oid</structfield></entry>
3318 <entry><type>oid</type></entry>
3320 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3324 <entry><structfield>extname</structfield></entry>
3325 <entry><type>name</type></entry>
3327 <entry>Name of the extension</entry>
3331 <entry><structfield>extowner</structfield></entry>
3332 <entry><type>oid</type></entry>
3333 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3334 <entry>Owner of the extension</entry>
3338 <entry><structfield>extnamespace</structfield></entry>
3339 <entry><type>oid</type></entry>
3340 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3341 <entry>Schema containing the extension's exported objects</entry>
3345 <entry><structfield>extrelocatable</structfield></entry>
3346 <entry><type>bool</type></entry>
3348 <entry>True if extension can be relocated to another schema</entry>
3352 <entry><structfield>extversion</structfield></entry>
3353 <entry><type>text</type></entry>
3355 <entry>Version name for the extension</entry>
3359 <entry><structfield>extconfig</structfield></entry>
3360 <entry><type>oid[]</type></entry>
3361 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3362 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3363 table(s), or <literal>NULL</> if none</entry>
3367 <entry><structfield>extcondition</structfield></entry>
3368 <entry><type>text[]</type></entry>
3370 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3371 extension's configuration table(s), or <literal>NULL</> if none</entry>
3379 Note that unlike most catalogs with a <quote>namespace</> column,
3380 <structfield>extnamespace</structfield> is not meant to imply
3381 that the extension belongs to that schema. Extension names are never
3382 schema-qualified. Rather, <structfield>extnamespace</structfield>
3383 indicates the schema that contains most or all of the extension's
3384 objects. If <structfield>extrelocatable</structfield> is true, then
3385 this schema must in fact contain all schema-qualifiable objects
3386 belonging to the extension.
3391 <sect1 id="catalog-pg-foreign-data-wrapper">
3392 <title><structname>pg_foreign_data_wrapper</structname></title>
3394 <indexterm zone="catalog-pg-foreign-data-wrapper">
3395 <primary>pg_foreign_data_wrapper</primary>
3399 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3400 foreign-data wrapper definitions. A foreign-data wrapper is the
3401 mechanism by which external data, residing on foreign servers, is
3406 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3413 <entry>References</entry>
3414 <entry>Description</entry>
3420 <entry><structfield>oid</structfield></entry>
3421 <entry><type>oid</type></entry>
3423 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3427 <entry><structfield>fdwname</structfield></entry>
3428 <entry><type>name</type></entry>
3430 <entry>Name of the foreign-data wrapper</entry>
3434 <entry><structfield>fdwowner</structfield></entry>
3435 <entry><type>oid</type></entry>
3436 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3437 <entry>Owner of the foreign-data wrapper</entry>
3441 <entry><structfield>fdwhandler</structfield></entry>
3442 <entry><type>oid</type></entry>
3443 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3445 References a handler function that is responsible for
3446 supplying execution routines for the foreign-data wrapper.
3447 Zero if no handler is provided
3452 <entry><structfield>fdwvalidator</structfield></entry>
3453 <entry><type>oid</type></entry>
3454 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3456 References a validator function that is responsible for
3457 checking the validity of the options given to the
3458 foreign-data wrapper, as well as options for foreign servers and user
3459 mappings using the foreign-data wrapper. Zero if no validator
3465 <entry><structfield>fdwacl</structfield></entry>
3466 <entry><type>aclitem[]</type></entry>
3469 Access privileges; see
3470 <xref linkend="sql-grant"> and
3471 <xref linkend="sql-revoke">
3477 <entry><structfield>fdwoptions</structfield></entry>
3478 <entry><type>text[]</type></entry>
3481 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3490 <sect1 id="catalog-pg-foreign-server">
3491 <title><structname>pg_foreign_server</structname></title>
3493 <indexterm zone="catalog-pg-foreign-server">
3494 <primary>pg_foreign_server</primary>
3498 The catalog <structname>pg_foreign_server</structname> stores
3499 foreign server definitions. A foreign server describes a source
3500 of external data, such as a remote server. Foreign
3501 servers are accessed via foreign-data wrappers.
3505 <title><structname>pg_foreign_server</> Columns</title>
3512 <entry>References</entry>
3513 <entry>Description</entry>
3519 <entry><structfield>oid</structfield></entry>
3520 <entry><type>oid</type></entry>
3522 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3526 <entry><structfield>srvname</structfield></entry>
3527 <entry><type>name</type></entry>
3529 <entry>Name of the foreign server</entry>
3533 <entry><structfield>srvowner</structfield></entry>
3534 <entry><type>oid</type></entry>
3535 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3536 <entry>Owner of the foreign server</entry>
3540 <entry><structfield>srvfdw</structfield></entry>
3541 <entry><type>oid</type></entry>
3542 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3543 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3547 <entry><structfield>srvtype</structfield></entry>
3548 <entry><type>text</type></entry>
3550 <entry>Type of the server (optional)</entry>
3554 <entry><structfield>srvversion</structfield></entry>
3555 <entry><type>text</type></entry>
3557 <entry>Version of the server (optional)</entry>
3561 <entry><structfield>srvacl</structfield></entry>
3562 <entry><type>aclitem[]</type></entry>
3565 Access privileges; see
3566 <xref linkend="sql-grant"> and
3567 <xref linkend="sql-revoke">
3573 <entry><structfield>srvoptions</structfield></entry>
3574 <entry><type>text[]</type></entry>
3577 Foreign server specific options, as <quote>keyword=value</> strings
3586 <sect1 id="catalog-pg-foreign-table">
3587 <title><structname>pg_foreign_table</structname></title>
3589 <indexterm zone="catalog-pg-foreign-table">
3590 <primary>pg_foreign_table</primary>
3594 The catalog <structname>pg_foreign_table</structname> contains
3595 auxiliary information about foreign tables. A foreign table is
3596 primarily represented by a <structname>pg_class</structname> entry,
3597 just like a regular table. Its <structname>pg_foreign_table</structname>
3598 entry contains the information that is pertinent only to foreign tables
3599 and not any other kind of relation.
3603 <title><structname>pg_foreign_table</> Columns</title>
3610 <entry>References</entry>
3611 <entry>Description</entry>
3617 <entry><structfield>ftrelid</structfield></entry>
3618 <entry><type>oid</type></entry>
3619 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3620 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3624 <entry><structfield>ftserver</structfield></entry>
3625 <entry><type>oid</type></entry>
3626 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3627 <entry>OID of the foreign server for this foreign table</entry>
3631 <entry><structfield>ftoptions</structfield></entry>
3632 <entry><type>text[]</type></entry>
3635 Foreign table options, as <quote>keyword=value</> strings
3644 <sect1 id="catalog-pg-index">
3645 <title><structname>pg_index</structname></title>
3647 <indexterm zone="catalog-pg-index">
3648 <primary>pg_index</primary>
3652 The catalog <structname>pg_index</structname> contains part of the information
3653 about indexes. The rest is mostly in
3654 <structname>pg_class</structname>.
3658 <title><structname>pg_index</> Columns</title>
3665 <entry>References</entry>
3666 <entry>Description</entry>
3672 <entry><structfield>indexrelid</structfield></entry>
3673 <entry><type>oid</type></entry>
3674 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3675 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3679 <entry><structfield>indrelid</structfield></entry>
3680 <entry><type>oid</type></entry>
3681 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3682 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3686 <entry><structfield>indnatts</structfield></entry>
3687 <entry><type>int2</type></entry>
3689 <entry>The number of columns in the index (duplicates
3690 <literal>pg_class.relnatts</literal>)</entry>
3694 <entry><structfield>indisunique</structfield></entry>
3695 <entry><type>bool</type></entry>
3697 <entry>If true, this is a unique index</entry>
3701 <entry><structfield>indisprimary</structfield></entry>
3702 <entry><type>bool</type></entry>
3704 <entry>If true, this index represents the primary key of the table
3705 (<structfield>indisunique</> should always be true when this is true)</entry>
3709 <entry><structfield>indisexclusion</structfield></entry>
3710 <entry><type>bool</type></entry>
3712 <entry>If true, this index supports an exclusion constraint</entry>
3716 <entry><structfield>indimmediate</structfield></entry>
3717 <entry><type>bool</type></entry>
3719 <entry>If true, the uniqueness check is enforced immediately on
3721 (irrelevant if <structfield>indisunique</> is not true)</entry>
3725 <entry><structfield>indisclustered</structfield></entry>
3726 <entry><type>bool</type></entry>
3728 <entry>If true, the table was last clustered on this index</entry>
3732 <entry><structfield>indisvalid</structfield></entry>
3733 <entry><type>bool</type></entry>
3736 If true, the index is currently valid for queries. False means the
3737 index is possibly incomplete: it must still be modified by
3738 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3739 be used for queries. If it is unique, the uniqueness property is not
3740 guaranteed true either.
3745 <entry><structfield>indcheckxmin</structfield></entry>
3746 <entry><type>bool</type></entry>
3749 If true, queries must not use the index until the <structfield>xmin</>
3750 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3751 event horizon, because the table may contain broken HOT chains with
3752 incompatible rows that they can see
3757 <entry><structfield>indisready</structfield></entry>
3758 <entry><type>bool</type></entry>
3761 If true, the index is currently ready for inserts. False means the
3762 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3768 <entry><structfield>indislive</structfield></entry>
3769 <entry><type>bool</type></entry>
3772 If false, the index is in process of being dropped, and should be
3773 ignored for all purposes (including HOT-safety decisions)
3778 <entry><structfield>indisreplident</structfield></entry>
3779 <entry><type>bool</type></entry>
3782 If true this index has been chosen as <quote>replica identity</>
3783 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3789 <entry><structfield>indkey</structfield></entry>
3790 <entry><type>int2vector</type></entry>
3791 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3793 This is an array of <structfield>indnatts</structfield> values that
3794 indicate which table columns this index indexes. For example a value
3795 of <literal>1 3</literal> would mean that the first and the third table
3796 columns make up the index key. A zero in this array indicates that the
3797 corresponding index attribute is an expression over the table columns,
3798 rather than a simple column reference.
3803 <entry><structfield>indcollation</structfield></entry>
3804 <entry><type>oidvector</type></entry>
3805 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3807 For each column in the index key, this contains the OID of the
3808 collation to use for the index.
3813 <entry><structfield>indclass</structfield></entry>
3814 <entry><type>oidvector</type></entry>
3815 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3817 For each column in the index key, this contains the OID of
3818 the operator class to use. See
3819 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3824 <entry><structfield>indoption</structfield></entry>
3825 <entry><type>int2vector</type></entry>
3828 This is an array of <structfield>indnatts</structfield> values that
3829 store per-column flag bits. The meaning of the bits is defined by
3830 the index's access method.
3835 <entry><structfield>indexprs</structfield></entry>
3836 <entry><type>pg_node_tree</type></entry>
3839 Expression trees (in <function>nodeToString()</function>
3840 representation) for index attributes that are not simple column
3841 references. This is a list with one element for each zero
3842 entry in <structfield>indkey</>. Null if all index attributes
3843 are simple references.
3848 <entry><structfield>indpred</structfield></entry>
3849 <entry><type>pg_node_tree</type></entry>
3852 Expression tree (in <function>nodeToString()</function>
3853 representation) for partial index predicate. Null if not a
3864 <sect1 id="catalog-pg-inherits">
3865 <title><structname>pg_inherits</structname></title>
3867 <indexterm zone="catalog-pg-inherits">
3868 <primary>pg_inherits</primary>
3872 The catalog <structname>pg_inherits</> records information about
3873 table inheritance hierarchies. There is one entry for each direct
3874 child table in the database. (Indirect inheritance can be determined
3875 by following chains of entries.)
3879 <title><structname>pg_inherits</> Columns</title>
3886 <entry>References</entry>
3887 <entry>Description</entry>
3893 <entry><structfield>inhrelid</structfield></entry>
3894 <entry><type>oid</type></entry>
3895 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3897 The OID of the child table
3902 <entry><structfield>inhparent</structfield></entry>
3903 <entry><type>oid</type></entry>
3904 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3906 The OID of the parent table
3911 <entry><structfield>inhseqno</structfield></entry>
3912 <entry><type>int4</type></entry>
3915 If there is more than one direct parent for a child table (multiple
3916 inheritance), this number tells the order in which the
3917 inherited columns are to be arranged. The count starts at 1.
3927 <sect1 id="catalog-pg-language">
3928 <title><structname>pg_language</structname></title>
3930 <indexterm zone="catalog-pg-language">
3931 <primary>pg_language</primary>
3935 The catalog <structname>pg_language</structname> registers
3936 languages in which you can write functions or stored procedures.
3937 See <xref linkend="sql-createlanguage">
3938 and <xref linkend="xplang"> for more information about language handlers.
3942 <title><structname>pg_language</> Columns</title>
3949 <entry>References</entry>
3950 <entry>Description</entry>
3956 <entry><structfield>oid</structfield></entry>
3957 <entry><type>oid</type></entry>
3959 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3963 <entry><structfield>lanname</structfield></entry>
3964 <entry><type>name</type></entry>
3966 <entry>Name of the language</entry>
3970 <entry><structfield>lanowner</structfield></entry>
3971 <entry><type>oid</type></entry>
3972 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3973 <entry>Owner of the language</entry>
3977 <entry><structfield>lanispl</structfield></entry>
3978 <entry><type>bool</type></entry>
3981 This is false for internal languages (such as
3982 <acronym>SQL</acronym>) and true for user-defined languages.
3983 Currently, <application>pg_dump</application> still uses this
3984 to determine which languages need to be dumped, but this might be
3985 replaced by a different mechanism in the future.
3990 <entry><structfield>lanpltrusted</structfield></entry>
3991 <entry><type>bool</type></entry>
3994 True if this is a trusted language, which means that it is believed
3995 not to grant access to anything outside the normal SQL execution
3996 environment. Only superusers can create functions in untrusted
4002 <entry><structfield>lanplcallfoid</structfield></entry>
4003 <entry><type>oid</type></entry>
4004 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4006 For noninternal languages this references the language
4007 handler, which is a special function that is responsible for
4008 executing all functions that are written in the particular
4014 <entry><structfield>laninline</structfield></entry>
4015 <entry><type>oid</type></entry>
4016 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4018 This references a function that is responsible for executing
4019 <quote>inline</> anonymous code blocks
4020 (<xref linkend="sql-do"> blocks).
4021 Zero if inline blocks are not supported.
4026 <entry><structfield>lanvalidator</structfield></entry>
4027 <entry><type>oid</type></entry>
4028 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4030 This references a language validator function that is responsible
4031 for checking the syntax and validity of new functions when they
4032 are created. Zero if no validator is provided.
4037 <entry><structfield>lanacl</structfield></entry>
4038 <entry><type>aclitem[]</type></entry>
4041 Access privileges; see
4042 <xref linkend="sql-grant"> and
4043 <xref linkend="sql-revoke">
4054 <sect1 id="catalog-pg-largeobject">
4055 <title><structname>pg_largeobject</structname></title>
4057 <indexterm zone="catalog-pg-largeobject">
4058 <primary>pg_largeobject</primary>
4062 The catalog <structname>pg_largeobject</structname> holds the data making up
4063 <quote>large objects</quote>. A large object is identified by an OID
4064 assigned when it is created. Each large object is broken into
4065 segments or <quote>pages</> small enough to be conveniently stored as rows
4066 in <structname>pg_largeobject</structname>.
4067 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4068 <literal>BLCKSZ/4</>, or typically 2 kB).
4072 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4073 associated with large objects. As a result,
4074 <structname>pg_largeobject</structname> was publicly readable and could be
4075 used to obtain the OIDs (and contents) of all large objects in the system.
4076 This is no longer the case; use
4077 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4078 to obtain a list of large object OIDs.
4082 <title><structname>pg_largeobject</> Columns</title>
4089 <entry>References</entry>
4090 <entry>Description</entry>
4096 <entry><structfield>loid</structfield></entry>
4097 <entry><type>oid</type></entry>
4098 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4099 <entry>Identifier of the large object that includes this page</entry>
4103 <entry><structfield>pageno</structfield></entry>
4104 <entry><type>int4</type></entry>
4106 <entry>Page number of this page within its large object
4107 (counting from zero)</entry>
4111 <entry><structfield>data</structfield></entry>
4112 <entry><type>bytea</type></entry>
4115 Actual data stored in the large object.
4116 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4124 Each row of <structname>pg_largeobject</structname> holds data
4125 for one page of a large object, beginning at
4126 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4127 allows sparse storage: pages might be missing, and might be shorter than
4128 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4129 Missing regions within a large object read as zeroes.
4134 <sect1 id="catalog-pg-largeobject-metadata">
4135 <title><structname>pg_largeobject_metadata</structname></title>
4137 <indexterm zone="catalog-pg-largeobject-metadata">
4138 <primary>pg_largeobject_metadata</primary>
4142 The catalog <structname>pg_largeobject_metadata</structname>
4143 holds metadata associated with large objects. The actual large object
4145 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4149 <title><structname>pg_largeobject_metadata</> Columns</title>
4156 <entry>References</entry>
4157 <entry>Description</entry>
4163 <entry><structfield>oid</structfield></entry>
4164 <entry><type>oid</type></entry>
4166 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4170 <entry><structfield>lomowner</structfield></entry>
4171 <entry><type>oid</type></entry>
4172 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4173 <entry>Owner of the large object</entry>
4177 <entry><structfield>lomacl</structfield></entry>
4178 <entry><type>aclitem[]</type></entry>
4181 Access privileges; see
4182 <xref linkend="sql-grant"> and
4183 <xref linkend="sql-revoke">
4193 <sect1 id="catalog-pg-namespace">
4194 <title><structname>pg_namespace</structname></title>
4196 <indexterm zone="catalog-pg-namespace">
4197 <primary>pg_namespace</primary>
4201 The catalog <structname>pg_namespace</> stores namespaces.
4202 A namespace is the structure underlying SQL schemas: each namespace
4203 can have a separate collection of relations, types, etc. without name
4208 <title><structname>pg_namespace</> Columns</title>
4215 <entry>References</entry>
4216 <entry>Description</entry>
4222 <entry><structfield>oid</structfield></entry>
4223 <entry><type>oid</type></entry>
4225 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4229 <entry><structfield>nspname</structfield></entry>
4230 <entry><type>name</type></entry>
4232 <entry>Name of the namespace</entry>
4236 <entry><structfield>nspowner</structfield></entry>
4237 <entry><type>oid</type></entry>
4238 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4239 <entry>Owner of the namespace</entry>
4243 <entry><structfield>nspacl</structfield></entry>
4244 <entry><type>aclitem[]</type></entry>
4247 Access privileges; see
4248 <xref linkend="sql-grant"> and
4249 <xref linkend="sql-revoke">
4260 <sect1 id="catalog-pg-opclass">
4261 <title><structname>pg_opclass</structname></title>
4263 <indexterm zone="catalog-pg-opclass">
4264 <primary>pg_opclass</primary>
4268 The catalog <structname>pg_opclass</structname> defines
4269 index access method operator classes. Each operator class defines
4270 semantics for index columns of a particular data type and a particular
4271 index access method. An operator class essentially specifies that a
4272 particular operator family is applicable to a particular indexable column
4273 data type. The set of operators from the family that are actually usable
4274 with the indexed column are whichever ones accept the column's data type
4275 as their left-hand input.
4279 Operator classes are described at length in <xref linkend="xindex">.
4283 <title><structname>pg_opclass</> Columns</title>
4290 <entry>References</entry>
4291 <entry>Description</entry>
4297 <entry><structfield>oid</structfield></entry>
4298 <entry><type>oid</type></entry>
4300 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4304 <entry><structfield>opcmethod</structfield></entry>
4305 <entry><type>oid</type></entry>
4306 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4307 <entry>Index access method operator class is for</entry>
4311 <entry><structfield>opcname</structfield></entry>
4312 <entry><type>name</type></entry>
4314 <entry>Name of this operator class</entry>
4318 <entry><structfield>opcnamespace</structfield></entry>
4319 <entry><type>oid</type></entry>
4320 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4321 <entry>Namespace of this operator class</entry>
4325 <entry><structfield>opcowner</structfield></entry>
4326 <entry><type>oid</type></entry>
4327 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4328 <entry>Owner of the operator class</entry>
4332 <entry><structfield>opcfamily</structfield></entry>
4333 <entry><type>oid</type></entry>
4334 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4335 <entry>Operator family containing the operator class</entry>
4339 <entry><structfield>opcintype</structfield></entry>
4340 <entry><type>oid</type></entry>
4341 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4342 <entry>Data type that the operator class indexes</entry>
4346 <entry><structfield>opcdefault</structfield></entry>
4347 <entry><type>bool</type></entry>
4349 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4353 <entry><structfield>opckeytype</structfield></entry>
4354 <entry><type>oid</type></entry>
4355 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4356 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4364 An operator class's <structfield>opcmethod</> must match the
4365 <structname>opfmethod</> of its containing operator family.
4366 Also, there must be no more than one <structname>pg_opclass</structname>
4367 row having <structname>opcdefault</> true for any given combination of
4368 <structname>opcmethod</> and <structname>opcintype</>.
4374 <sect1 id="catalog-pg-operator">
4375 <title><structname>pg_operator</structname></title>
4377 <indexterm zone="catalog-pg-operator">
4378 <primary>pg_operator</primary>
4382 The catalog <structname>pg_operator</> stores information about operators.
4383 See <xref linkend="sql-createoperator">
4384 and <xref linkend="xoper"> for more information.
4388 <title><structname>pg_operator</> Columns</title>
4395 <entry>References</entry>
4396 <entry>Description</entry>
4402 <entry><structfield>oid</structfield></entry>
4403 <entry><type>oid</type></entry>
4405 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4409 <entry><structfield>oprname</structfield></entry>
4410 <entry><type>name</type></entry>
4412 <entry>Name of the operator</entry>
4416 <entry><structfield>oprnamespace</structfield></entry>
4417 <entry><type>oid</type></entry>
4418 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4420 The OID of the namespace that contains this operator
4425 <entry><structfield>oprowner</structfield></entry>
4426 <entry><type>oid</type></entry>
4427 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4428 <entry>Owner of the operator</entry>
4432 <entry><structfield>oprkind</structfield></entry>
4433 <entry><type>char</type></entry>
4436 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4437 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4442 <entry><structfield>oprcanmerge</structfield></entry>
4443 <entry><type>bool</type></entry>
4445 <entry>This operator supports merge joins</entry>
4449 <entry><structfield>oprcanhash</structfield></entry>
4450 <entry><type>bool</type></entry>
4452 <entry>This operator supports hash joins</entry>
4456 <entry><structfield>oprleft</structfield></entry>
4457 <entry><type>oid</type></entry>
4458 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4459 <entry>Type of the left operand</entry>
4463 <entry><structfield>oprright</structfield></entry>
4464 <entry><type>oid</type></entry>
4465 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4466 <entry>Type of the right operand</entry>
4470 <entry><structfield>oprresult</structfield></entry>
4471 <entry><type>oid</type></entry>
4472 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4473 <entry>Type of the result</entry>
4477 <entry><structfield>oprcom</structfield></entry>
4478 <entry><type>oid</type></entry>
4479 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4480 <entry>Commutator of this operator, if any</entry>
4484 <entry><structfield>oprnegate</structfield></entry>
4485 <entry><type>oid</type></entry>
4486 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4487 <entry>Negator of this operator, if any</entry>
4491 <entry><structfield>oprcode</structfield></entry>
4492 <entry><type>regproc</type></entry>
4493 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4494 <entry>Function that implements this operator</entry>
4498 <entry><structfield>oprrest</structfield></entry>
4499 <entry><type>regproc</type></entry>
4500 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4501 <entry>Restriction selectivity estimation function for this operator</entry>
4505 <entry><structfield>oprjoin</structfield></entry>
4506 <entry><type>regproc</type></entry>
4507 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4508 <entry>Join selectivity estimation function for this operator</entry>
4515 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4516 is zero for a prefix operator.
4522 <sect1 id="catalog-pg-opfamily">
4523 <title><structname>pg_opfamily</structname></title>
4525 <indexterm zone="catalog-pg-opfamily">
4526 <primary>pg_opfamily</primary>
4530 The catalog <structname>pg_opfamily</structname> defines operator families.
4531 Each operator family is a collection of operators and associated
4532 support routines that implement the semantics specified for a particular
4533 index access method. Furthermore, the operators in a family are all
4534 <quote>compatible</>, in a way that is specified by the access method.
4535 The operator family concept allows cross-data-type operators to be used
4536 with indexes and to be reasoned about using knowledge of access method
4541 Operator families are described at length in <xref linkend="xindex">.
4545 <title><structname>pg_opfamily</> Columns</title>
4552 <entry>References</entry>
4553 <entry>Description</entry>
4559 <entry><structfield>oid</structfield></entry>
4560 <entry><type>oid</type></entry>
4562 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4566 <entry><structfield>opfmethod</structfield></entry>
4567 <entry><type>oid</type></entry>
4568 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4569 <entry>Index access method operator family is for</entry>
4573 <entry><structfield>opfname</structfield></entry>
4574 <entry><type>name</type></entry>
4576 <entry>Name of this operator family</entry>
4580 <entry><structfield>opfnamespace</structfield></entry>
4581 <entry><type>oid</type></entry>
4582 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4583 <entry>Namespace of this operator family</entry>
4587 <entry><structfield>opfowner</structfield></entry>
4588 <entry><type>oid</type></entry>
4589 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4590 <entry>Owner of the operator family</entry>
4598 The majority of the information defining an operator family is not in its
4599 <structname>pg_opfamily</structname> row, but in the associated rows in
4600 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4601 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4603 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4609 <sect1 id="catalog-pg-pltemplate">
4610 <title><structname>pg_pltemplate</structname></title>
4612 <indexterm zone="catalog-pg-pltemplate">
4613 <primary>pg_pltemplate</primary>
4617 The catalog <structname>pg_pltemplate</structname> stores
4618 <quote>template</> information for procedural languages.
4619 A template for a language allows the language to be created in a
4620 particular database by a simple <command>CREATE LANGUAGE</> command,
4621 with no need to specify implementation details.
4625 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4626 is shared across all databases of a cluster: there is only one
4627 copy of <structname>pg_pltemplate</structname> per cluster, not
4628 one per database. This allows the information to be accessible in
4629 each database as it is needed.
4633 <title><structname>pg_pltemplate</> Columns</title>
4640 <entry>Description</entry>
4646 <entry><structfield>tmplname</structfield></entry>
4647 <entry><type>name</type></entry>
4648 <entry>Name of the language this template is for</entry>
4652 <entry><structfield>tmpltrusted</structfield></entry>
4653 <entry><type>boolean</type></entry>
4654 <entry>True if language is considered trusted</entry>
4658 <entry><structfield>tmpldbacreate</structfield></entry>
4659 <entry><type>boolean</type></entry>
4660 <entry>True if language may be created by a database owner</entry>
4664 <entry><structfield>tmplhandler</structfield></entry>
4665 <entry><type>text</type></entry>
4666 <entry>Name of call handler function</entry>
4670 <entry><structfield>tmplinline</structfield></entry>
4671 <entry><type>text</type></entry>
4672 <entry>Name of anonymous-block handler function, or null if none</entry>
4676 <entry><structfield>tmplvalidator</structfield></entry>
4677 <entry><type>text</type></entry>
4678 <entry>Name of validator function, or null if none</entry>
4682 <entry><structfield>tmpllibrary</structfield></entry>
4683 <entry><type>text</type></entry>
4684 <entry>Path of shared library that implements language</entry>
4688 <entry><structfield>tmplacl</structfield></entry>
4689 <entry><type>aclitem[]</type></entry>
4690 <entry>Access privileges for template (not actually used)</entry>
4698 There are not currently any commands that manipulate procedural language
4699 templates; to change the built-in information, a superuser must modify
4700 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4701 or <command>UPDATE</command> commands.
4706 It is likely that <structname>pg_pltemplate</> will be removed in some
4707 future release of <productname>PostgreSQL</productname>, in favor of
4708 keeping this knowledge about procedural languages in their respective
4709 extension installation scripts.
4716 <sect1 id="catalog-pg-proc">
4717 <title><structname>pg_proc</structname></title>
4719 <indexterm zone="catalog-pg-proc">
4720 <primary>pg_proc</primary>
4724 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4725 See <xref linkend="sql-createfunction">
4726 and <xref linkend="xfunc"> for more information.
4730 The table contains data for aggregate functions as well as plain functions.
4731 If <structfield>proisagg</structfield> is true, there should be a matching
4732 row in <structfield>pg_aggregate</structfield>.
4736 <title><structname>pg_proc</> Columns</title>
4743 <entry>References</entry>
4744 <entry>Description</entry>
4750 <entry><structfield>oid</structfield></entry>
4751 <entry><type>oid</type></entry>
4753 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4757 <entry><structfield>proname</structfield></entry>
4758 <entry><type>name</type></entry>
4760 <entry>Name of the function</entry>
4764 <entry><structfield>pronamespace</structfield></entry>
4765 <entry><type>oid</type></entry>
4766 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4768 The OID of the namespace that contains this function
4773 <entry><structfield>proowner</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>Owner of the function</entry>
4780 <entry><structfield>prolang</structfield></entry>
4781 <entry><type>oid</type></entry>
4782 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4783 <entry>Implementation language or call interface of this function</entry>
4787 <entry><structfield>procost</structfield></entry>
4788 <entry><type>float4</type></entry>
4790 <entry>Estimated execution cost (in units of
4791 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4792 this is cost per row returned</entry>
4796 <entry><structfield>prorows</structfield></entry>
4797 <entry><type>float4</type></entry>
4799 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4803 <entry><structfield>provariadic</structfield></entry>
4804 <entry><type>oid</type></entry>
4805 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4806 <entry>Data type of the variadic array parameter's elements,
4807 or zero if the function does not have a variadic parameter</entry>
4811 <entry><structfield>protransform</structfield></entry>
4812 <entry><type>regproc</type></entry>
4813 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4814 <entry>Calls to this function can be simplified by this other function
4815 (see <xref linkend="xfunc-transform-functions">)</entry>
4819 <entry><structfield>proisagg</structfield></entry>
4820 <entry><type>bool</type></entry>
4822 <entry>Function is an aggregate function</entry>
4826 <entry><structfield>proiswindow</structfield></entry>
4827 <entry><type>bool</type></entry>
4829 <entry>Function is a window function</entry>
4833 <entry><structfield>prosecdef</structfield></entry>
4834 <entry><type>bool</type></entry>
4836 <entry>Function is a security definer (i.e., a <quote>setuid</>
4841 <entry><structfield>proleakproof</structfield></entry>
4842 <entry><type>bool</type></entry>
4845 The function has no side effects. No information about the
4846 arguments is conveyed except via the return value. Any function
4847 that might throw an error depending on the values of its arguments
4853 <entry><structfield>proisstrict</structfield></entry>
4854 <entry><type>bool</type></entry>
4857 Function returns null if any call argument is null. In that
4858 case the function won't actually be called at all. Functions
4859 that are not <quote>strict</quote> must be prepared to handle
4865 <entry><structfield>proretset</structfield></entry>
4866 <entry><type>bool</type></entry>
4868 <entry>Function returns a set (i.e., multiple values of the specified
4873 <entry><structfield>provolatile</structfield></entry>
4874 <entry><type>char</type></entry>
4877 <structfield>provolatile</structfield> tells whether the function's
4878 result depends only on its input arguments, or is affected by outside
4880 It is <literal>i</literal> for <quote>immutable</> functions,
4881 which always deliver the same result for the same inputs.
4882 It is <literal>s</literal> for <quote>stable</> functions,
4883 whose results (for fixed inputs) do not change within a scan.
4884 It is <literal>v</literal> for <quote>volatile</> functions,
4885 whose results might change at any time. (Use <literal>v</literal> also
4886 for functions with side-effects, so that calls to them cannot get
4892 <entry><structfield>pronargs</structfield></entry>
4893 <entry><type>int2</type></entry>
4895 <entry>Number of input arguments</entry>
4899 <entry><structfield>pronargdefaults</structfield></entry>
4900 <entry><type>int2</type></entry>
4902 <entry>Number of arguments that have defaults</entry>
4906 <entry><structfield>prorettype</structfield></entry>
4907 <entry><type>oid</type></entry>
4908 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4909 <entry>Data type of the return value</entry>
4913 <entry><structfield>proargtypes</structfield></entry>
4914 <entry><type>oidvector</type></entry>
4915 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4917 An array with the data types of the function arguments. This includes
4918 only input arguments (including <literal>INOUT</literal> and
4919 <literal>VARIADIC</> arguments), and thus represents
4920 the call signature of the function.
4925 <entry><structfield>proallargtypes</structfield></entry>
4926 <entry><type>oid[]</type></entry>
4927 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4929 An array with the data types of the function arguments. This includes
4930 all arguments (including <literal>OUT</literal> and
4931 <literal>INOUT</literal> arguments); however, if all the
4932 arguments are <literal>IN</literal> arguments, this field will be null.
4933 Note that subscripting is 1-based, whereas for historical reasons
4934 <structfield>proargtypes</> is subscripted from 0.
4939 <entry><structfield>proargmodes</structfield></entry>
4940 <entry><type>char[]</type></entry>
4943 An array with the modes of the function arguments, encoded as
4944 <literal>i</literal> for <literal>IN</> arguments,
4945 <literal>o</literal> for <literal>OUT</> arguments,
4946 <literal>b</literal> for <literal>INOUT</> arguments,
4947 <literal>v</literal> for <literal>VARIADIC</> arguments,
4948 <literal>t</literal> for <literal>TABLE</> arguments.
4949 If all the arguments are <literal>IN</literal> arguments,
4950 this field will be null.
4951 Note that subscripts correspond to positions of
4952 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4957 <entry><structfield>proargnames</structfield></entry>
4958 <entry><type>text[]</type></entry>
4961 An array with the names of the function arguments.
4962 Arguments without a name are set to empty strings in the array.
4963 If none of the arguments have a name, this field will be null.
4964 Note that subscripts correspond to positions of
4965 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4970 <entry><structfield>proargdefaults</structfield></entry>
4971 <entry><type>pg_node_tree</type></entry>
4974 Expression trees (in <function>nodeToString()</function> representation)
4975 for default values. This is a list with
4976 <structfield>pronargdefaults</> elements, corresponding to the last
4977 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
4978 <replaceable>N</> <structfield>proargtypes</> positions).
4979 If none of the arguments have defaults, this field will be null.
4984 <entry><structfield>prosrc</structfield></entry>
4985 <entry><type>text</type></entry>
4988 This tells the function handler how to invoke the function. It
4989 might be the actual source code of the function for interpreted
4990 languages, a link symbol, a file name, or just about anything
4991 else, depending on the implementation language/call convention.
4996 <entry><structfield>probin</structfield></entry>
4997 <entry><type>text</type></entry>
5000 Additional information about how to invoke the function.
5001 Again, the interpretation is language-specific.
5006 <entry><structfield>proconfig</structfield></entry>
5007 <entry><type>text[]</type></entry>
5009 <entry>Function's local settings for run-time configuration variables</entry>
5013 <entry><structfield>proacl</structfield></entry>
5014 <entry><type>aclitem[]</type></entry>
5017 Access privileges; see
5018 <xref linkend="sql-grant"> and
5019 <xref linkend="sql-revoke">
5028 For compiled functions, both built-in and dynamically loaded,
5029 <structfield>prosrc</structfield> contains the function's C-language
5030 name (link symbol). For all other currently-known language types,
5031 <structfield>prosrc</structfield> contains the function's source
5032 text. <structfield>probin</structfield> is unused except for
5033 dynamically-loaded C functions, for which it gives the name of the
5034 shared library file containing the function.
5039 <sect1 id="catalog-pg-range">
5040 <title><structname>pg_range</structname></title>
5042 <indexterm zone="catalog-pg-range">
5043 <primary>pg_range</primary>
5047 The catalog <structname>pg_range</structname> stores information about
5048 range types. This is in addition to the types' entries in
5049 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5053 <title><structname>pg_range</> Columns</title>
5060 <entry>References</entry>
5061 <entry>Description</entry>
5067 <entry><structfield>rngtypid</structfield></entry>
5068 <entry><type>oid</type></entry>
5069 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5070 <entry>OID of the range type</entry>
5074 <entry><structfield>rngsubtype</structfield></entry>
5075 <entry><type>oid</type></entry>
5076 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5077 <entry>OID of the element type (subtype) of this range type</entry>
5081 <entry><structfield>rngcollation</structfield></entry>
5082 <entry><type>oid</type></entry>
5083 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5084 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5088 <entry><structfield>rngsubopc</structfield></entry>
5089 <entry><type>oid</type></entry>
5090 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5091 <entry>OID of the subtype's operator class used for range comparisons</entry>
5095 <entry><structfield>rngcanonical</structfield></entry>
5096 <entry><type>regproc</type></entry>
5097 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5098 <entry>OID of the function to convert a range value into canonical form,
5099 or 0 if none</entry>
5103 <entry><structfield>rngsubdiff</structfield></entry>
5104 <entry><type>regproc</type></entry>
5105 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5106 <entry>OID of the function to return the difference between two element
5107 values as <type>double precision</type>, or 0 if none</entry>
5114 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5115 element type is collatable) determines the sort ordering used by the range
5116 type. <structfield>rngcanonical</> is used when the element type is
5117 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5118 improve performance of GiST indexes on the range type.
5123 <sect1 id="catalog-pg-rewrite">
5124 <title><structname>pg_rewrite</structname></title>
5126 <indexterm zone="catalog-pg-rewrite">
5127 <primary>pg_rewrite</primary>
5131 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5135 <title><structname>pg_rewrite</> Columns</title>
5142 <entry>References</entry>
5143 <entry>Description</entry>
5149 <entry><structfield>oid</structfield></entry>
5150 <entry><type>oid</type></entry>
5152 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5156 <entry><structfield>rulename</structfield></entry>
5157 <entry><type>name</type></entry>
5159 <entry>Rule name</entry>
5163 <entry><structfield>ev_class</structfield></entry>
5164 <entry><type>oid</type></entry>
5165 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5166 <entry>The table this rule is for</entry>
5170 <entry><structfield>ev_type</structfield></entry>
5171 <entry><type>char</type></entry>
5174 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5175 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5181 <entry><structfield>ev_enabled</structfield></entry>
5182 <entry><type>char</type></entry>
5185 Controls in which <xref linkend="guc-session-replication-role"> modes
5187 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5188 <literal>D</> = rule is disabled,
5189 <literal>R</> = rule fires in <quote>replica</> mode,
5190 <literal>A</> = rule fires always.
5195 <entry><structfield>is_instead</structfield></entry>
5196 <entry><type>bool</type></entry>
5198 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5202 <entry><structfield>ev_qual</structfield></entry>
5203 <entry><type>pg_node_tree</type></entry>
5206 Expression tree (in the form of a
5207 <function>nodeToString()</function> representation) for the
5208 rule's qualifying condition
5213 <entry><structfield>ev_action</structfield></entry>
5214 <entry><type>pg_node_tree</type></entry>
5217 Query tree (in the form of a
5218 <function>nodeToString()</function> representation) for the
5228 <literal>pg_class.relhasrules</literal>
5229 must be true if a table has any rules in this catalog.
5235 <sect1 id="catalog-pg-replication-slots">
5236 <title><structname>pg_replication_slots</structname></title>
5238 <indexterm zone="catalog-pg-replication-slots">
5239 <primary>pg_replication_slots</primary>
5243 The <structname>pg_replication_slots</structname> view provides a listing
5244 of all replication slots that currently exist on the database cluster,
5245 along with their current state.
5249 For more on replication slots,
5250 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
5255 <title><structname>pg_replication_slots</structname> Columns</title>
5262 <entry>References</entry>
5263 <entry>Description</entry>
5269 <entry><structfield>slot_name</structfield></entry>
5270 <entry><type>name</type></entry>
5272 <entry>A unique, cluster-wide identifier for the replication slot</entry>
5276 <entry><structfield>plugin</structfield></entry>
5277 <entry><type>name</type></entry>
5279 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
5283 <entry><structfield>slot_type</structfield></entry>
5284 <entry><type>text</type></entry>
5286 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
5290 <entry><structfield>datoid</structfield></entry>
5291 <entry><type>oid</type></entry>
5292 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5293 <entry>The OID of the database this slot is associated with, or
5294 null. Only logical slots have an associated database.</entry>
5298 <entry><structfield>database</structfield></entry>
5299 <entry><type>text</type></entry>
5300 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5301 <entry>The name of the database this slot is associated with, or
5302 null. Only logical slots have an associated database.</entry>
5306 <entry><structfield>active</structfield></entry>
5307 <entry><type>boolean</type></entry>
5309 <entry>True if this slot is currently actively being used</entry>
5313 <entry><structfield>xmin</structfield></entry>
5314 <entry><type>xid</type></entry>
5316 <entry>The oldest transaction that this slot needs the database to
5317 retain. <literal>VACUUM</literal> cannot remove tuples deleted
5318 by any later transaction.
5323 <entry><structfield>catalog_xmin</structfield></entry>
5324 <entry><type>xid</type></entry>
5326 <entry>The oldest transaction affecting the system catalogs that this
5327 slot needs the database to retain. <literal>VACUUM</literal> cannot
5328 remove catalog tuples deleted by any later transaction.
5333 <entry><structfield>restart_lsn</structfield></entry>
5334 <entry><type>pg_lsn</type></entry>
5336 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
5337 might be required by the consumer of this slot and thus won't be
5338 automatically removed during checkpoints.
5346 <sect1 id="catalog-pg-rowsecurity">
5347 <title><structname>pg_rowsecurity</structname></title>
5349 <indexterm zone="catalog-pg-rowsecurity">
5350 <primary>pg_rowsecurity</primary>
5354 The catalog <structname>pg_rowsecurity</structname> stores row-level
5355 security policies for each table. A policy includes the kind of
5356 command which it applies to (or all commands), the roles which it
5357 applies to, the expression to be added as a security-barrier
5358 qualification to queries which include the table and the expression
5359 to be added as a with-check option for queries which attempt to add
5360 new records to the table.
5365 <title><structname>pg_rowsecurity</structname> Columns</title>
5372 <entry>References</entry>
5373 <entry>Description</entry>
5379 <entry><structfield>rsecpolname</structfield></entry>
5380 <entry><type>name</type></entry>
5382 <entry>The name of the row-security policy</entry>
5386 <entry><structfield>rsecrelid</structfield></entry>
5387 <entry><type>oid</type></entry>
5388 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5389 <entry>The table to which the row-security policy belongs</entry>
5393 <entry><structfield>rseccmd</structfield></entry>
5394 <entry><type>char</type></entry>
5396 <entry>The command type to which the row-security policy is applied.</entry>
5400 <entry><structfield>rsecroles</structfield></entry>
5401 <entry><type>char</type></entry>
5403 <entry>The roles to which the row-security policy is applied.</entry>
5407 <entry><structfield>rsecqual</structfield></entry>
5408 <entry><type>pg_node_tree</type></entry>
5410 <entry>The expression tree to be added to the security barrier qualifications for queries which use the table.</entry>
5414 <entry><structfield>rsecwithcheck</structfield></entry>
5415 <entry><type>pg_node_tree</type></entry>
5417 <entry>The expression tree to be added to the with check qualifications for queries which attempt to add rows to the table.</entry>
5426 <literal>pg_class.relrowsecurity</literal>
5427 True if the table has row-security enabled. Policies will not be applied
5428 unless row-security is enabled on the table.
5434 <sect1 id="catalog-pg-seclabel">
5435 <title><structname>pg_seclabel</structname></title>
5437 <indexterm zone="catalog-pg-seclabel">
5438 <primary>pg_seclabel</primary>
5442 The catalog <structname>pg_seclabel</structname> stores security
5443 labels on database objects. Security labels can be manipulated
5444 with the <xref linkend="sql-security-label"> command. For an easier
5445 way to view security labels, see <xref linkend="view-pg-seclabels">.
5449 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5450 which performs a similar function for security labels of database objects
5451 that are shared across a database cluster.
5455 <title><structname>pg_seclabel</structname> Columns</title>
5462 <entry>References</entry>
5463 <entry>Description</entry>
5469 <entry><structfield>objoid</structfield></entry>
5470 <entry><type>oid</type></entry>
5471 <entry>any OID column</entry>
5472 <entry>The OID of the object this security label pertains to</entry>
5476 <entry><structfield>classoid</structfield></entry>
5477 <entry><type>oid</type></entry>
5478 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5479 <entry>The OID of the system catalog this object appears in</entry>
5483 <entry><structfield>objsubid</structfield></entry>
5484 <entry><type>int4</type></entry>
5487 For a security label on a table column, this is the column number (the
5488 <structfield>objoid</> and <structfield>classoid</> refer to
5489 the table itself). For all other object types, this column is
5495 <entry><structfield>provider</structfield></entry>
5496 <entry><type>text</type></entry>
5498 <entry>The label provider associated with this label.</entry>
5502 <entry><structfield>label</structfield></entry>
5503 <entry><type>text</type></entry>
5505 <entry>The security label applied to this object.</entry>
5512 <sect1 id="catalog-pg-shdepend">
5513 <title><structname>pg_shdepend</structname></title>
5515 <indexterm zone="catalog-pg-shdepend">
5516 <primary>pg_shdepend</primary>
5520 The catalog <structname>pg_shdepend</structname> records the
5521 dependency relationships between database objects and shared objects,
5522 such as roles. This information allows
5523 <productname>PostgreSQL</productname> to ensure that those objects are
5524 unreferenced before attempting to delete them.
5528 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5529 which performs a similar function for dependencies involving objects
5530 within a single database.
5534 Unlike most system catalogs, <structname>pg_shdepend</structname>
5535 is shared across all databases of a cluster: there is only one
5536 copy of <structname>pg_shdepend</structname> per cluster, not
5541 <title><structname>pg_shdepend</> Columns</title>
5548 <entry>References</entry>
5549 <entry>Description</entry>
5555 <entry><structfield>dbid</structfield></entry>
5556 <entry><type>oid</type></entry>
5557 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5558 <entry>The OID of the database the dependent object is in,
5559 or zero for a shared object</entry>
5563 <entry><structfield>classid</structfield></entry>
5564 <entry><type>oid</type></entry>
5565 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5566 <entry>The OID of the system catalog the dependent object is in</entry>
5570 <entry><structfield>objid</structfield></entry>
5571 <entry><type>oid</type></entry>
5572 <entry>any OID column</entry>
5573 <entry>The OID of the specific dependent object</entry>
5577 <entry><structfield>objsubid</structfield></entry>
5578 <entry><type>int4</type></entry>
5581 For a table column, this is the column number (the
5582 <structfield>objid</> and <structfield>classid</> refer to the
5583 table itself). For all other object types, this column is zero.
5588 <entry><structfield>refclassid</structfield></entry>
5589 <entry><type>oid</type></entry>
5590 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5591 <entry>The OID of the system catalog the referenced object is in
5592 (must be a shared catalog)</entry>
5596 <entry><structfield>refobjid</structfield></entry>
5597 <entry><type>oid</type></entry>
5598 <entry>any OID column</entry>
5599 <entry>The OID of the specific referenced object</entry>
5603 <entry><structfield>deptype</structfield></entry>
5604 <entry><type>char</type></entry>
5607 A code defining the specific semantics of this dependency relationship; see text
5616 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5617 the referenced object cannot be dropped without also dropping the dependent
5618 object. However, there are several subflavors identified by
5619 <structfield>deptype</>:
5623 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5626 The referenced object (which must be a role) is the owner of the
5633 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5636 The referenced object (which must be a role) is mentioned in the
5637 ACL (access control list, i.e., privileges list) of the
5638 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5639 not made for the owner of the object, since the owner will have
5640 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5646 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5649 There is no dependent object; this type of entry is a signal
5650 that the system itself depends on the referenced object, and so
5651 that object must never be deleted. Entries of this type are
5652 created only by <command>initdb</command>. The columns for the
5653 dependent object contain zeroes.
5659 Other dependency flavors might be needed in future. Note in particular
5660 that the current definition only supports roles as referenced objects.
5665 <sect1 id="catalog-pg-shdescription">
5666 <title><structname>pg_shdescription</structname></title>
5668 <indexterm zone="catalog-pg-shdescription">
5669 <primary>pg_shdescription</primary>
5673 The catalog <structname>pg_shdescription</structname> stores optional
5674 descriptions (comments) for shared database objects. Descriptions can be
5675 manipulated with the <xref linkend="sql-comment"> command and viewed with
5676 <application>psql</application>'s <literal>\d</literal> commands.
5680 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5681 which performs a similar function for descriptions involving objects
5682 within a single database.
5686 Unlike most system catalogs, <structname>pg_shdescription</structname>
5687 is shared across all databases of a cluster: there is only one
5688 copy of <structname>pg_shdescription</structname> per cluster, not
5693 <title><structname>pg_shdescription</> Columns</title>
5700 <entry>References</entry>
5701 <entry>Description</entry>
5707 <entry><structfield>objoid</structfield></entry>
5708 <entry><type>oid</type></entry>
5709 <entry>any OID column</entry>
5710 <entry>The OID of the object this description pertains to</entry>
5714 <entry><structfield>classoid</structfield></entry>
5715 <entry><type>oid</type></entry>
5716 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5717 <entry>The OID of the system catalog this object appears in</entry>
5721 <entry><structfield>description</structfield></entry>
5722 <entry><type>text</type></entry>
5724 <entry>Arbitrary text that serves as the description of this object</entry>
5732 <sect1 id="catalog-pg-shseclabel">
5733 <title><structname>pg_shseclabel</structname></title>
5735 <indexterm zone="catalog-pg-shseclabel">
5736 <primary>pg_shseclabel</primary>
5740 The catalog <structname>pg_shseclabel</structname> stores security
5741 labels on shared database objects. Security labels can be manipulated
5742 with the <xref linkend="sql-security-label"> command. For an easier
5743 way to view security labels, see <xref linkend="view-pg-seclabels">.
5747 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5748 which performs a similar function for security labels involving objects
5749 within a single database.
5753 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5754 is shared across all databases of a cluster: there is only one
5755 copy of <structname>pg_shseclabel</structname> per cluster, not
5760 <title><structname>pg_shseclabel</structname> Columns</title>
5766 <entry>References</entry>
5767 <entry>Description</entry>
5772 <entry><structfield>objoid</structfield></entry>
5773 <entry><type>oid</type></entry>
5774 <entry>any OID column</entry>
5775 <entry>The OID of the object this security label pertains to</entry>
5778 <entry><structfield>classoid</structfield></entry>
5779 <entry><type>oid</type></entry>
5780 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5781 <entry>The OID of the system catalog this object appears in</entry>
5784 <entry><structfield>provider</structfield></entry>
5785 <entry><type>text</type></entry>
5787 <entry>The label provider associated with this label.</entry>
5790 <entry><structfield>label</structfield></entry>
5791 <entry><type>text</type></entry>
5793 <entry>The security label applied to this object.</entry>
5800 <sect1 id="catalog-pg-statistic">
5801 <title><structname>pg_statistic</structname></title>
5803 <indexterm zone="catalog-pg-statistic">
5804 <primary>pg_statistic</primary>
5808 The catalog <structname>pg_statistic</structname> stores
5809 statistical data about the contents of the database. Entries are
5810 created by <xref linkend="sql-analyze">
5811 and subsequently used by the query planner. Note that all the
5812 statistical data is inherently approximate, even assuming that it
5817 Normally there is one entry, with <structfield>stainherit</> =
5818 <literal>false</>, for each table column that has been analyzed.
5819 If the table has inheritance children, a second entry with
5820 <structfield>stainherit</> = <literal>true</> is also created. This row
5821 represents the column's statistics over the inheritance tree, i.e.,
5822 statistics for the data you'd see with
5823 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5824 whereas the <structfield>stainherit</> = <literal>false</> row represents
5826 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5830 <structname>pg_statistic</structname> also stores statistical data about
5831 the values of index expressions. These are described as if they were
5832 actual data columns; in particular, <structfield>starelid</structfield>
5833 references the index. No entry is made for an ordinary non-expression
5834 index column, however, since it would be redundant with the entry
5835 for the underlying table column. Currently, entries for index expressions
5836 always have <structfield>stainherit</> = <literal>false</>.
5840 Since different kinds of statistics might be appropriate for different
5841 kinds of data, <structname>pg_statistic</structname> is designed not
5842 to assume very much about what sort of statistics it stores. Only
5843 extremely general statistics (such as nullness) are given dedicated
5844 columns in <structname>pg_statistic</structname>. Everything else
5845 is stored in <quote>slots</quote>, which are groups of associated columns
5846 whose content is identified by a code number in one of the slot's columns.
5847 For more information see
5848 <filename>src/include/catalog/pg_statistic.h</filename>.
5852 <structname>pg_statistic</structname> should not be readable by the
5853 public, since even statistical information about a table's contents
5854 might be considered sensitive. (Example: minimum and maximum values
5855 of a salary column might be quite interesting.)
5856 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
5857 is a publicly readable view on
5858 <structname>pg_statistic</structname> that only exposes information
5859 about those tables that are readable by the current user.
5863 <title><structname>pg_statistic</> Columns</title>
5870 <entry>References</entry>
5871 <entry>Description</entry>
5877 <entry><structfield>starelid</structfield></entry>
5878 <entry><type>oid</type></entry>
5879 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5880 <entry>The table or index that the described column belongs to</entry>
5884 <entry><structfield>staattnum</structfield></entry>
5885 <entry><type>int2</type></entry>
5886 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5887 <entry>The number of the described column</entry>
5891 <entry><structfield>stainherit</structfield></entry>
5892 <entry><type>bool</type></entry>
5894 <entry>If true, the stats include inheritance child columns, not just the
5895 values in the specified relation</entry>
5899 <entry><structfield>stanullfrac</structfield></entry>
5900 <entry><type>float4</type></entry>
5902 <entry>The fraction of the column's entries that are null</entry>
5906 <entry><structfield>stawidth</structfield></entry>
5907 <entry><type>int4</type></entry>
5909 <entry>The average stored width, in bytes, of nonnull entries</entry>
5913 <entry><structfield>stadistinct</structfield></entry>
5914 <entry><type>float4</type></entry>
5916 <entry>The number of distinct nonnull data values in the column.
5917 A value greater than zero is the actual number of distinct values.
5918 A value less than zero is the negative of a multiplier for the number
5919 of rows in the table; for example, a column in which values appear about
5920 twice on the average could be represented by
5921 <structfield>stadistinct</> = -0.5.
5922 A zero value means the number of distinct values is unknown.
5927 <entry><structfield>stakind<replaceable>N</></structfield></entry>
5928 <entry><type>int2</type></entry>
5931 A code number indicating the kind of statistics stored in the
5932 <replaceable>N</>th <quote>slot</quote> of the
5933 <structname>pg_statistic</structname> row.
5938 <entry><structfield>staop<replaceable>N</></structfield></entry>
5939 <entry><type>oid</type></entry>
5940 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
5942 An operator used to derive the statistics stored in the
5943 <replaceable>N</>th <quote>slot</quote>. For example, a
5944 histogram slot would show the <literal><</literal> operator
5945 that defines the sort order of the data.
5950 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
5951 <entry><type>float4[]</type></entry>
5954 Numerical statistics of the appropriate kind for the
5955 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5956 kind does not involve numerical values
5961 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
5962 <entry><type>anyarray</type></entry>
5965 Column data values of the appropriate kind for the
5966 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5967 kind does not store any data values. Each array's element
5968 values are actually of the specific column's data type, or a related
5969 type such as an array's element type, so there is no way to define
5970 these columns' type more specifically than <type>anyarray</>.
5980 <sect1 id="catalog-pg-tablespace">
5981 <title><structname>pg_tablespace</structname></title>
5983 <indexterm zone="catalog-pg-tablespace">
5984 <primary>pg_tablespace</primary>
5988 The catalog <structname>pg_tablespace</structname> stores information
5989 about the available tablespaces. Tables can be placed in particular
5990 tablespaces to aid administration of disk layout.
5994 Unlike most system catalogs, <structname>pg_tablespace</structname>
5995 is shared across all databases of a cluster: there is only one
5996 copy of <structname>pg_tablespace</structname> per cluster, not
6001 <title><structname>pg_tablespace</> Columns</title>
6008 <entry>References</entry>
6009 <entry>Description</entry>
6015 <entry><structfield>oid</structfield></entry>
6016 <entry><type>oid</type></entry>
6018 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6022 <entry><structfield>spcname</structfield></entry>
6023 <entry><type>name</type></entry>
6025 <entry>Tablespace name</entry>
6029 <entry><structfield>spcowner</structfield></entry>
6030 <entry><type>oid</type></entry>
6031 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6032 <entry>Owner of the tablespace, usually the user who created it</entry>
6036 <entry><structfield>spcacl</structfield></entry>
6037 <entry><type>aclitem[]</type></entry>
6040 Access privileges; see
6041 <xref linkend="sql-grant"> and
6042 <xref linkend="sql-revoke">
6048 <entry><structfield>spcoptions</structfield></entry>
6049 <entry><type>text[]</type></entry>
6052 Tablespace-level options, as <quote>keyword=value</> strings
6061 <sect1 id="catalog-pg-trigger">
6062 <title><structname>pg_trigger</structname></title>
6064 <indexterm zone="catalog-pg-trigger">
6065 <primary>pg_trigger</primary>
6069 The catalog <structname>pg_trigger</structname> stores triggers on tables
6071 See <xref linkend="sql-createtrigger">
6072 for more information.
6076 <title><structname>pg_trigger</> Columns</title>
6083 <entry>References</entry>
6084 <entry>Description</entry>
6090 <entry><structfield>oid</structfield></entry>
6091 <entry><type>oid</type></entry>
6093 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6097 <entry><structfield>tgrelid</structfield></entry>
6098 <entry><type>oid</type></entry>
6099 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6100 <entry>The table this trigger is on</entry>
6104 <entry><structfield>tgname</structfield></entry>
6105 <entry><type>name</type></entry>
6107 <entry>Trigger name (must be unique among triggers of same table)</entry>
6111 <entry><structfield>tgfoid</structfield></entry>
6112 <entry><type>oid</type></entry>
6113 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6114 <entry>The function to be called</entry>
6118 <entry><structfield>tgtype</structfield></entry>
6119 <entry><type>int2</type></entry>
6121 <entry>Bit mask identifying trigger firing conditions</entry>
6125 <entry><structfield>tgenabled</structfield></entry>
6126 <entry><type>char</type></entry>
6129 Controls in which <xref linkend="guc-session-replication-role"> modes
6131 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6132 <literal>D</> = trigger is disabled,
6133 <literal>R</> = trigger fires in <quote>replica</> mode,
6134 <literal>A</> = trigger fires always.
6139 <entry><structfield>tgisinternal</structfield></entry>
6140 <entry><type>bool</type></entry>
6142 <entry>True if trigger is internally generated (usually, to enforce
6143 the constraint identified by <structfield>tgconstraint</>)</entry>
6147 <entry><structfield>tgconstrrelid</structfield></entry>
6148 <entry><type>oid</type></entry>
6149 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6150 <entry>The table referenced by a referential integrity constraint</entry>
6154 <entry><structfield>tgconstrindid</structfield></entry>
6155 <entry><type>oid</type></entry>
6156 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6157 <entry>The index supporting a unique, primary key, referential integrity,
6158 or exclusion constraint</entry>
6162 <entry><structfield>tgconstraint</structfield></entry>
6163 <entry><type>oid</type></entry>
6164 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6165 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6169 <entry><structfield>tgdeferrable</structfield></entry>
6170 <entry><type>bool</type></entry>
6172 <entry>True if constraint trigger is deferrable</entry>
6176 <entry><structfield>tginitdeferred</structfield></entry>
6177 <entry><type>bool</type></entry>
6179 <entry>True if constraint trigger is initially deferred</entry>
6183 <entry><structfield>tgnargs</structfield></entry>
6184 <entry><type>int2</type></entry>
6186 <entry>Number of argument strings passed to trigger function</entry>
6190 <entry><structfield>tgattr</structfield></entry>
6191 <entry><type>int2vector</type></entry>
6192 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6193 <entry>Column numbers, if trigger is column-specific; otherwise an
6198 <entry><structfield>tgargs</structfield></entry>
6199 <entry><type>bytea</type></entry>
6201 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6205 <entry><structfield>tgqual</structfield></entry>
6206 <entry><type>pg_node_tree</type></entry>
6208 <entry>Expression tree (in <function>nodeToString()</function>
6209 representation) for the trigger's <literal>WHEN</> condition, or null
6217 Currently, column-specific triggering is supported only for
6218 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6219 only for that event type. <structfield>tgtype</structfield> might
6220 contain bits for other event types as well, but those are presumed
6221 to be table-wide regardless of what is in <structfield>tgattr</>.
6226 When <structfield>tgconstraint</> is nonzero,
6227 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6228 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6229 largely redundant with the referenced <structname>pg_constraint</> entry.
6230 However, it is possible for a non-deferrable trigger to be associated
6231 with a deferrable constraint: foreign key constraints can have some
6232 deferrable and some non-deferrable triggers.
6238 <literal>pg_class.relhastriggers</literal>
6239 must be true if a relation has any triggers in this catalog.
6246 <sect1 id="catalog-pg-ts-config">
6247 <title><structname>pg_ts_config</structname></title>
6249 <indexterm zone="catalog-pg-ts-config">
6250 <primary>pg_ts_config</primary>
6254 The <structname>pg_ts_config</structname> catalog contains entries
6255 representing text search configurations. A configuration specifies
6256 a particular text search parser and a list of dictionaries to use
6257 for each of the parser's output token types. The parser is shown
6258 in the <structname>pg_ts_config</structname> entry, but the
6259 token-to-dictionary mapping is defined by subsidiary entries in <link
6260 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6264 <productname>PostgreSQL</productname>'s text search features are
6265 described at length in <xref linkend="textsearch">.
6269 <title><structname>pg_ts_config</> Columns</title>
6276 <entry>References</entry>
6277 <entry>Description</entry>
6283 <entry><structfield>oid</structfield></entry>
6284 <entry><type>oid</type></entry>
6286 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6290 <entry><structfield>cfgname</structfield></entry>
6291 <entry><type>name</type></entry>
6293 <entry>Text search configuration name</entry>
6297 <entry><structfield>cfgnamespace</structfield></entry>
6298 <entry><type>oid</type></entry>
6299 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6301 The OID of the namespace that contains this configuration
6306 <entry><structfield>cfgowner</structfield></entry>
6307 <entry><type>oid</type></entry>
6308 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6309 <entry>Owner of the configuration</entry>
6313 <entry><structfield>cfgparser</structfield></entry>
6314 <entry><type>oid</type></entry>
6315 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6316 <entry>The OID of the text search parser for this configuration</entry>
6324 <sect1 id="catalog-pg-ts-config-map">
6325 <title><structname>pg_ts_config_map</structname></title>
6327 <indexterm zone="catalog-pg-ts-config-map">
6328 <primary>pg_ts_config_map</primary>
6332 The <structname>pg_ts_config_map</structname> catalog contains entries
6333 showing which text search dictionaries should be consulted, and in
6334 what order, for each output token type of each text search configuration's
6339 <productname>PostgreSQL</productname>'s text search features are
6340 described at length in <xref linkend="textsearch">.
6344 <title><structname>pg_ts_config_map</> Columns</title>
6351 <entry>References</entry>
6352 <entry>Description</entry>
6358 <entry><structfield>mapcfg</structfield></entry>
6359 <entry><type>oid</type></entry>
6360 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6361 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6365 <entry><structfield>maptokentype</structfield></entry>
6366 <entry><type>integer</type></entry>
6368 <entry>A token type emitted by the configuration's parser</entry>
6372 <entry><structfield>mapseqno</structfield></entry>
6373 <entry><type>integer</type></entry>
6375 <entry>Order in which to consult this entry (lower
6376 <structfield>mapseqno</>s first)</entry>
6380 <entry><structfield>mapdict</structfield></entry>
6381 <entry><type>oid</type></entry>
6382 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6383 <entry>The OID of the text search dictionary to consult</entry>
6391 <sect1 id="catalog-pg-ts-dict">
6392 <title><structname>pg_ts_dict</structname></title>
6394 <indexterm zone="catalog-pg-ts-dict">
6395 <primary>pg_ts_dict</primary>
6399 The <structname>pg_ts_dict</structname> catalog contains entries
6400 defining text search dictionaries. A dictionary depends on a text
6401 search template, which specifies all the implementation functions
6402 needed; the dictionary itself provides values for the user-settable
6403 parameters supported by the template. This division of labor allows
6404 dictionaries to be created by unprivileged users. The parameters
6405 are specified by a text string <structfield>dictinitoption</>,
6406 whose format and meaning vary depending on the template.
6410 <productname>PostgreSQL</productname>'s text search features are
6411 described at length in <xref linkend="textsearch">.
6415 <title><structname>pg_ts_dict</> Columns</title>
6422 <entry>References</entry>
6423 <entry>Description</entry>
6429 <entry><structfield>oid</structfield></entry>
6430 <entry><type>oid</type></entry>
6432 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6436 <entry><structfield>dictname</structfield></entry>
6437 <entry><type>name</type></entry>
6439 <entry>Text search dictionary name</entry>
6443 <entry><structfield>dictnamespace</structfield></entry>
6444 <entry><type>oid</type></entry>
6445 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6447 The OID of the namespace that contains this dictionary
6452 <entry><structfield>dictowner</structfield></entry>
6453 <entry><type>oid</type></entry>
6454 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6455 <entry>Owner of the dictionary</entry>
6459 <entry><structfield>dicttemplate</structfield></entry>
6460 <entry><type>oid</type></entry>
6461 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6462 <entry>The OID of the text search template for this dictionary</entry>
6466 <entry><structfield>dictinitoption</structfield></entry>
6467 <entry><type>text</type></entry>
6469 <entry>Initialization option string for the template</entry>
6477 <sect1 id="catalog-pg-ts-parser">
6478 <title><structname>pg_ts_parser</structname></title>
6480 <indexterm zone="catalog-pg-ts-parser">
6481 <primary>pg_ts_parser</primary>
6485 The <structname>pg_ts_parser</structname> catalog contains entries
6486 defining text search parsers. A parser is responsible for splitting
6487 input text into lexemes and assigning a token type to each lexeme.
6488 Since a parser must be implemented by C-language-level functions,
6489 creation of new parsers is restricted to database superusers.
6493 <productname>PostgreSQL</productname>'s text search features are
6494 described at length in <xref linkend="textsearch">.
6498 <title><structname>pg_ts_parser</> Columns</title>
6505 <entry>References</entry>
6506 <entry>Description</entry>
6512 <entry><structfield>oid</structfield></entry>
6513 <entry><type>oid</type></entry>
6515 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6519 <entry><structfield>prsname</structfield></entry>
6520 <entry><type>name</type></entry>
6522 <entry>Text search parser name</entry>
6526 <entry><structfield>prsnamespace</structfield></entry>
6527 <entry><type>oid</type></entry>
6528 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6530 The OID of the namespace that contains this parser
6535 <entry><structfield>prsstart</structfield></entry>
6536 <entry><type>regproc</type></entry>
6537 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6538 <entry>OID of the parser's startup function</entry>
6542 <entry><structfield>prstoken</structfield></entry>
6543 <entry><type>regproc</type></entry>
6544 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6545 <entry>OID of the parser's next-token function</entry>
6549 <entry><structfield>prsend</structfield></entry>
6550 <entry><type>regproc</type></entry>
6551 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6552 <entry>OID of the parser's shutdown function</entry>
6556 <entry><structfield>prsheadline</structfield></entry>
6557 <entry><type>regproc</type></entry>
6558 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6559 <entry>OID of the parser's headline function</entry>
6563 <entry><structfield>prslextype</structfield></entry>
6564 <entry><type>regproc</type></entry>
6565 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6566 <entry>OID of the parser's lextype function</entry>
6574 <sect1 id="catalog-pg-ts-template">
6575 <title><structname>pg_ts_template</structname></title>
6577 <indexterm zone="catalog-pg-ts-template">
6578 <primary>pg_ts_template</primary>
6582 The <structname>pg_ts_template</structname> catalog contains entries
6583 defining text search templates. A template is the implementation
6584 skeleton for a class of text search dictionaries.
6585 Since a template must be implemented by C-language-level functions,
6586 creation of new templates is restricted to database superusers.
6590 <productname>PostgreSQL</productname>'s text search features are
6591 described at length in <xref linkend="textsearch">.
6595 <title><structname>pg_ts_template</> Columns</title>
6602 <entry>References</entry>
6603 <entry>Description</entry>
6609 <entry><structfield>oid</structfield></entry>
6610 <entry><type>oid</type></entry>
6612 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6616 <entry><structfield>tmplname</structfield></entry>
6617 <entry><type>name</type></entry>
6619 <entry>Text search template name</entry>
6623 <entry><structfield>tmplnamespace</structfield></entry>
6624 <entry><type>oid</type></entry>
6625 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6627 The OID of the namespace that contains this template
6632 <entry><structfield>tmplinit</structfield></entry>
6633 <entry><type>regproc</type></entry>
6634 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6635 <entry>OID of the template's initialization function</entry>
6639 <entry><structfield>tmpllexize</structfield></entry>
6640 <entry><type>regproc</type></entry>
6641 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6642 <entry>OID of the template's lexize function</entry>
6650 <sect1 id="catalog-pg-type">
6651 <title><structname>pg_type</structname></title>
6653 <indexterm zone="catalog-pg-type">
6654 <primary>pg_type</primary>
6658 The catalog <structname>pg_type</structname> stores information about data
6659 types. Base types and enum types (scalar types) are created with
6660 <xref linkend="sql-createtype">, and
6662 <xref linkend="sql-createdomain">.
6663 A composite type is automatically created for each table in the database, to
6664 represent the row structure of the table. It is also possible to create
6665 composite types with <command>CREATE TYPE AS</command>.
6669 <title><structname>pg_type</> Columns</title>
6676 <entry>References</entry>
6677 <entry>Description</entry>
6683 <entry><structfield>oid</structfield></entry>
6684 <entry><type>oid</type></entry>
6686 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6690 <entry><structfield>typname</structfield></entry>
6691 <entry><type>name</type></entry>
6693 <entry>Data type name</entry>
6697 <entry><structfield>typnamespace</structfield></entry>
6698 <entry><type>oid</type></entry>
6699 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6701 The OID of the namespace that contains this type
6706 <entry><structfield>typowner</structfield></entry>
6707 <entry><type>oid</type></entry>
6708 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6709 <entry>Owner of the type</entry>
6713 <entry><structfield>typlen</structfield></entry>
6714 <entry><type>int2</type></entry>
6717 For a fixed-size type, <structfield>typlen</structfield> is the number
6718 of bytes in the internal representation of the type. But for a
6719 variable-length type, <structfield>typlen</structfield> is negative.
6720 -1 indicates a <quote>varlena</> type (one that has a length word),
6721 -2 indicates a null-terminated C string.
6726 <entry><structfield>typbyval</structfield></entry>
6727 <entry><type>bool</type></entry>
6730 <structfield>typbyval</structfield> determines whether internal
6731 routines pass a value of this type by value or by reference.
6732 <structfield>typbyval</structfield> had better be false if
6733 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6734 where Datum is 8 bytes).
6735 Variable-length types are always passed by reference. Note that
6736 <structfield>typbyval</structfield> can be false even if the
6737 length would allow pass-by-value.
6742 <entry><structfield>typtype</structfield></entry>
6743 <entry><type>char</type></entry>
6746 <structfield>typtype</structfield> is
6747 <literal>b</literal> for a base type,
6748 <literal>c</literal> for a composite type (e.g., a table's row type),
6749 <literal>d</literal> for a domain,
6750 <literal>e</literal> for an enum type,
6751 <literal>p</literal> for a pseudo-type, or
6752 <literal>r</literal> for a range type.
6753 See also <structfield>typrelid</structfield> and
6754 <structfield>typbasetype</structfield>.
6759 <entry><structfield>typcategory</structfield></entry>
6760 <entry><type>char</type></entry>
6763 <structfield>typcategory</structfield> is an arbitrary classification
6764 of data types that is used by the parser to determine which implicit
6765 casts should be <quote>preferred</>.
6766 See <xref linkend="catalog-typcategory-table">.
6771 <entry><structfield>typispreferred</structfield></entry>
6772 <entry><type>bool</type></entry>
6775 True if the type is a preferred cast target within its
6776 <structfield>typcategory</structfield>
6781 <entry><structfield>typisdefined</structfield></entry>
6782 <entry><type>bool</type></entry>
6785 True if the type is defined, false if this is a placeholder
6786 entry for a not-yet-defined type. When
6787 <structfield>typisdefined</structfield> is false, nothing
6788 except the type name, namespace, and OID can be relied on.
6793 <entry><structfield>typdelim</structfield></entry>
6794 <entry><type>char</type></entry>
6797 Character that separates two values of this type when parsing
6798 array input. Note that the delimiter is associated with the array
6799 element data type, not the array data type.
6804 <entry><structfield>typrelid</structfield></entry>
6805 <entry><type>oid</type></entry>
6806 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6808 If this is a composite type (see
6809 <structfield>typtype</structfield>), then this column points to
6810 the <structname>pg_class</structname> entry that defines the
6811 corresponding table. (For a free-standing composite type, the
6812 <structname>pg_class</structname> entry doesn't really represent
6813 a table, but it is needed anyway for the type's
6814 <structname>pg_attribute</structname> entries to link to.)
6815 Zero for non-composite types.
6820 <entry><structfield>typelem</structfield></entry>
6821 <entry><type>oid</type></entry>
6822 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6824 If <structfield>typelem</structfield> is not 0 then it
6825 identifies another row in <structname>pg_type</structname>.
6826 The current type can then be subscripted like an array yielding
6827 values of type <structfield>typelem</structfield>. A
6828 <quote>true</quote> array type is variable length
6829 (<structfield>typlen</structfield> = -1),
6830 but some fixed-length (<structfield>typlen</structfield> > 0) types
6831 also have nonzero <structfield>typelem</structfield>, for example
6832 <type>name</type> and <type>point</type>.
6833 If a fixed-length type has a <structfield>typelem</structfield> then
6834 its internal representation must be some number of values of the
6835 <structfield>typelem</structfield> data type with no other data.
6836 Variable-length array types have a header defined by the array
6842 <entry><structfield>typarray</structfield></entry>
6843 <entry><type>oid</type></entry>
6844 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6846 If <structfield>typarray</structfield> is not 0 then it
6847 identifies another row in <structname>pg_type</structname>, which
6848 is the <quote>true</quote> array type having this type as element
6853 <entry><structfield>typinput</structfield></entry>
6854 <entry><type>regproc</type></entry>
6855 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6856 <entry>Input conversion function (text format)</entry>
6860 <entry><structfield>typoutput</structfield></entry>
6861 <entry><type>regproc</type></entry>
6862 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6863 <entry>Output conversion function (text format)</entry>
6867 <entry><structfield>typreceive</structfield></entry>
6868 <entry><type>regproc</type></entry>
6869 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6870 <entry>Input conversion function (binary format), or 0 if none</entry>
6874 <entry><structfield>typsend</structfield></entry>
6875 <entry><type>regproc</type></entry>
6876 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6877 <entry>Output conversion function (binary format), or 0 if none</entry>
6881 <entry><structfield>typmodin</structfield></entry>
6882 <entry><type>regproc</type></entry>
6883 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6884 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
6888 <entry><structfield>typmodout</structfield></entry>
6889 <entry><type>regproc</type></entry>
6890 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6891 <entry>Type modifier output function, or 0 to use the standard format</entry>
6895 <entry><structfield>typanalyze</structfield></entry>
6896 <entry><type>regproc</type></entry>
6897 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6898 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
6902 <entry><structfield>typalign</structfield></entry>
6903 <entry><type>char</type></entry>
6907 <structfield>typalign</structfield> is the alignment required
6908 when storing a value of this type. It applies to storage on
6909 disk as well as most representations of the value inside
6910 <productname>PostgreSQL</>.
6911 When multiple values are stored consecutively, such
6912 as in the representation of a complete row on disk, padding is
6913 inserted before a datum of this type so that it begins on the
6914 specified boundary. The alignment reference is the beginning
6915 of the first datum in the sequence.
6919 Possible values are:
6922 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
6925 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
6928 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
6931 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
6936 For types used in system tables, it is critical that the size
6937 and alignment defined in <structname>pg_type</structname>
6938 agree with the way that the compiler will lay out the column in
6939 a structure representing a table row.
6945 <entry><structfield>typstorage</structfield></entry>
6946 <entry><type>char</type></entry>
6949 <structfield>typstorage</structfield> tells for varlena
6950 types (those with <structfield>typlen</structfield> = -1) if
6951 the type is prepared for toasting and what the default strategy
6952 for attributes of this type should be.
6956 <para><literal>p</>: Value must always be stored plain.</para>
6960 <literal>e</>: Value can be stored in a <quote>secondary</quote>
6961 relation (if relation has one, see
6962 <literal>pg_class.reltoastrelid</literal>).
6966 <para><literal>m</>: Value can be stored compressed inline.</para>
6969 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
6972 Note that <literal>m</> columns can also be moved out to secondary
6973 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
6979 <entry><structfield>typnotnull</structfield></entry>
6980 <entry><type>bool</type></entry>
6983 <structfield>typnotnull</structfield> represents a not-null
6984 constraint on a type. Used for domains only.
6989 <entry><structfield>typbasetype</structfield></entry>
6990 <entry><type>oid</type></entry>
6991 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6993 If this is a domain (see <structfield>typtype</structfield>), then
6994 <structfield>typbasetype</structfield> identifies the type that this
6995 one is based on. Zero if this type is not a domain.
7000 <entry><structfield>typtypmod</structfield></entry>
7001 <entry><type>int4</type></entry>
7004 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7005 to be applied to their base type (-1 if base type does not use a
7006 <literal>typmod</>). -1 if this type is not a domain.
7011 <entry><structfield>typndims</structfield></entry>
7012 <entry><type>int4</type></entry>
7015 <structfield>typndims</structfield> is the number of array dimensions
7016 for a domain over an array (that is, <structfield>typbasetype</> is
7018 Zero for types other than domains over array types.
7023 <entry><structfield>typcollation</structfield></entry>
7024 <entry><type>oid</type></entry>
7025 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7027 <structfield>typcollation</structfield> specifies the collation
7028 of the type. If the type does not support collations, this will
7029 be zero. A base type that supports collations will have
7030 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7031 collatable type can have some other collation OID, if one was
7032 specified for the domain.
7037 <entry><structfield>typdefaultbin</structfield></entry>
7038 <entry><type>pg_node_tree</type></entry>
7041 If <structfield>typdefaultbin</> is not null, it is the
7042 <function>nodeToString()</function>
7043 representation of a default expression for the type. This is
7044 only used for domains.
7049 <entry><structfield>typdefault</structfield></entry>
7050 <entry><type>text</type></entry>
7053 <structfield>typdefault</> is null if the type has no associated
7054 default value. If <structfield>typdefaultbin</> is not null,
7055 <structfield>typdefault</> must contain a human-readable version of the
7056 default expression represented by <structfield>typdefaultbin</>. If
7057 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7058 not, then <structfield>typdefault</> is the external representation of
7059 the type's default value, which can be fed to the type's input
7060 converter to produce a constant.
7065 <entry><structfield>typacl</structfield></entry>
7066 <entry><type>aclitem[]</type></entry>
7069 Access privileges; see
7070 <xref linkend="sql-grant"> and
7071 <xref linkend="sql-revoke">
7080 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7081 of <structfield>typcategory</>. Any future additions to this list will
7082 also be upper-case ASCII letters. All other ASCII characters are reserved
7083 for user-defined categories.
7086 <table id="catalog-typcategory-table">
7087 <title><structfield>typcategory</> Codes</title>
7093 <entry>Category</entry>
7099 <entry><literal>A</literal></entry>
7100 <entry>Array types</entry>
7103 <entry><literal>B</literal></entry>
7104 <entry>Boolean types</entry>
7107 <entry><literal>C</literal></entry>
7108 <entry>Composite types</entry>
7111 <entry><literal>D</literal></entry>
7112 <entry>Date/time types</entry>
7115 <entry><literal>E</literal></entry>
7116 <entry>Enum types</entry>
7119 <entry><literal>G</literal></entry>
7120 <entry>Geometric types</entry>
7123 <entry><literal>I</literal></entry>
7124 <entry>Network address types</entry>
7127 <entry><literal>N</literal></entry>
7128 <entry>Numeric types</entry>
7131 <entry><literal>P</literal></entry>
7132 <entry>Pseudo-types</entry>
7135 <entry><literal>R</literal></entry>
7136 <entry>Range types</entry>
7139 <entry><literal>S</literal></entry>
7140 <entry>String types</entry>
7143 <entry><literal>T</literal></entry>
7144 <entry>Timespan types</entry>
7147 <entry><literal>U</literal></entry>
7148 <entry>User-defined types</entry>
7151 <entry><literal>V</literal></entry>
7152 <entry>Bit-string types</entry>
7155 <entry><literal>X</literal></entry>
7156 <entry><type>unknown</> type</entry>
7165 <sect1 id="catalog-pg-user-mapping">
7166 <title><structname>pg_user_mapping</structname></title>
7168 <indexterm zone="catalog-pg-user-mapping">
7169 <primary>pg_user_mapping</primary>
7173 The catalog <structname>pg_user_mapping</structname> stores
7174 the mappings from local user to remote. Access to this catalog is
7175 restricted from normal users, use the view
7176 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7181 <title><structname>pg_user_mapping</> Columns</title>
7188 <entry>References</entry>
7189 <entry>Description</entry>
7195 <entry><structfield>oid</structfield></entry>
7196 <entry><type>oid</type></entry>
7198 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7202 <entry><structfield>umuser</structfield></entry>
7203 <entry><type>oid</type></entry>
7204 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7205 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7209 <entry><structfield>umserver</structfield></entry>
7210 <entry><type>oid</type></entry>
7211 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7213 The OID of the foreign server that contains this mapping
7218 <entry><structfield>umoptions</structfield></entry>
7219 <entry><type>text[]</type></entry>
7222 User mapping specific options, as <quote>keyword=value</> strings
7231 <sect1 id="views-overview">
7232 <title>System Views</title>
7235 In addition to the system catalogs, <productname>PostgreSQL</productname>
7236 provides a number of built-in views. Some system views provide convenient
7237 access to some commonly used queries on the system catalogs. Other views
7238 provide access to internal server state.
7242 The information schema (<xref linkend="information-schema">) provides
7243 an alternative set of views which overlap the functionality of the system
7244 views. Since the information schema is SQL-standard whereas the views
7245 described here are <productname>PostgreSQL</productname>-specific,
7246 it's usually better to use the information schema if it provides all
7247 the information you need.
7251 <xref linkend="view-table"> lists the system views described here.
7252 More detailed documentation of each view follows below.
7253 There are some additional views that provide access to the results of
7254 the statistics collector; they are described in <xref
7255 linkend="monitoring-stats-views-table">.
7259 Except where noted, all the views described here are read-only.
7262 <table id="view-table">
7263 <title>System Views</title>
7268 <entry>View Name</entry>
7269 <entry>Purpose</entry>
7275 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7276 <entry>available extensions</entry>
7280 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7281 <entry>available versions of extensions</entry>
7285 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7286 <entry>open cursors</entry>
7290 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7291 <entry>groups of database users</entry>
7295 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7296 <entry>indexes</entry>
7300 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7301 <entry>currently held locks</entry>
7305 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7306 <entry>materialized views</entry>
7310 <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7311 <entry>policies</entry>
7315 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7316 <entry>prepared statements</entry>
7320 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7321 <entry>prepared transactions</entry>
7325 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7326 <entry>database roles</entry>
7330 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7331 <entry>rules</entry>
7335 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7336 <entry>security labels</entry>
7340 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7341 <entry>parameter settings</entry>
7345 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7346 <entry>database users</entry>
7350 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7351 <entry>planner statistics</entry>
7355 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7356 <entry>tables</entry>
7360 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7361 <entry>time zone abbreviations</entry>
7365 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7366 <entry>time zone names</entry>
7370 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7371 <entry>database users</entry>
7375 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7376 <entry>user mappings</entry>
7380 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7381 <entry>views</entry>
7389 <sect1 id="view-pg-available-extensions">
7390 <title><structname>pg_available_extensions</structname></title>
7392 <indexterm zone="view-pg-available-extensions">
7393 <primary>pg_available_extensions</primary>
7397 The <structname>pg_available_extensions</structname> view lists the
7398 extensions that are available for installation.
7400 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7401 catalog, which shows the extensions currently installed.
7405 <title><structname>pg_available_extensions</> Columns</title>
7412 <entry>Description</entry>
7418 <entry><structfield>name</structfield></entry>
7419 <entry><type>name</type></entry>
7420 <entry>Extension name</entry>
7424 <entry><structfield>default_version</structfield></entry>
7425 <entry><type>text</type></entry>
7426 <entry>Name of default version, or <literal>NULL</literal> if none is
7431 <entry><structfield>installed_version</structfield></entry>
7432 <entry><type>text</type></entry>
7433 <entry>Currently installed version of the extension,
7434 or <literal>NULL</literal> if not installed</entry>
7438 <entry><structfield>comment</structfield></entry>
7439 <entry><type>text</type></entry>
7440 <entry>Comment string from the extension's control file</entry>
7447 The <structname>pg_available_extensions</structname> view is read only.
7451 <sect1 id="view-pg-available-extension-versions">
7452 <title><structname>pg_available_extension_versions</structname></title>
7454 <indexterm zone="view-pg-available-extension-versions">
7455 <primary>pg_available_extension_versions</primary>
7459 The <structname>pg_available_extension_versions</structname> view lists the
7460 specific extension versions that are available for installation.
7462 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7463 catalog, which shows the extensions currently installed.
7467 <title><structname>pg_available_extension_versions</> Columns</title>
7474 <entry>Description</entry>
7480 <entry><structfield>name</structfield></entry>
7481 <entry><type>name</type></entry>
7482 <entry>Extension name</entry>
7486 <entry><structfield>version</structfield></entry>
7487 <entry><type>text</type></entry>
7488 <entry>Version name</entry>
7492 <entry><structfield>installed</structfield></entry>
7493 <entry><type>bool</type></entry>
7494 <entry>True if this version of this extension is currently
7499 <entry><structfield>superuser</structfield></entry>
7500 <entry><type>bool</type></entry>
7501 <entry>True if only superusers are allowed to install this extension</entry>
7505 <entry><structfield>relocatable</structfield></entry>
7506 <entry><type>bool</type></entry>
7507 <entry>True if extension can be relocated to another schema</entry>
7511 <entry><structfield>schema</structfield></entry>
7512 <entry><type>name</type></entry>
7513 <entry>Name of the schema that the extension must be installed into,
7514 or <literal>NULL</literal> if partially or fully relocatable</entry>
7518 <entry><structfield>requires</structfield></entry>
7519 <entry><type>name[]</type></entry>
7520 <entry>Names of prerequisite extensions,
7521 or <literal>NULL</literal> if none</entry>
7525 <entry><structfield>comment</structfield></entry>
7526 <entry><type>text</type></entry>
7527 <entry>Comment string from the extension's control file</entry>
7534 The <structname>pg_available_extension_versions</structname> view is read
7539 <sect1 id="view-pg-cursors">
7540 <title><structname>pg_cursors</structname></title>
7542 <indexterm zone="view-pg-cursors">
7543 <primary>pg_cursors</primary>
7547 The <structname>pg_cursors</structname> view lists the cursors that
7548 are currently available. Cursors can be defined in several ways:
7552 via the <xref linkend="sql-declare">
7559 via the Bind message in the frontend/backend protocol, as
7560 described in <xref linkend="protocol-flow-ext-query">
7566 via the Server Programming Interface (SPI), as described in
7567 <xref linkend="spi-interface">
7572 The <structname>pg_cursors</structname> view displays cursors
7573 created by any of these means. Cursors only exist for the duration
7574 of the transaction that defines them, unless they have been
7575 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7576 cursors are only present in the view until the end of their
7577 creating transaction.
7581 Cursors are used internally to implement some of the components
7582 of <productname>PostgreSQL</>, such as procedural languages.
7583 Therefore, the <structname>pg_cursors</> view might include cursors
7584 that have not been explicitly created by the user.
7590 <title><structname>pg_cursors</> Columns</title>
7597 <entry>Description</entry>
7603 <entry><structfield>name</structfield></entry>
7604 <entry><type>text</type></entry>
7605 <entry>The name of the cursor</entry>
7609 <entry><structfield>statement</structfield></entry>
7610 <entry><type>text</type></entry>
7611 <entry>The verbatim query string submitted to declare this cursor</entry>
7615 <entry><structfield>is_holdable</structfield></entry>
7616 <entry><type>boolean</type></entry>
7618 <literal>true</literal> if the cursor is holdable (that is, it
7619 can be accessed after the transaction that declared the cursor
7620 has committed); <literal>false</literal> otherwise
7625 <entry><structfield>is_binary</structfield></entry>
7626 <entry><type>boolean</type></entry>
7628 <literal>true</literal> if the cursor was declared
7629 <literal>BINARY</literal>; <literal>false</literal>
7635 <entry><structfield>is_scrollable</structfield></entry>
7636 <entry><type>boolean</type></entry>
7638 <literal>true</> if the cursor is scrollable (that is, it
7639 allows rows to be retrieved in a nonsequential manner);
7640 <literal>false</literal> otherwise
7645 <entry><structfield>creation_time</structfield></entry>
7646 <entry><type>timestamptz</type></entry>
7647 <entry>The time at which the cursor was declared</entry>
7654 The <structname>pg_cursors</structname> view is read only.
7659 <sect1 id="view-pg-group">
7660 <title><structname>pg_group</structname></title>
7662 <indexterm zone="view-pg-group">
7663 <primary>pg_group</primary>
7667 The view <structname>pg_group</structname> exists for backwards
7668 compatibility: it emulates a catalog that existed in
7669 <productname>PostgreSQL</productname> before version 8.1.
7670 It shows the names and members of all roles that are marked as not
7671 <structfield>rolcanlogin</>, which is an approximation to the set
7672 of roles that are being used as groups.
7676 <title><structname>pg_group</> Columns</title>
7683 <entry>References</entry>
7684 <entry>Description</entry>
7690 <entry><structfield>groname</structfield></entry>
7691 <entry><type>name</type></entry>
7692 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7693 <entry>Name of the group</entry>
7697 <entry><structfield>grosysid</structfield></entry>
7698 <entry><type>oid</type></entry>
7699 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7700 <entry>ID of this group</entry>
7704 <entry><structfield>grolist</structfield></entry>
7705 <entry><type>oid[]</type></entry>
7706 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7707 <entry>An array containing the IDs of the roles in this group</entry>
7715 <sect1 id="view-pg-indexes">
7716 <title><structname>pg_indexes</structname></title>
7718 <indexterm zone="view-pg-indexes">
7719 <primary>pg_indexes</primary>
7723 The view <structname>pg_indexes</structname> provides access to
7724 useful information about each index in the database.
7728 <title><structname>pg_indexes</> Columns</title>
7735 <entry>References</entry>
7736 <entry>Description</entry>
7741 <entry><structfield>schemaname</structfield></entry>
7742 <entry><type>name</type></entry>
7743 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7744 <entry>Name of schema containing table and index</entry>
7747 <entry><structfield>tablename</structfield></entry>
7748 <entry><type>name</type></entry>
7749 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7750 <entry>Name of table the index is for</entry>
7753 <entry><structfield>indexname</structfield></entry>
7754 <entry><type>name</type></entry>
7755 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7756 <entry>Name of index</entry>
7759 <entry><structfield>tablespace</structfield></entry>
7760 <entry><type>name</type></entry>
7761 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7762 <entry>Name of tablespace containing index (null if default for database)</entry>
7765 <entry><structfield>indexdef</structfield></entry>
7766 <entry><type>text</type></entry>
7768 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
7777 <sect1 id="view-pg-locks">
7778 <title><structname>pg_locks</structname></title>
7780 <indexterm zone="view-pg-locks">
7781 <primary>pg_locks</primary>
7785 The view <structname>pg_locks</structname> provides access to
7786 information about the locks held by open transactions within the
7787 database server. See <xref linkend="mvcc"> for more discussion
7792 <structname>pg_locks</structname> contains one row per active lockable
7793 object, requested lock mode, and relevant transaction. Thus, the same
7794 lockable object might
7795 appear many times, if multiple transactions are holding or waiting
7796 for locks on it. However, an object that currently has no locks on it
7797 will not appear at all.
7801 There are several distinct types of lockable objects:
7802 whole relations (e.g., tables), individual pages of relations,
7803 individual tuples of relations,
7804 transaction IDs (both virtual and permanent IDs),
7805 and general database objects (identified by class OID and object OID,
7806 in the same way as in <structname>pg_description</structname> or
7807 <structname>pg_depend</structname>). Also, the right to extend a
7808 relation is represented as a separate lockable object.
7809 Also, <quote>advisory</> locks can be taken on numbers that have
7810 user-defined meanings.
7814 <title><structname>pg_locks</> Columns</title>
7821 <entry>References</entry>
7822 <entry>Description</entry>
7827 <entry><structfield>locktype</structfield></entry>
7828 <entry><type>text</type></entry>
7831 Type of the lockable object:
7832 <literal>relation</>,
7836 <literal>transactionid</>,
7837 <literal>virtualxid</>,
7839 <literal>userlock</>, or
7840 <literal>advisory</>
7844 <entry><structfield>database</structfield></entry>
7845 <entry><type>oid</type></entry>
7846 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
7848 OID of the database in which the lock target exists, or
7849 zero if the target is a shared object, or
7850 null if the target is a transaction ID
7854 <entry><structfield>relation</structfield></entry>
7855 <entry><type>oid</type></entry>
7856 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7858 OID of the relation targeted by the lock, or null if the target is not
7859 a relation or part of a relation
7863 <entry><structfield>page</structfield></entry>
7864 <entry><type>integer</type></entry>
7867 Page number targeted by the lock within the relation,
7868 or null if the target is not a relation page or tuple
7872 <entry><structfield>tuple</structfield></entry>
7873 <entry><type>smallint</type></entry>
7876 Tuple number targeted by the lock within the page,
7877 or null if the target is not a tuple
7881 <entry><structfield>virtualxid</structfield></entry>
7882 <entry><type>text</type></entry>
7885 Virtual ID of the transaction targeted by the lock,
7886 or null if the target is not a virtual transaction ID
7890 <entry><structfield>transactionid</structfield></entry>
7891 <entry><type>xid</type></entry>
7894 ID of the transaction targeted by the lock,
7895 or null if the target is not a transaction ID
7899 <entry><structfield>classid</structfield></entry>
7900 <entry><type>oid</type></entry>
7901 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7903 OID of the system catalog containing the lock target, or null if the
7904 target is not a general database object
7908 <entry><structfield>objid</structfield></entry>
7909 <entry><type>oid</type></entry>
7910 <entry>any OID column</entry>
7912 OID of the lock target within its system catalog, or null if the
7913 target is not a general database object
7917 <entry><structfield>objsubid</structfield></entry>
7918 <entry><type>smallint</type></entry>
7921 Column number targeted by the lock (the
7922 <structfield>classid</> and <structfield>objid</> refer to the
7924 or zero if the target is some other general database object,
7925 or null if the target is not a general database object
7929 <entry><structfield>virtualtransaction</structfield></entry>
7930 <entry><type>text</type></entry>
7933 Virtual ID of the transaction that is holding or awaiting this lock
7937 <entry><structfield>pid</structfield></entry>
7938 <entry><type>integer</type></entry>
7941 Process ID of the server process holding or awaiting this
7942 lock, or null if the lock is held by a prepared transaction
7946 <entry><structfield>mode</structfield></entry>
7947 <entry><type>text</type></entry>
7949 <entry>Name of the lock mode held or desired by this process (see <xref
7950 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
7953 <entry><structfield>granted</structfield></entry>
7954 <entry><type>boolean</type></entry>
7956 <entry>True if lock is held, false if lock is awaited</entry>
7959 <entry><structfield>fastpath</structfield></entry>
7960 <entry><type>boolean</type></entry>
7962 <entry>True if lock was taken via fast path, false if taken via main
7970 <structfield>granted</structfield> is true in a row representing a lock
7971 held by the indicated transaction. False indicates that this transaction is
7972 currently waiting to acquire this lock, which implies that some other
7973 transaction is holding a conflicting lock mode on the same lockable object.
7974 The waiting transaction will sleep until the other lock is released (or a
7975 deadlock situation is detected). A single transaction can be waiting to
7976 acquire at most one lock at a time.
7980 Every transaction holds an exclusive lock on its virtual transaction ID for
7981 its entire duration. If a permanent ID is assigned to the transaction
7982 (which normally happens only if the transaction changes the state of the
7983 database), it also holds an exclusive lock on its permanent transaction ID
7984 until it ends. When one transaction finds it necessary to wait specifically
7985 for another transaction, it does so by attempting to acquire share lock on
7986 the other transaction ID (either virtual or permanent ID depending on the
7987 situation). That will succeed only when the other transaction
7988 terminates and releases its locks.
7992 Although tuples are a lockable type of object,
7993 information about row-level locks is stored on disk, not in memory,
7994 and therefore row-level locks normally do not appear in this view.
7995 If a transaction is waiting for a
7996 row-level lock, it will usually appear in the view as waiting for the
7997 permanent transaction ID of the current holder of that row lock.
8001 Advisory locks can be acquired on keys consisting of either a single
8002 <type>bigint</type> value or two integer values.
8003 A <type>bigint</type> key is displayed with its
8004 high-order half in the <structfield>classid</> column, its low-order half
8005 in the <structfield>objid</> column, and <structfield>objsubid</> equal
8006 to 1. The original <type>bigint</type> value can be reassembled with the
8007 expression <literal>(classid::bigint << 32) |
8008 objid::bigint</literal>. Integer keys are displayed with the
8010 <structfield>classid</> column, the second key in the <structfield>objid</>
8011 column, and <structfield>objsubid</> equal to 2. The actual meaning of
8012 the keys is up to the user. Advisory locks are local to each database,
8013 so the <structfield>database</> column is meaningful for an advisory lock.
8017 <structname>pg_locks</structname> provides a global view of all locks
8018 in the database cluster, not only those relevant to the current database.
8019 Although its <structfield>relation</structfield> column can be joined
8020 against <structname>pg_class</>.<structfield>oid</> to identify locked
8021 relations, this will only work correctly for relations in the current
8022 database (those for which the <structfield>database</structfield> column
8023 is either the current database's OID or zero).
8027 The <structfield>pid</structfield> column can be joined to the
8028 <structfield>pid</structfield> column of the <link
8029 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8031 information on the session holding or waiting to hold each lock,
8034 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8035 ON pl.pid = psa.pid;
8037 Also, if you are using prepared transactions, the
8038 <structfield>virtualtransaction</> column can be joined to the
8039 <structfield>transaction</structfield> column of the <link
8040 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8041 view to get more information on prepared transactions that hold locks.
8042 (A prepared transaction can never be waiting for a lock,
8043 but it continues to hold the locks it acquired while running.)
8046 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8047 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8052 The <structname>pg_locks</structname> view displays data from both the
8053 regular lock manager and the predicate lock manager, which are
8054 separate systems; in addition, the regular lock manager subdivides its
8055 locks into regular and <firstterm>fast-path</> locks.
8056 This data is not guaranteed to be entirely consistent.
8057 When the view is queried,
8058 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8059 is gathered from each backend one at a time, without freezing the state of
8060 the entire lock manager, so it is possible for locks to be taken or
8061 released while information is gathered. Note, however, that these locks are
8062 known not to conflict with any other lock currently in place. After
8063 all backends have been queried for fast-path locks, the remainder of the
8064 regular lock manager is locked as a unit, and a consistent snapshot of all
8065 remaining locks is collected as an atomic action. After unlocking the
8066 regular lock manager, the predicate lock manager is similarly locked and all
8067 predicate locks are collected as an atomic action. Thus, with the exception
8068 of fast-path locks, each lock manager will deliver a consistent set of
8069 results, but as we do not lock both lock managers simultaneously, it is
8070 possible for locks to be taken or released after we interrogate the regular
8071 lock manager and before we interrogate the predicate lock manager.
8075 Locking the regular and/or predicate lock manager could have some
8076 impact on database performance if this view is very frequently accessed.
8077 The locks are held only for the minimum amount of time necessary to
8078 obtain data from the lock managers, but this does not completely eliminate
8079 the possibility of a performance impact.
8084 <sect1 id="view-pg-matviews">
8085 <title><structname>pg_matviews</structname></title>
8087 <indexterm zone="view-pg-matviews">
8088 <primary>pg_matviews</primary>
8091 <indexterm zone="view-pg-matviews">
8092 <primary>materialized views</primary>
8096 The view <structname>pg_matviews</structname> provides access to
8097 useful information about each materialized view in the database.
8101 <title><structname>pg_matviews</> Columns</title>
8108 <entry>References</entry>
8109 <entry>Description</entry>
8114 <entry><structfield>schemaname</structfield></entry>
8115 <entry><type>name</type></entry>
8116 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8117 <entry>Name of schema containing materialized view</entry>
8120 <entry><structfield>matviewname</structfield></entry>
8121 <entry><type>name</type></entry>
8122 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8123 <entry>Name of materialized view</entry>
8126 <entry><structfield>matviewowner</structfield></entry>
8127 <entry><type>name</type></entry>
8128 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8129 <entry>Name of materialized view's owner</entry>
8132 <entry><structfield>tablespace</structfield></entry>
8133 <entry><type>name</type></entry>
8134 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8135 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8138 <entry><structfield>hasindexes</structfield></entry>
8139 <entry><type>boolean</type></entry>
8141 <entry>True if materialized view has (or recently had) any indexes</entry>
8144 <entry><structfield>ispopulated</structfield></entry>
8145 <entry><type>boolean</type></entry>
8147 <entry>True if materialized view is currently populated</entry>
8150 <entry><structfield>definition</structfield></entry>
8151 <entry><type>text</type></entry>
8153 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8161 <sect1 id="view-pg-policies">
8162 <title><structname>pg_policies</structname></title>
8164 <indexterm zone="view-pg-policies">
8165 <primary>pg_policies</primary>
8169 The view <structname>pg_policies</structname> provides access to
8170 useful information about each policy in the database.
8174 <title><structname>pg_policies</> Columns</title>
8181 <entry>References</entry>
8182 <entry>Description</entry>
8187 <entry><structfield>schemaname</structfield></entry>
8188 <entry><type>name</type></entry>
8189 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8190 <entry>Name of schema containing table policy is on</entry>
8193 <entry><structfield>tablename</structfield></entry>
8194 <entry><type>name</type></entry>
8195 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8196 <entry>Name of table policy is on</entry>
8199 <entry><structfield>policyname</structfield></entry>
8200 <entry><type>name</type></entry>
8201 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8202 <entry>Name of policy</entry>
8205 <entry><structfield>cmd</structfield></entry>
8206 <entry><type>text</type></entry>
8208 <entry>The command type to which the policy is applied.</entry>
8211 <entry><structfield>roles</structfield></entry>
8212 <entry><type>name[]</type></entry>
8214 <entry>The roles to which this policy applies.</entry>
8217 <entry><structfield>qual</structfield></entry>
8218 <entry><type>text</type></entry>
8220 <entry>The expression added to the security barrier qualifications for
8221 queries which this policy applies to.</entry>
8224 <entry><structfield>with_check</structfield></entry>
8225 <entry><type>text</type></entry>
8227 <entry>The expression added to the with check qualifications for
8228 queries which attempt to add rows to this table.</entry>
8236 <sect1 id="view-pg-prepared-statements">
8237 <title><structname>pg_prepared_statements</structname></title>
8239 <indexterm zone="view-pg-prepared-statements">
8240 <primary>pg_prepared_statements</primary>
8244 The <structname>pg_prepared_statements</structname> view displays
8245 all the prepared statements that are available in the current
8246 session. See <xref linkend="sql-prepare"> for more information about prepared
8251 <structname>pg_prepared_statements</structname> contains one row
8252 for each prepared statement. Rows are added to the view when a new
8253 prepared statement is created and removed when a prepared statement
8254 is released (for example, via the <xref linkend="sql-deallocate"> command).
8258 <title><structname>pg_prepared_statements</> Columns</title>
8265 <entry>Description</entry>
8270 <entry><structfield>name</structfield></entry>
8271 <entry><type>text</type></entry>
8273 The identifier of the prepared statement
8277 <entry><structfield>statement</structfield></entry>
8278 <entry><type>text</type></entry>
8280 The query string submitted by the client to create this
8281 prepared statement. For prepared statements created via SQL,
8282 this is the <command>PREPARE</command> statement submitted by
8283 the client. For prepared statements created via the
8284 frontend/backend protocol, this is the text of the prepared
8289 <entry><structfield>prepare_time</structfield></entry>
8290 <entry><type>timestamptz</type></entry>
8292 The time at which the prepared statement was created
8296 <entry><structfield>parameter_types</structfield></entry>
8297 <entry><type>regtype[]</type></entry>
8299 The expected parameter types for the prepared statement in the
8300 form of an array of <type>regtype</type>. The OID corresponding
8301 to an element of this array can be obtained by casting the
8302 <type>regtype</type> value to <type>oid</type>.
8306 <entry><structfield>from_sql</structfield></entry>
8307 <entry><type>boolean</type></entry>
8309 <literal>true</literal> if the prepared statement was created
8310 via the <command>PREPARE</command> SQL statement;
8311 <literal>false</literal> if the statement was prepared via the
8312 frontend/backend protocol
8320 The <structname>pg_prepared_statements</structname> view is read only.
8324 <sect1 id="view-pg-prepared-xacts">
8325 <title><structname>pg_prepared_xacts</structname></title>
8327 <indexterm zone="view-pg-prepared-xacts">
8328 <primary>pg_prepared_xacts</primary>
8332 The view <structname>pg_prepared_xacts</structname> displays
8333 information about transactions that are currently prepared for two-phase
8334 commit (see <xref linkend="sql-prepare-transaction"> for details).
8338 <structname>pg_prepared_xacts</structname> contains one row per prepared
8339 transaction. An entry is removed when the transaction is committed or
8344 <title><structname>pg_prepared_xacts</> Columns</title>
8351 <entry>References</entry>
8352 <entry>Description</entry>
8357 <entry><structfield>transaction</structfield></entry>
8358 <entry><type>xid</type></entry>
8361 Numeric transaction identifier of the prepared transaction
8365 <entry><structfield>gid</structfield></entry>
8366 <entry><type>text</type></entry>
8369 Global transaction identifier that was assigned to the transaction
8373 <entry><structfield>prepared</structfield></entry>
8374 <entry><type>timestamp with time zone</type></entry>
8377 Time at which the transaction was prepared for commit
8381 <entry><structfield>owner</structfield></entry>
8382 <entry><type>name</type></entry>
8383 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8385 Name of the user that executed the transaction
8389 <entry><structfield>database</structfield></entry>
8390 <entry><type>name</type></entry>
8391 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8393 Name of the database in which the transaction was executed
8401 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8402 internal transaction manager data structures are momentarily locked, and
8403 a copy is made for the view to display. This ensures that the
8404 view produces a consistent set of results, while not blocking
8405 normal operations longer than necessary. Nonetheless
8406 there could be some impact on database performance if this view is
8407 frequently accessed.
8412 <sect1 id="view-pg-roles">
8413 <title><structname>pg_roles</structname></title>
8415 <indexterm zone="view-pg-roles">
8416 <primary>pg_roles</primary>
8420 The view <structname>pg_roles</structname> provides access to
8421 information about database roles. This is simply a publicly
8423 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8424 that blanks out the password field.
8428 This view explicitly exposes the OID column of the underlying table,
8429 since that is needed to do joins to other catalogs.
8433 <title><structname>pg_roles</> Columns</title>
8440 <entry>References</entry>
8441 <entry>Description</entry>
8447 <entry><structfield>rolname</structfield></entry>
8448 <entry><type>name</type></entry>
8450 <entry>Role name</entry>
8454 <entry><structfield>rolsuper</structfield></entry>
8455 <entry><type>bool</type></entry>
8457 <entry>Role has superuser privileges</entry>
8461 <entry><structfield>rolinherit</structfield></entry>
8462 <entry><type>bool</type></entry>
8464 <entry>Role automatically inherits privileges of roles it is a
8469 <entry><structfield>rolcreaterole</structfield></entry>
8470 <entry><type>bool</type></entry>
8472 <entry>Role can create more roles</entry>
8476 <entry><structfield>rolcreatedb</structfield></entry>
8477 <entry><type>bool</type></entry>
8479 <entry>Role can create databases</entry>
8483 <entry><structfield>rolcatupdate</structfield></entry>
8484 <entry><type>bool</type></entry>
8487 Role can update system catalogs directly. (Even a superuser cannot do
8488 this unless this column is true)
8493 <entry><structfield>rolcanlogin</structfield></entry>
8494 <entry><type>bool</type></entry>
8497 Role can log in. That is, this role can be given as the initial
8498 session authorization identifier
8503 <entry><structfield>rolreplication</structfield></entry>
8504 <entry><type>bool</type></entry>
8507 Role is a replication role. That is, this role can initiate streaming
8508 replication (see <xref linkend="streaming-replication">) and set/unset
8509 the system backup mode using <function>pg_start_backup</> and
8510 <function>pg_stop_backup</>
8515 <entry><structfield>rolconnlimit</structfield></entry>
8516 <entry><type>int4</type></entry>
8519 For roles that can log in, this sets maximum number of concurrent
8520 connections this role can make. -1 means no limit.
8525 <entry><structfield>rolpassword</structfield></entry>
8526 <entry><type>text</type></entry>
8528 <entry>Not the password (always reads as <literal>********</>)</entry>
8532 <entry><structfield>rolvaliduntil</structfield></entry>
8533 <entry><type>timestamptz</type></entry>
8535 <entry>Password expiry time (only used for password authentication);
8536 null if no expiration</entry>
8540 <entry><structfield>rolconfig</structfield></entry>
8541 <entry><type>text[]</type></entry>
8543 <entry>Role-specific defaults for run-time configuration variables</entry>
8547 <entry><structfield>oid</structfield></entry>
8548 <entry><type>oid</type></entry>
8549 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8550 <entry>ID of role</entry>
8558 <sect1 id="view-pg-rules">
8559 <title><structname>pg_rules</structname></title>
8561 <indexterm zone="view-pg-rules">
8562 <primary>pg_rules</primary>
8566 The view <structname>pg_rules</structname> provides access to
8567 useful information about query rewrite rules.
8571 <title><structname>pg_rules</> Columns</title>
8578 <entry>References</entry>
8579 <entry>Description</entry>
8584 <entry><structfield>schemaname</structfield></entry>
8585 <entry><type>name</type></entry>
8586 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8587 <entry>Name of schema containing table</entry>
8590 <entry><structfield>tablename</structfield></entry>
8591 <entry><type>name</type></entry>
8592 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8593 <entry>Name of table the rule is for</entry>
8596 <entry><structfield>rulename</structfield></entry>
8597 <entry><type>name</type></entry>
8598 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8599 <entry>Name of rule</entry>
8602 <entry><structfield>definition</structfield></entry>
8603 <entry><type>text</type></entry>
8605 <entry>Rule definition (a reconstructed creation command)</entry>
8612 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8613 of views and materialized views; those can be seen in
8614 <structname>pg_views</> and <structname>pg_matviews</>.
8619 <sect1 id="view-pg-seclabels">
8620 <title><structname>pg_seclabels</structname></title>
8622 <indexterm zone="view-pg-seclabels">
8623 <primary>pg_seclabels</primary>
8627 The view <structname>pg_seclabels</structname> provides information about
8628 security labels. It as an easier-to-query version of the
8629 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
8633 <title><structname>pg_seclabels</> Columns</title>
8640 <entry>References</entry>
8641 <entry>Description</entry>
8646 <entry><structfield>objoid</structfield></entry>
8647 <entry><type>oid</type></entry>
8648 <entry>any OID column</entry>
8649 <entry>The OID of the object this security label pertains to</entry>
8652 <entry><structfield>classoid</structfield></entry>
8653 <entry><type>oid</type></entry>
8654 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8655 <entry>The OID of the system catalog this object appears in</entry>
8658 <entry><structfield>objsubid</structfield></entry>
8659 <entry><type>int4</type></entry>
8662 For a security label on a table column, this is the column number (the
8663 <structfield>objoid</> and <structfield>classoid</> refer to
8664 the table itself). For all other object types, this column is
8669 <entry><structfield>objtype</structfield></entry>
8670 <entry><type>text</type></entry>
8673 The type of object to which this label applies, as text.
8677 <entry><structfield>objnamespace</structfield></entry>
8678 <entry><type>oid</type></entry>
8679 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
8681 The OID of the namespace for this object, if applicable;
8686 <entry><structfield>objname</structfield></entry>
8687 <entry><type>text</type></entry>
8690 The name of the object to which this label applies, as text.
8694 <entry><structfield>provider</structfield></entry>
8695 <entry><type>text</type></entry>
8696 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
8697 <entry>The label provider associated with this label.</entry>
8700 <entry><structfield>label</structfield></entry>
8701 <entry><type>text</type></entry>
8702 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
8703 <entry>The security label applied to this object.</entry>
8710 <sect1 id="view-pg-settings">
8711 <title><structname>pg_settings</structname></title>
8713 <indexterm zone="view-pg-settings">
8714 <primary>pg_settings</primary>
8718 The view <structname>pg_settings</structname> provides access to
8719 run-time parameters of the server. It is essentially an alternative
8720 interface to the <xref linkend="sql-show">
8721 and <xref linkend="sql-set"> commands.
8722 It also provides access to some facts about each parameter that are
8723 not directly available from <command>SHOW</>, such as minimum and
8728 <title><structname>pg_settings</> Columns</title>
8735 <entry>Description</entry>
8740 <entry><structfield>name</structfield></entry>
8741 <entry><type>text</type></entry>
8742 <entry>Run-time configuration parameter name</entry>
8745 <entry><structfield>setting</structfield></entry>
8746 <entry><type>text</type></entry>
8747 <entry>Current value of the parameter</entry>
8750 <entry><structfield>unit</structfield></entry>
8751 <entry><type>text</type></entry>
8752 <entry>Implicit unit of the parameter</entry>
8755 <entry><structfield>category</structfield></entry>
8756 <entry><type>text</type></entry>
8757 <entry>Logical group of the parameter</entry>
8760 <entry><structfield>short_desc</structfield></entry>
8761 <entry><type>text</type></entry>
8762 <entry>A brief description of the parameter</entry>
8765 <entry><structfield>extra_desc</structfield></entry>
8766 <entry><type>text</type></entry>
8767 <entry>Additional, more detailed, description of the parameter</entry>
8770 <entry><structfield>context</structfield></entry>
8771 <entry><type>text</type></entry>
8772 <entry>Context required to set the parameter's value (see below)</entry>
8775 <entry><structfield>vartype</structfield></entry>
8776 <entry><type>text</type></entry>
8777 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
8778 <literal>integer</>, <literal>real</>, or <literal>string</>)
8782 <entry><structfield>source</structfield></entry>
8783 <entry><type>text</type></entry>
8784 <entry>Source of the current parameter value</entry>
8787 <entry><structfield>min_val</structfield></entry>
8788 <entry><type>text</type></entry>
8789 <entry>Minimum allowed value of the parameter (null for non-numeric
8793 <entry><structfield>max_val</structfield></entry>
8794 <entry><type>text</type></entry>
8795 <entry>Maximum allowed value of the parameter (null for non-numeric
8799 <entry><structfield>enumvals</structfield></entry>
8800 <entry><type>text[]</type></entry>
8801 <entry>Allowed values of an enum parameter (null for non-enum
8805 <entry><structfield>boot_val</structfield></entry>
8806 <entry><type>text</type></entry>
8807 <entry>Parameter value assumed at server startup if the parameter is
8808 not otherwise set</entry>
8811 <entry><structfield>reset_val</structfield></entry>
8812 <entry><type>text</type></entry>
8813 <entry>Value that <command>RESET</command> would reset the parameter to
8814 in the current session</entry>
8817 <entry><structfield>sourcefile</structfield></entry>
8818 <entry><type>text</type></entry>
8819 <entry>Configuration file the current value was set in (null for
8820 values set from sources other than configuration files, or when
8821 examined by a non-superuser);
8822 helpful when using <literal>include</> directives in configuration files</entry>
8825 <entry><structfield>sourceline</structfield></entry>
8826 <entry><type>integer</type></entry>
8827 <entry>Line number within the configuration file the current value was
8828 set at (null for values set from sources other than configuration files,
8829 or when examined by a non-superuser)
8837 There are several possible values of <structfield>context</structfield>.
8838 In order of decreasing difficulty of changing the setting, they are:
8843 <term><literal>internal</literal></term>
8846 These settings cannot be changed directly; they reflect internally
8847 determined values. Some of them may be adjustable by rebuilding the
8848 server with different configuration options, or by changing options
8849 supplied to <command>initdb</command>.
8854 <term><literal>postmaster</literal></term>
8857 These settings can only be applied when the server starts, so any change
8858 requires restarting the server. Values for these settings are typically
8859 stored in the <filename>postgresql.conf</filename> file, or passed on
8860 the command line when starting the server. Of course, settings with any
8861 of the lower <structfield>context</structfield> types can also be
8862 set at server start time.
8867 <term><literal>sighup</literal></term>
8870 Changes to these settings can be made in
8871 <filename>postgresql.conf</filename> without restarting the server.
8872 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
8873 cause it to re-read <filename>postgresql.conf</filename> and apply
8874 the changes. The postmaster will also forward the
8875 <systemitem>SIGHUP</systemitem> signal to its child processes so that
8876 they all pick up the new value.
8881 <term><literal>backend</literal></term>
8884 Changes to these settings can be made in
8885 <filename>postgresql.conf</filename> without restarting the server;
8886 they can also be set for a particular session in the connection request
8887 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
8888 environment variable). However, these settings never change in a
8889 session after it is started. If you change them in
8890 <filename>postgresql.conf</filename>, send a
8891 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
8892 re-read <filename>postgresql.conf</filename>. The new values will only
8893 affect subsequently-launched sessions.
8898 <term><literal>superuser</literal></term>
8901 These settings can be set from <filename>postgresql.conf</filename>,
8902 or within a session via the <command>SET</> command; but only superusers
8903 can change them via <command>SET</>. Changes in
8904 <filename>postgresql.conf</filename> will affect existing sessions
8905 only if no session-local value has been established with <command>SET</>.
8910 <term><literal>user</literal></term>
8913 These settings can be set from <filename>postgresql.conf</filename>,
8914 or within a session via the <command>SET</> command. Any user is
8915 allowed to change his session-local value. Changes in
8916 <filename>postgresql.conf</filename> will affect existing sessions
8917 only if no session-local value has been established with <command>SET</>.
8924 See <xref linkend="config-setting"> for more information about the various
8925 ways to change these parameters.
8929 The <structname>pg_settings</structname> view cannot be inserted into or
8930 deleted from, but it can be updated. An <command>UPDATE</command> applied
8931 to a row of <structname>pg_settings</structname> is equivalent to executing
8932 the <xref linkend="sql-set"> command on that named
8933 parameter. The change only affects the value used by the current
8934 session. If an <command>UPDATE</command> is issued within a transaction
8935 that is later aborted, the effects of the <command>UPDATE</command> command
8936 disappear when the transaction is rolled back. Once the surrounding
8937 transaction is committed, the effects will persist until the end of the
8938 session, unless overridden by another <command>UPDATE</command> or
8939 <command>SET</command>.
8944 <sect1 id="view-pg-shadow">
8945 <title><structname>pg_shadow</structname></title>
8947 <indexterm zone="view-pg-shadow">
8948 <primary>pg_shadow</primary>
8952 The view <structname>pg_shadow</structname> exists for backwards
8953 compatibility: it emulates a catalog that existed in
8954 <productname>PostgreSQL</productname> before version 8.1.
8955 It shows properties of all roles that are marked as
8956 <structfield>rolcanlogin</> in
8957 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
8961 The name stems from the fact that this table
8962 should not be readable by the public since it contains passwords.
8963 <link linkend="view-pg-user"><structname>pg_user</structname></link>
8964 is a publicly readable view on
8965 <structname>pg_shadow</structname> that blanks out the password field.
8969 <title><structname>pg_shadow</> Columns</title>
8976 <entry>References</entry>
8977 <entry>Description</entry>
8983 <entry><structfield>usename</structfield></entry>
8984 <entry><type>name</type></entry>
8985 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8986 <entry>User name</entry>
8990 <entry><structfield>usesysid</structfield></entry>
8991 <entry><type>oid</type></entry>
8992 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8993 <entry>ID of this user</entry>
8997 <entry><structfield>usecreatedb</structfield></entry>
8998 <entry><type>bool</type></entry>
9000 <entry>User can create databases</entry>
9004 <entry><structfield>usesuper</structfield></entry>
9005 <entry><type>bool</type></entry>
9007 <entry>User is a superuser</entry>
9011 <entry><structfield>usecatupd</structfield></entry>
9012 <entry><type>bool</type></entry>
9015 User can update system catalogs. (Even a superuser cannot do
9016 this unless this column is true.)
9021 <entry><structfield>userepl</structfield></entry>
9022 <entry><type>bool</type></entry>
9025 User can initiate streaming replication and put the system in and
9031 <entry><structfield>passwd</structfield></entry>
9032 <entry><type>text</type></entry>
9034 <entry>Password (possibly encrypted); null if none. See
9035 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9036 for details of how encrypted passwords are stored.</entry>
9040 <entry><structfield>valuntil</structfield></entry>
9041 <entry><type>abstime</type></entry>
9043 <entry>Password expiry time (only used for password authentication)</entry>
9047 <entry><structfield>useconfig</structfield></entry>
9048 <entry><type>text[]</type></entry>
9050 <entry>Session defaults for run-time configuration variables</entry>
9058 <sect1 id="view-pg-stats">
9059 <title><structname>pg_stats</structname></title>
9061 <indexterm zone="view-pg-stats">
9062 <primary>pg_stats</primary>
9066 The view <structname>pg_stats</structname> provides access to
9067 the information stored in the <link
9068 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
9069 catalog. This view allows access only to rows of
9070 <structname>pg_statistic</structname> that correspond to tables the
9071 user has permission to read, and therefore it is safe to allow public
9072 read access to this view.
9076 <structname>pg_stats</structname> is also designed to present the
9077 information in a more readable format than the underlying catalog
9078 — at the cost that its schema must be extended whenever new slot types
9079 are defined for <structname>pg_statistic</structname>.
9083 <title><structname>pg_stats</> Columns</title>
9090 <entry>References</entry>
9091 <entry>Description</entry>
9096 <entry><structfield>schemaname</structfield></entry>
9097 <entry><type>name</type></entry>
9098 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9099 <entry>Name of schema containing table</entry>
9103 <entry><structfield>tablename</structfield></entry>
9104 <entry><type>name</type></entry>
9105 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9106 <entry>Name of table</entry>
9110 <entry><structfield>attname</structfield></entry>
9111 <entry><type>name</type></entry>
9112 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9113 <entry>Name of the column described by this row</entry>
9117 <entry><structfield>inherited</structfield></entry>
9118 <entry><type>bool</type></entry>
9120 <entry>If true, this row includes inheritance child columns, not just the
9121 values in the specified table</entry>
9125 <entry><structfield>null_frac</structfield></entry>
9126 <entry><type>real</type></entry>
9128 <entry>Fraction of column entries that are null</entry>
9132 <entry><structfield>avg_width</structfield></entry>
9133 <entry><type>integer</type></entry>
9135 <entry>Average width in bytes of column's entries</entry>
9139 <entry><structfield>n_distinct</structfield></entry>
9140 <entry><type>real</type></entry>
9143 If greater than zero, the estimated number of distinct values in the
9144 column. If less than zero, the negative of the number of distinct
9145 values divided by the number of rows. (The negated form is used when
9146 <command>ANALYZE</> believes that the number of distinct values is
9147 likely to increase as the table grows; the positive form is used when
9148 the column seems to have a fixed number of possible values.) For
9149 example, -1 indicates a unique column in which the number of distinct
9150 values is the same as the number of rows.
9155 <entry><structfield>most_common_vals</structfield></entry>
9156 <entry><type>anyarray</type></entry>
9159 A list of the most common values in the column. (Null if
9160 no values seem to be more common than any others.)
9165 <entry><structfield>most_common_freqs</structfield></entry>
9166 <entry><type>real[]</type></entry>
9169 A list of the frequencies of the most common values,
9170 i.e., number of occurrences of each divided by total number of rows.
9171 (Null when <structfield>most_common_vals</structfield> is.)
9176 <entry><structfield>histogram_bounds</structfield></entry>
9177 <entry><type>anyarray</type></entry>
9180 A list of values that divide the column's values into groups of
9181 approximately equal population. The values in
9182 <structfield>most_common_vals</>, if present, are omitted from this
9183 histogram calculation. (This column is null if the column data type
9184 does not have a <literal><</> operator or if the
9185 <structfield>most_common_vals</> list accounts for the entire
9191 <entry><structfield>correlation</structfield></entry>
9192 <entry><type>real</type></entry>
9195 Statistical correlation between physical row ordering and
9196 logical ordering of the column values. This ranges from -1 to +1.
9197 When the value is near -1 or +1, an index scan on the column will
9198 be estimated to be cheaper than when it is near zero, due to reduction
9199 of random access to the disk. (This column is null if the column data
9200 type does not have a <literal><</> operator.)
9205 <entry><structfield>most_common_elems</structfield></entry>
9206 <entry><type>anyarray</type></entry>
9209 A list of non-null element values most often appearing within values of
9210 the column. (Null for scalar types.)
9215 <entry><structfield>most_common_elem_freqs</structfield></entry>
9216 <entry><type>real[]</type></entry>
9219 A list of the frequencies of the most common element values, i.e., the
9220 fraction of rows containing at least one instance of the given value.
9221 Two or three additional values follow the per-element frequencies;
9222 these are the minimum and maximum of the preceding per-element
9223 frequencies, and optionally the frequency of null elements.
9224 (Null when <structfield>most_common_elems</structfield> is.)
9229 <entry><structfield>elem_count_histogram</structfield></entry>
9230 <entry><type>real[]</type></entry>
9233 A histogram of the counts of distinct non-null element values within the
9234 values of the column, followed by the average number of distinct
9235 non-null elements. (Null for scalar types.)
9243 The maximum number of entries in the array fields can be controlled on a
9244 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9245 command, or globally by setting the
9246 <xref linkend="guc-default-statistics-target"> run-time parameter.
9251 <sect1 id="view-pg-tables">
9252 <title><structname>pg_tables</structname></title>
9254 <indexterm zone="view-pg-tables">
9255 <primary>pg_tables</primary>
9259 The view <structname>pg_tables</structname> provides access to
9260 useful information about each table in the database.
9264 <title><structname>pg_tables</> Columns</title>
9271 <entry>References</entry>
9272 <entry>Description</entry>
9277 <entry><structfield>schemaname</structfield></entry>
9278 <entry><type>name</type></entry>
9279 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9280 <entry>Name of schema containing table</entry>
9283 <entry><structfield>tablename</structfield></entry>
9284 <entry><type>name</type></entry>
9285 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9286 <entry>Name of table</entry>
9289 <entry><structfield>tableowner</structfield></entry>
9290 <entry><type>name</type></entry>
9291 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9292 <entry>Name of table's owner</entry>
9295 <entry><structfield>tablespace</structfield></entry>
9296 <entry><type>name</type></entry>
9297 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9298 <entry>Name of tablespace containing table (null if default for database)</entry>
9301 <entry><structfield>hasindexes</structfield></entry>
9302 <entry><type>boolean</type></entry>
9303 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9304 <entry>True if table has (or recently had) any indexes</entry>
9307 <entry><structfield>hasrules</structfield></entry>
9308 <entry><type>boolean</type></entry>
9309 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9310 <entry>True if table has (or once had) rules</entry>
9313 <entry><structfield>hastriggers</structfield></entry>
9314 <entry><type>boolean</type></entry>
9315 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9316 <entry>True if table has (or once had) triggers</entry>
9319 <entry><structfield>rowsecurity</structfield></entry>
9320 <entry><type>boolean</type></entry>
9321 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
9322 <entry>True if row security is enabled on the table</entry>
9330 <sect1 id="view-pg-timezone-abbrevs">
9331 <title><structname>pg_timezone_abbrevs</structname></title>
9333 <indexterm zone="view-pg-timezone-abbrevs">
9334 <primary>pg_timezone_abbrevs</primary>
9338 The view <structname>pg_timezone_abbrevs</structname> provides a list
9339 of time zone abbreviations that are currently recognized by the datetime
9340 input routines. The contents of this view change when the
9341 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9345 <title><structname>pg_timezone_abbrevs</> Columns</title>
9352 <entry>Description</entry>
9357 <entry><structfield>abbrev</structfield></entry>
9358 <entry><type>text</type></entry>
9359 <entry>Time zone abbreviation</entry>
9362 <entry><structfield>utc_offset</structfield></entry>
9363 <entry><type>interval</type></entry>
9364 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9367 <entry><structfield>is_dst</structfield></entry>
9368 <entry><type>boolean</type></entry>
9369 <entry>True if this is a daylight-savings abbreviation</entry>
9377 <sect1 id="view-pg-timezone-names">
9378 <title><structname>pg_timezone_names</structname></title>
9380 <indexterm zone="view-pg-timezone-names">
9381 <primary>pg_timezone_names</primary>
9385 The view <structname>pg_timezone_names</structname> provides a list
9386 of time zone names that are recognized by <command>SET TIMEZONE</>,
9387 along with their associated abbreviations, UTC offsets,
9388 and daylight-savings status. (Technically,
9389 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9390 than UTC because leap seconds are not handled.)
9391 Unlike the abbreviations shown in <link
9392 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9393 date rules. Therefore, the associated information changes across local DST
9394 boundaries. The displayed information is computed based on the current
9395 value of <function>CURRENT_TIMESTAMP</>.
9399 <title><structname>pg_timezone_names</> Columns</title>
9406 <entry>Description</entry>
9411 <entry><structfield>name</structfield></entry>
9412 <entry><type>text</type></entry>
9413 <entry>Time zone name</entry>
9416 <entry><structfield>abbrev</structfield></entry>
9417 <entry><type>text</type></entry>
9418 <entry>Time zone abbreviation</entry>
9421 <entry><structfield>utc_offset</structfield></entry>
9422 <entry><type>interval</type></entry>
9423 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9426 <entry><structfield>is_dst</structfield></entry>
9427 <entry><type>boolean</type></entry>
9428 <entry>True if currently observing daylight savings</entry>
9436 <sect1 id="view-pg-user">
9437 <title><structname>pg_user</structname></title>
9439 <indexterm zone="view-pg-user">
9440 <primary>pg_user</primary>
9444 The view <structname>pg_user</structname> provides access to
9445 information about database users. This is simply a publicly
9447 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9448 that blanks out the password field.
9452 <title><structname>pg_user</> Columns</title>
9459 <entry>Description</entry>
9464 <entry><structfield>usename</structfield></entry>
9465 <entry><type>name</type></entry>
9466 <entry>User name</entry>
9470 <entry><structfield>usesysid</structfield></entry>
9471 <entry><type>oid</type></entry>
9472 <entry>ID of this user</entry>
9476 <entry><structfield>usecreatedb</structfield></entry>
9477 <entry><type>bool</type></entry>
9478 <entry>User can create databases</entry>
9482 <entry><structfield>usesuper</structfield></entry>
9483 <entry><type>bool</type></entry>
9484 <entry>User is a superuser</entry>
9488 <entry><structfield>usecatupd</structfield></entry>
9489 <entry><type>bool</type></entry>
9491 User can update system catalogs. (Even a superuser cannot do
9492 this unless this column is true.)
9497 <entry><structfield>userepl</structfield></entry>
9498 <entry><type>bool</type></entry>
9500 User can initiate streaming replication and put the system in and
9506 <entry><structfield>passwd</structfield></entry>
9507 <entry><type>text</type></entry>
9508 <entry>Not the password (always reads as <literal>********</>)</entry>
9512 <entry><structfield>valuntil</structfield></entry>
9513 <entry><type>abstime</type></entry>
9514 <entry>Password expiry time (only used for password authentication)</entry>
9518 <entry><structfield>useconfig</structfield></entry>
9519 <entry><type>text[]</type></entry>
9520 <entry>Session defaults for run-time configuration variables</entry>
9528 <sect1 id="view-pg-user-mappings">
9529 <title><structname>pg_user_mappings</structname></title>
9531 <indexterm zone="view-pg-user-mappings">
9532 <primary>pg_user_mappings</primary>
9536 The view <structname>pg_user_mappings</structname> provides access
9537 to information about user mappings. This is essentially a publicly
9539 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9540 that leaves out the options field if the user has no rights to use
9545 <title><structname>pg_user_mappings</> Columns</title>
9552 <entry>References</entry>
9553 <entry>Description</entry>
9559 <entry><structfield>umid</structfield></entry>
9560 <entry><type>oid</type></entry>
9561 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
9562 <entry>OID of the user mapping</entry>
9566 <entry><structfield>srvid</structfield></entry>
9567 <entry><type>oid</type></entry>
9568 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
9570 The OID of the foreign server that contains this mapping
9575 <entry><structfield>srvname</structfield></entry>
9576 <entry><type>name</type></entry>
9577 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
9579 Name of the foreign server
9584 <entry><structfield>umuser</structfield></entry>
9585 <entry><type>oid</type></entry>
9586 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9587 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
9591 <entry><structfield>usename</structfield></entry>
9592 <entry><type>name</type></entry>
9594 <entry>Name of the local user to be mapped</entry>
9598 <entry><structfield>umoptions</structfield></entry>
9599 <entry><type>text[]</type></entry>
9602 User mapping specific options, as <quote>keyword=value</>
9603 strings, if the current user is the owner of the foreign
9613 <sect1 id="view-pg-views">
9614 <title><structname>pg_views</structname></title>
9616 <indexterm zone="view-pg-views">
9617 <primary>pg_views</primary>
9621 The view <structname>pg_views</structname> provides access to
9622 useful information about each view in the database.
9626 <title><structname>pg_views</> Columns</title>
9633 <entry>References</entry>
9634 <entry>Description</entry>
9639 <entry><structfield>schemaname</structfield></entry>
9640 <entry><type>name</type></entry>
9641 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9642 <entry>Name of schema containing view</entry>
9645 <entry><structfield>viewname</structfield></entry>
9646 <entry><type>name</type></entry>
9647 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9648 <entry>Name of view</entry>
9651 <entry><structfield>viewowner</structfield></entry>
9652 <entry><type>name</type></entry>
9653 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9654 <entry>Name of view's owner</entry>
9657 <entry><structfield>definition</structfield></entry>
9658 <entry><type>text</type></entry>
9660 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>