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>relhasrowsecurity</structfield></entry>
1945 <entry><type>bool</type></entry>
1947 True if table has row-security enabled; see
1948 <link linkend="catalog-pg-rowsecurity"><structname>pg_rowsecurity</structname></link> catalog
1953 <entry><structfield>relhassubclass</structfield></entry>
1954 <entry><type>bool</type></entry>
1956 <entry>True if table has (or once had) any inheritance children</entry>
1960 <entry><structfield>relispopulated</structfield></entry>
1961 <entry><type>bool</type></entry>
1963 <entry>True if relation is populated (this is true for all
1964 relations other than some materialized views)</entry>
1968 <entry><structfield>relreplident</structfield></entry>
1969 <entry><type>char</type></entry>
1972 Columns used to form <quote>replica identity</> for rows:
1973 <literal>d</> = default (primary key, if any),
1974 <literal>n</> = nothing,
1975 <literal>f</> = all columns
1976 <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1981 <entry><structfield>relfrozenxid</structfield></entry>
1982 <entry><type>xid</type></entry>
1985 All transaction IDs before this one have been replaced with a permanent
1986 (<quote>frozen</>) transaction ID in this table. This is used to track
1987 whether the table needs to be vacuumed in order to prevent transaction
1988 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1989 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1994 <entry><structfield>relminmxid</structfield></entry>
1995 <entry><type>xid</type></entry>
1998 All multitransaction IDs before this one have been replaced by a
1999 transaction ID in this table. This is used to track
2000 whether the table needs to be vacuumed in order to prevent multitransaction ID
2001 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
2002 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2007 <entry><structfield>relacl</structfield></entry>
2008 <entry><type>aclitem[]</type></entry>
2011 Access privileges; see
2012 <xref linkend="sql-grant"> and
2013 <xref linkend="sql-revoke">
2019 <entry><structfield>reloptions</structfield></entry>
2020 <entry><type>text[]</type></entry>
2023 Access-method-specific options, as <quote>keyword=value</> strings
2031 Several of the Boolean flags in <structname>pg_class</> are maintained
2032 lazily: they are guaranteed to be true if that's the correct state, but
2033 may not be reset to false immediately when the condition is no longer
2034 true. For example, <structfield>relhasindex</> is set by
2035 <command>CREATE INDEX</command>, but it is never cleared by
2036 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
2037 <structfield>relhasindex</> if it finds the table has no indexes. This
2038 arrangement avoids race conditions and improves concurrency.
2042 <sect1 id="catalog-pg-collation">
2043 <title><structname>pg_collation</structname></title>
2045 <indexterm zone="catalog-pg-collation">
2046 <primary>pg_collation</primary>
2050 The catalog <structname>pg_collation</structname> describes the
2051 available collations, which are essentially mappings from an SQL
2052 name to operating system locale categories.
2053 See <xref linkend="collation"> for more information.
2057 <title><structname>pg_collation</> Columns</title>
2064 <entry>References</entry>
2065 <entry>Description</entry>
2071 <entry><structfield>oid</structfield></entry>
2072 <entry><type>oid</type></entry>
2074 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2078 <entry><structfield>collname</structfield></entry>
2079 <entry><type>name</type></entry>
2081 <entry>Collation name (unique per namespace and encoding)</entry>
2085 <entry><structfield>collnamespace</structfield></entry>
2086 <entry><type>oid</type></entry>
2087 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2089 The OID of the namespace that contains this collation
2094 <entry><structfield>collowner</structfield></entry>
2095 <entry><type>oid</type></entry>
2096 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2097 <entry>Owner of the collation</entry>
2101 <entry><structfield>collencoding</structfield></entry>
2102 <entry><type>int4</type></entry>
2104 <entry>Encoding in which the collation is applicable, or -1 if it
2105 works for any encoding</entry>
2109 <entry><structfield>collcollate</structfield></entry>
2110 <entry><type>name</type></entry>
2112 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2116 <entry><structfield>collctype</structfield></entry>
2117 <entry><type>name</type></entry>
2119 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2126 Note that the unique key on this catalog is (<structfield>collname</>,
2127 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2128 (<structfield>collname</>, <structfield>collnamespace</>).
2129 <productname>PostgreSQL</productname> generally ignores all
2130 collations that do not have <structfield>collencoding</> equal to
2131 either the current database's encoding or -1, and creation of new entries
2132 with the same name as an entry with <structfield>collencoding</> = -1
2133 is forbidden. Therefore it is sufficient to use a qualified SQL name
2134 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2135 even though this is not unique according to the catalog definition.
2136 The reason for defining the catalog this way is that
2137 <application>initdb</> fills it in at cluster initialization time with
2138 entries for all locales available on the system, so it must be able to
2139 hold entries for all encodings that might ever be used in the cluster.
2143 In the <literal>template0</> database, it could be useful to create
2144 collations whose encoding does not match the database encoding,
2145 since they could match the encodings of databases later cloned from
2146 <literal>template0</>. This would currently have to be done manually.
2150 <sect1 id="catalog-pg-constraint">
2151 <title><structname>pg_constraint</structname></title>
2153 <indexterm zone="catalog-pg-constraint">
2154 <primary>pg_constraint</primary>
2158 The catalog <structname>pg_constraint</structname> stores check, primary
2159 key, unique, foreign key, and exclusion constraints on tables.
2160 (Column constraints are not treated specially. Every column constraint is
2161 equivalent to some table constraint.)
2162 Not-null constraints are represented in the <structname>pg_attribute</>
2167 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2168 TRIGGER</>) also give rise to an entry in this table.
2172 Check constraints on domains are stored here, too.
2176 <title><structname>pg_constraint</> Columns</title>
2183 <entry>References</entry>
2184 <entry>Description</entry>
2190 <entry><structfield>oid</structfield></entry>
2191 <entry><type>oid</type></entry>
2193 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2197 <entry><structfield>conname</structfield></entry>
2198 <entry><type>name</type></entry>
2200 <entry>Constraint name (not necessarily unique!)</entry>
2204 <entry><structfield>connamespace</structfield></entry>
2205 <entry><type>oid</type></entry>
2206 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2208 The OID of the namespace that contains this constraint
2213 <entry><structfield>contype</structfield></entry>
2214 <entry><type>char</type></entry>
2217 <literal>c</> = check constraint,
2218 <literal>f</> = foreign key constraint,
2219 <literal>p</> = primary key constraint,
2220 <literal>u</> = unique constraint,
2221 <literal>t</> = constraint trigger,
2222 <literal>x</> = exclusion constraint
2227 <entry><structfield>condeferrable</structfield></entry>
2228 <entry><type>bool</type></entry>
2230 <entry>Is the constraint deferrable?</entry>
2234 <entry><structfield>condeferred</structfield></entry>
2235 <entry><type>bool</type></entry>
2237 <entry>Is the constraint deferred by default?</entry>
2241 <entry><structfield>convalidated</structfield></entry>
2242 <entry><type>bool</type></entry>
2244 <entry>Has the constraint been validated?
2245 Currently, can only be false for foreign keys and CHECK constraints</entry>
2249 <entry><structfield>conrelid</structfield></entry>
2250 <entry><type>oid</type></entry>
2251 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2252 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2256 <entry><structfield>contypid</structfield></entry>
2257 <entry><type>oid</type></entry>
2258 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2259 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2263 <entry><structfield>conindid</structfield></entry>
2264 <entry><type>oid</type></entry>
2265 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2266 <entry>The index supporting this constraint, if it's a unique, primary
2267 key, foreign key, or exclusion constraint; else 0</entry>
2271 <entry><structfield>confrelid</structfield></entry>
2272 <entry><type>oid</type></entry>
2273 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2274 <entry>If a foreign key, the referenced table; else 0</entry>
2278 <entry><structfield>confupdtype</structfield></entry>
2279 <entry><type>char</type></entry>
2281 <entry>Foreign key update action code:
2282 <literal>a</> = no action,
2283 <literal>r</> = restrict,
2284 <literal>c</> = cascade,
2285 <literal>n</> = set null,
2286 <literal>d</> = set default
2291 <entry><structfield>confdeltype</structfield></entry>
2292 <entry><type>char</type></entry>
2294 <entry>Foreign key deletion action code:
2295 <literal>a</> = no action,
2296 <literal>r</> = restrict,
2297 <literal>c</> = cascade,
2298 <literal>n</> = set null,
2299 <literal>d</> = set default
2304 <entry><structfield>confmatchtype</structfield></entry>
2305 <entry><type>char</type></entry>
2307 <entry>Foreign key match type:
2308 <literal>f</> = full,
2309 <literal>p</> = partial,
2310 <literal>s</> = simple
2315 <entry><structfield>conislocal</structfield></entry>
2316 <entry><type>bool</type></entry>
2319 This constraint is defined locally for the relation. Note that a
2320 constraint can be locally defined and inherited simultaneously.
2325 <entry><structfield>coninhcount</structfield></entry>
2326 <entry><type>int4</type></entry>
2329 The number of direct inheritance ancestors this constraint has.
2331 a nonzero number of ancestors cannot be dropped nor renamed.
2336 <entry><structfield>connoinherit</structfield></entry>
2337 <entry><type>bool</type></entry>
2340 This constraint is defined locally for the relation. It is a
2341 non-inheritable constraint.
2346 <entry><structfield>conkey</structfield></entry>
2347 <entry><type>int2[]</type></entry>
2348 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2349 <entry>If a table constraint (including foreign keys, but not constraint
2350 triggers), list of the constrained columns</entry>
2354 <entry><structfield>confkey</structfield></entry>
2355 <entry><type>int2[]</type></entry>
2356 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2357 <entry>If a foreign key, list of the referenced columns</entry>
2361 <entry><structfield>conpfeqop</structfield></entry>
2362 <entry><type>oid[]</type></entry>
2363 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2364 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2368 <entry><structfield>conppeqop</structfield></entry>
2369 <entry><type>oid[]</type></entry>
2370 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2371 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2375 <entry><structfield>conffeqop</structfield></entry>
2376 <entry><type>oid[]</type></entry>
2377 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2378 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2382 <entry><structfield>conexclop</structfield></entry>
2383 <entry><type>oid[]</type></entry>
2384 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2385 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2389 <entry><structfield>conbin</structfield></entry>
2390 <entry><type>pg_node_tree</type></entry>
2392 <entry>If a check constraint, an internal representation of the expression</entry>
2396 <entry><structfield>consrc</structfield></entry>
2397 <entry><type>text</type></entry>
2399 <entry>If a check constraint, a human-readable representation of the expression</entry>
2406 In the case of an exclusion constraint, <structfield>conkey</structfield>
2407 is only useful for constraint elements that are simple column references.
2408 For other cases, a zero appears in <structfield>conkey</structfield>
2409 and the associated index must be consulted to discover the expression
2410 that is constrained. (<structfield>conkey</structfield> thus has the
2411 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2417 <structfield>consrc</structfield> is not updated when referenced objects
2418 change; for example, it won't track renaming of columns. Rather than
2419 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2420 to extract the definition of a check constraint.
2426 <literal>pg_class.relchecks</literal> needs to agree with the
2427 number of check-constraint entries found in this table for each
2434 <sect1 id="catalog-pg-conversion">
2435 <title><structname>pg_conversion</structname></title>
2437 <indexterm zone="catalog-pg-conversion">
2438 <primary>pg_conversion</primary>
2442 The catalog <structname>pg_conversion</structname> describes
2443 encoding conversion procedures. See <xref linkend="sql-createconversion">
2444 for more information.
2448 <title><structname>pg_conversion</> Columns</title>
2455 <entry>References</entry>
2456 <entry>Description</entry>
2462 <entry><structfield>oid</structfield></entry>
2463 <entry><type>oid</type></entry>
2465 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2469 <entry><structfield>conname</structfield></entry>
2470 <entry><type>name</type></entry>
2472 <entry>Conversion name (unique within a namespace)</entry>
2476 <entry><structfield>connamespace</structfield></entry>
2477 <entry><type>oid</type></entry>
2478 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2480 The OID of the namespace that contains this conversion
2485 <entry><structfield>conowner</structfield></entry>
2486 <entry><type>oid</type></entry>
2487 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2488 <entry>Owner of the conversion</entry>
2492 <entry><structfield>conforencoding</structfield></entry>
2493 <entry><type>int4</type></entry>
2495 <entry>Source encoding ID</entry>
2499 <entry><structfield>contoencoding</structfield></entry>
2500 <entry><type>int4</type></entry>
2502 <entry>Destination encoding ID</entry>
2506 <entry><structfield>conproc</structfield></entry>
2507 <entry><type>regproc</type></entry>
2508 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2509 <entry>Conversion procedure</entry>
2513 <entry><structfield>condefault</structfield></entry>
2514 <entry><type>bool</type></entry>
2516 <entry>True if this is the default conversion</entry>
2525 <sect1 id="catalog-pg-database">
2526 <title><structname>pg_database</structname></title>
2528 <indexterm zone="catalog-pg-database">
2529 <primary>pg_database</primary>
2533 The catalog <structname>pg_database</structname> stores information about
2534 the available databases. Databases are created with the <xref
2535 linkend="sql-createdatabase"> command.
2536 Consult <xref linkend="managing-databases"> for details about the meaning
2537 of some of the parameters.
2541 Unlike most system catalogs, <structname>pg_database</structname>
2542 is shared across all databases of a cluster: there is only one
2543 copy of <structname>pg_database</structname> per cluster, not
2548 <title><structname>pg_database</> Columns</title>
2555 <entry>References</entry>
2556 <entry>Description</entry>
2562 <entry><structfield>oid</structfield></entry>
2563 <entry><type>oid</type></entry>
2565 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2569 <entry><structfield>datname</structfield></entry>
2570 <entry><type>name</type></entry>
2572 <entry>Database name</entry>
2576 <entry><structfield>datdba</structfield></entry>
2577 <entry><type>oid</type></entry>
2578 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2579 <entry>Owner of the database, usually the user who created it</entry>
2583 <entry><structfield>encoding</structfield></entry>
2584 <entry><type>int4</type></entry>
2586 <entry>Character encoding for this database
2587 (<function>pg_encoding_to_char()</function> can translate
2588 this number to the encoding name)</entry>
2592 <entry><structfield>datcollate</structfield></entry>
2593 <entry><type>name</type></entry>
2595 <entry>LC_COLLATE for this database</entry>
2599 <entry><structfield>datctype</structfield></entry>
2600 <entry><type>name</type></entry>
2602 <entry>LC_CTYPE for this database</entry>
2606 <entry><structfield>datistemplate</structfield></entry>
2607 <entry><type>bool</type></entry>
2610 If true, then this database can be cloned by
2611 any user with <literal>CREATEDB</> privileges;
2612 if false, then only superusers or the owner of
2613 the database can clone it.
2618 <entry><structfield>datallowconn</structfield></entry>
2619 <entry><type>bool</type></entry>
2622 If false then no one can connect to this database. This is
2623 used to protect the <literal>template0</> database from being altered.
2628 <entry><structfield>datconnlimit</structfield></entry>
2629 <entry><type>int4</type></entry>
2632 Sets maximum number of concurrent connections that can be made
2633 to this database. -1 means no limit.
2638 <entry><structfield>datlastsysoid</structfield></entry>
2639 <entry><type>oid</type></entry>
2642 Last system OID in the database; useful
2643 particularly to <application>pg_dump</application>
2648 <entry><structfield>datfrozenxid</structfield></entry>
2649 <entry><type>xid</type></entry>
2652 All transaction IDs before this one have been replaced with a permanent
2653 (<quote>frozen</>) transaction ID in this database. This is used to
2654 track whether the database needs to be vacuumed in order to prevent
2655 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2656 It is the minimum of the per-table
2657 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2662 <entry><structfield>datminmxid</structfield></entry>
2663 <entry><type>xid</type></entry>
2666 All multitransaction IDs before this one have been replaced with a
2667 transaction ID in this database. This is used to
2668 track whether the database needs to be vacuumed in order to prevent
2669 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2670 It is the minimum of the per-table
2671 <structname>pg_class</>.<structfield>relminmxid</> values.
2676 <entry><structfield>dattablespace</structfield></entry>
2677 <entry><type>oid</type></entry>
2678 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2680 The default tablespace for the database.
2681 Within this database, all tables for which
2682 <structname>pg_class</>.<structfield>reltablespace</> is zero
2683 will be stored in this tablespace; in particular, all the non-shared
2684 system catalogs will be there.
2689 <entry><structfield>datacl</structfield></entry>
2690 <entry><type>aclitem[]</type></entry>
2693 Access privileges; see
2694 <xref linkend="sql-grant"> and
2695 <xref linkend="sql-revoke">
2705 <sect1 id="catalog-pg-db-role-setting">
2706 <title><structname>pg_db_role_setting</structname></title>
2708 <indexterm zone="catalog-pg-db-role-setting">
2709 <primary>pg_db_role_setting</primary>
2713 The catalog <structname>pg_db_role_setting</structname> records the default
2714 values that have been set for run-time configuration variables,
2715 for each role and database combination.
2719 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2720 is shared across all databases of a cluster: there is only one
2721 copy of <structname>pg_db_role_setting</structname> per cluster, not
2726 <title><structname>pg_db_role_setting</> Columns</title>
2733 <entry>References</entry>
2734 <entry>Description</entry>
2740 <entry><structfield>setdatabase</structfield></entry>
2741 <entry><type>oid</type></entry>
2742 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2743 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2747 <entry><structfield>setrole</structfield></entry>
2748 <entry><type>oid</type></entry>
2749 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2750 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2754 <entry><structfield>setconfig</structfield></entry>
2755 <entry><type>text[]</type></entry>
2757 <entry>Defaults for run-time configuration variables</entry>
2765 <sect1 id="catalog-pg-default-acl">
2766 <title><structname>pg_default_acl</structname></title>
2768 <indexterm zone="catalog-pg-default-acl">
2769 <primary>pg_default_acl</primary>
2773 The catalog <structname>pg_default_acl</> stores initial
2774 privileges to be assigned to newly created objects.
2778 <title><structname>pg_default_acl</> Columns</title>
2785 <entry>References</entry>
2786 <entry>Description</entry>
2792 <entry><structfield>oid</structfield></entry>
2793 <entry><type>oid</type></entry>
2795 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2799 <entry><structfield>defaclrole</structfield></entry>
2800 <entry><type>oid</type></entry>
2801 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2802 <entry>The OID of the role associated with this entry</entry>
2806 <entry><structfield>defaclnamespace</structfield></entry>
2807 <entry><type>oid</type></entry>
2808 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2809 <entry>The OID of the namespace associated with this entry,
2810 or 0 if none</entry>
2814 <entry><structfield>defaclobjtype</structfield></entry>
2815 <entry><type>char</type></entry>
2818 Type of object this entry is for:
2819 <literal>r</> = relation (table, view),
2820 <literal>S</> = sequence,
2821 <literal>f</> = function,
2822 <literal>T</> = type
2827 <entry><structfield>defaclacl</structfield></entry>
2828 <entry><type>aclitem[]</type></entry>
2831 Access privileges that this type of object should have on creation
2839 A <structname>pg_default_acl</> entry shows the initial privileges to
2840 be assigned to an object belonging to the indicated user. There are
2841 currently two types of entry: <quote>global</> entries with
2842 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2843 that reference a particular schema. If a global entry is present then
2844 it <emphasis>overrides</> the normal hard-wired default privileges
2845 for the object type. A per-schema entry, if present, represents privileges
2846 to be <emphasis>added to</> the global or hard-wired default privileges.
2850 Note that when an ACL entry in another catalog is null, it is taken
2851 to represent the hard-wired default privileges for its object,
2852 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2853 at the moment. <structname>pg_default_acl</> is only consulted during
2860 <sect1 id="catalog-pg-depend">
2861 <title><structname>pg_depend</structname></title>
2863 <indexterm zone="catalog-pg-depend">
2864 <primary>pg_depend</primary>
2868 The catalog <structname>pg_depend</structname> records the dependency
2869 relationships between database objects. This information allows
2870 <command>DROP</> commands to find which other objects must be dropped
2871 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2876 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2877 which performs a similar function for dependencies involving objects
2878 that are shared across a database cluster.
2882 <title><structname>pg_depend</> Columns</title>
2889 <entry>References</entry>
2890 <entry>Description</entry>
2896 <entry><structfield>classid</structfield></entry>
2897 <entry><type>oid</type></entry>
2898 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2899 <entry>The OID of the system catalog the dependent object is in</entry>
2903 <entry><structfield>objid</structfield></entry>
2904 <entry><type>oid</type></entry>
2905 <entry>any OID column</entry>
2906 <entry>The OID of the specific dependent object</entry>
2910 <entry><structfield>objsubid</structfield></entry>
2911 <entry><type>int4</type></entry>
2914 For a table column, this is the column number (the
2915 <structfield>objid</> and <structfield>classid</> refer to the
2916 table itself). For all other object types, this column is
2922 <entry><structfield>refclassid</structfield></entry>
2923 <entry><type>oid</type></entry>
2924 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2925 <entry>The OID of the system catalog the referenced object is in</entry>
2929 <entry><structfield>refobjid</structfield></entry>
2930 <entry><type>oid</type></entry>
2931 <entry>any OID column</entry>
2932 <entry>The OID of the specific referenced object</entry>
2936 <entry><structfield>refobjsubid</structfield></entry>
2937 <entry><type>int4</type></entry>
2940 For a table column, this is the column number (the
2941 <structfield>refobjid</> and <structfield>refclassid</> refer
2942 to the table itself). For all other object types, this column
2948 <entry><structfield>deptype</structfield></entry>
2949 <entry><type>char</type></entry>
2952 A code defining the specific semantics of this dependency relationship; see text
2961 In all cases, a <structname>pg_depend</structname> entry indicates that the
2962 referenced object cannot be dropped without also dropping the dependent
2963 object. However, there are several subflavors identified by
2964 <structfield>deptype</>:
2968 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2971 A normal relationship between separately-created objects. The
2972 dependent object can be dropped without affecting the
2973 referenced object. The referenced object can only be dropped
2974 by specifying <literal>CASCADE</>, in which case the dependent
2975 object is dropped, too. Example: a table column has a normal
2976 dependency on its data type.
2982 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2985 The dependent object can be dropped separately from the
2986 referenced object, and should be automatically dropped
2987 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2988 mode) if the referenced object is dropped. Example: a named
2989 constraint on a table is made autodependent on the table, so
2990 that it will go away if the table is dropped.
2996 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2999 The dependent object was created as part of creation of the
3000 referenced object, and is really just a part of its internal
3001 implementation. A <command>DROP</> of the dependent object
3002 will be disallowed outright (we'll tell the user to issue a
3003 <command>DROP</> against the referenced object, instead). A
3004 <command>DROP</> of the referenced object will be propagated
3005 through to drop the dependent object whether
3006 <command>CASCADE</> is specified or not. Example: a trigger
3007 that's created to enforce a foreign-key constraint is made
3008 internally dependent on the constraint's
3009 <structname>pg_constraint</> entry.
3015 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
3018 The dependent object is a member of the <firstterm>extension</> that is
3019 the referenced object (see
3020 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3021 The dependent object can be dropped only via
3022 <command>DROP EXTENSION</> on the referenced object. Functionally
3023 this dependency type acts the same as an internal dependency, but
3024 it's kept separate for clarity and to simplify <application>pg_dump</>.
3030 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3033 There is no dependent object; this type of entry is a signal
3034 that the system itself depends on the referenced object, and so
3035 that object must never be deleted. Entries of this type are
3036 created only by <command>initdb</command>. The columns for the
3037 dependent object contain zeroes.
3043 Other dependency flavors might be needed in future.
3049 <sect1 id="catalog-pg-description">
3050 <title><structname>pg_description</structname></title>
3052 <indexterm zone="catalog-pg-description">
3053 <primary>pg_description</primary>
3057 The catalog <structname>pg_description</> stores optional descriptions
3058 (comments) for each database object. Descriptions can be manipulated
3059 with the <xref linkend="sql-comment"> command and viewed with
3060 <application>psql</application>'s <literal>\d</literal> commands.
3061 Descriptions of many built-in system objects are provided in the initial
3062 contents of <structname>pg_description</structname>.
3066 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3067 which performs a similar function for descriptions involving objects that
3068 are shared across a database cluster.
3072 <title><structname>pg_description</> Columns</title>
3079 <entry>References</entry>
3080 <entry>Description</entry>
3086 <entry><structfield>objoid</structfield></entry>
3087 <entry><type>oid</type></entry>
3088 <entry>any OID column</entry>
3089 <entry>The OID of the object this description pertains to</entry>
3093 <entry><structfield>classoid</structfield></entry>
3094 <entry><type>oid</type></entry>
3095 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3096 <entry>The OID of the system catalog this object appears in</entry>
3100 <entry><structfield>objsubid</structfield></entry>
3101 <entry><type>int4</type></entry>
3104 For a comment on a table column, this is the column number (the
3105 <structfield>objoid</> and <structfield>classoid</> refer to
3106 the table itself). For all other object types, this column is
3112 <entry><structfield>description</structfield></entry>
3113 <entry><type>text</type></entry>
3115 <entry>Arbitrary text that serves as the description of this object</entry>
3124 <sect1 id="catalog-pg-enum">
3125 <title><structname>pg_enum</structname></title>
3127 <indexterm zone="catalog-pg-enum">
3128 <primary>pg_enum</primary>
3132 The <structname>pg_enum</structname> catalog contains entries
3133 showing the values and labels for each enum type. The
3134 internal representation of a given enum value is actually the OID
3135 of its associated row in <structname>pg_enum</structname>.
3139 <title><structname>pg_enum</> Columns</title>
3146 <entry>References</entry>
3147 <entry>Description</entry>
3153 <entry><structfield>oid</structfield></entry>
3154 <entry><type>oid</type></entry>
3156 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3160 <entry><structfield>enumtypid</structfield></entry>
3161 <entry><type>oid</type></entry>
3162 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3163 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3167 <entry><structfield>enumsortorder</structfield></entry>
3168 <entry><type>float4</type></entry>
3170 <entry>The sort position of this enum value within its enum type</entry>
3174 <entry><structfield>enumlabel</structfield></entry>
3175 <entry><type>name</type></entry>
3177 <entry>The textual label for this enum value</entry>
3184 The OIDs for <structname>pg_enum</structname> rows follow a special
3185 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3186 as the sort ordering of their enum type. That is, if two even OIDs
3187 belong to the same enum type, the smaller OID must have the smaller
3188 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3189 need bear no relationship to the sort order. This rule allows the
3190 enum comparison routines to avoid catalog lookups in many common cases.
3191 The routines that create and alter enum types attempt to assign even
3192 OIDs to enum values whenever possible.
3196 When an enum type is created, its members are assigned sort-order
3197 positions 1..<replaceable>n</>. But members added later might be given
3198 negative or fractional values of <structfield>enumsortorder</structfield>.
3199 The only requirement on these values is that they be correctly
3200 ordered and unique within each enum type.
3205 <sect1 id="catalog-pg-event-trigger">
3206 <title><structname>pg_event_trigger</structname></title>
3208 <indexterm zone="catalog-pg-event-trigger">
3209 <primary>pg_event_trigger</primary>
3213 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3214 See <xref linkend="event-triggers"> for more information.
3218 <title><structname>pg_event_trigger</> Columns</title>
3225 <entry>References</entry>
3226 <entry>Description</entry>
3232 <entry><structfield>evtname</structfield></entry>
3233 <entry><type>name</type></entry>
3235 <entry>Trigger name (must be unique)</entry>
3239 <entry><structfield>evtevent</structfield></entry>
3240 <entry><type>name</type></entry>
3242 <entry>Identifies the event for which this trigger fires</entry>
3246 <entry><structfield>evtowner</structfield></entry>
3247 <entry><type>oid</type></entry>
3248 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3249 <entry>Owner of the event trigger</entry>
3253 <entry><structfield>evtfoid</structfield></entry>
3254 <entry><type>oid</type></entry>
3255 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3256 <entry>The function to be called</entry>
3260 <entry><structfield>evtenabled</structfield></entry>
3261 <entry><type>char</type></entry>
3264 Controls in which <xref linkend="guc-session-replication-role"> modes
3265 the event trigger fires.
3266 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3267 <literal>D</> = trigger is disabled,
3268 <literal>R</> = trigger fires in <quote>replica</> mode,
3269 <literal>A</> = trigger fires always.
3274 <entry><structfield>evttags</structfield></entry>
3275 <entry><type>text[]</type></entry>
3278 Command tags for which this trigger will fire. If NULL, the firing
3279 of this trigger is not restricted on the basis of the command tag.
3288 <sect1 id="catalog-pg-extension">
3289 <title><structname>pg_extension</structname></title>
3291 <indexterm zone="catalog-pg-extension">
3292 <primary>pg_extension</primary>
3296 The catalog <structname>pg_extension</structname> stores information
3297 about the installed extensions. See <xref linkend="extend-extensions">
3298 for details about extensions.
3302 <title><structname>pg_extension</> Columns</title>
3309 <entry>References</entry>
3310 <entry>Description</entry>
3316 <entry><structfield>oid</structfield></entry>
3317 <entry><type>oid</type></entry>
3319 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3323 <entry><structfield>extname</structfield></entry>
3324 <entry><type>name</type></entry>
3326 <entry>Name of the extension</entry>
3330 <entry><structfield>extowner</structfield></entry>
3331 <entry><type>oid</type></entry>
3332 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3333 <entry>Owner of the extension</entry>
3337 <entry><structfield>extnamespace</structfield></entry>
3338 <entry><type>oid</type></entry>
3339 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3340 <entry>Schema containing the extension's exported objects</entry>
3344 <entry><structfield>extrelocatable</structfield></entry>
3345 <entry><type>bool</type></entry>
3347 <entry>True if extension can be relocated to another schema</entry>
3351 <entry><structfield>extversion</structfield></entry>
3352 <entry><type>text</type></entry>
3354 <entry>Version name for the extension</entry>
3358 <entry><structfield>extconfig</structfield></entry>
3359 <entry><type>oid[]</type></entry>
3360 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3361 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3362 table(s), or <literal>NULL</> if none</entry>
3366 <entry><structfield>extcondition</structfield></entry>
3367 <entry><type>text[]</type></entry>
3369 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3370 extension's configuration table(s), or <literal>NULL</> if none</entry>
3378 Note that unlike most catalogs with a <quote>namespace</> column,
3379 <structfield>extnamespace</structfield> is not meant to imply
3380 that the extension belongs to that schema. Extension names are never
3381 schema-qualified. Rather, <structfield>extnamespace</structfield>
3382 indicates the schema that contains most or all of the extension's
3383 objects. If <structfield>extrelocatable</structfield> is true, then
3384 this schema must in fact contain all schema-qualifiable objects
3385 belonging to the extension.
3390 <sect1 id="catalog-pg-foreign-data-wrapper">
3391 <title><structname>pg_foreign_data_wrapper</structname></title>
3393 <indexterm zone="catalog-pg-foreign-data-wrapper">
3394 <primary>pg_foreign_data_wrapper</primary>
3398 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3399 foreign-data wrapper definitions. A foreign-data wrapper is the
3400 mechanism by which external data, residing on foreign servers, is
3405 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3412 <entry>References</entry>
3413 <entry>Description</entry>
3419 <entry><structfield>oid</structfield></entry>
3420 <entry><type>oid</type></entry>
3422 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3426 <entry><structfield>fdwname</structfield></entry>
3427 <entry><type>name</type></entry>
3429 <entry>Name of the foreign-data wrapper</entry>
3433 <entry><structfield>fdwowner</structfield></entry>
3434 <entry><type>oid</type></entry>
3435 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3436 <entry>Owner of the foreign-data wrapper</entry>
3440 <entry><structfield>fdwhandler</structfield></entry>
3441 <entry><type>oid</type></entry>
3442 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3444 References a handler function that is responsible for
3445 supplying execution routines for the foreign-data wrapper.
3446 Zero if no handler is provided
3451 <entry><structfield>fdwvalidator</structfield></entry>
3452 <entry><type>oid</type></entry>
3453 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3455 References a validator function that is responsible for
3456 checking the validity of the options given to the
3457 foreign-data wrapper, as well as options for foreign servers and user
3458 mappings using the foreign-data wrapper. Zero if no validator
3464 <entry><structfield>fdwacl</structfield></entry>
3465 <entry><type>aclitem[]</type></entry>
3468 Access privileges; see
3469 <xref linkend="sql-grant"> and
3470 <xref linkend="sql-revoke">
3476 <entry><structfield>fdwoptions</structfield></entry>
3477 <entry><type>text[]</type></entry>
3480 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3489 <sect1 id="catalog-pg-foreign-server">
3490 <title><structname>pg_foreign_server</structname></title>
3492 <indexterm zone="catalog-pg-foreign-server">
3493 <primary>pg_foreign_server</primary>
3497 The catalog <structname>pg_foreign_server</structname> stores
3498 foreign server definitions. A foreign server describes a source
3499 of external data, such as a remote server. Foreign
3500 servers are accessed via foreign-data wrappers.
3504 <title><structname>pg_foreign_server</> Columns</title>
3511 <entry>References</entry>
3512 <entry>Description</entry>
3518 <entry><structfield>oid</structfield></entry>
3519 <entry><type>oid</type></entry>
3521 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3525 <entry><structfield>srvname</structfield></entry>
3526 <entry><type>name</type></entry>
3528 <entry>Name of the foreign server</entry>
3532 <entry><structfield>srvowner</structfield></entry>
3533 <entry><type>oid</type></entry>
3534 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3535 <entry>Owner of the foreign server</entry>
3539 <entry><structfield>srvfdw</structfield></entry>
3540 <entry><type>oid</type></entry>
3541 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3542 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3546 <entry><structfield>srvtype</structfield></entry>
3547 <entry><type>text</type></entry>
3549 <entry>Type of the server (optional)</entry>
3553 <entry><structfield>srvversion</structfield></entry>
3554 <entry><type>text</type></entry>
3556 <entry>Version of the server (optional)</entry>
3560 <entry><structfield>srvacl</structfield></entry>
3561 <entry><type>aclitem[]</type></entry>
3564 Access privileges; see
3565 <xref linkend="sql-grant"> and
3566 <xref linkend="sql-revoke">
3572 <entry><structfield>srvoptions</structfield></entry>
3573 <entry><type>text[]</type></entry>
3576 Foreign server specific options, as <quote>keyword=value</> strings
3585 <sect1 id="catalog-pg-foreign-table">
3586 <title><structname>pg_foreign_table</structname></title>
3588 <indexterm zone="catalog-pg-foreign-table">
3589 <primary>pg_foreign_table</primary>
3593 The catalog <structname>pg_foreign_table</structname> contains
3594 auxiliary information about foreign tables. A foreign table is
3595 primarily represented by a <structname>pg_class</structname> entry,
3596 just like a regular table. Its <structname>pg_foreign_table</structname>
3597 entry contains the information that is pertinent only to foreign tables
3598 and not any other kind of relation.
3602 <title><structname>pg_foreign_table</> Columns</title>
3609 <entry>References</entry>
3610 <entry>Description</entry>
3616 <entry><structfield>ftrelid</structfield></entry>
3617 <entry><type>oid</type></entry>
3618 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3619 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3623 <entry><structfield>ftserver</structfield></entry>
3624 <entry><type>oid</type></entry>
3625 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3626 <entry>OID of the foreign server for this foreign table</entry>
3630 <entry><structfield>ftoptions</structfield></entry>
3631 <entry><type>text[]</type></entry>
3634 Foreign table options, as <quote>keyword=value</> strings
3643 <sect1 id="catalog-pg-index">
3644 <title><structname>pg_index</structname></title>
3646 <indexterm zone="catalog-pg-index">
3647 <primary>pg_index</primary>
3651 The catalog <structname>pg_index</structname> contains part of the information
3652 about indexes. The rest is mostly in
3653 <structname>pg_class</structname>.
3657 <title><structname>pg_index</> Columns</title>
3664 <entry>References</entry>
3665 <entry>Description</entry>
3671 <entry><structfield>indexrelid</structfield></entry>
3672 <entry><type>oid</type></entry>
3673 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3674 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3678 <entry><structfield>indrelid</structfield></entry>
3679 <entry><type>oid</type></entry>
3680 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3681 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3685 <entry><structfield>indnatts</structfield></entry>
3686 <entry><type>int2</type></entry>
3688 <entry>The number of columns in the index (duplicates
3689 <literal>pg_class.relnatts</literal>)</entry>
3693 <entry><structfield>indisunique</structfield></entry>
3694 <entry><type>bool</type></entry>
3696 <entry>If true, this is a unique index</entry>
3700 <entry><structfield>indisprimary</structfield></entry>
3701 <entry><type>bool</type></entry>
3703 <entry>If true, this index represents the primary key of the table
3704 (<structfield>indisunique</> should always be true when this is true)</entry>
3708 <entry><structfield>indisexclusion</structfield></entry>
3709 <entry><type>bool</type></entry>
3711 <entry>If true, this index supports an exclusion constraint</entry>
3715 <entry><structfield>indimmediate</structfield></entry>
3716 <entry><type>bool</type></entry>
3718 <entry>If true, the uniqueness check is enforced immediately on
3720 (irrelevant if <structfield>indisunique</> is not true)</entry>
3724 <entry><structfield>indisclustered</structfield></entry>
3725 <entry><type>bool</type></entry>
3727 <entry>If true, the table was last clustered on this index</entry>
3731 <entry><structfield>indisvalid</structfield></entry>
3732 <entry><type>bool</type></entry>
3735 If true, the index is currently valid for queries. False means the
3736 index is possibly incomplete: it must still be modified by
3737 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3738 be used for queries. If it is unique, the uniqueness property is not
3739 guaranteed true either.
3744 <entry><structfield>indcheckxmin</structfield></entry>
3745 <entry><type>bool</type></entry>
3748 If true, queries must not use the index until the <structfield>xmin</>
3749 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3750 event horizon, because the table may contain broken HOT chains with
3751 incompatible rows that they can see
3756 <entry><structfield>indisready</structfield></entry>
3757 <entry><type>bool</type></entry>
3760 If true, the index is currently ready for inserts. False means the
3761 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3767 <entry><structfield>indislive</structfield></entry>
3768 <entry><type>bool</type></entry>
3771 If false, the index is in process of being dropped, and should be
3772 ignored for all purposes (including HOT-safety decisions)
3777 <entry><structfield>indisreplident</structfield></entry>
3778 <entry><type>bool</type></entry>
3781 If true this index has been chosen as <quote>replica identity</>
3782 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3788 <entry><structfield>indkey</structfield></entry>
3789 <entry><type>int2vector</type></entry>
3790 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3792 This is an array of <structfield>indnatts</structfield> values that
3793 indicate which table columns this index indexes. For example a value
3794 of <literal>1 3</literal> would mean that the first and the third table
3795 columns make up the index key. A zero in this array indicates that the
3796 corresponding index attribute is an expression over the table columns,
3797 rather than a simple column reference.
3802 <entry><structfield>indcollation</structfield></entry>
3803 <entry><type>oidvector</type></entry>
3804 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3806 For each column in the index key, this contains the OID of the
3807 collation to use for the index.
3812 <entry><structfield>indclass</structfield></entry>
3813 <entry><type>oidvector</type></entry>
3814 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3816 For each column in the index key, this contains the OID of
3817 the operator class to use. See
3818 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3823 <entry><structfield>indoption</structfield></entry>
3824 <entry><type>int2vector</type></entry>
3827 This is an array of <structfield>indnatts</structfield> values that
3828 store per-column flag bits. The meaning of the bits is defined by
3829 the index's access method.
3834 <entry><structfield>indexprs</structfield></entry>
3835 <entry><type>pg_node_tree</type></entry>
3838 Expression trees (in <function>nodeToString()</function>
3839 representation) for index attributes that are not simple column
3840 references. This is a list with one element for each zero
3841 entry in <structfield>indkey</>. Null if all index attributes
3842 are simple references.
3847 <entry><structfield>indpred</structfield></entry>
3848 <entry><type>pg_node_tree</type></entry>
3851 Expression tree (in <function>nodeToString()</function>
3852 representation) for partial index predicate. Null if not a
3863 <sect1 id="catalog-pg-inherits">
3864 <title><structname>pg_inherits</structname></title>
3866 <indexterm zone="catalog-pg-inherits">
3867 <primary>pg_inherits</primary>
3871 The catalog <structname>pg_inherits</> records information about
3872 table inheritance hierarchies. There is one entry for each direct
3873 child table in the database. (Indirect inheritance can be determined
3874 by following chains of entries.)
3878 <title><structname>pg_inherits</> Columns</title>
3885 <entry>References</entry>
3886 <entry>Description</entry>
3892 <entry><structfield>inhrelid</structfield></entry>
3893 <entry><type>oid</type></entry>
3894 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3896 The OID of the child table
3901 <entry><structfield>inhparent</structfield></entry>
3902 <entry><type>oid</type></entry>
3903 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3905 The OID of the parent table
3910 <entry><structfield>inhseqno</structfield></entry>
3911 <entry><type>int4</type></entry>
3914 If there is more than one direct parent for a child table (multiple
3915 inheritance), this number tells the order in which the
3916 inherited columns are to be arranged. The count starts at 1.
3926 <sect1 id="catalog-pg-language">
3927 <title><structname>pg_language</structname></title>
3929 <indexterm zone="catalog-pg-language">
3930 <primary>pg_language</primary>
3934 The catalog <structname>pg_language</structname> registers
3935 languages in which you can write functions or stored procedures.
3936 See <xref linkend="sql-createlanguage">
3937 and <xref linkend="xplang"> for more information about language handlers.
3941 <title><structname>pg_language</> Columns</title>
3948 <entry>References</entry>
3949 <entry>Description</entry>
3955 <entry><structfield>oid</structfield></entry>
3956 <entry><type>oid</type></entry>
3958 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3962 <entry><structfield>lanname</structfield></entry>
3963 <entry><type>name</type></entry>
3965 <entry>Name of the language</entry>
3969 <entry><structfield>lanowner</structfield></entry>
3970 <entry><type>oid</type></entry>
3971 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3972 <entry>Owner of the language</entry>
3976 <entry><structfield>lanispl</structfield></entry>
3977 <entry><type>bool</type></entry>
3980 This is false for internal languages (such as
3981 <acronym>SQL</acronym>) and true for user-defined languages.
3982 Currently, <application>pg_dump</application> still uses this
3983 to determine which languages need to be dumped, but this might be
3984 replaced by a different mechanism in the future.
3989 <entry><structfield>lanpltrusted</structfield></entry>
3990 <entry><type>bool</type></entry>
3993 True if this is a trusted language, which means that it is believed
3994 not to grant access to anything outside the normal SQL execution
3995 environment. Only superusers can create functions in untrusted
4001 <entry><structfield>lanplcallfoid</structfield></entry>
4002 <entry><type>oid</type></entry>
4003 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4005 For noninternal languages this references the language
4006 handler, which is a special function that is responsible for
4007 executing all functions that are written in the particular
4013 <entry><structfield>laninline</structfield></entry>
4014 <entry><type>oid</type></entry>
4015 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4017 This references a function that is responsible for executing
4018 <quote>inline</> anonymous code blocks
4019 (<xref linkend="sql-do"> blocks).
4020 Zero if inline blocks are not supported.
4025 <entry><structfield>lanvalidator</structfield></entry>
4026 <entry><type>oid</type></entry>
4027 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4029 This references a language validator function that is responsible
4030 for checking the syntax and validity of new functions when they
4031 are created. Zero if no validator is provided.
4036 <entry><structfield>lanacl</structfield></entry>
4037 <entry><type>aclitem[]</type></entry>
4040 Access privileges; see
4041 <xref linkend="sql-grant"> and
4042 <xref linkend="sql-revoke">
4053 <sect1 id="catalog-pg-largeobject">
4054 <title><structname>pg_largeobject</structname></title>
4056 <indexterm zone="catalog-pg-largeobject">
4057 <primary>pg_largeobject</primary>
4061 The catalog <structname>pg_largeobject</structname> holds the data making up
4062 <quote>large objects</quote>. A large object is identified by an OID
4063 assigned when it is created. Each large object is broken into
4064 segments or <quote>pages</> small enough to be conveniently stored as rows
4065 in <structname>pg_largeobject</structname>.
4066 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4067 <literal>BLCKSZ/4</>, or typically 2 kB).
4071 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4072 associated with large objects. As a result,
4073 <structname>pg_largeobject</structname> was publicly readable and could be
4074 used to obtain the OIDs (and contents) of all large objects in the system.
4075 This is no longer the case; use
4076 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4077 to obtain a list of large object OIDs.
4081 <title><structname>pg_largeobject</> Columns</title>
4088 <entry>References</entry>
4089 <entry>Description</entry>
4095 <entry><structfield>loid</structfield></entry>
4096 <entry><type>oid</type></entry>
4097 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4098 <entry>Identifier of the large object that includes this page</entry>
4102 <entry><structfield>pageno</structfield></entry>
4103 <entry><type>int4</type></entry>
4105 <entry>Page number of this page within its large object
4106 (counting from zero)</entry>
4110 <entry><structfield>data</structfield></entry>
4111 <entry><type>bytea</type></entry>
4114 Actual data stored in the large object.
4115 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4123 Each row of <structname>pg_largeobject</structname> holds data
4124 for one page of a large object, beginning at
4125 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4126 allows sparse storage: pages might be missing, and might be shorter than
4127 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4128 Missing regions within a large object read as zeroes.
4133 <sect1 id="catalog-pg-largeobject-metadata">
4134 <title><structname>pg_largeobject_metadata</structname></title>
4136 <indexterm zone="catalog-pg-largeobject-metadata">
4137 <primary>pg_largeobject_metadata</primary>
4141 The catalog <structname>pg_largeobject_metadata</structname>
4142 holds metadata associated with large objects. The actual large object
4144 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4148 <title><structname>pg_largeobject_metadata</> Columns</title>
4155 <entry>References</entry>
4156 <entry>Description</entry>
4162 <entry><structfield>oid</structfield></entry>
4163 <entry><type>oid</type></entry>
4165 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4169 <entry><structfield>lomowner</structfield></entry>
4170 <entry><type>oid</type></entry>
4171 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4172 <entry>Owner of the large object</entry>
4176 <entry><structfield>lomacl</structfield></entry>
4177 <entry><type>aclitem[]</type></entry>
4180 Access privileges; see
4181 <xref linkend="sql-grant"> and
4182 <xref linkend="sql-revoke">
4192 <sect1 id="catalog-pg-namespace">
4193 <title><structname>pg_namespace</structname></title>
4195 <indexterm zone="catalog-pg-namespace">
4196 <primary>pg_namespace</primary>
4200 The catalog <structname>pg_namespace</> stores namespaces.
4201 A namespace is the structure underlying SQL schemas: each namespace
4202 can have a separate collection of relations, types, etc. without name
4207 <title><structname>pg_namespace</> Columns</title>
4214 <entry>References</entry>
4215 <entry>Description</entry>
4221 <entry><structfield>oid</structfield></entry>
4222 <entry><type>oid</type></entry>
4224 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4228 <entry><structfield>nspname</structfield></entry>
4229 <entry><type>name</type></entry>
4231 <entry>Name of the namespace</entry>
4235 <entry><structfield>nspowner</structfield></entry>
4236 <entry><type>oid</type></entry>
4237 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4238 <entry>Owner of the namespace</entry>
4242 <entry><structfield>nspacl</structfield></entry>
4243 <entry><type>aclitem[]</type></entry>
4246 Access privileges; see
4247 <xref linkend="sql-grant"> and
4248 <xref linkend="sql-revoke">
4259 <sect1 id="catalog-pg-opclass">
4260 <title><structname>pg_opclass</structname></title>
4262 <indexterm zone="catalog-pg-opclass">
4263 <primary>pg_opclass</primary>
4267 The catalog <structname>pg_opclass</structname> defines
4268 index access method operator classes. Each operator class defines
4269 semantics for index columns of a particular data type and a particular
4270 index access method. An operator class essentially specifies that a
4271 particular operator family is applicable to a particular indexable column
4272 data type. The set of operators from the family that are actually usable
4273 with the indexed column are whichever ones accept the column's data type
4274 as their left-hand input.
4278 Operator classes are described at length in <xref linkend="xindex">.
4282 <title><structname>pg_opclass</> Columns</title>
4289 <entry>References</entry>
4290 <entry>Description</entry>
4296 <entry><structfield>oid</structfield></entry>
4297 <entry><type>oid</type></entry>
4299 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4303 <entry><structfield>opcmethod</structfield></entry>
4304 <entry><type>oid</type></entry>
4305 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4306 <entry>Index access method operator class is for</entry>
4310 <entry><structfield>opcname</structfield></entry>
4311 <entry><type>name</type></entry>
4313 <entry>Name of this operator class</entry>
4317 <entry><structfield>opcnamespace</structfield></entry>
4318 <entry><type>oid</type></entry>
4319 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4320 <entry>Namespace of this operator class</entry>
4324 <entry><structfield>opcowner</structfield></entry>
4325 <entry><type>oid</type></entry>
4326 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4327 <entry>Owner of the operator class</entry>
4331 <entry><structfield>opcfamily</structfield></entry>
4332 <entry><type>oid</type></entry>
4333 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4334 <entry>Operator family containing the operator class</entry>
4338 <entry><structfield>opcintype</structfield></entry>
4339 <entry><type>oid</type></entry>
4340 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4341 <entry>Data type that the operator class indexes</entry>
4345 <entry><structfield>opcdefault</structfield></entry>
4346 <entry><type>bool</type></entry>
4348 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4352 <entry><structfield>opckeytype</structfield></entry>
4353 <entry><type>oid</type></entry>
4354 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4355 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4363 An operator class's <structfield>opcmethod</> must match the
4364 <structname>opfmethod</> of its containing operator family.
4365 Also, there must be no more than one <structname>pg_opclass</structname>
4366 row having <structname>opcdefault</> true for any given combination of
4367 <structname>opcmethod</> and <structname>opcintype</>.
4373 <sect1 id="catalog-pg-operator">
4374 <title><structname>pg_operator</structname></title>
4376 <indexterm zone="catalog-pg-operator">
4377 <primary>pg_operator</primary>
4381 The catalog <structname>pg_operator</> stores information about operators.
4382 See <xref linkend="sql-createoperator">
4383 and <xref linkend="xoper"> for more information.
4387 <title><structname>pg_operator</> Columns</title>
4394 <entry>References</entry>
4395 <entry>Description</entry>
4401 <entry><structfield>oid</structfield></entry>
4402 <entry><type>oid</type></entry>
4404 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4408 <entry><structfield>oprname</structfield></entry>
4409 <entry><type>name</type></entry>
4411 <entry>Name of the operator</entry>
4415 <entry><structfield>oprnamespace</structfield></entry>
4416 <entry><type>oid</type></entry>
4417 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4419 The OID of the namespace that contains this operator
4424 <entry><structfield>oprowner</structfield></entry>
4425 <entry><type>oid</type></entry>
4426 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4427 <entry>Owner of the operator</entry>
4431 <entry><structfield>oprkind</structfield></entry>
4432 <entry><type>char</type></entry>
4435 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4436 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4441 <entry><structfield>oprcanmerge</structfield></entry>
4442 <entry><type>bool</type></entry>
4444 <entry>This operator supports merge joins</entry>
4448 <entry><structfield>oprcanhash</structfield></entry>
4449 <entry><type>bool</type></entry>
4451 <entry>This operator supports hash joins</entry>
4455 <entry><structfield>oprleft</structfield></entry>
4456 <entry><type>oid</type></entry>
4457 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4458 <entry>Type of the left operand</entry>
4462 <entry><structfield>oprright</structfield></entry>
4463 <entry><type>oid</type></entry>
4464 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4465 <entry>Type of the right operand</entry>
4469 <entry><structfield>oprresult</structfield></entry>
4470 <entry><type>oid</type></entry>
4471 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4472 <entry>Type of the result</entry>
4476 <entry><structfield>oprcom</structfield></entry>
4477 <entry><type>oid</type></entry>
4478 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4479 <entry>Commutator of this operator, if any</entry>
4483 <entry><structfield>oprnegate</structfield></entry>
4484 <entry><type>oid</type></entry>
4485 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4486 <entry>Negator of this operator, if any</entry>
4490 <entry><structfield>oprcode</structfield></entry>
4491 <entry><type>regproc</type></entry>
4492 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4493 <entry>Function that implements this operator</entry>
4497 <entry><structfield>oprrest</structfield></entry>
4498 <entry><type>regproc</type></entry>
4499 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4500 <entry>Restriction selectivity estimation function for this operator</entry>
4504 <entry><structfield>oprjoin</structfield></entry>
4505 <entry><type>regproc</type></entry>
4506 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4507 <entry>Join selectivity estimation function for this operator</entry>
4514 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4515 is zero for a prefix operator.
4521 <sect1 id="catalog-pg-opfamily">
4522 <title><structname>pg_opfamily</structname></title>
4524 <indexterm zone="catalog-pg-opfamily">
4525 <primary>pg_opfamily</primary>
4529 The catalog <structname>pg_opfamily</structname> defines operator families.
4530 Each operator family is a collection of operators and associated
4531 support routines that implement the semantics specified for a particular
4532 index access method. Furthermore, the operators in a family are all
4533 <quote>compatible</>, in a way that is specified by the access method.
4534 The operator family concept allows cross-data-type operators to be used
4535 with indexes and to be reasoned about using knowledge of access method
4540 Operator families are described at length in <xref linkend="xindex">.
4544 <title><structname>pg_opfamily</> Columns</title>
4551 <entry>References</entry>
4552 <entry>Description</entry>
4558 <entry><structfield>oid</structfield></entry>
4559 <entry><type>oid</type></entry>
4561 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4565 <entry><structfield>opfmethod</structfield></entry>
4566 <entry><type>oid</type></entry>
4567 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4568 <entry>Index access method operator family is for</entry>
4572 <entry><structfield>opfname</structfield></entry>
4573 <entry><type>name</type></entry>
4575 <entry>Name of this operator family</entry>
4579 <entry><structfield>opfnamespace</structfield></entry>
4580 <entry><type>oid</type></entry>
4581 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4582 <entry>Namespace of this operator family</entry>
4586 <entry><structfield>opfowner</structfield></entry>
4587 <entry><type>oid</type></entry>
4588 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4589 <entry>Owner of the operator family</entry>
4597 The majority of the information defining an operator family is not in its
4598 <structname>pg_opfamily</structname> row, but in the associated rows in
4599 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4600 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4602 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4608 <sect1 id="catalog-pg-pltemplate">
4609 <title><structname>pg_pltemplate</structname></title>
4611 <indexterm zone="catalog-pg-pltemplate">
4612 <primary>pg_pltemplate</primary>
4616 The catalog <structname>pg_pltemplate</structname> stores
4617 <quote>template</> information for procedural languages.
4618 A template for a language allows the language to be created in a
4619 particular database by a simple <command>CREATE LANGUAGE</> command,
4620 with no need to specify implementation details.
4624 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4625 is shared across all databases of a cluster: there is only one
4626 copy of <structname>pg_pltemplate</structname> per cluster, not
4627 one per database. This allows the information to be accessible in
4628 each database as it is needed.
4632 <title><structname>pg_pltemplate</> Columns</title>
4639 <entry>Description</entry>
4645 <entry><structfield>tmplname</structfield></entry>
4646 <entry><type>name</type></entry>
4647 <entry>Name of the language this template is for</entry>
4651 <entry><structfield>tmpltrusted</structfield></entry>
4652 <entry><type>boolean</type></entry>
4653 <entry>True if language is considered trusted</entry>
4657 <entry><structfield>tmpldbacreate</structfield></entry>
4658 <entry><type>boolean</type></entry>
4659 <entry>True if language may be created by a database owner</entry>
4663 <entry><structfield>tmplhandler</structfield></entry>
4664 <entry><type>text</type></entry>
4665 <entry>Name of call handler function</entry>
4669 <entry><structfield>tmplinline</structfield></entry>
4670 <entry><type>text</type></entry>
4671 <entry>Name of anonymous-block handler function, or null if none</entry>
4675 <entry><structfield>tmplvalidator</structfield></entry>
4676 <entry><type>text</type></entry>
4677 <entry>Name of validator function, or null if none</entry>
4681 <entry><structfield>tmpllibrary</structfield></entry>
4682 <entry><type>text</type></entry>
4683 <entry>Path of shared library that implements language</entry>
4687 <entry><structfield>tmplacl</structfield></entry>
4688 <entry><type>aclitem[]</type></entry>
4689 <entry>Access privileges for template (not actually used)</entry>
4697 There are not currently any commands that manipulate procedural language
4698 templates; to change the built-in information, a superuser must modify
4699 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4700 or <command>UPDATE</command> commands.
4705 It is likely that <structname>pg_pltemplate</> will be removed in some
4706 future release of <productname>PostgreSQL</productname>, in favor of
4707 keeping this knowledge about procedural languages in their respective
4708 extension installation scripts.
4715 <sect1 id="catalog-pg-proc">
4716 <title><structname>pg_proc</structname></title>
4718 <indexterm zone="catalog-pg-proc">
4719 <primary>pg_proc</primary>
4723 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4724 See <xref linkend="sql-createfunction">
4725 and <xref linkend="xfunc"> for more information.
4729 The table contains data for aggregate functions as well as plain functions.
4730 If <structfield>proisagg</structfield> is true, there should be a matching
4731 row in <structfield>pg_aggregate</structfield>.
4735 <title><structname>pg_proc</> Columns</title>
4742 <entry>References</entry>
4743 <entry>Description</entry>
4749 <entry><structfield>oid</structfield></entry>
4750 <entry><type>oid</type></entry>
4752 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4756 <entry><structfield>proname</structfield></entry>
4757 <entry><type>name</type></entry>
4759 <entry>Name of the function</entry>
4763 <entry><structfield>pronamespace</structfield></entry>
4764 <entry><type>oid</type></entry>
4765 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4767 The OID of the namespace that contains this function
4772 <entry><structfield>proowner</structfield></entry>
4773 <entry><type>oid</type></entry>
4774 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4775 <entry>Owner of the function</entry>
4779 <entry><structfield>prolang</structfield></entry>
4780 <entry><type>oid</type></entry>
4781 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4782 <entry>Implementation language or call interface of this function</entry>
4786 <entry><structfield>procost</structfield></entry>
4787 <entry><type>float4</type></entry>
4789 <entry>Estimated execution cost (in units of
4790 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4791 this is cost per row returned</entry>
4795 <entry><structfield>prorows</structfield></entry>
4796 <entry><type>float4</type></entry>
4798 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4802 <entry><structfield>provariadic</structfield></entry>
4803 <entry><type>oid</type></entry>
4804 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4805 <entry>Data type of the variadic array parameter's elements,
4806 or zero if the function does not have a variadic parameter</entry>
4810 <entry><structfield>protransform</structfield></entry>
4811 <entry><type>regproc</type></entry>
4812 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4813 <entry>Calls to this function can be simplified by this other function
4814 (see <xref linkend="xfunc-transform-functions">)</entry>
4818 <entry><structfield>proisagg</structfield></entry>
4819 <entry><type>bool</type></entry>
4821 <entry>Function is an aggregate function</entry>
4825 <entry><structfield>proiswindow</structfield></entry>
4826 <entry><type>bool</type></entry>
4828 <entry>Function is a window function</entry>
4832 <entry><structfield>prosecdef</structfield></entry>
4833 <entry><type>bool</type></entry>
4835 <entry>Function is a security definer (i.e., a <quote>setuid</>
4840 <entry><structfield>proleakproof</structfield></entry>
4841 <entry><type>bool</type></entry>
4844 The function has no side effects. No information about the
4845 arguments is conveyed except via the return value. Any function
4846 that might throw an error depending on the values of its arguments
4852 <entry><structfield>proisstrict</structfield></entry>
4853 <entry><type>bool</type></entry>
4856 Function returns null if any call argument is null. In that
4857 case the function won't actually be called at all. Functions
4858 that are not <quote>strict</quote> must be prepared to handle
4864 <entry><structfield>proretset</structfield></entry>
4865 <entry><type>bool</type></entry>
4867 <entry>Function returns a set (i.e., multiple values of the specified
4872 <entry><structfield>provolatile</structfield></entry>
4873 <entry><type>char</type></entry>
4876 <structfield>provolatile</structfield> tells whether the function's
4877 result depends only on its input arguments, or is affected by outside
4879 It is <literal>i</literal> for <quote>immutable</> functions,
4880 which always deliver the same result for the same inputs.
4881 It is <literal>s</literal> for <quote>stable</> functions,
4882 whose results (for fixed inputs) do not change within a scan.
4883 It is <literal>v</literal> for <quote>volatile</> functions,
4884 whose results might change at any time. (Use <literal>v</literal> also
4885 for functions with side-effects, so that calls to them cannot get
4891 <entry><structfield>pronargs</structfield></entry>
4892 <entry><type>int2</type></entry>
4894 <entry>Number of input arguments</entry>
4898 <entry><structfield>pronargdefaults</structfield></entry>
4899 <entry><type>int2</type></entry>
4901 <entry>Number of arguments that have defaults</entry>
4905 <entry><structfield>prorettype</structfield></entry>
4906 <entry><type>oid</type></entry>
4907 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4908 <entry>Data type of the return value</entry>
4912 <entry><structfield>proargtypes</structfield></entry>
4913 <entry><type>oidvector</type></entry>
4914 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4916 An array with the data types of the function arguments. This includes
4917 only input arguments (including <literal>INOUT</literal> and
4918 <literal>VARIADIC</> arguments), and thus represents
4919 the call signature of the function.
4924 <entry><structfield>proallargtypes</structfield></entry>
4925 <entry><type>oid[]</type></entry>
4926 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4928 An array with the data types of the function arguments. This includes
4929 all arguments (including <literal>OUT</literal> and
4930 <literal>INOUT</literal> arguments); however, if all the
4931 arguments are <literal>IN</literal> arguments, this field will be null.
4932 Note that subscripting is 1-based, whereas for historical reasons
4933 <structfield>proargtypes</> is subscripted from 0.
4938 <entry><structfield>proargmodes</structfield></entry>
4939 <entry><type>char[]</type></entry>
4942 An array with the modes of the function arguments, encoded as
4943 <literal>i</literal> for <literal>IN</> arguments,
4944 <literal>o</literal> for <literal>OUT</> arguments,
4945 <literal>b</literal> for <literal>INOUT</> arguments,
4946 <literal>v</literal> for <literal>VARIADIC</> arguments,
4947 <literal>t</literal> for <literal>TABLE</> arguments.
4948 If all the arguments are <literal>IN</literal> arguments,
4949 this field will be null.
4950 Note that subscripts correspond to positions of
4951 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4956 <entry><structfield>proargnames</structfield></entry>
4957 <entry><type>text[]</type></entry>
4960 An array with the names of the function arguments.
4961 Arguments without a name are set to empty strings in the array.
4962 If none of the arguments have a name, this field will be null.
4963 Note that subscripts correspond to positions of
4964 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4969 <entry><structfield>proargdefaults</structfield></entry>
4970 <entry><type>pg_node_tree</type></entry>
4973 Expression trees (in <function>nodeToString()</function> representation)
4974 for default values. This is a list with
4975 <structfield>pronargdefaults</> elements, corresponding to the last
4976 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
4977 <replaceable>N</> <structfield>proargtypes</> positions).
4978 If none of the arguments have defaults, this field will be null.
4983 <entry><structfield>prosrc</structfield></entry>
4984 <entry><type>text</type></entry>
4987 This tells the function handler how to invoke the function. It
4988 might be the actual source code of the function for interpreted
4989 languages, a link symbol, a file name, or just about anything
4990 else, depending on the implementation language/call convention.
4995 <entry><structfield>probin</structfield></entry>
4996 <entry><type>text</type></entry>
4999 Additional information about how to invoke the function.
5000 Again, the interpretation is language-specific.
5005 <entry><structfield>proconfig</structfield></entry>
5006 <entry><type>text[]</type></entry>
5008 <entry>Function's local settings for run-time configuration variables</entry>
5012 <entry><structfield>proacl</structfield></entry>
5013 <entry><type>aclitem[]</type></entry>
5016 Access privileges; see
5017 <xref linkend="sql-grant"> and
5018 <xref linkend="sql-revoke">
5027 For compiled functions, both built-in and dynamically loaded,
5028 <structfield>prosrc</structfield> contains the function's C-language
5029 name (link symbol). For all other currently-known language types,
5030 <structfield>prosrc</structfield> contains the function's source
5031 text. <structfield>probin</structfield> is unused except for
5032 dynamically-loaded C functions, for which it gives the name of the
5033 shared library file containing the function.
5038 <sect1 id="catalog-pg-range">
5039 <title><structname>pg_range</structname></title>
5041 <indexterm zone="catalog-pg-range">
5042 <primary>pg_range</primary>
5046 The catalog <structname>pg_range</structname> stores information about
5047 range types. This is in addition to the types' entries in
5048 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5052 <title><structname>pg_range</> Columns</title>
5059 <entry>References</entry>
5060 <entry>Description</entry>
5066 <entry><structfield>rngtypid</structfield></entry>
5067 <entry><type>oid</type></entry>
5068 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5069 <entry>OID of the range type</entry>
5073 <entry><structfield>rngsubtype</structfield></entry>
5074 <entry><type>oid</type></entry>
5075 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5076 <entry>OID of the element type (subtype) of this range type</entry>
5080 <entry><structfield>rngcollation</structfield></entry>
5081 <entry><type>oid</type></entry>
5082 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5083 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5087 <entry><structfield>rngsubopc</structfield></entry>
5088 <entry><type>oid</type></entry>
5089 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5090 <entry>OID of the subtype's operator class used for range comparisons</entry>
5094 <entry><structfield>rngcanonical</structfield></entry>
5095 <entry><type>regproc</type></entry>
5096 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5097 <entry>OID of the function to convert a range value into canonical form,
5098 or 0 if none</entry>
5102 <entry><structfield>rngsubdiff</structfield></entry>
5103 <entry><type>regproc</type></entry>
5104 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5105 <entry>OID of the function to return the difference between two element
5106 values as <type>double precision</type>, or 0 if none</entry>
5113 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5114 element type is collatable) determines the sort ordering used by the range
5115 type. <structfield>rngcanonical</> is used when the element type is
5116 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5117 improve performance of GiST indexes on the range type.
5122 <sect1 id="catalog-pg-rewrite">
5123 <title><structname>pg_rewrite</structname></title>
5125 <indexterm zone="catalog-pg-rewrite">
5126 <primary>pg_rewrite</primary>
5130 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5134 <title><structname>pg_rewrite</> Columns</title>
5141 <entry>References</entry>
5142 <entry>Description</entry>
5148 <entry><structfield>oid</structfield></entry>
5149 <entry><type>oid</type></entry>
5151 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5155 <entry><structfield>rulename</structfield></entry>
5156 <entry><type>name</type></entry>
5158 <entry>Rule name</entry>
5162 <entry><structfield>ev_class</structfield></entry>
5163 <entry><type>oid</type></entry>
5164 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5165 <entry>The table this rule is for</entry>
5169 <entry><structfield>ev_type</structfield></entry>
5170 <entry><type>char</type></entry>
5173 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5174 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5180 <entry><structfield>ev_enabled</structfield></entry>
5181 <entry><type>char</type></entry>
5184 Controls in which <xref linkend="guc-session-replication-role"> modes
5186 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5187 <literal>D</> = rule is disabled,
5188 <literal>R</> = rule fires in <quote>replica</> mode,
5189 <literal>A</> = rule fires always.
5194 <entry><structfield>is_instead</structfield></entry>
5195 <entry><type>bool</type></entry>
5197 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5201 <entry><structfield>ev_qual</structfield></entry>
5202 <entry><type>pg_node_tree</type></entry>
5205 Expression tree (in the form of a
5206 <function>nodeToString()</function> representation) for the
5207 rule's qualifying condition
5212 <entry><structfield>ev_action</structfield></entry>
5213 <entry><type>pg_node_tree</type></entry>
5216 Query tree (in the form of a
5217 <function>nodeToString()</function> representation) for the
5227 <literal>pg_class.relhasrules</literal>
5228 must be true if a table has any rules in this catalog.
5234 <sect1 id="catalog-pg-replication-slots">
5235 <title><structname>pg_replication_slots</structname></title>
5237 <indexterm zone="catalog-pg-replication-slots">
5238 <primary>pg_replication_slots</primary>
5242 The <structname>pg_replication_slots</structname> view provides a listing
5243 of all replication slots that currently exist on the database cluster,
5244 along with their current state.
5248 For more on replication slots,
5249 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
5254 <title><structname>pg_replication_slots</structname> Columns</title>
5261 <entry>References</entry>
5262 <entry>Description</entry>
5268 <entry><structfield>slot_name</structfield></entry>
5269 <entry><type>name</type></entry>
5271 <entry>A unique, cluster-wide identifier for the replication slot</entry>
5275 <entry><structfield>plugin</structfield></entry>
5276 <entry><type>name</type></entry>
5278 <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
5282 <entry><structfield>slot_type</structfield></entry>
5283 <entry><type>text</type></entry>
5285 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
5289 <entry><structfield>datoid</structfield></entry>
5290 <entry><type>oid</type></entry>
5291 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5292 <entry>The OID of the database this slot is associated with, or
5293 null. Only logical slots have an associated database.</entry>
5297 <entry><structfield>database</structfield></entry>
5298 <entry><type>text</type></entry>
5299 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5300 <entry>The name of the database this slot is associated with, or
5301 null. Only logical slots have an associated database.</entry>
5305 <entry><structfield>active</structfield></entry>
5306 <entry><type>boolean</type></entry>
5308 <entry>True if this slot is currently actively being used</entry>
5312 <entry><structfield>xmin</structfield></entry>
5313 <entry><type>xid</type></entry>
5315 <entry>The oldest transaction that this slot needs the database to
5316 retain. <literal>VACUUM</literal> cannot remove tuples deleted
5317 by any later transaction.
5322 <entry><structfield>catalog_xmin</structfield></entry>
5323 <entry><type>xid</type></entry>
5325 <entry>The oldest transaction affecting the system catalogs that this
5326 slot needs the database to retain. <literal>VACUUM</literal> cannot
5327 remove catalog tuples deleted by any later transaction.
5332 <entry><structfield>restart_lsn</structfield></entry>
5333 <entry><type>pg_lsn</type></entry>
5335 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
5336 might be required by the consumer of this slot and thus won't be
5337 automatically removed during checkpoints.
5345 <sect1 id="catalog-pg-rowsecurity">
5346 <title><structname>pg_rowsecurity</structname></title>
5348 <indexterm zone="catalog-pg-rowsecurity">
5349 <primary>pg_rowsecurity</primary>
5353 The catalog <structname>pg_rowsecurity</structname> stores row-level
5354 security policies for each table. A policy includes the kind of
5355 command which it applies to (or all commands), the roles which it
5356 applies to, the expression to be added as a security-barrier
5357 qualification to queries which include the table and the expression
5358 to be added as a with-check option for queries which attempt to add
5359 new records to the table.
5364 <title><structname>pg_rowsecurity</structname> Columns</title>
5371 <entry>References</entry>
5372 <entry>Description</entry>
5378 <entry><structfield>rsecpolname</structfield></entry>
5379 <entry><type>name</type></entry>
5381 <entry>The name of the row-security policy</entry>
5385 <entry><structfield>rsecrelid</structfield></entry>
5386 <entry><type>oid</type></entry>
5387 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5388 <entry>The table to which the row-security policy belongs</entry>
5392 <entry><structfield>rseccmd</structfield></entry>
5393 <entry><type>char</type></entry>
5395 <entry>The command type to which the row-security policy is applied.</entry>
5399 <entry><structfield>rsecqual</structfield></entry>
5400 <entry><type>pg_node_tree</type></entry>
5402 <entry>The expression tree to be added to the security barrier qualifications for queries which use the table.</entry>
5406 <entry><structfield>rsecwithcheck</structfield></entry>
5407 <entry><type>pg_node_tree</type></entry>
5409 <entry>The expression tree to be added to the with check qualifications for queries which attempt to add rows to the table.</entry>
5418 <literal>pg_class.relhasrowsecurity</literal>
5419 True if the table has row-security enabled.
5420 Must be true if the table has a row-security policy in this catalog.
5426 <sect1 id="catalog-pg-seclabel">
5427 <title><structname>pg_seclabel</structname></title>
5429 <indexterm zone="catalog-pg-seclabel">
5430 <primary>pg_seclabel</primary>
5434 The catalog <structname>pg_seclabel</structname> stores security
5435 labels on database objects. Security labels can be manipulated
5436 with the <xref linkend="sql-security-label"> command. For an easier
5437 way to view security labels, see <xref linkend="view-pg-seclabels">.
5441 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5442 which performs a similar function for security labels of database objects
5443 that are shared across a database cluster.
5447 <title><structname>pg_seclabel</structname> Columns</title>
5454 <entry>References</entry>
5455 <entry>Description</entry>
5461 <entry><structfield>objoid</structfield></entry>
5462 <entry><type>oid</type></entry>
5463 <entry>any OID column</entry>
5464 <entry>The OID of the object this security label pertains to</entry>
5468 <entry><structfield>classoid</structfield></entry>
5469 <entry><type>oid</type></entry>
5470 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5471 <entry>The OID of the system catalog this object appears in</entry>
5475 <entry><structfield>objsubid</structfield></entry>
5476 <entry><type>int4</type></entry>
5479 For a security label on a table column, this is the column number (the
5480 <structfield>objoid</> and <structfield>classoid</> refer to
5481 the table itself). For all other object types, this column is
5487 <entry><structfield>provider</structfield></entry>
5488 <entry><type>text</type></entry>
5490 <entry>The label provider associated with this label.</entry>
5494 <entry><structfield>label</structfield></entry>
5495 <entry><type>text</type></entry>
5497 <entry>The security label applied to this object.</entry>
5504 <sect1 id="catalog-pg-shdepend">
5505 <title><structname>pg_shdepend</structname></title>
5507 <indexterm zone="catalog-pg-shdepend">
5508 <primary>pg_shdepend</primary>
5512 The catalog <structname>pg_shdepend</structname> records the
5513 dependency relationships between database objects and shared objects,
5514 such as roles. This information allows
5515 <productname>PostgreSQL</productname> to ensure that those objects are
5516 unreferenced before attempting to delete them.
5520 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5521 which performs a similar function for dependencies involving objects
5522 within a single database.
5526 Unlike most system catalogs, <structname>pg_shdepend</structname>
5527 is shared across all databases of a cluster: there is only one
5528 copy of <structname>pg_shdepend</structname> per cluster, not
5533 <title><structname>pg_shdepend</> Columns</title>
5540 <entry>References</entry>
5541 <entry>Description</entry>
5547 <entry><structfield>dbid</structfield></entry>
5548 <entry><type>oid</type></entry>
5549 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5550 <entry>The OID of the database the dependent object is in,
5551 or zero for a shared object</entry>
5555 <entry><structfield>classid</structfield></entry>
5556 <entry><type>oid</type></entry>
5557 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5558 <entry>The OID of the system catalog the dependent object is in</entry>
5562 <entry><structfield>objid</structfield></entry>
5563 <entry><type>oid</type></entry>
5564 <entry>any OID column</entry>
5565 <entry>The OID of the specific dependent object</entry>
5569 <entry><structfield>objsubid</structfield></entry>
5570 <entry><type>int4</type></entry>
5573 For a table column, this is the column number (the
5574 <structfield>objid</> and <structfield>classid</> refer to the
5575 table itself). For all other object types, this column is zero.
5580 <entry><structfield>refclassid</structfield></entry>
5581 <entry><type>oid</type></entry>
5582 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5583 <entry>The OID of the system catalog the referenced object is in
5584 (must be a shared catalog)</entry>
5588 <entry><structfield>refobjid</structfield></entry>
5589 <entry><type>oid</type></entry>
5590 <entry>any OID column</entry>
5591 <entry>The OID of the specific referenced object</entry>
5595 <entry><structfield>deptype</structfield></entry>
5596 <entry><type>char</type></entry>
5599 A code defining the specific semantics of this dependency relationship; see text
5608 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5609 the referenced object cannot be dropped without also dropping the dependent
5610 object. However, there are several subflavors identified by
5611 <structfield>deptype</>:
5615 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5618 The referenced object (which must be a role) is the owner of the
5625 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5628 The referenced object (which must be a role) is mentioned in the
5629 ACL (access control list, i.e., privileges list) of the
5630 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5631 not made for the owner of the object, since the owner will have
5632 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5638 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5641 There is no dependent object; this type of entry is a signal
5642 that the system itself depends on the referenced object, and so
5643 that object must never be deleted. Entries of this type are
5644 created only by <command>initdb</command>. The columns for the
5645 dependent object contain zeroes.
5651 Other dependency flavors might be needed in future. Note in particular
5652 that the current definition only supports roles as referenced objects.
5657 <sect1 id="catalog-pg-shdescription">
5658 <title><structname>pg_shdescription</structname></title>
5660 <indexterm zone="catalog-pg-shdescription">
5661 <primary>pg_shdescription</primary>
5665 The catalog <structname>pg_shdescription</structname> stores optional
5666 descriptions (comments) for shared database objects. Descriptions can be
5667 manipulated with the <xref linkend="sql-comment"> command and viewed with
5668 <application>psql</application>'s <literal>\d</literal> commands.
5672 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5673 which performs a similar function for descriptions involving objects
5674 within a single database.
5678 Unlike most system catalogs, <structname>pg_shdescription</structname>
5679 is shared across all databases of a cluster: there is only one
5680 copy of <structname>pg_shdescription</structname> per cluster, not
5685 <title><structname>pg_shdescription</> Columns</title>
5692 <entry>References</entry>
5693 <entry>Description</entry>
5699 <entry><structfield>objoid</structfield></entry>
5700 <entry><type>oid</type></entry>
5701 <entry>any OID column</entry>
5702 <entry>The OID of the object this description pertains to</entry>
5706 <entry><structfield>classoid</structfield></entry>
5707 <entry><type>oid</type></entry>
5708 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5709 <entry>The OID of the system catalog this object appears in</entry>
5713 <entry><structfield>description</structfield></entry>
5714 <entry><type>text</type></entry>
5716 <entry>Arbitrary text that serves as the description of this object</entry>
5724 <sect1 id="catalog-pg-shseclabel">
5725 <title><structname>pg_shseclabel</structname></title>
5727 <indexterm zone="catalog-pg-shseclabel">
5728 <primary>pg_shseclabel</primary>
5732 The catalog <structname>pg_shseclabel</structname> stores security
5733 labels on shared database objects. Security labels can be manipulated
5734 with the <xref linkend="sql-security-label"> command. For an easier
5735 way to view security labels, see <xref linkend="view-pg-seclabels">.
5739 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5740 which performs a similar function for security labels involving objects
5741 within a single database.
5745 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5746 is shared across all databases of a cluster: there is only one
5747 copy of <structname>pg_shseclabel</structname> per cluster, not
5752 <title><structname>pg_shseclabel</structname> Columns</title>
5758 <entry>References</entry>
5759 <entry>Description</entry>
5764 <entry><structfield>objoid</structfield></entry>
5765 <entry><type>oid</type></entry>
5766 <entry>any OID column</entry>
5767 <entry>The OID of the object this security label pertains to</entry>
5770 <entry><structfield>classoid</structfield></entry>
5771 <entry><type>oid</type></entry>
5772 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5773 <entry>The OID of the system catalog this object appears in</entry>
5776 <entry><structfield>provider</structfield></entry>
5777 <entry><type>text</type></entry>
5779 <entry>The label provider associated with this label.</entry>
5782 <entry><structfield>label</structfield></entry>
5783 <entry><type>text</type></entry>
5785 <entry>The security label applied to this object.</entry>
5792 <sect1 id="catalog-pg-statistic">
5793 <title><structname>pg_statistic</structname></title>
5795 <indexterm zone="catalog-pg-statistic">
5796 <primary>pg_statistic</primary>
5800 The catalog <structname>pg_statistic</structname> stores
5801 statistical data about the contents of the database. Entries are
5802 created by <xref linkend="sql-analyze">
5803 and subsequently used by the query planner. Note that all the
5804 statistical data is inherently approximate, even assuming that it
5809 Normally there is one entry, with <structfield>stainherit</> =
5810 <literal>false</>, for each table column that has been analyzed.
5811 If the table has inheritance children, a second entry with
5812 <structfield>stainherit</> = <literal>true</> is also created. This row
5813 represents the column's statistics over the inheritance tree, i.e.,
5814 statistics for the data you'd see with
5815 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5816 whereas the <structfield>stainherit</> = <literal>false</> row represents
5818 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5822 <structname>pg_statistic</structname> also stores statistical data about
5823 the values of index expressions. These are described as if they were
5824 actual data columns; in particular, <structfield>starelid</structfield>
5825 references the index. No entry is made for an ordinary non-expression
5826 index column, however, since it would be redundant with the entry
5827 for the underlying table column. Currently, entries for index expressions
5828 always have <structfield>stainherit</> = <literal>false</>.
5832 Since different kinds of statistics might be appropriate for different
5833 kinds of data, <structname>pg_statistic</structname> is designed not
5834 to assume very much about what sort of statistics it stores. Only
5835 extremely general statistics (such as nullness) are given dedicated
5836 columns in <structname>pg_statistic</structname>. Everything else
5837 is stored in <quote>slots</quote>, which are groups of associated columns
5838 whose content is identified by a code number in one of the slot's columns.
5839 For more information see
5840 <filename>src/include/catalog/pg_statistic.h</filename>.
5844 <structname>pg_statistic</structname> should not be readable by the
5845 public, since even statistical information about a table's contents
5846 might be considered sensitive. (Example: minimum and maximum values
5847 of a salary column might be quite interesting.)
5848 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
5849 is a publicly readable view on
5850 <structname>pg_statistic</structname> that only exposes information
5851 about those tables that are readable by the current user.
5855 <title><structname>pg_statistic</> Columns</title>
5862 <entry>References</entry>
5863 <entry>Description</entry>
5869 <entry><structfield>starelid</structfield></entry>
5870 <entry><type>oid</type></entry>
5871 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5872 <entry>The table or index that the described column belongs to</entry>
5876 <entry><structfield>staattnum</structfield></entry>
5877 <entry><type>int2</type></entry>
5878 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5879 <entry>The number of the described column</entry>
5883 <entry><structfield>stainherit</structfield></entry>
5884 <entry><type>bool</type></entry>
5886 <entry>If true, the stats include inheritance child columns, not just the
5887 values in the specified relation</entry>
5891 <entry><structfield>stanullfrac</structfield></entry>
5892 <entry><type>float4</type></entry>
5894 <entry>The fraction of the column's entries that are null</entry>
5898 <entry><structfield>stawidth</structfield></entry>
5899 <entry><type>int4</type></entry>
5901 <entry>The average stored width, in bytes, of nonnull entries</entry>
5905 <entry><structfield>stadistinct</structfield></entry>
5906 <entry><type>float4</type></entry>
5908 <entry>The number of distinct nonnull data values in the column.
5909 A value greater than zero is the actual number of distinct values.
5910 A value less than zero is the negative of a multiplier for the number
5911 of rows in the table; for example, a column in which values appear about
5912 twice on the average could be represented by
5913 <structfield>stadistinct</> = -0.5.
5914 A zero value means the number of distinct values is unknown.
5919 <entry><structfield>stakind<replaceable>N</></structfield></entry>
5920 <entry><type>int2</type></entry>
5923 A code number indicating the kind of statistics stored in the
5924 <replaceable>N</>th <quote>slot</quote> of the
5925 <structname>pg_statistic</structname> row.
5930 <entry><structfield>staop<replaceable>N</></structfield></entry>
5931 <entry><type>oid</type></entry>
5932 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
5934 An operator used to derive the statistics stored in the
5935 <replaceable>N</>th <quote>slot</quote>. For example, a
5936 histogram slot would show the <literal><</literal> operator
5937 that defines the sort order of the data.
5942 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
5943 <entry><type>float4[]</type></entry>
5946 Numerical statistics of the appropriate kind for the
5947 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5948 kind does not involve numerical values
5953 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
5954 <entry><type>anyarray</type></entry>
5957 Column data values of the appropriate kind for the
5958 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5959 kind does not store any data values. Each array's element
5960 values are actually of the specific column's data type, or a related
5961 type such as an array's element type, so there is no way to define
5962 these columns' type more specifically than <type>anyarray</>.
5972 <sect1 id="catalog-pg-tablespace">
5973 <title><structname>pg_tablespace</structname></title>
5975 <indexterm zone="catalog-pg-tablespace">
5976 <primary>pg_tablespace</primary>
5980 The catalog <structname>pg_tablespace</structname> stores information
5981 about the available tablespaces. Tables can be placed in particular
5982 tablespaces to aid administration of disk layout.
5986 Unlike most system catalogs, <structname>pg_tablespace</structname>
5987 is shared across all databases of a cluster: there is only one
5988 copy of <structname>pg_tablespace</structname> per cluster, not
5993 <title><structname>pg_tablespace</> Columns</title>
6000 <entry>References</entry>
6001 <entry>Description</entry>
6007 <entry><structfield>oid</structfield></entry>
6008 <entry><type>oid</type></entry>
6010 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6014 <entry><structfield>spcname</structfield></entry>
6015 <entry><type>name</type></entry>
6017 <entry>Tablespace name</entry>
6021 <entry><structfield>spcowner</structfield></entry>
6022 <entry><type>oid</type></entry>
6023 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6024 <entry>Owner of the tablespace, usually the user who created it</entry>
6028 <entry><structfield>spcacl</structfield></entry>
6029 <entry><type>aclitem[]</type></entry>
6032 Access privileges; see
6033 <xref linkend="sql-grant"> and
6034 <xref linkend="sql-revoke">
6040 <entry><structfield>spcoptions</structfield></entry>
6041 <entry><type>text[]</type></entry>
6044 Tablespace-level options, as <quote>keyword=value</> strings
6053 <sect1 id="catalog-pg-trigger">
6054 <title><structname>pg_trigger</structname></title>
6056 <indexterm zone="catalog-pg-trigger">
6057 <primary>pg_trigger</primary>
6061 The catalog <structname>pg_trigger</structname> stores triggers on tables
6063 See <xref linkend="sql-createtrigger">
6064 for more information.
6068 <title><structname>pg_trigger</> Columns</title>
6075 <entry>References</entry>
6076 <entry>Description</entry>
6082 <entry><structfield>oid</structfield></entry>
6083 <entry><type>oid</type></entry>
6085 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6089 <entry><structfield>tgrelid</structfield></entry>
6090 <entry><type>oid</type></entry>
6091 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6092 <entry>The table this trigger is on</entry>
6096 <entry><structfield>tgname</structfield></entry>
6097 <entry><type>name</type></entry>
6099 <entry>Trigger name (must be unique among triggers of same table)</entry>
6103 <entry><structfield>tgfoid</structfield></entry>
6104 <entry><type>oid</type></entry>
6105 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6106 <entry>The function to be called</entry>
6110 <entry><structfield>tgtype</structfield></entry>
6111 <entry><type>int2</type></entry>
6113 <entry>Bit mask identifying trigger firing conditions</entry>
6117 <entry><structfield>tgenabled</structfield></entry>
6118 <entry><type>char</type></entry>
6121 Controls in which <xref linkend="guc-session-replication-role"> modes
6123 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6124 <literal>D</> = trigger is disabled,
6125 <literal>R</> = trigger fires in <quote>replica</> mode,
6126 <literal>A</> = trigger fires always.
6131 <entry><structfield>tgisinternal</structfield></entry>
6132 <entry><type>bool</type></entry>
6134 <entry>True if trigger is internally generated (usually, to enforce
6135 the constraint identified by <structfield>tgconstraint</>)</entry>
6139 <entry><structfield>tgconstrrelid</structfield></entry>
6140 <entry><type>oid</type></entry>
6141 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6142 <entry>The table referenced by a referential integrity constraint</entry>
6146 <entry><structfield>tgconstrindid</structfield></entry>
6147 <entry><type>oid</type></entry>
6148 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6149 <entry>The index supporting a unique, primary key, referential integrity,
6150 or exclusion constraint</entry>
6154 <entry><structfield>tgconstraint</structfield></entry>
6155 <entry><type>oid</type></entry>
6156 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6157 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6161 <entry><structfield>tgdeferrable</structfield></entry>
6162 <entry><type>bool</type></entry>
6164 <entry>True if constraint trigger is deferrable</entry>
6168 <entry><structfield>tginitdeferred</structfield></entry>
6169 <entry><type>bool</type></entry>
6171 <entry>True if constraint trigger is initially deferred</entry>
6175 <entry><structfield>tgnargs</structfield></entry>
6176 <entry><type>int2</type></entry>
6178 <entry>Number of argument strings passed to trigger function</entry>
6182 <entry><structfield>tgattr</structfield></entry>
6183 <entry><type>int2vector</type></entry>
6184 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6185 <entry>Column numbers, if trigger is column-specific; otherwise an
6190 <entry><structfield>tgargs</structfield></entry>
6191 <entry><type>bytea</type></entry>
6193 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6197 <entry><structfield>tgqual</structfield></entry>
6198 <entry><type>pg_node_tree</type></entry>
6200 <entry>Expression tree (in <function>nodeToString()</function>
6201 representation) for the trigger's <literal>WHEN</> condition, or null
6209 Currently, column-specific triggering is supported only for
6210 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6211 only for that event type. <structfield>tgtype</structfield> might
6212 contain bits for other event types as well, but those are presumed
6213 to be table-wide regardless of what is in <structfield>tgattr</>.
6218 When <structfield>tgconstraint</> is nonzero,
6219 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6220 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6221 largely redundant with the referenced <structname>pg_constraint</> entry.
6222 However, it is possible for a non-deferrable trigger to be associated
6223 with a deferrable constraint: foreign key constraints can have some
6224 deferrable and some non-deferrable triggers.
6230 <literal>pg_class.relhastriggers</literal>
6231 must be true if a relation has any triggers in this catalog.
6238 <sect1 id="catalog-pg-ts-config">
6239 <title><structname>pg_ts_config</structname></title>
6241 <indexterm zone="catalog-pg-ts-config">
6242 <primary>pg_ts_config</primary>
6246 The <structname>pg_ts_config</structname> catalog contains entries
6247 representing text search configurations. A configuration specifies
6248 a particular text search parser and a list of dictionaries to use
6249 for each of the parser's output token types. The parser is shown
6250 in the <structname>pg_ts_config</structname> entry, but the
6251 token-to-dictionary mapping is defined by subsidiary entries in <link
6252 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6256 <productname>PostgreSQL</productname>'s text search features are
6257 described at length in <xref linkend="textsearch">.
6261 <title><structname>pg_ts_config</> Columns</title>
6268 <entry>References</entry>
6269 <entry>Description</entry>
6275 <entry><structfield>oid</structfield></entry>
6276 <entry><type>oid</type></entry>
6278 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6282 <entry><structfield>cfgname</structfield></entry>
6283 <entry><type>name</type></entry>
6285 <entry>Text search configuration name</entry>
6289 <entry><structfield>cfgnamespace</structfield></entry>
6290 <entry><type>oid</type></entry>
6291 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6293 The OID of the namespace that contains this configuration
6298 <entry><structfield>cfgowner</structfield></entry>
6299 <entry><type>oid</type></entry>
6300 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6301 <entry>Owner of the configuration</entry>
6305 <entry><structfield>cfgparser</structfield></entry>
6306 <entry><type>oid</type></entry>
6307 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6308 <entry>The OID of the text search parser for this configuration</entry>
6316 <sect1 id="catalog-pg-ts-config-map">
6317 <title><structname>pg_ts_config_map</structname></title>
6319 <indexterm zone="catalog-pg-ts-config-map">
6320 <primary>pg_ts_config_map</primary>
6324 The <structname>pg_ts_config_map</structname> catalog contains entries
6325 showing which text search dictionaries should be consulted, and in
6326 what order, for each output token type of each text search configuration's
6331 <productname>PostgreSQL</productname>'s text search features are
6332 described at length in <xref linkend="textsearch">.
6336 <title><structname>pg_ts_config_map</> Columns</title>
6343 <entry>References</entry>
6344 <entry>Description</entry>
6350 <entry><structfield>mapcfg</structfield></entry>
6351 <entry><type>oid</type></entry>
6352 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6353 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6357 <entry><structfield>maptokentype</structfield></entry>
6358 <entry><type>integer</type></entry>
6360 <entry>A token type emitted by the configuration's parser</entry>
6364 <entry><structfield>mapseqno</structfield></entry>
6365 <entry><type>integer</type></entry>
6367 <entry>Order in which to consult this entry (lower
6368 <structfield>mapseqno</>s first)</entry>
6372 <entry><structfield>mapdict</structfield></entry>
6373 <entry><type>oid</type></entry>
6374 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6375 <entry>The OID of the text search dictionary to consult</entry>
6383 <sect1 id="catalog-pg-ts-dict">
6384 <title><structname>pg_ts_dict</structname></title>
6386 <indexterm zone="catalog-pg-ts-dict">
6387 <primary>pg_ts_dict</primary>
6391 The <structname>pg_ts_dict</structname> catalog contains entries
6392 defining text search dictionaries. A dictionary depends on a text
6393 search template, which specifies all the implementation functions
6394 needed; the dictionary itself provides values for the user-settable
6395 parameters supported by the template. This division of labor allows
6396 dictionaries to be created by unprivileged users. The parameters
6397 are specified by a text string <structfield>dictinitoption</>,
6398 whose format and meaning vary depending on the template.
6402 <productname>PostgreSQL</productname>'s text search features are
6403 described at length in <xref linkend="textsearch">.
6407 <title><structname>pg_ts_dict</> Columns</title>
6414 <entry>References</entry>
6415 <entry>Description</entry>
6421 <entry><structfield>oid</structfield></entry>
6422 <entry><type>oid</type></entry>
6424 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6428 <entry><structfield>dictname</structfield></entry>
6429 <entry><type>name</type></entry>
6431 <entry>Text search dictionary name</entry>
6435 <entry><structfield>dictnamespace</structfield></entry>
6436 <entry><type>oid</type></entry>
6437 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6439 The OID of the namespace that contains this dictionary
6444 <entry><structfield>dictowner</structfield></entry>
6445 <entry><type>oid</type></entry>
6446 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6447 <entry>Owner of the dictionary</entry>
6451 <entry><structfield>dicttemplate</structfield></entry>
6452 <entry><type>oid</type></entry>
6453 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6454 <entry>The OID of the text search template for this dictionary</entry>
6458 <entry><structfield>dictinitoption</structfield></entry>
6459 <entry><type>text</type></entry>
6461 <entry>Initialization option string for the template</entry>
6469 <sect1 id="catalog-pg-ts-parser">
6470 <title><structname>pg_ts_parser</structname></title>
6472 <indexterm zone="catalog-pg-ts-parser">
6473 <primary>pg_ts_parser</primary>
6477 The <structname>pg_ts_parser</structname> catalog contains entries
6478 defining text search parsers. A parser is responsible for splitting
6479 input text into lexemes and assigning a token type to each lexeme.
6480 Since a parser must be implemented by C-language-level functions,
6481 creation of new parsers is restricted to database superusers.
6485 <productname>PostgreSQL</productname>'s text search features are
6486 described at length in <xref linkend="textsearch">.
6490 <title><structname>pg_ts_parser</> Columns</title>
6497 <entry>References</entry>
6498 <entry>Description</entry>
6504 <entry><structfield>oid</structfield></entry>
6505 <entry><type>oid</type></entry>
6507 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6511 <entry><structfield>prsname</structfield></entry>
6512 <entry><type>name</type></entry>
6514 <entry>Text search parser name</entry>
6518 <entry><structfield>prsnamespace</structfield></entry>
6519 <entry><type>oid</type></entry>
6520 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6522 The OID of the namespace that contains this parser
6527 <entry><structfield>prsstart</structfield></entry>
6528 <entry><type>regproc</type></entry>
6529 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6530 <entry>OID of the parser's startup function</entry>
6534 <entry><structfield>prstoken</structfield></entry>
6535 <entry><type>regproc</type></entry>
6536 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6537 <entry>OID of the parser's next-token function</entry>
6541 <entry><structfield>prsend</structfield></entry>
6542 <entry><type>regproc</type></entry>
6543 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6544 <entry>OID of the parser's shutdown function</entry>
6548 <entry><structfield>prsheadline</structfield></entry>
6549 <entry><type>regproc</type></entry>
6550 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6551 <entry>OID of the parser's headline function</entry>
6555 <entry><structfield>prslextype</structfield></entry>
6556 <entry><type>regproc</type></entry>
6557 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6558 <entry>OID of the parser's lextype function</entry>
6566 <sect1 id="catalog-pg-ts-template">
6567 <title><structname>pg_ts_template</structname></title>
6569 <indexterm zone="catalog-pg-ts-template">
6570 <primary>pg_ts_template</primary>
6574 The <structname>pg_ts_template</structname> catalog contains entries
6575 defining text search templates. A template is the implementation
6576 skeleton for a class of text search dictionaries.
6577 Since a template must be implemented by C-language-level functions,
6578 creation of new templates is restricted to database superusers.
6582 <productname>PostgreSQL</productname>'s text search features are
6583 described at length in <xref linkend="textsearch">.
6587 <title><structname>pg_ts_template</> Columns</title>
6594 <entry>References</entry>
6595 <entry>Description</entry>
6601 <entry><structfield>oid</structfield></entry>
6602 <entry><type>oid</type></entry>
6604 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6608 <entry><structfield>tmplname</structfield></entry>
6609 <entry><type>name</type></entry>
6611 <entry>Text search template name</entry>
6615 <entry><structfield>tmplnamespace</structfield></entry>
6616 <entry><type>oid</type></entry>
6617 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6619 The OID of the namespace that contains this template
6624 <entry><structfield>tmplinit</structfield></entry>
6625 <entry><type>regproc</type></entry>
6626 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6627 <entry>OID of the template's initialization function</entry>
6631 <entry><structfield>tmpllexize</structfield></entry>
6632 <entry><type>regproc</type></entry>
6633 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6634 <entry>OID of the template's lexize function</entry>
6642 <sect1 id="catalog-pg-type">
6643 <title><structname>pg_type</structname></title>
6645 <indexterm zone="catalog-pg-type">
6646 <primary>pg_type</primary>
6650 The catalog <structname>pg_type</structname> stores information about data
6651 types. Base types and enum types (scalar types) are created with
6652 <xref linkend="sql-createtype">, and
6654 <xref linkend="sql-createdomain">.
6655 A composite type is automatically created for each table in the database, to
6656 represent the row structure of the table. It is also possible to create
6657 composite types with <command>CREATE TYPE AS</command>.
6661 <title><structname>pg_type</> Columns</title>
6668 <entry>References</entry>
6669 <entry>Description</entry>
6675 <entry><structfield>oid</structfield></entry>
6676 <entry><type>oid</type></entry>
6678 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6682 <entry><structfield>typname</structfield></entry>
6683 <entry><type>name</type></entry>
6685 <entry>Data type name</entry>
6689 <entry><structfield>typnamespace</structfield></entry>
6690 <entry><type>oid</type></entry>
6691 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6693 The OID of the namespace that contains this type
6698 <entry><structfield>typowner</structfield></entry>
6699 <entry><type>oid</type></entry>
6700 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6701 <entry>Owner of the type</entry>
6705 <entry><structfield>typlen</structfield></entry>
6706 <entry><type>int2</type></entry>
6709 For a fixed-size type, <structfield>typlen</structfield> is the number
6710 of bytes in the internal representation of the type. But for a
6711 variable-length type, <structfield>typlen</structfield> is negative.
6712 -1 indicates a <quote>varlena</> type (one that has a length word),
6713 -2 indicates a null-terminated C string.
6718 <entry><structfield>typbyval</structfield></entry>
6719 <entry><type>bool</type></entry>
6722 <structfield>typbyval</structfield> determines whether internal
6723 routines pass a value of this type by value or by reference.
6724 <structfield>typbyval</structfield> had better be false if
6725 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6726 where Datum is 8 bytes).
6727 Variable-length types are always passed by reference. Note that
6728 <structfield>typbyval</structfield> can be false even if the
6729 length would allow pass-by-value.
6734 <entry><structfield>typtype</structfield></entry>
6735 <entry><type>char</type></entry>
6738 <structfield>typtype</structfield> is
6739 <literal>b</literal> for a base type,
6740 <literal>c</literal> for a composite type (e.g., a table's row type),
6741 <literal>d</literal> for a domain,
6742 <literal>e</literal> for an enum type,
6743 <literal>p</literal> for a pseudo-type, or
6744 <literal>r</literal> for a range type.
6745 See also <structfield>typrelid</structfield> and
6746 <structfield>typbasetype</structfield>.
6751 <entry><structfield>typcategory</structfield></entry>
6752 <entry><type>char</type></entry>
6755 <structfield>typcategory</structfield> is an arbitrary classification
6756 of data types that is used by the parser to determine which implicit
6757 casts should be <quote>preferred</>.
6758 See <xref linkend="catalog-typcategory-table">.
6763 <entry><structfield>typispreferred</structfield></entry>
6764 <entry><type>bool</type></entry>
6767 True if the type is a preferred cast target within its
6768 <structfield>typcategory</structfield>
6773 <entry><structfield>typisdefined</structfield></entry>
6774 <entry><type>bool</type></entry>
6777 True if the type is defined, false if this is a placeholder
6778 entry for a not-yet-defined type. When
6779 <structfield>typisdefined</structfield> is false, nothing
6780 except the type name, namespace, and OID can be relied on.
6785 <entry><structfield>typdelim</structfield></entry>
6786 <entry><type>char</type></entry>
6789 Character that separates two values of this type when parsing
6790 array input. Note that the delimiter is associated with the array
6791 element data type, not the array data type.
6796 <entry><structfield>typrelid</structfield></entry>
6797 <entry><type>oid</type></entry>
6798 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6800 If this is a composite type (see
6801 <structfield>typtype</structfield>), then this column points to
6802 the <structname>pg_class</structname> entry that defines the
6803 corresponding table. (For a free-standing composite type, the
6804 <structname>pg_class</structname> entry doesn't really represent
6805 a table, but it is needed anyway for the type's
6806 <structname>pg_attribute</structname> entries to link to.)
6807 Zero for non-composite types.
6812 <entry><structfield>typelem</structfield></entry>
6813 <entry><type>oid</type></entry>
6814 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6816 If <structfield>typelem</structfield> is not 0 then it
6817 identifies another row in <structname>pg_type</structname>.
6818 The current type can then be subscripted like an array yielding
6819 values of type <structfield>typelem</structfield>. A
6820 <quote>true</quote> array type is variable length
6821 (<structfield>typlen</structfield> = -1),
6822 but some fixed-length (<structfield>typlen</structfield> > 0) types
6823 also have nonzero <structfield>typelem</structfield>, for example
6824 <type>name</type> and <type>point</type>.
6825 If a fixed-length type has a <structfield>typelem</structfield> then
6826 its internal representation must be some number of values of the
6827 <structfield>typelem</structfield> data type with no other data.
6828 Variable-length array types have a header defined by the array
6834 <entry><structfield>typarray</structfield></entry>
6835 <entry><type>oid</type></entry>
6836 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6838 If <structfield>typarray</structfield> is not 0 then it
6839 identifies another row in <structname>pg_type</structname>, which
6840 is the <quote>true</quote> array type having this type as element
6845 <entry><structfield>typinput</structfield></entry>
6846 <entry><type>regproc</type></entry>
6847 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6848 <entry>Input conversion function (text format)</entry>
6852 <entry><structfield>typoutput</structfield></entry>
6853 <entry><type>regproc</type></entry>
6854 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6855 <entry>Output conversion function (text format)</entry>
6859 <entry><structfield>typreceive</structfield></entry>
6860 <entry><type>regproc</type></entry>
6861 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6862 <entry>Input conversion function (binary format), or 0 if none</entry>
6866 <entry><structfield>typsend</structfield></entry>
6867 <entry><type>regproc</type></entry>
6868 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6869 <entry>Output conversion function (binary format), or 0 if none</entry>
6873 <entry><structfield>typmodin</structfield></entry>
6874 <entry><type>regproc</type></entry>
6875 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6876 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
6880 <entry><structfield>typmodout</structfield></entry>
6881 <entry><type>regproc</type></entry>
6882 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6883 <entry>Type modifier output function, or 0 to use the standard format</entry>
6887 <entry><structfield>typanalyze</structfield></entry>
6888 <entry><type>regproc</type></entry>
6889 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6890 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
6894 <entry><structfield>typalign</structfield></entry>
6895 <entry><type>char</type></entry>
6899 <structfield>typalign</structfield> is the alignment required
6900 when storing a value of this type. It applies to storage on
6901 disk as well as most representations of the value inside
6902 <productname>PostgreSQL</>.
6903 When multiple values are stored consecutively, such
6904 as in the representation of a complete row on disk, padding is
6905 inserted before a datum of this type so that it begins on the
6906 specified boundary. The alignment reference is the beginning
6907 of the first datum in the sequence.
6911 Possible values are:
6914 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
6917 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
6920 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
6923 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
6928 For types used in system tables, it is critical that the size
6929 and alignment defined in <structname>pg_type</structname>
6930 agree with the way that the compiler will lay out the column in
6931 a structure representing a table row.
6937 <entry><structfield>typstorage</structfield></entry>
6938 <entry><type>char</type></entry>
6941 <structfield>typstorage</structfield> tells for varlena
6942 types (those with <structfield>typlen</structfield> = -1) if
6943 the type is prepared for toasting and what the default strategy
6944 for attributes of this type should be.
6948 <para><literal>p</>: Value must always be stored plain.</para>
6952 <literal>e</>: Value can be stored in a <quote>secondary</quote>
6953 relation (if relation has one, see
6954 <literal>pg_class.reltoastrelid</literal>).
6958 <para><literal>m</>: Value can be stored compressed inline.</para>
6961 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
6964 Note that <literal>m</> columns can also be moved out to secondary
6965 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
6971 <entry><structfield>typnotnull</structfield></entry>
6972 <entry><type>bool</type></entry>
6975 <structfield>typnotnull</structfield> represents a not-null
6976 constraint on a type. Used for domains only.
6981 <entry><structfield>typbasetype</structfield></entry>
6982 <entry><type>oid</type></entry>
6983 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6985 If this is a domain (see <structfield>typtype</structfield>), then
6986 <structfield>typbasetype</structfield> identifies the type that this
6987 one is based on. Zero if this type is not a domain.
6992 <entry><structfield>typtypmod</structfield></entry>
6993 <entry><type>int4</type></entry>
6996 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
6997 to be applied to their base type (-1 if base type does not use a
6998 <literal>typmod</>). -1 if this type is not a domain.
7003 <entry><structfield>typndims</structfield></entry>
7004 <entry><type>int4</type></entry>
7007 <structfield>typndims</structfield> is the number of array dimensions
7008 for a domain over an array (that is, <structfield>typbasetype</> is
7010 Zero for types other than domains over array types.
7015 <entry><structfield>typcollation</structfield></entry>
7016 <entry><type>oid</type></entry>
7017 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7019 <structfield>typcollation</structfield> specifies the collation
7020 of the type. If the type does not support collations, this will
7021 be zero. A base type that supports collations will have
7022 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
7023 collatable type can have some other collation OID, if one was
7024 specified for the domain.
7029 <entry><structfield>typdefaultbin</structfield></entry>
7030 <entry><type>pg_node_tree</type></entry>
7033 If <structfield>typdefaultbin</> is not null, it is the
7034 <function>nodeToString()</function>
7035 representation of a default expression for the type. This is
7036 only used for domains.
7041 <entry><structfield>typdefault</structfield></entry>
7042 <entry><type>text</type></entry>
7045 <structfield>typdefault</> is null if the type has no associated
7046 default value. If <structfield>typdefaultbin</> is not null,
7047 <structfield>typdefault</> must contain a human-readable version of the
7048 default expression represented by <structfield>typdefaultbin</>. If
7049 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7050 not, then <structfield>typdefault</> is the external representation of
7051 the type's default value, which can be fed to the type's input
7052 converter to produce a constant.
7057 <entry><structfield>typacl</structfield></entry>
7058 <entry><type>aclitem[]</type></entry>
7061 Access privileges; see
7062 <xref linkend="sql-grant"> and
7063 <xref linkend="sql-revoke">
7072 <xref linkend="catalog-typcategory-table"> lists the system-defined values
7073 of <structfield>typcategory</>. Any future additions to this list will
7074 also be upper-case ASCII letters. All other ASCII characters are reserved
7075 for user-defined categories.
7078 <table id="catalog-typcategory-table">
7079 <title><structfield>typcategory</> Codes</title>
7085 <entry>Category</entry>
7091 <entry><literal>A</literal></entry>
7092 <entry>Array types</entry>
7095 <entry><literal>B</literal></entry>
7096 <entry>Boolean types</entry>
7099 <entry><literal>C</literal></entry>
7100 <entry>Composite types</entry>
7103 <entry><literal>D</literal></entry>
7104 <entry>Date/time types</entry>
7107 <entry><literal>E</literal></entry>
7108 <entry>Enum types</entry>
7111 <entry><literal>G</literal></entry>
7112 <entry>Geometric types</entry>
7115 <entry><literal>I</literal></entry>
7116 <entry>Network address types</entry>
7119 <entry><literal>N</literal></entry>
7120 <entry>Numeric types</entry>
7123 <entry><literal>P</literal></entry>
7124 <entry>Pseudo-types</entry>
7127 <entry><literal>R</literal></entry>
7128 <entry>Range types</entry>
7131 <entry><literal>S</literal></entry>
7132 <entry>String types</entry>
7135 <entry><literal>T</literal></entry>
7136 <entry>Timespan types</entry>
7139 <entry><literal>U</literal></entry>
7140 <entry>User-defined types</entry>
7143 <entry><literal>V</literal></entry>
7144 <entry>Bit-string types</entry>
7147 <entry><literal>X</literal></entry>
7148 <entry><type>unknown</> type</entry>
7157 <sect1 id="catalog-pg-user-mapping">
7158 <title><structname>pg_user_mapping</structname></title>
7160 <indexterm zone="catalog-pg-user-mapping">
7161 <primary>pg_user_mapping</primary>
7165 The catalog <structname>pg_user_mapping</structname> stores
7166 the mappings from local user to remote. Access to this catalog is
7167 restricted from normal users, use the view
7168 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7173 <title><structname>pg_user_mapping</> Columns</title>
7180 <entry>References</entry>
7181 <entry>Description</entry>
7187 <entry><structfield>oid</structfield></entry>
7188 <entry><type>oid</type></entry>
7190 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7194 <entry><structfield>umuser</structfield></entry>
7195 <entry><type>oid</type></entry>
7196 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7197 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7201 <entry><structfield>umserver</structfield></entry>
7202 <entry><type>oid</type></entry>
7203 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7205 The OID of the foreign server that contains this mapping
7210 <entry><structfield>umoptions</structfield></entry>
7211 <entry><type>text[]</type></entry>
7214 User mapping specific options, as <quote>keyword=value</> strings
7223 <sect1 id="views-overview">
7224 <title>System Views</title>
7227 In addition to the system catalogs, <productname>PostgreSQL</productname>
7228 provides a number of built-in views. Some system views provide convenient
7229 access to some commonly used queries on the system catalogs. Other views
7230 provide access to internal server state.
7234 The information schema (<xref linkend="information-schema">) provides
7235 an alternative set of views which overlap the functionality of the system
7236 views. Since the information schema is SQL-standard whereas the views
7237 described here are <productname>PostgreSQL</productname>-specific,
7238 it's usually better to use the information schema if it provides all
7239 the information you need.
7243 <xref linkend="view-table"> lists the system views described here.
7244 More detailed documentation of each view follows below.
7245 There are some additional views that provide access to the results of
7246 the statistics collector; they are described in <xref
7247 linkend="monitoring-stats-views-table">.
7251 Except where noted, all the views described here are read-only.
7254 <table id="view-table">
7255 <title>System Views</title>
7260 <entry>View Name</entry>
7261 <entry>Purpose</entry>
7267 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7268 <entry>available extensions</entry>
7272 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7273 <entry>available versions of extensions</entry>
7277 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7278 <entry>open cursors</entry>
7282 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7283 <entry>groups of database users</entry>
7287 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7288 <entry>indexes</entry>
7292 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7293 <entry>currently held locks</entry>
7297 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7298 <entry>materialized views</entry>
7302 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7303 <entry>prepared statements</entry>
7307 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7308 <entry>prepared transactions</entry>
7312 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7313 <entry>database roles</entry>
7317 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7318 <entry>rules</entry>
7322 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7323 <entry>security labels</entry>
7327 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7328 <entry>parameter settings</entry>
7332 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7333 <entry>database users</entry>
7337 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7338 <entry>planner statistics</entry>
7342 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7343 <entry>tables</entry>
7347 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7348 <entry>time zone abbreviations</entry>
7352 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7353 <entry>time zone names</entry>
7357 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7358 <entry>database users</entry>
7362 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7363 <entry>user mappings</entry>
7367 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7368 <entry>views</entry>
7376 <sect1 id="view-pg-available-extensions">
7377 <title><structname>pg_available_extensions</structname></title>
7379 <indexterm zone="view-pg-available-extensions">
7380 <primary>pg_available_extensions</primary>
7384 The <structname>pg_available_extensions</structname> view lists the
7385 extensions that are available for installation.
7387 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7388 catalog, which shows the extensions currently installed.
7392 <title><structname>pg_available_extensions</> Columns</title>
7399 <entry>Description</entry>
7405 <entry><structfield>name</structfield></entry>
7406 <entry><type>name</type></entry>
7407 <entry>Extension name</entry>
7411 <entry><structfield>default_version</structfield></entry>
7412 <entry><type>text</type></entry>
7413 <entry>Name of default version, or <literal>NULL</literal> if none is
7418 <entry><structfield>installed_version</structfield></entry>
7419 <entry><type>text</type></entry>
7420 <entry>Currently installed version of the extension,
7421 or <literal>NULL</literal> if not installed</entry>
7425 <entry><structfield>comment</structfield></entry>
7426 <entry><type>text</type></entry>
7427 <entry>Comment string from the extension's control file</entry>
7434 The <structname>pg_available_extensions</structname> view is read only.
7438 <sect1 id="view-pg-available-extension-versions">
7439 <title><structname>pg_available_extension_versions</structname></title>
7441 <indexterm zone="view-pg-available-extension-versions">
7442 <primary>pg_available_extension_versions</primary>
7446 The <structname>pg_available_extension_versions</structname> view lists the
7447 specific extension versions that are available for installation.
7449 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7450 catalog, which shows the extensions currently installed.
7454 <title><structname>pg_available_extension_versions</> Columns</title>
7461 <entry>Description</entry>
7467 <entry><structfield>name</structfield></entry>
7468 <entry><type>name</type></entry>
7469 <entry>Extension name</entry>
7473 <entry><structfield>version</structfield></entry>
7474 <entry><type>text</type></entry>
7475 <entry>Version name</entry>
7479 <entry><structfield>installed</structfield></entry>
7480 <entry><type>bool</type></entry>
7481 <entry>True if this version of this extension is currently
7486 <entry><structfield>superuser</structfield></entry>
7487 <entry><type>bool</type></entry>
7488 <entry>True if only superusers are allowed to install this extension</entry>
7492 <entry><structfield>relocatable</structfield></entry>
7493 <entry><type>bool</type></entry>
7494 <entry>True if extension can be relocated to another schema</entry>
7498 <entry><structfield>schema</structfield></entry>
7499 <entry><type>name</type></entry>
7500 <entry>Name of the schema that the extension must be installed into,
7501 or <literal>NULL</literal> if partially or fully relocatable</entry>
7505 <entry><structfield>requires</structfield></entry>
7506 <entry><type>name[]</type></entry>
7507 <entry>Names of prerequisite extensions,
7508 or <literal>NULL</literal> if none</entry>
7512 <entry><structfield>comment</structfield></entry>
7513 <entry><type>text</type></entry>
7514 <entry>Comment string from the extension's control file</entry>
7521 The <structname>pg_available_extension_versions</structname> view is read
7526 <sect1 id="view-pg-cursors">
7527 <title><structname>pg_cursors</structname></title>
7529 <indexterm zone="view-pg-cursors">
7530 <primary>pg_cursors</primary>
7534 The <structname>pg_cursors</structname> view lists the cursors that
7535 are currently available. Cursors can be defined in several ways:
7539 via the <xref linkend="sql-declare">
7546 via the Bind message in the frontend/backend protocol, as
7547 described in <xref linkend="protocol-flow-ext-query">
7553 via the Server Programming Interface (SPI), as described in
7554 <xref linkend="spi-interface">
7559 The <structname>pg_cursors</structname> view displays cursors
7560 created by any of these means. Cursors only exist for the duration
7561 of the transaction that defines them, unless they have been
7562 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7563 cursors are only present in the view until the end of their
7564 creating transaction.
7568 Cursors are used internally to implement some of the components
7569 of <productname>PostgreSQL</>, such as procedural languages.
7570 Therefore, the <structname>pg_cursors</> view might include cursors
7571 that have not been explicitly created by the user.
7577 <title><structname>pg_cursors</> Columns</title>
7584 <entry>Description</entry>
7590 <entry><structfield>name</structfield></entry>
7591 <entry><type>text</type></entry>
7592 <entry>The name of the cursor</entry>
7596 <entry><structfield>statement</structfield></entry>
7597 <entry><type>text</type></entry>
7598 <entry>The verbatim query string submitted to declare this cursor</entry>
7602 <entry><structfield>is_holdable</structfield></entry>
7603 <entry><type>boolean</type></entry>
7605 <literal>true</literal> if the cursor is holdable (that is, it
7606 can be accessed after the transaction that declared the cursor
7607 has committed); <literal>false</literal> otherwise
7612 <entry><structfield>is_binary</structfield></entry>
7613 <entry><type>boolean</type></entry>
7615 <literal>true</literal> if the cursor was declared
7616 <literal>BINARY</literal>; <literal>false</literal>
7622 <entry><structfield>is_scrollable</structfield></entry>
7623 <entry><type>boolean</type></entry>
7625 <literal>true</> if the cursor is scrollable (that is, it
7626 allows rows to be retrieved in a nonsequential manner);
7627 <literal>false</literal> otherwise
7632 <entry><structfield>creation_time</structfield></entry>
7633 <entry><type>timestamptz</type></entry>
7634 <entry>The time at which the cursor was declared</entry>
7641 The <structname>pg_cursors</structname> view is read only.
7646 <sect1 id="view-pg-group">
7647 <title><structname>pg_group</structname></title>
7649 <indexterm zone="view-pg-group">
7650 <primary>pg_group</primary>
7654 The view <structname>pg_group</structname> exists for backwards
7655 compatibility: it emulates a catalog that existed in
7656 <productname>PostgreSQL</productname> before version 8.1.
7657 It shows the names and members of all roles that are marked as not
7658 <structfield>rolcanlogin</>, which is an approximation to the set
7659 of roles that are being used as groups.
7663 <title><structname>pg_group</> Columns</title>
7670 <entry>References</entry>
7671 <entry>Description</entry>
7677 <entry><structfield>groname</structfield></entry>
7678 <entry><type>name</type></entry>
7679 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7680 <entry>Name of the group</entry>
7684 <entry><structfield>grosysid</structfield></entry>
7685 <entry><type>oid</type></entry>
7686 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7687 <entry>ID of this group</entry>
7691 <entry><structfield>grolist</structfield></entry>
7692 <entry><type>oid[]</type></entry>
7693 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7694 <entry>An array containing the IDs of the roles in this group</entry>
7702 <sect1 id="view-pg-indexes">
7703 <title><structname>pg_indexes</structname></title>
7705 <indexterm zone="view-pg-indexes">
7706 <primary>pg_indexes</primary>
7710 The view <structname>pg_indexes</structname> provides access to
7711 useful information about each index in the database.
7715 <title><structname>pg_indexes</> Columns</title>
7722 <entry>References</entry>
7723 <entry>Description</entry>
7728 <entry><structfield>schemaname</structfield></entry>
7729 <entry><type>name</type></entry>
7730 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7731 <entry>Name of schema containing table and index</entry>
7734 <entry><structfield>tablename</structfield></entry>
7735 <entry><type>name</type></entry>
7736 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7737 <entry>Name of table the index is for</entry>
7740 <entry><structfield>indexname</structfield></entry>
7741 <entry><type>name</type></entry>
7742 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7743 <entry>Name of index</entry>
7746 <entry><structfield>tablespace</structfield></entry>
7747 <entry><type>name</type></entry>
7748 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7749 <entry>Name of tablespace containing index (null if default for database)</entry>
7752 <entry><structfield>indexdef</structfield></entry>
7753 <entry><type>text</type></entry>
7755 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
7764 <sect1 id="view-pg-locks">
7765 <title><structname>pg_locks</structname></title>
7767 <indexterm zone="view-pg-locks">
7768 <primary>pg_locks</primary>
7772 The view <structname>pg_locks</structname> provides access to
7773 information about the locks held by open transactions within the
7774 database server. See <xref linkend="mvcc"> for more discussion
7779 <structname>pg_locks</structname> contains one row per active lockable
7780 object, requested lock mode, and relevant transaction. Thus, the same
7781 lockable object might
7782 appear many times, if multiple transactions are holding or waiting
7783 for locks on it. However, an object that currently has no locks on it
7784 will not appear at all.
7788 There are several distinct types of lockable objects:
7789 whole relations (e.g., tables), individual pages of relations,
7790 individual tuples of relations,
7791 transaction IDs (both virtual and permanent IDs),
7792 and general database objects (identified by class OID and object OID,
7793 in the same way as in <structname>pg_description</structname> or
7794 <structname>pg_depend</structname>). Also, the right to extend a
7795 relation is represented as a separate lockable object.
7796 Also, <quote>advisory</> locks can be taken on numbers that have
7797 user-defined meanings.
7801 <title><structname>pg_locks</> Columns</title>
7808 <entry>References</entry>
7809 <entry>Description</entry>
7814 <entry><structfield>locktype</structfield></entry>
7815 <entry><type>text</type></entry>
7818 Type of the lockable object:
7819 <literal>relation</>,
7823 <literal>transactionid</>,
7824 <literal>virtualxid</>,
7826 <literal>userlock</>, or
7827 <literal>advisory</>
7831 <entry><structfield>database</structfield></entry>
7832 <entry><type>oid</type></entry>
7833 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
7835 OID of the database in which the lock target exists, or
7836 zero if the target is a shared object, or
7837 null if the target is a transaction ID
7841 <entry><structfield>relation</structfield></entry>
7842 <entry><type>oid</type></entry>
7843 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7845 OID of the relation targeted by the lock, or null if the target is not
7846 a relation or part of a relation
7850 <entry><structfield>page</structfield></entry>
7851 <entry><type>integer</type></entry>
7854 Page number targeted by the lock within the relation,
7855 or null if the target is not a relation page or tuple
7859 <entry><structfield>tuple</structfield></entry>
7860 <entry><type>smallint</type></entry>
7863 Tuple number targeted by the lock within the page,
7864 or null if the target is not a tuple
7868 <entry><structfield>virtualxid</structfield></entry>
7869 <entry><type>text</type></entry>
7872 Virtual ID of the transaction targeted by the lock,
7873 or null if the target is not a virtual transaction ID
7877 <entry><structfield>transactionid</structfield></entry>
7878 <entry><type>xid</type></entry>
7881 ID of the transaction targeted by the lock,
7882 or null if the target is not a transaction ID
7886 <entry><structfield>classid</structfield></entry>
7887 <entry><type>oid</type></entry>
7888 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7890 OID of the system catalog containing the lock target, or null if the
7891 target is not a general database object
7895 <entry><structfield>objid</structfield></entry>
7896 <entry><type>oid</type></entry>
7897 <entry>any OID column</entry>
7899 OID of the lock target within its system catalog, or null if the
7900 target is not a general database object
7904 <entry><structfield>objsubid</structfield></entry>
7905 <entry><type>smallint</type></entry>
7908 Column number targeted by the lock (the
7909 <structfield>classid</> and <structfield>objid</> refer to the
7911 or zero if the target is some other general database object,
7912 or null if the target is not a general database object
7916 <entry><structfield>virtualtransaction</structfield></entry>
7917 <entry><type>text</type></entry>
7920 Virtual ID of the transaction that is holding or awaiting this lock
7924 <entry><structfield>pid</structfield></entry>
7925 <entry><type>integer</type></entry>
7928 Process ID of the server process holding or awaiting this
7929 lock, or null if the lock is held by a prepared transaction
7933 <entry><structfield>mode</structfield></entry>
7934 <entry><type>text</type></entry>
7936 <entry>Name of the lock mode held or desired by this process (see <xref
7937 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
7940 <entry><structfield>granted</structfield></entry>
7941 <entry><type>boolean</type></entry>
7943 <entry>True if lock is held, false if lock is awaited</entry>
7946 <entry><structfield>fastpath</structfield></entry>
7947 <entry><type>boolean</type></entry>
7949 <entry>True if lock was taken via fast path, false if taken via main
7957 <structfield>granted</structfield> is true in a row representing a lock
7958 held by the indicated transaction. False indicates that this transaction is
7959 currently waiting to acquire this lock, which implies that some other
7960 transaction is holding a conflicting lock mode on the same lockable object.
7961 The waiting transaction will sleep until the other lock is released (or a
7962 deadlock situation is detected). A single transaction can be waiting to
7963 acquire at most one lock at a time.
7967 Every transaction holds an exclusive lock on its virtual transaction ID for
7968 its entire duration. If a permanent ID is assigned to the transaction
7969 (which normally happens only if the transaction changes the state of the
7970 database), it also holds an exclusive lock on its permanent transaction ID
7971 until it ends. When one transaction finds it necessary to wait specifically
7972 for another transaction, it does so by attempting to acquire share lock on
7973 the other transaction ID (either virtual or permanent ID depending on the
7974 situation). That will succeed only when the other transaction
7975 terminates and releases its locks.
7979 Although tuples are a lockable type of object,
7980 information about row-level locks is stored on disk, not in memory,
7981 and therefore row-level locks normally do not appear in this view.
7982 If a transaction is waiting for a
7983 row-level lock, it will usually appear in the view as waiting for the
7984 permanent transaction ID of the current holder of that row lock.
7988 Advisory locks can be acquired on keys consisting of either a single
7989 <type>bigint</type> value or two integer values.
7990 A <type>bigint</type> key is displayed with its
7991 high-order half in the <structfield>classid</> column, its low-order half
7992 in the <structfield>objid</> column, and <structfield>objsubid</> equal
7993 to 1. The original <type>bigint</type> value can be reassembled with the
7994 expression <literal>(classid::bigint << 32) |
7995 objid::bigint</literal>. Integer keys are displayed with the
7997 <structfield>classid</> column, the second key in the <structfield>objid</>
7998 column, and <structfield>objsubid</> equal to 2. The actual meaning of
7999 the keys is up to the user. Advisory locks are local to each database,
8000 so the <structfield>database</> column is meaningful for an advisory lock.
8004 <structname>pg_locks</structname> provides a global view of all locks
8005 in the database cluster, not only those relevant to the current database.
8006 Although its <structfield>relation</structfield> column can be joined
8007 against <structname>pg_class</>.<structfield>oid</> to identify locked
8008 relations, this will only work correctly for relations in the current
8009 database (those for which the <structfield>database</structfield> column
8010 is either the current database's OID or zero).
8014 The <structfield>pid</structfield> column can be joined to the
8015 <structfield>pid</structfield> column of the <link
8016 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8018 information on the session holding or waiting to hold each lock,
8021 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8022 ON pl.pid = psa.pid;
8024 Also, if you are using prepared transactions, the
8025 <structfield>virtualtransaction</> column can be joined to the
8026 <structfield>transaction</structfield> column of the <link
8027 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8028 view to get more information on prepared transactions that hold locks.
8029 (A prepared transaction can never be waiting for a lock,
8030 but it continues to hold the locks it acquired while running.)
8033 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8034 ON pl.virtualtransaction = '-1/' || ppx.transaction;
8039 The <structname>pg_locks</structname> view displays data from both the
8040 regular lock manager and the predicate lock manager, which are
8041 separate systems; in addition, the regular lock manager subdivides its
8042 locks into regular and <firstterm>fast-path</> locks.
8043 This data is not guaranteed to be entirely consistent.
8044 When the view is queried,
8045 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8046 is gathered from each backend one at a time, without freezing the state of
8047 the entire lock manager, so it is possible for locks to be taken or
8048 released while information is gathered. Note, however, that these locks are
8049 known not to conflict with any other lock currently in place. After
8050 all backends have been queried for fast-path locks, the remainder of the
8051 regular lock manager is locked as a unit, and a consistent snapshot of all
8052 remaining locks is collected as an atomic action. After unlocking the
8053 regular lock manager, the predicate lock manager is similarly locked and all
8054 predicate locks are collected as an atomic action. Thus, with the exception
8055 of fast-path locks, each lock manager will deliver a consistent set of
8056 results, but as we do not lock both lock managers simultaneously, it is
8057 possible for locks to be taken or released after we interrogate the regular
8058 lock manager and before we interrogate the predicate lock manager.
8062 Locking the regular and/or predicate lock manager could have some
8063 impact on database performance if this view is very frequently accessed.
8064 The locks are held only for the minimum amount of time necessary to
8065 obtain data from the lock managers, but this does not completely eliminate
8066 the possibility of a performance impact.
8071 <sect1 id="view-pg-matviews">
8072 <title><structname>pg_matviews</structname></title>
8074 <indexterm zone="view-pg-matviews">
8075 <primary>pg_matviews</primary>
8078 <indexterm zone="view-pg-matviews">
8079 <primary>materialized views</primary>
8083 The view <structname>pg_matviews</structname> provides access to
8084 useful information about each materialized view in the database.
8088 <title><structname>pg_matviews</> Columns</title>
8095 <entry>References</entry>
8096 <entry>Description</entry>
8101 <entry><structfield>schemaname</structfield></entry>
8102 <entry><type>name</type></entry>
8103 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8104 <entry>Name of schema containing materialized view</entry>
8107 <entry><structfield>matviewname</structfield></entry>
8108 <entry><type>name</type></entry>
8109 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8110 <entry>Name of materialized view</entry>
8113 <entry><structfield>matviewowner</structfield></entry>
8114 <entry><type>name</type></entry>
8115 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8116 <entry>Name of materialized view's owner</entry>
8119 <entry><structfield>tablespace</structfield></entry>
8120 <entry><type>name</type></entry>
8121 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8122 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8125 <entry><structfield>hasindexes</structfield></entry>
8126 <entry><type>boolean</type></entry>
8128 <entry>True if materialized view has (or recently had) any indexes</entry>
8131 <entry><structfield>ispopulated</structfield></entry>
8132 <entry><type>boolean</type></entry>
8134 <entry>True if materialized view is currently populated</entry>
8137 <entry><structfield>definition</structfield></entry>
8138 <entry><type>text</type></entry>
8140 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8148 <sect1 id="view-pg-prepared-statements">
8149 <title><structname>pg_prepared_statements</structname></title>
8151 <indexterm zone="view-pg-prepared-statements">
8152 <primary>pg_prepared_statements</primary>
8156 The <structname>pg_prepared_statements</structname> view displays
8157 all the prepared statements that are available in the current
8158 session. See <xref linkend="sql-prepare"> for more information about prepared
8163 <structname>pg_prepared_statements</structname> contains one row
8164 for each prepared statement. Rows are added to the view when a new
8165 prepared statement is created and removed when a prepared statement
8166 is released (for example, via the <xref linkend="sql-deallocate"> command).
8170 <title><structname>pg_prepared_statements</> Columns</title>
8177 <entry>Description</entry>
8182 <entry><structfield>name</structfield></entry>
8183 <entry><type>text</type></entry>
8185 The identifier of the prepared statement
8189 <entry><structfield>statement</structfield></entry>
8190 <entry><type>text</type></entry>
8192 The query string submitted by the client to create this
8193 prepared statement. For prepared statements created via SQL,
8194 this is the <command>PREPARE</command> statement submitted by
8195 the client. For prepared statements created via the
8196 frontend/backend protocol, this is the text of the prepared
8201 <entry><structfield>prepare_time</structfield></entry>
8202 <entry><type>timestamptz</type></entry>
8204 The time at which the prepared statement was created
8208 <entry><structfield>parameter_types</structfield></entry>
8209 <entry><type>regtype[]</type></entry>
8211 The expected parameter types for the prepared statement in the
8212 form of an array of <type>regtype</type>. The OID corresponding
8213 to an element of this array can be obtained by casting the
8214 <type>regtype</type> value to <type>oid</type>.
8218 <entry><structfield>from_sql</structfield></entry>
8219 <entry><type>boolean</type></entry>
8221 <literal>true</literal> if the prepared statement was created
8222 via the <command>PREPARE</command> SQL statement;
8223 <literal>false</literal> if the statement was prepared via the
8224 frontend/backend protocol
8232 The <structname>pg_prepared_statements</structname> view is read only.
8236 <sect1 id="view-pg-prepared-xacts">
8237 <title><structname>pg_prepared_xacts</structname></title>
8239 <indexterm zone="view-pg-prepared-xacts">
8240 <primary>pg_prepared_xacts</primary>
8244 The view <structname>pg_prepared_xacts</structname> displays
8245 information about transactions that are currently prepared for two-phase
8246 commit (see <xref linkend="sql-prepare-transaction"> for details).
8250 <structname>pg_prepared_xacts</structname> contains one row per prepared
8251 transaction. An entry is removed when the transaction is committed or
8256 <title><structname>pg_prepared_xacts</> Columns</title>
8263 <entry>References</entry>
8264 <entry>Description</entry>
8269 <entry><structfield>transaction</structfield></entry>
8270 <entry><type>xid</type></entry>
8273 Numeric transaction identifier of the prepared transaction
8277 <entry><structfield>gid</structfield></entry>
8278 <entry><type>text</type></entry>
8281 Global transaction identifier that was assigned to the transaction
8285 <entry><structfield>prepared</structfield></entry>
8286 <entry><type>timestamp with time zone</type></entry>
8289 Time at which the transaction was prepared for commit
8293 <entry><structfield>owner</structfield></entry>
8294 <entry><type>name</type></entry>
8295 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8297 Name of the user that executed the transaction
8301 <entry><structfield>database</structfield></entry>
8302 <entry><type>name</type></entry>
8303 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8305 Name of the database in which the transaction was executed
8313 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8314 internal transaction manager data structures are momentarily locked, and
8315 a copy is made for the view to display. This ensures that the
8316 view produces a consistent set of results, while not blocking
8317 normal operations longer than necessary. Nonetheless
8318 there could be some impact on database performance if this view is
8319 frequently accessed.
8324 <sect1 id="view-pg-roles">
8325 <title><structname>pg_roles</structname></title>
8327 <indexterm zone="view-pg-roles">
8328 <primary>pg_roles</primary>
8332 The view <structname>pg_roles</structname> provides access to
8333 information about database roles. This is simply a publicly
8335 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8336 that blanks out the password field.
8340 This view explicitly exposes the OID column of the underlying table,
8341 since that is needed to do joins to other catalogs.
8345 <title><structname>pg_roles</> Columns</title>
8352 <entry>References</entry>
8353 <entry>Description</entry>
8359 <entry><structfield>rolname</structfield></entry>
8360 <entry><type>name</type></entry>
8362 <entry>Role name</entry>
8366 <entry><structfield>rolsuper</structfield></entry>
8367 <entry><type>bool</type></entry>
8369 <entry>Role has superuser privileges</entry>
8373 <entry><structfield>rolinherit</structfield></entry>
8374 <entry><type>bool</type></entry>
8376 <entry>Role automatically inherits privileges of roles it is a
8381 <entry><structfield>rolcreaterole</structfield></entry>
8382 <entry><type>bool</type></entry>
8384 <entry>Role can create more roles</entry>
8388 <entry><structfield>rolcreatedb</structfield></entry>
8389 <entry><type>bool</type></entry>
8391 <entry>Role can create databases</entry>
8395 <entry><structfield>rolcatupdate</structfield></entry>
8396 <entry><type>bool</type></entry>
8399 Role can update system catalogs directly. (Even a superuser cannot do
8400 this unless this column is true)
8405 <entry><structfield>rolcanlogin</structfield></entry>
8406 <entry><type>bool</type></entry>
8409 Role can log in. That is, this role can be given as the initial
8410 session authorization identifier
8415 <entry><structfield>rolreplication</structfield></entry>
8416 <entry><type>bool</type></entry>
8419 Role is a replication role. That is, this role can initiate streaming
8420 replication (see <xref linkend="streaming-replication">) and set/unset
8421 the system backup mode using <function>pg_start_backup</> and
8422 <function>pg_stop_backup</>
8427 <entry><structfield>rolconnlimit</structfield></entry>
8428 <entry><type>int4</type></entry>
8431 For roles that can log in, this sets maximum number of concurrent
8432 connections this role can make. -1 means no limit.
8437 <entry><structfield>rolpassword</structfield></entry>
8438 <entry><type>text</type></entry>
8440 <entry>Not the password (always reads as <literal>********</>)</entry>
8444 <entry><structfield>rolvaliduntil</structfield></entry>
8445 <entry><type>timestamptz</type></entry>
8447 <entry>Password expiry time (only used for password authentication);
8448 null if no expiration</entry>
8452 <entry><structfield>rolconfig</structfield></entry>
8453 <entry><type>text[]</type></entry>
8455 <entry>Role-specific defaults for run-time configuration variables</entry>
8459 <entry><structfield>oid</structfield></entry>
8460 <entry><type>oid</type></entry>
8461 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8462 <entry>ID of role</entry>
8470 <sect1 id="view-pg-rules">
8471 <title><structname>pg_rules</structname></title>
8473 <indexterm zone="view-pg-rules">
8474 <primary>pg_rules</primary>
8478 The view <structname>pg_rules</structname> provides access to
8479 useful information about query rewrite rules.
8483 <title><structname>pg_rules</> Columns</title>
8490 <entry>References</entry>
8491 <entry>Description</entry>
8496 <entry><structfield>schemaname</structfield></entry>
8497 <entry><type>name</type></entry>
8498 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8499 <entry>Name of schema containing table</entry>
8502 <entry><structfield>tablename</structfield></entry>
8503 <entry><type>name</type></entry>
8504 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8505 <entry>Name of table the rule is for</entry>
8508 <entry><structfield>rulename</structfield></entry>
8509 <entry><type>name</type></entry>
8510 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8511 <entry>Name of rule</entry>
8514 <entry><structfield>definition</structfield></entry>
8515 <entry><type>text</type></entry>
8517 <entry>Rule definition (a reconstructed creation command)</entry>
8524 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8525 of views and materialized views; those can be seen in
8526 <structname>pg_views</> and <structname>pg_matviews</>.
8531 <sect1 id="view-pg-seclabels">
8532 <title><structname>pg_seclabels</structname></title>
8534 <indexterm zone="view-pg-seclabels">
8535 <primary>pg_seclabels</primary>
8539 The view <structname>pg_seclabels</structname> provides information about
8540 security labels. It as an easier-to-query version of the
8541 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
8545 <title><structname>pg_seclabels</> Columns</title>
8552 <entry>References</entry>
8553 <entry>Description</entry>
8558 <entry><structfield>objoid</structfield></entry>
8559 <entry><type>oid</type></entry>
8560 <entry>any OID column</entry>
8561 <entry>The OID of the object this security label pertains to</entry>
8564 <entry><structfield>classoid</structfield></entry>
8565 <entry><type>oid</type></entry>
8566 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8567 <entry>The OID of the system catalog this object appears in</entry>
8570 <entry><structfield>objsubid</structfield></entry>
8571 <entry><type>int4</type></entry>
8574 For a security label on a table column, this is the column number (the
8575 <structfield>objoid</> and <structfield>classoid</> refer to
8576 the table itself). For all other object types, this column is
8581 <entry><structfield>objtype</structfield></entry>
8582 <entry><type>text</type></entry>
8585 The type of object to which this label applies, as text.
8589 <entry><structfield>objnamespace</structfield></entry>
8590 <entry><type>oid</type></entry>
8591 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
8593 The OID of the namespace for this object, if applicable;
8598 <entry><structfield>objname</structfield></entry>
8599 <entry><type>text</type></entry>
8602 The name of the object to which this label applies, as text.
8606 <entry><structfield>provider</structfield></entry>
8607 <entry><type>text</type></entry>
8608 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
8609 <entry>The label provider associated with this label.</entry>
8612 <entry><structfield>label</structfield></entry>
8613 <entry><type>text</type></entry>
8614 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
8615 <entry>The security label applied to this object.</entry>
8622 <sect1 id="view-pg-settings">
8623 <title><structname>pg_settings</structname></title>
8625 <indexterm zone="view-pg-settings">
8626 <primary>pg_settings</primary>
8630 The view <structname>pg_settings</structname> provides access to
8631 run-time parameters of the server. It is essentially an alternative
8632 interface to the <xref linkend="sql-show">
8633 and <xref linkend="sql-set"> commands.
8634 It also provides access to some facts about each parameter that are
8635 not directly available from <command>SHOW</>, such as minimum and
8640 <title><structname>pg_settings</> Columns</title>
8647 <entry>Description</entry>
8652 <entry><structfield>name</structfield></entry>
8653 <entry><type>text</type></entry>
8654 <entry>Run-time configuration parameter name</entry>
8657 <entry><structfield>setting</structfield></entry>
8658 <entry><type>text</type></entry>
8659 <entry>Current value of the parameter</entry>
8662 <entry><structfield>unit</structfield></entry>
8663 <entry><type>text</type></entry>
8664 <entry>Implicit unit of the parameter</entry>
8667 <entry><structfield>category</structfield></entry>
8668 <entry><type>text</type></entry>
8669 <entry>Logical group of the parameter</entry>
8672 <entry><structfield>short_desc</structfield></entry>
8673 <entry><type>text</type></entry>
8674 <entry>A brief description of the parameter</entry>
8677 <entry><structfield>extra_desc</structfield></entry>
8678 <entry><type>text</type></entry>
8679 <entry>Additional, more detailed, description of the parameter</entry>
8682 <entry><structfield>context</structfield></entry>
8683 <entry><type>text</type></entry>
8684 <entry>Context required to set the parameter's value (see below)</entry>
8687 <entry><structfield>vartype</structfield></entry>
8688 <entry><type>text</type></entry>
8689 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
8690 <literal>integer</>, <literal>real</>, or <literal>string</>)
8694 <entry><structfield>source</structfield></entry>
8695 <entry><type>text</type></entry>
8696 <entry>Source of the current parameter value</entry>
8699 <entry><structfield>min_val</structfield></entry>
8700 <entry><type>text</type></entry>
8701 <entry>Minimum allowed value of the parameter (null for non-numeric
8705 <entry><structfield>max_val</structfield></entry>
8706 <entry><type>text</type></entry>
8707 <entry>Maximum allowed value of the parameter (null for non-numeric
8711 <entry><structfield>enumvals</structfield></entry>
8712 <entry><type>text[]</type></entry>
8713 <entry>Allowed values of an enum parameter (null for non-enum
8717 <entry><structfield>boot_val</structfield></entry>
8718 <entry><type>text</type></entry>
8719 <entry>Parameter value assumed at server startup if the parameter is
8720 not otherwise set</entry>
8723 <entry><structfield>reset_val</structfield></entry>
8724 <entry><type>text</type></entry>
8725 <entry>Value that <command>RESET</command> would reset the parameter to
8726 in the current session</entry>
8729 <entry><structfield>sourcefile</structfield></entry>
8730 <entry><type>text</type></entry>
8731 <entry>Configuration file the current value was set in (null for
8732 values set from sources other than configuration files, or when
8733 examined by a non-superuser);
8734 helpful when using <literal>include</> directives in configuration files</entry>
8737 <entry><structfield>sourceline</structfield></entry>
8738 <entry><type>integer</type></entry>
8739 <entry>Line number within the configuration file the current value was
8740 set at (null for values set from sources other than configuration files,
8741 or when examined by a non-superuser)
8749 There are several possible values of <structfield>context</structfield>.
8750 In order of decreasing difficulty of changing the setting, they are:
8755 <term><literal>internal</literal></term>
8758 These settings cannot be changed directly; they reflect internally
8759 determined values. Some of them may be adjustable by rebuilding the
8760 server with different configuration options, or by changing options
8761 supplied to <command>initdb</command>.
8766 <term><literal>postmaster</literal></term>
8769 These settings can only be applied when the server starts, so any change
8770 requires restarting the server. Values for these settings are typically
8771 stored in the <filename>postgresql.conf</filename> file, or passed on
8772 the command line when starting the server. Of course, settings with any
8773 of the lower <structfield>context</structfield> types can also be
8774 set at server start time.
8779 <term><literal>sighup</literal></term>
8782 Changes to these settings can be made in
8783 <filename>postgresql.conf</filename> without restarting the server.
8784 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
8785 cause it to re-read <filename>postgresql.conf</filename> and apply
8786 the changes. The postmaster will also forward the
8787 <systemitem>SIGHUP</systemitem> signal to its child processes so that
8788 they all pick up the new value.
8793 <term><literal>backend</literal></term>
8796 Changes to these settings can be made in
8797 <filename>postgresql.conf</filename> without restarting the server;
8798 they can also be set for a particular session in the connection request
8799 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
8800 environment variable). However, these settings never change in a
8801 session after it is started. If you change them in
8802 <filename>postgresql.conf</filename>, send a
8803 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
8804 re-read <filename>postgresql.conf</filename>. The new values will only
8805 affect subsequently-launched sessions.
8810 <term><literal>superuser</literal></term>
8813 These settings can be set from <filename>postgresql.conf</filename>,
8814 or within a session via the <command>SET</> command; but only superusers
8815 can change them via <command>SET</>. Changes in
8816 <filename>postgresql.conf</filename> will affect existing sessions
8817 only if no session-local value has been established with <command>SET</>.
8822 <term><literal>user</literal></term>
8825 These settings can be set from <filename>postgresql.conf</filename>,
8826 or within a session via the <command>SET</> command. Any user is
8827 allowed to change his session-local value. Changes in
8828 <filename>postgresql.conf</filename> will affect existing sessions
8829 only if no session-local value has been established with <command>SET</>.
8836 See <xref linkend="config-setting"> for more information about the various
8837 ways to change these parameters.
8841 The <structname>pg_settings</structname> view cannot be inserted into or
8842 deleted from, but it can be updated. An <command>UPDATE</command> applied
8843 to a row of <structname>pg_settings</structname> is equivalent to executing
8844 the <xref linkend="sql-set"> command on that named
8845 parameter. The change only affects the value used by the current
8846 session. If an <command>UPDATE</command> is issued within a transaction
8847 that is later aborted, the effects of the <command>UPDATE</command> command
8848 disappear when the transaction is rolled back. Once the surrounding
8849 transaction is committed, the effects will persist until the end of the
8850 session, unless overridden by another <command>UPDATE</command> or
8851 <command>SET</command>.
8856 <sect1 id="view-pg-shadow">
8857 <title><structname>pg_shadow</structname></title>
8859 <indexterm zone="view-pg-shadow">
8860 <primary>pg_shadow</primary>
8864 The view <structname>pg_shadow</structname> exists for backwards
8865 compatibility: it emulates a catalog that existed in
8866 <productname>PostgreSQL</productname> before version 8.1.
8867 It shows properties of all roles that are marked as
8868 <structfield>rolcanlogin</> in
8869 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
8873 The name stems from the fact that this table
8874 should not be readable by the public since it contains passwords.
8875 <link linkend="view-pg-user"><structname>pg_user</structname></link>
8876 is a publicly readable view on
8877 <structname>pg_shadow</structname> that blanks out the password field.
8881 <title><structname>pg_shadow</> Columns</title>
8888 <entry>References</entry>
8889 <entry>Description</entry>
8895 <entry><structfield>usename</structfield></entry>
8896 <entry><type>name</type></entry>
8897 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8898 <entry>User name</entry>
8902 <entry><structfield>usesysid</structfield></entry>
8903 <entry><type>oid</type></entry>
8904 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8905 <entry>ID of this user</entry>
8909 <entry><structfield>usecreatedb</structfield></entry>
8910 <entry><type>bool</type></entry>
8912 <entry>User can create databases</entry>
8916 <entry><structfield>usesuper</structfield></entry>
8917 <entry><type>bool</type></entry>
8919 <entry>User is a superuser</entry>
8923 <entry><structfield>usecatupd</structfield></entry>
8924 <entry><type>bool</type></entry>
8927 User can update system catalogs. (Even a superuser cannot do
8928 this unless this column is true.)
8933 <entry><structfield>userepl</structfield></entry>
8934 <entry><type>bool</type></entry>
8937 User can initiate streaming replication and put the system in and
8943 <entry><structfield>passwd</structfield></entry>
8944 <entry><type>text</type></entry>
8946 <entry>Password (possibly encrypted); null if none. See
8947 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8948 for details of how encrypted passwords are stored.</entry>
8952 <entry><structfield>valuntil</structfield></entry>
8953 <entry><type>abstime</type></entry>
8955 <entry>Password expiry time (only used for password authentication)</entry>
8959 <entry><structfield>useconfig</structfield></entry>
8960 <entry><type>text[]</type></entry>
8962 <entry>Session defaults for run-time configuration variables</entry>
8970 <sect1 id="view-pg-stats">
8971 <title><structname>pg_stats</structname></title>
8973 <indexterm zone="view-pg-stats">
8974 <primary>pg_stats</primary>
8978 The view <structname>pg_stats</structname> provides access to
8979 the information stored in the <link
8980 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
8981 catalog. This view allows access only to rows of
8982 <structname>pg_statistic</structname> that correspond to tables the
8983 user has permission to read, and therefore it is safe to allow public
8984 read access to this view.
8988 <structname>pg_stats</structname> is also designed to present the
8989 information in a more readable format than the underlying catalog
8990 — at the cost that its schema must be extended whenever new slot types
8991 are defined for <structname>pg_statistic</structname>.
8995 <title><structname>pg_stats</> Columns</title>
9002 <entry>References</entry>
9003 <entry>Description</entry>
9008 <entry><structfield>schemaname</structfield></entry>
9009 <entry><type>name</type></entry>
9010 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9011 <entry>Name of schema containing table</entry>
9015 <entry><structfield>tablename</structfield></entry>
9016 <entry><type>name</type></entry>
9017 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9018 <entry>Name of table</entry>
9022 <entry><structfield>attname</structfield></entry>
9023 <entry><type>name</type></entry>
9024 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9025 <entry>Name of the column described by this row</entry>
9029 <entry><structfield>inherited</structfield></entry>
9030 <entry><type>bool</type></entry>
9032 <entry>If true, this row includes inheritance child columns, not just the
9033 values in the specified table</entry>
9037 <entry><structfield>null_frac</structfield></entry>
9038 <entry><type>real</type></entry>
9040 <entry>Fraction of column entries that are null</entry>
9044 <entry><structfield>avg_width</structfield></entry>
9045 <entry><type>integer</type></entry>
9047 <entry>Average width in bytes of column's entries</entry>
9051 <entry><structfield>n_distinct</structfield></entry>
9052 <entry><type>real</type></entry>
9055 If greater than zero, the estimated number of distinct values in the
9056 column. If less than zero, the negative of the number of distinct
9057 values divided by the number of rows. (The negated form is used when
9058 <command>ANALYZE</> believes that the number of distinct values is
9059 likely to increase as the table grows; the positive form is used when
9060 the column seems to have a fixed number of possible values.) For
9061 example, -1 indicates a unique column in which the number of distinct
9062 values is the same as the number of rows.
9067 <entry><structfield>most_common_vals</structfield></entry>
9068 <entry><type>anyarray</type></entry>
9071 A list of the most common values in the column. (Null if
9072 no values seem to be more common than any others.)
9077 <entry><structfield>most_common_freqs</structfield></entry>
9078 <entry><type>real[]</type></entry>
9081 A list of the frequencies of the most common values,
9082 i.e., number of occurrences of each divided by total number of rows.
9083 (Null when <structfield>most_common_vals</structfield> is.)
9088 <entry><structfield>histogram_bounds</structfield></entry>
9089 <entry><type>anyarray</type></entry>
9092 A list of values that divide the column's values into groups of
9093 approximately equal population. The values in
9094 <structfield>most_common_vals</>, if present, are omitted from this
9095 histogram calculation. (This column is null if the column data type
9096 does not have a <literal><</> operator or if the
9097 <structfield>most_common_vals</> list accounts for the entire
9103 <entry><structfield>correlation</structfield></entry>
9104 <entry><type>real</type></entry>
9107 Statistical correlation between physical row ordering and
9108 logical ordering of the column values. This ranges from -1 to +1.
9109 When the value is near -1 or +1, an index scan on the column will
9110 be estimated to be cheaper than when it is near zero, due to reduction
9111 of random access to the disk. (This column is null if the column data
9112 type does not have a <literal><</> operator.)
9117 <entry><structfield>most_common_elems</structfield></entry>
9118 <entry><type>anyarray</type></entry>
9121 A list of non-null element values most often appearing within values of
9122 the column. (Null for scalar types.)
9127 <entry><structfield>most_common_elem_freqs</structfield></entry>
9128 <entry><type>real[]</type></entry>
9131 A list of the frequencies of the most common element values, i.e., the
9132 fraction of rows containing at least one instance of the given value.
9133 Two or three additional values follow the per-element frequencies;
9134 these are the minimum and maximum of the preceding per-element
9135 frequencies, and optionally the frequency of null elements.
9136 (Null when <structfield>most_common_elems</structfield> is.)
9141 <entry><structfield>elem_count_histogram</structfield></entry>
9142 <entry><type>real[]</type></entry>
9145 A histogram of the counts of distinct non-null element values within the
9146 values of the column, followed by the average number of distinct
9147 non-null elements. (Null for scalar types.)
9155 The maximum number of entries in the array fields can be controlled on a
9156 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9157 command, or globally by setting the
9158 <xref linkend="guc-default-statistics-target"> run-time parameter.
9163 <sect1 id="view-pg-tables">
9164 <title><structname>pg_tables</structname></title>
9166 <indexterm zone="view-pg-tables">
9167 <primary>pg_tables</primary>
9171 The view <structname>pg_tables</structname> provides access to
9172 useful information about each table in the database.
9176 <title><structname>pg_tables</> Columns</title>
9183 <entry>References</entry>
9184 <entry>Description</entry>
9189 <entry><structfield>schemaname</structfield></entry>
9190 <entry><type>name</type></entry>
9191 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9192 <entry>Name of schema containing table</entry>
9195 <entry><structfield>tablename</structfield></entry>
9196 <entry><type>name</type></entry>
9197 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9198 <entry>Name of table</entry>
9201 <entry><structfield>tableowner</structfield></entry>
9202 <entry><type>name</type></entry>
9203 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9204 <entry>Name of table's owner</entry>
9207 <entry><structfield>tablespace</structfield></entry>
9208 <entry><type>name</type></entry>
9209 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9210 <entry>Name of tablespace containing table (null if default for database)</entry>
9213 <entry><structfield>hasindexes</structfield></entry>
9214 <entry><type>boolean</type></entry>
9215 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9216 <entry>True if table has (or recently had) any indexes</entry>
9219 <entry><structfield>hasrules</structfield></entry>
9220 <entry><type>boolean</type></entry>
9221 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9222 <entry>True if table has (or once had) rules</entry>
9225 <entry><structfield>hastriggers</structfield></entry>
9226 <entry><type>boolean</type></entry>
9227 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9228 <entry>True if table has (or once had) triggers</entry>
9231 <entry><structfield>hasrowsecurity</structfield></entry>
9232 <entry><type>boolean</type></entry>
9233 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrowsecurity</literal></entry>
9234 <entry>True if table has row security enabled</entry>
9242 <sect1 id="view-pg-timezone-abbrevs">
9243 <title><structname>pg_timezone_abbrevs</structname></title>
9245 <indexterm zone="view-pg-timezone-abbrevs">
9246 <primary>pg_timezone_abbrevs</primary>
9250 The view <structname>pg_timezone_abbrevs</structname> provides a list
9251 of time zone abbreviations that are currently recognized by the datetime
9252 input routines. The contents of this view change when the
9253 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9257 <title><structname>pg_timezone_abbrevs</> Columns</title>
9264 <entry>Description</entry>
9269 <entry><structfield>abbrev</structfield></entry>
9270 <entry><type>text</type></entry>
9271 <entry>Time zone abbreviation</entry>
9274 <entry><structfield>utc_offset</structfield></entry>
9275 <entry><type>interval</type></entry>
9276 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9279 <entry><structfield>is_dst</structfield></entry>
9280 <entry><type>boolean</type></entry>
9281 <entry>True if this is a daylight-savings abbreviation</entry>
9289 <sect1 id="view-pg-timezone-names">
9290 <title><structname>pg_timezone_names</structname></title>
9292 <indexterm zone="view-pg-timezone-names">
9293 <primary>pg_timezone_names</primary>
9297 The view <structname>pg_timezone_names</structname> provides a list
9298 of time zone names that are recognized by <command>SET TIMEZONE</>,
9299 along with their associated abbreviations, UTC offsets,
9300 and daylight-savings status. (Technically,
9301 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9302 than UTC because leap seconds are not handled.)
9303 Unlike the abbreviations shown in <link
9304 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9305 date rules. Therefore, the associated information changes across local DST
9306 boundaries. The displayed information is computed based on the current
9307 value of <function>CURRENT_TIMESTAMP</>.
9311 <title><structname>pg_timezone_names</> Columns</title>
9318 <entry>Description</entry>
9323 <entry><structfield>name</structfield></entry>
9324 <entry><type>text</type></entry>
9325 <entry>Time zone name</entry>
9328 <entry><structfield>abbrev</structfield></entry>
9329 <entry><type>text</type></entry>
9330 <entry>Time zone abbreviation</entry>
9333 <entry><structfield>utc_offset</structfield></entry>
9334 <entry><type>interval</type></entry>
9335 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9338 <entry><structfield>is_dst</structfield></entry>
9339 <entry><type>boolean</type></entry>
9340 <entry>True if currently observing daylight savings</entry>
9348 <sect1 id="view-pg-user">
9349 <title><structname>pg_user</structname></title>
9351 <indexterm zone="view-pg-user">
9352 <primary>pg_user</primary>
9356 The view <structname>pg_user</structname> provides access to
9357 information about database users. This is simply a publicly
9359 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9360 that blanks out the password field.
9364 <title><structname>pg_user</> Columns</title>
9371 <entry>Description</entry>
9376 <entry><structfield>usename</structfield></entry>
9377 <entry><type>name</type></entry>
9378 <entry>User name</entry>
9382 <entry><structfield>usesysid</structfield></entry>
9383 <entry><type>oid</type></entry>
9384 <entry>ID of this user</entry>
9388 <entry><structfield>usecreatedb</structfield></entry>
9389 <entry><type>bool</type></entry>
9390 <entry>User can create databases</entry>
9394 <entry><structfield>usesuper</structfield></entry>
9395 <entry><type>bool</type></entry>
9396 <entry>User is a superuser</entry>
9400 <entry><structfield>usecatupd</structfield></entry>
9401 <entry><type>bool</type></entry>
9403 User can update system catalogs. (Even a superuser cannot do
9404 this unless this column is true.)
9409 <entry><structfield>userepl</structfield></entry>
9410 <entry><type>bool</type></entry>
9412 User can initiate streaming replication and put the system in and
9418 <entry><structfield>passwd</structfield></entry>
9419 <entry><type>text</type></entry>
9420 <entry>Not the password (always reads as <literal>********</>)</entry>
9424 <entry><structfield>valuntil</structfield></entry>
9425 <entry><type>abstime</type></entry>
9426 <entry>Password expiry time (only used for password authentication)</entry>
9430 <entry><structfield>useconfig</structfield></entry>
9431 <entry><type>text[]</type></entry>
9432 <entry>Session defaults for run-time configuration variables</entry>
9440 <sect1 id="view-pg-user-mappings">
9441 <title><structname>pg_user_mappings</structname></title>
9443 <indexterm zone="view-pg-user-mappings">
9444 <primary>pg_user_mappings</primary>
9448 The view <structname>pg_user_mappings</structname> provides access
9449 to information about user mappings. This is essentially a publicly
9451 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9452 that leaves out the options field if the user has no rights to use
9457 <title><structname>pg_user_mappings</> Columns</title>
9464 <entry>References</entry>
9465 <entry>Description</entry>
9471 <entry><structfield>umid</structfield></entry>
9472 <entry><type>oid</type></entry>
9473 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
9474 <entry>OID of the user mapping</entry>
9478 <entry><structfield>srvid</structfield></entry>
9479 <entry><type>oid</type></entry>
9480 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
9482 The OID of the foreign server that contains this mapping
9487 <entry><structfield>srvname</structfield></entry>
9488 <entry><type>name</type></entry>
9489 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
9491 Name of the foreign server
9496 <entry><structfield>umuser</structfield></entry>
9497 <entry><type>oid</type></entry>
9498 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9499 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
9503 <entry><structfield>usename</structfield></entry>
9504 <entry><type>name</type></entry>
9506 <entry>Name of the local user to be mapped</entry>
9510 <entry><structfield>umoptions</structfield></entry>
9511 <entry><type>text[]</type></entry>
9514 User mapping specific options, as <quote>keyword=value</>
9515 strings, if the current user is the owner of the foreign
9525 <sect1 id="view-pg-views">
9526 <title><structname>pg_views</structname></title>
9528 <indexterm zone="view-pg-views">
9529 <primary>pg_views</primary>
9533 The view <structname>pg_views</structname> provides access to
9534 useful information about each view in the database.
9538 <title><structname>pg_views</> Columns</title>
9545 <entry>References</entry>
9546 <entry>Description</entry>
9551 <entry><structfield>schemaname</structfield></entry>
9552 <entry><type>name</type></entry>
9553 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9554 <entry>Name of schema containing view</entry>
9557 <entry><structfield>viewname</structfield></entry>
9558 <entry><type>name</type></entry>
9559 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9560 <entry>Name of view</entry>
9563 <entry><structfield>viewowner</structfield></entry>
9564 <entry><type>name</type></entry>
9565 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9566 <entry>Name of view's owner</entry>
9569 <entry><structfield>definition</structfield></entry>
9570 <entry><type>text</type></entry>
9572 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>