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-seclabel"><structname>pg_seclabel</structname></link></entry>
243 <entry>security labels on database objects</entry>
247 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
248 <entry>dependencies on shared objects</entry>
252 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
253 <entry>comments on shared objects</entry>
257 <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
258 <entry>security labels on shared database objects</entry>
262 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
263 <entry>planner statistics</entry>
267 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
268 <entry>tablespaces within this database cluster</entry>
272 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
273 <entry>triggers</entry>
277 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
278 <entry>text search configurations</entry>
282 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
283 <entry>text search configurations' token mappings</entry>
287 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
288 <entry>text search dictionaries</entry>
292 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
293 <entry>text search parsers</entry>
297 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
298 <entry>text search templates</entry>
302 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
303 <entry>data types</entry>
307 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
308 <entry>mappings of users to foreign servers</entry>
316 <sect1 id="catalog-pg-aggregate">
317 <title><structname>pg_aggregate</structname></title>
319 <indexterm zone="catalog-pg-aggregate">
320 <primary>pg_aggregate</primary>
324 The catalog <structname>pg_aggregate</structname> stores information about
325 aggregate functions. An aggregate function is a function that
326 operates on a set of values (typically one column from each row
327 that matches a query condition) and returns a single value computed
328 from all these values. Typical aggregate functions are
329 <function>sum</function>, <function>count</function>, and
330 <function>max</function>. Each entry in
331 <structname>pg_aggregate</structname> is an extension of an entry
332 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
333 entry carries the aggregate's name, input and output data types, and
334 other information that is similar to ordinary functions.
338 <title><structname>pg_aggregate</> Columns</title>
345 <entry>References</entry>
346 <entry>Description</entry>
351 <entry><structfield>aggfnoid</structfield></entry>
352 <entry><type>regproc</type></entry>
353 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
354 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
357 <entry><structfield>aggkind</structfield></entry>
358 <entry><type>char</type></entry>
360 <entry>Aggregate kind:
361 <literal>n</literal> for <quote>normal</> aggregates,
362 <literal>o</literal> for <quote>ordered-set</> aggregates, or
363 <literal>h</literal> for <quote>hypothetical-set</> aggregates
367 <entry><structfield>aggnumdirectargs</structfield></entry>
368 <entry><type>int2</type></entry>
370 <entry>Number of direct (non-aggregated) arguments of an ordered-set or
371 hypothetical-set aggregate, counting a variadic array as one argument.
372 If equal to <structfield>pronargs</>, the aggregate must be variadic
373 and the variadic array describes the aggregated arguments as well as
374 the final direct arguments.
375 Always zero for normal aggregates.</entry>
378 <entry><structfield>aggtransfn</structfield></entry>
379 <entry><type>regproc</type></entry>
380 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
381 <entry>Transition function</entry>
384 <entry><structfield>aggfinalfn</structfield></entry>
385 <entry><type>regproc</type></entry>
386 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
387 <entry>Final function (zero if none)</entry>
390 <entry><structfield>aggmtransfn</structfield></entry>
391 <entry><type>regproc</type></entry>
392 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
393 <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
396 <entry><structfield>aggminvtransfn</structfield></entry>
397 <entry><type>regproc</type></entry>
398 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
399 <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
402 <entry><structfield>aggmfinalfn</structfield></entry>
403 <entry><type>regproc</type></entry>
404 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
405 <entry>Final function for moving-aggregate mode (zero if none)</entry>
408 <entry><structfield>aggsortop</structfield></entry>
409 <entry><type>oid</type></entry>
410 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
411 <entry>Associated sort operator (zero if none)</entry>
414 <entry><structfield>aggtranstype</structfield></entry>
415 <entry><type>oid</type></entry>
416 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
417 <entry>Data type of the aggregate function's internal transition (state) data</entry>
420 <entry><structfield>aggtransspace</structfield></entry>
421 <entry><type>int4</type></entry>
423 <entry>Approximate average size (in bytes) of the transition state
424 data, or zero to use a default estimate</entry>
427 <entry><structfield>aggmtranstype</structfield></entry>
428 <entry><type>oid</type></entry>
429 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
430 <entry>Data type of the aggregate function's internal transition (state)
431 data for moving-aggregate mode (zero if none)</entry>
434 <entry><structfield>aggmtransspace</structfield></entry>
435 <entry><type>int4</type></entry>
437 <entry>Approximate average size (in bytes) of the transition state data
438 for moving-aggregate mode, or zero to use a default estimate</entry>
441 <entry><structfield>agginitval</structfield></entry>
442 <entry><type>text</type></entry>
445 The initial value of the transition state. This is a text
446 field containing the initial value in its external string
447 representation. If this field is null, the transition state
448 value starts out null.
452 <entry><structfield>aggminitval</structfield></entry>
453 <entry><type>text</type></entry>
456 The initial value of the transition state for moving-aggregate mode.
457 This is a text field containing the initial value in its external
458 string representation. If this field is null, the transition state
459 value starts out null.
467 New aggregate functions are registered with the <xref
468 linkend="sql-createaggregate">
469 command. See <xref linkend="xaggr"> for more information about
470 writing aggregate functions and the meaning of the transition
477 <sect1 id="catalog-pg-am">
478 <title><structname>pg_am</structname></title>
480 <indexterm zone="catalog-pg-am">
481 <primary>pg_am</primary>
485 The catalog <structname>pg_am</structname> stores information about index
486 access methods. There is one row for each index access method supported by
487 the system. The contents of this catalog are discussed in detail in
488 <xref linkend="indexam">.
492 <title><structname>pg_am</> Columns</title>
499 <entry>References</entry>
500 <entry>Description</entry>
506 <entry><structfield>oid</structfield></entry>
507 <entry><type>oid</type></entry>
509 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
513 <entry><structfield>amname</structfield></entry>
514 <entry><type>name</type></entry>
516 <entry>Name of the access method</entry>
520 <entry><structfield>amstrategies</structfield></entry>
521 <entry><type>int2</type></entry>
523 <entry>Number of operator strategies for this access method,
524 or zero if access method does not have a fixed set of operator
529 <entry><structfield>amsupport</structfield></entry>
530 <entry><type>int2</type></entry>
532 <entry>Number of support routines for this access method</entry>
536 <entry><structfield>amcanorder</structfield></entry>
537 <entry><type>bool</type></entry>
539 <entry>Does the access method support ordered scans sorted by the
540 indexed column's value?</entry>
544 <entry><structfield>amcanorderbyop</structfield></entry>
545 <entry><type>bool</type></entry>
547 <entry>Does the access method support ordered scans sorted by the result
548 of an operator on the indexed column?</entry>
552 <entry><structfield>amcanbackward</structfield></entry>
553 <entry><type>bool</type></entry>
555 <entry>Does the access method support backward scanning?</entry>
559 <entry><structfield>amcanunique</structfield></entry>
560 <entry><type>bool</type></entry>
562 <entry>Does the access method support unique indexes?</entry>
566 <entry><structfield>amcanmulticol</structfield></entry>
567 <entry><type>bool</type></entry>
569 <entry>Does the access method support multicolumn indexes?</entry>
573 <entry><structfield>amoptionalkey</structfield></entry>
574 <entry><type>bool</type></entry>
576 <entry>Does the access method support a scan without any constraint
577 for the first index column?</entry>
581 <entry><structfield>amsearcharray</structfield></entry>
582 <entry><type>bool</type></entry>
584 <entry>Does the access method support <literal>ScalarArrayOpExpr</> searches?</entry>
588 <entry><structfield>amsearchnulls</structfield></entry>
589 <entry><type>bool</type></entry>
591 <entry>Does the access method support <literal>IS NULL</>/<literal>NOT NULL</> searches?</entry>
595 <entry><structfield>amstorage</structfield></entry>
596 <entry><type>bool</type></entry>
598 <entry>Can index storage data type differ from column data type?</entry>
602 <entry><structfield>amclusterable</structfield></entry>
603 <entry><type>bool</type></entry>
605 <entry>Can an index of this type be clustered on?</entry>
609 <entry><structfield>ampredlocks</structfield></entry>
610 <entry><type>bool</type></entry>
612 <entry>Does an index of this type manage fine-grained predicate locks?</entry>
616 <entry><structfield>amkeytype</structfield></entry>
617 <entry><type>oid</type></entry>
618 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
619 <entry>Type of data stored in index, or zero if not a fixed type</entry>
623 <entry><structfield>aminsert</structfield></entry>
624 <entry><type>regproc</type></entry>
625 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
626 <entry><quote>Insert this tuple</quote> function</entry>
630 <entry><structfield>ambeginscan</structfield></entry>
631 <entry><type>regproc</type></entry>
632 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
633 <entry><quote>Prepare for index scan</quote> function</entry>
637 <entry><structfield>amgettuple</structfield></entry>
638 <entry><type>regproc</type></entry>
639 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
640 <entry><quote>Next valid tuple</quote> function, or zero if none</entry>
644 <entry><structfield>amgetbitmap</structfield></entry>
645 <entry><type>regproc</type></entry>
646 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
647 <entry><quote>Fetch all valid tuples</quote> function, or zero if none</entry>
651 <entry><structfield>amrescan</structfield></entry>
652 <entry><type>regproc</type></entry>
653 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
654 <entry><quote>(Re)start index scan</quote> function</entry>
658 <entry><structfield>amendscan</structfield></entry>
659 <entry><type>regproc</type></entry>
660 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
661 <entry><quote>Clean up after index scan</quote> function</entry>
665 <entry><structfield>ammarkpos</structfield></entry>
666 <entry><type>regproc</type></entry>
667 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
668 <entry><quote>Mark current scan position</quote> function</entry>
672 <entry><structfield>amrestrpos</structfield></entry>
673 <entry><type>regproc</type></entry>
674 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
675 <entry><quote>Restore marked scan position</quote> function</entry>
679 <entry><structfield>ambuild</structfield></entry>
680 <entry><type>regproc</type></entry>
681 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
682 <entry><quote>Build new index</quote> function</entry>
686 <entry><structfield>ambuildempty</structfield></entry>
687 <entry><type>regproc</type></entry>
688 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
689 <entry><quote>Build empty index</quote> function</entry>
693 <entry><structfield>ambulkdelete</structfield></entry>
694 <entry><type>regproc</type></entry>
695 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
696 <entry>Bulk-delete function</entry>
700 <entry><structfield>amvacuumcleanup</structfield></entry>
701 <entry><type>regproc</type></entry>
702 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
703 <entry>Post-<command>VACUUM</command> cleanup function</entry>
707 <entry><structfield>amcanreturn</structfield></entry>
708 <entry><type>regproc</type></entry>
709 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
710 <entry>Function to check whether index supports index-only scans,
711 or zero if none</entry>
715 <entry><structfield>amcostestimate</structfield></entry>
716 <entry><type>regproc</type></entry>
717 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
718 <entry>Function to estimate cost of an index scan</entry>
722 <entry><structfield>amoptions</structfield></entry>
723 <entry><type>regproc</type></entry>
724 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
725 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
735 <sect1 id="catalog-pg-amop">
736 <title><structname>pg_amop</structname></title>
738 <indexterm zone="catalog-pg-amop">
739 <primary>pg_amop</primary>
743 The catalog <structname>pg_amop</structname> stores information about
744 operators associated with access method operator families. There is one
745 row for each operator that is a member of an operator family. A family
746 member can be either a <firstterm>search</> operator or an
747 <firstterm>ordering</> operator. An operator
748 can appear in more than one family, but cannot appear in more than one
749 search position nor more than one ordering position within a family.
750 (It is allowed, though unlikely, for an operator to be used for both
751 search and ordering purposes.)
755 <title><structname>pg_amop</> Columns</title>
762 <entry>References</entry>
763 <entry>Description</entry>
769 <entry><structfield>oid</structfield></entry>
770 <entry><type>oid</type></entry>
772 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
776 <entry><structfield>amopfamily</structfield></entry>
777 <entry><type>oid</type></entry>
778 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
779 <entry>The operator family this entry is for</entry>
783 <entry><structfield>amoplefttype</structfield></entry>
784 <entry><type>oid</type></entry>
785 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
786 <entry>Left-hand input data type of operator</entry>
790 <entry><structfield>amoprighttype</structfield></entry>
791 <entry><type>oid</type></entry>
792 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
793 <entry>Right-hand input data type of operator</entry>
797 <entry><structfield>amopstrategy</structfield></entry>
798 <entry><type>int2</type></entry>
800 <entry>Operator strategy number</entry>
804 <entry><structfield>amoppurpose</structfield></entry>
805 <entry><type>char</type></entry>
807 <entry>Operator purpose, either <literal>s</> for search or
808 <literal>o</> for ordering</entry>
812 <entry><structfield>amopopr</structfield></entry>
813 <entry><type>oid</type></entry>
814 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
815 <entry>OID of the operator</entry>
819 <entry><structfield>amopmethod</structfield></entry>
820 <entry><type>oid</type></entry>
821 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
822 <entry>Index access method operator family is for</entry>
826 <entry><structfield>amopsortfamily</structfield></entry>
827 <entry><type>oid</type></entry>
828 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
829 <entry>The btree operator family this entry sorts according to, if an
830 ordering operator; zero if a search operator</entry>
838 A <quote>search</> operator entry indicates that an index of this operator
839 family can be searched to find all rows satisfying
841 <replaceable>indexed_column</>
842 <replaceable>operator</>
843 <replaceable>constant</>.
844 Obviously, such an operator must return boolean, and its left-hand input
845 type must match the index's column data type.
849 An <quote>ordering</> operator entry indicates that an index of this
850 operator family can be scanned to return rows in the order represented by
852 <replaceable>indexed_column</>
853 <replaceable>operator</>
854 <replaceable>constant</>.
855 Such an operator could return any sortable data type, though again
856 its left-hand input type must match the index's column data type.
857 The exact semantics of the <literal>ORDER BY</> are specified by the
858 <structfield>amopsortfamily</structfield> column, which must reference
859 a btree operator family for the operator's result type.
864 At present, it's assumed that the sort order for an ordering operator
865 is the default for the referenced opfamily, i.e., <literal>ASC NULLS
866 LAST</>. This might someday be relaxed by adding additional columns
867 to specify sort options explicitly.
872 An entry's <structfield>amopmethod</> must match the
873 <structname>opfmethod</> of its containing operator family (including
874 <structfield>amopmethod</> here is an intentional denormalization of the
875 catalog structure for performance reasons). Also,
876 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
877 the <structfield>oprleft</> and <structfield>oprright</> fields of the
878 referenced <structname>pg_operator</> entry.
884 <sect1 id="catalog-pg-amproc">
885 <title><structname>pg_amproc</structname></title>
887 <indexterm zone="catalog-pg-amproc">
888 <primary>pg_amproc</primary>
892 The catalog <structname>pg_amproc</structname> stores information about
893 support procedures associated with access method operator families. There
894 is one row for each support procedure belonging to an operator family.
898 <title><structname>pg_amproc</structname> Columns</title>
905 <entry>References</entry>
906 <entry>Description</entry>
912 <entry><structfield>oid</structfield></entry>
913 <entry><type>oid</type></entry>
915 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
919 <entry><structfield>amprocfamily</structfield></entry>
920 <entry><type>oid</type></entry>
921 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
922 <entry>The operator family this entry is for</entry>
926 <entry><structfield>amproclefttype</structfield></entry>
927 <entry><type>oid</type></entry>
928 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
929 <entry>Left-hand input data type of associated operator</entry>
933 <entry><structfield>amprocrighttype</structfield></entry>
934 <entry><type>oid</type></entry>
935 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
936 <entry>Right-hand input data type of associated operator</entry>
940 <entry><structfield>amprocnum</structfield></entry>
941 <entry><type>int2</type></entry>
943 <entry>Support procedure number</entry>
947 <entry><structfield>amproc</structfield></entry>
948 <entry><type>regproc</type></entry>
949 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
950 <entry>OID of the procedure</entry>
958 The usual interpretation of the
959 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
960 is that they identify the left and right input types of the operator(s)
961 that a particular support procedure supports. For some access methods
962 these match the input data type(s) of the support procedure itself, for
963 others not. There is a notion of <quote>default</> support procedures for
964 an index, which are those with <structfield>amproclefttype</> and
965 <structfield>amprocrighttype</> both equal to the index opclass's
966 <structfield>opcintype</>.
972 <sect1 id="catalog-pg-attrdef">
973 <title><structname>pg_attrdef</structname></title>
975 <indexterm zone="catalog-pg-attrdef">
976 <primary>pg_attrdef</primary>
980 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
981 about columns is stored in <structname>pg_attribute</structname>
982 (see below). Only columns that explicitly specify a default value
983 (when the table is created or the column is added) will have an
988 <title><structname>pg_attrdef</> Columns</title>
995 <entry>References</entry>
996 <entry>Description</entry>
1002 <entry><structfield>oid</structfield></entry>
1003 <entry><type>oid</type></entry>
1005 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1009 <entry><structfield>adrelid</structfield></entry>
1010 <entry><type>oid</type></entry>
1011 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1012 <entry>The table this column belongs to</entry>
1016 <entry><structfield>adnum</structfield></entry>
1017 <entry><type>int2</type></entry>
1018 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
1019 <entry>The number of the column</entry>
1023 <entry><structfield>adbin</structfield></entry>
1024 <entry><type>pg_node_tree</type></entry>
1026 <entry>The internal representation of the column default value</entry>
1030 <entry><structfield>adsrc</structfield></entry>
1031 <entry><type>text</type></entry>
1033 <entry>A human-readable representation of the default value</entry>
1040 The <structfield>adsrc</structfield> field is historical, and is best
1041 not used, because it does not track outside changes that might affect
1042 the representation of the default value. Reverse-compiling the
1043 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
1044 example) is a better way to display the default value.
1050 <sect1 id="catalog-pg-attribute">
1051 <title><structname>pg_attribute</structname></title>
1053 <indexterm zone="catalog-pg-attribute">
1054 <primary>pg_attribute</primary>
1058 The catalog <structname>pg_attribute</structname> stores information about
1059 table columns. There will be exactly one
1060 <structname>pg_attribute</structname> row for every column in every
1061 table in the database. (There will also be attribute entries for
1062 indexes, and indeed all objects that have <structname>pg_class</structname>
1067 The term attribute is equivalent to column and is used for
1072 <title><structname>pg_attribute</> Columns</title>
1079 <entry>References</entry>
1080 <entry>Description</entry>
1086 <entry><structfield>attrelid</structfield></entry>
1087 <entry><type>oid</type></entry>
1088 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1089 <entry>The table this column belongs to</entry>
1093 <entry><structfield>attname</structfield></entry>
1094 <entry><type>name</type></entry>
1096 <entry>The column name</entry>
1100 <entry><structfield>atttypid</structfield></entry>
1101 <entry><type>oid</type></entry>
1102 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1103 <entry>The data type of this column</entry>
1107 <entry><structfield>attstattarget</structfield></entry>
1108 <entry><type>int4</type></entry>
1111 <structfield>attstattarget</structfield> controls the level of detail
1112 of statistics accumulated for this column by
1113 <xref linkend="sql-analyze">.
1114 A zero value indicates that no statistics should be collected.
1115 A negative value says to use the system default statistics target.
1116 The exact meaning of positive values is data type-dependent.
1117 For scalar data types, <structfield>attstattarget</structfield>
1118 is both the target number of <quote>most common values</quote>
1119 to collect, and the target number of histogram bins to create.
1124 <entry><structfield>attlen</structfield></entry>
1125 <entry><type>int2</type></entry>
1128 A copy of <literal>pg_type.typlen</literal> of this column's
1134 <entry><structfield>attnum</structfield></entry>
1135 <entry><type>int2</type></entry>
1138 The number of the column. Ordinary columns are numbered from 1
1139 up. System columns, such as <structfield>oid</structfield>,
1140 have (arbitrary) negative numbers.
1145 <entry><structfield>attndims</structfield></entry>
1146 <entry><type>int4</type></entry>
1149 Number of dimensions, if the column is an array type; otherwise 0.
1150 (Presently, the number of dimensions of an array is not enforced,
1151 so any nonzero value effectively means <quote>it's an array</>.)
1156 <entry><structfield>attcacheoff</structfield></entry>
1157 <entry><type>int4</type></entry>
1160 Always -1 in storage, but when loaded into a row descriptor
1161 in memory this might be updated to cache the offset of the attribute
1167 <entry><structfield>atttypmod</structfield></entry>
1168 <entry><type>int4</type></entry>
1171 <structfield>atttypmod</structfield> records type-specific data
1172 supplied at table creation time (for example, the maximum
1173 length of a <type>varchar</type> column). It is passed to
1174 type-specific input functions and length coercion functions.
1175 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1180 <entry><structfield>attbyval</structfield></entry>
1181 <entry><type>bool</type></entry>
1184 A copy of <literal>pg_type.typbyval</> of this column's type
1189 <entry><structfield>attstorage</structfield></entry>
1190 <entry><type>char</type></entry>
1193 Normally a copy of <literal>pg_type.typstorage</> of this
1194 column's type. For TOAST-able data types, this can be altered
1195 after column creation to control storage policy.
1200 <entry><structfield>attalign</structfield></entry>
1201 <entry><type>char</type></entry>
1204 A copy of <literal>pg_type.typalign</> of this column's type
1209 <entry><structfield>attnotnull</structfield></entry>
1210 <entry><type>bool</type></entry>
1213 This represents a not-null constraint. It is possible to
1214 change this column to enable or disable the constraint.
1219 <entry><structfield>atthasdef</structfield></entry>
1220 <entry><type>bool</type></entry>
1223 This column has a default value, in which case there will be a
1224 corresponding entry in the <structname>pg_attrdef</structname>
1225 catalog that actually defines the value.
1230 <entry><structfield>attisdropped</structfield></entry>
1231 <entry><type>bool</type></entry>
1234 This column has been dropped and is no longer valid. A dropped
1235 column is still physically present in the table, but is
1236 ignored by the parser and so cannot be accessed via SQL.
1241 <entry><structfield>attislocal</structfield></entry>
1242 <entry><type>bool</type></entry>
1245 This column is defined locally in the relation. Note that a column can
1246 be locally defined and inherited simultaneously.
1251 <entry><structfield>attinhcount</structfield></entry>
1252 <entry><type>int4</type></entry>
1255 The number of direct ancestors this column has. A column with a
1256 nonzero number of ancestors cannot be dropped nor renamed.
1261 <entry><structfield>attcollation</structfield></entry>
1262 <entry><type>oid</type></entry>
1263 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1265 The defined collation of the column, or zero if the column is
1266 not of a collatable data type.
1271 <entry><structfield>attacl</structfield></entry>
1272 <entry><type>aclitem[]</type></entry>
1275 Column-level access privileges, if any have been granted specifically
1281 <entry><structfield>attoptions</structfield></entry>
1282 <entry><type>text[]</type></entry>
1285 Attribute-level options, as <quote>keyword=value</> strings
1290 <entry><structfield>attfdwoptions</structfield></entry>
1291 <entry><type>text[]</type></entry>
1294 Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1303 In a dropped column's <structname>pg_attribute</structname> entry,
1304 <structfield>atttypid</structfield> is reset to zero, but
1305 <structfield>attlen</structfield> and the other fields copied from
1306 <structname>pg_type</> are still valid. This arrangement is needed
1307 to cope with the situation where the dropped column's data type was
1308 later dropped, and so there is no <structname>pg_type</> row anymore.
1309 <structfield>attlen</structfield> and the other fields can be used
1310 to interpret the contents of a row of the table.
1315 <sect1 id="catalog-pg-authid">
1316 <title><structname>pg_authid</structname></title>
1318 <indexterm zone="catalog-pg-authid">
1319 <primary>pg_authid</primary>
1323 The catalog <structname>pg_authid</structname> contains information about
1324 database authorization identifiers (roles). A role subsumes the concepts
1325 of <quote>users</> and <quote>groups</>. A user is essentially just a
1326 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1327 without <structfield>rolcanlogin</>) can have other roles as members; see
1328 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1332 Since this catalog contains passwords, it must not be publicly readable.
1333 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1334 is a publicly readable view on
1335 <structname>pg_authid</structname> that blanks out the password field.
1339 <xref linkend="user-manag"> contains detailed information about user and
1340 privilege management.
1344 Because user identities are cluster-wide,
1345 <structname>pg_authid</structname>
1346 is shared across all databases of a cluster: there is only one
1347 copy of <structname>pg_authid</structname> per cluster, not
1352 <title><structname>pg_authid</> Columns</title>
1359 <entry>Description</entry>
1366 <entry><structfield>oid</structfield></entry>
1367 <entry><type>oid</type></entry>
1368 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1372 <entry><structfield>rolname</structfield></entry>
1373 <entry><type>name</type></entry>
1374 <entry>Role name</entry>
1378 <entry><structfield>rolsuper</structfield></entry>
1379 <entry><type>bool</type></entry>
1380 <entry>Role has superuser privileges</entry>
1384 <entry><structfield>rolinherit</structfield></entry>
1385 <entry><type>bool</type></entry>
1386 <entry>Role automatically inherits privileges of roles it is a
1391 <entry><structfield>rolcreaterole</structfield></entry>
1392 <entry><type>bool</type></entry>
1393 <entry>Role can create more roles</entry>
1397 <entry><structfield>rolcreatedb</structfield></entry>
1398 <entry><type>bool</type></entry>
1399 <entry>Role can create databases</entry>
1403 <entry><structfield>rolcatupdate</structfield></entry>
1404 <entry><type>bool</type></entry>
1406 Role can update system catalogs directly. (Even a superuser cannot do
1407 this unless this column is true)
1412 <entry><structfield>rolcanlogin</structfield></entry>
1413 <entry><type>bool</type></entry>
1415 Role can log in. That is, this role can be given as the initial
1416 session authorization identifier
1421 <entry><structfield>rolreplication</structfield></entry>
1422 <entry><type>bool</type></entry>
1424 Role is a replication role. That is, this role can initiate streaming
1425 replication (see <xref linkend="streaming-replication">) and set/unset
1426 the system backup mode using <function>pg_start_backup</> and
1427 <function>pg_stop_backup</>
1432 <entry><structfield>rolconnlimit</structfield></entry>
1433 <entry><type>int4</type></entry>
1435 For roles that can log in, this sets maximum number of concurrent
1436 connections this role can make. -1 means no limit.
1441 <entry><structfield>rolpassword</structfield></entry>
1442 <entry><type>text</type></entry>
1444 Password (possibly encrypted); null if none. If the password
1445 is encrypted, this column will begin with the string <literal>md5</>
1446 followed by a 32-character hexadecimal MD5 hash. The MD5 hash
1447 will be of the user's password concatenated to their user name.
1448 For example, if user <literal>joe</> has password <literal>xyzzy</>,
1449 <productname>PostgreSQL</> will store the md5 hash of
1450 <literal>xyzzyjoe</>. A password that does not follow that
1451 format is assumed to be unencrypted.
1456 <entry><structfield>rolvaliduntil</structfield></entry>
1457 <entry><type>timestamptz</type></entry>
1458 <entry>Password expiry time (only used for password authentication);
1459 null if no expiration</entry>
1468 <sect1 id="catalog-pg-auth-members">
1469 <title><structname>pg_auth_members</structname></title>
1471 <indexterm zone="catalog-pg-auth-members">
1472 <primary>pg_auth_members</primary>
1476 The catalog <structname>pg_auth_members</structname> shows the membership
1477 relations between roles. Any non-circular set of relationships is allowed.
1481 Because user identities are cluster-wide,
1482 <structname>pg_auth_members</structname>
1483 is shared across all databases of a cluster: there is only one
1484 copy of <structname>pg_auth_members</structname> per cluster, not
1489 <title><structname>pg_auth_members</> Columns</title>
1496 <entry>References</entry>
1497 <entry>Description</entry>
1503 <entry><structfield>roleid</structfield></entry>
1504 <entry><type>oid</type></entry>
1505 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1506 <entry>ID of a role that has a member</entry>
1510 <entry><structfield>member</structfield></entry>
1511 <entry><type>oid</type></entry>
1512 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1513 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1517 <entry><structfield>grantor</structfield></entry>
1518 <entry><type>oid</type></entry>
1519 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1520 <entry>ID of the role that granted this membership</entry>
1524 <entry><structfield>admin_option</structfield></entry>
1525 <entry><type>bool</type></entry>
1527 <entry>True if <structfield>member</> can grant membership in
1528 <structfield>roleid</> to others</entry>
1537 <sect1 id="catalog-pg-cast">
1538 <title><structname>pg_cast</structname></title>
1540 <indexterm zone="catalog-pg-cast">
1541 <primary>pg_cast</primary>
1545 The catalog <structname>pg_cast</structname> stores data type conversion
1546 paths, both built-in and user-defined.
1550 It should be noted that <structname>pg_cast</structname> does not represent
1551 every type conversion that the system knows how to perform; only those that
1552 cannot be deduced from some generic rule. For example, casting between a
1553 domain and its base type is not explicitly represented in
1554 <structname>pg_cast</structname>. Another important exception is that
1555 <quote>automatic I/O conversion casts</>, those performed using a data
1556 type's own I/O functions to convert to or from <type>text</> or other
1557 string types, are not explicitly represented in
1558 <structname>pg_cast</structname>.
1562 <title><structname>pg_cast</> Columns</title>
1569 <entry>References</entry>
1570 <entry>Description</entry>
1576 <entry><structfield>oid</structfield></entry>
1577 <entry><type>oid</type></entry>
1579 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1583 <entry><structfield>castsource</structfield></entry>
1584 <entry><type>oid</type></entry>
1585 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1586 <entry>OID of the source data type</entry>
1590 <entry><structfield>casttarget</structfield></entry>
1591 <entry><type>oid</type></entry>
1592 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1593 <entry>OID of the target data type</entry>
1597 <entry><structfield>castfunc</structfield></entry>
1598 <entry><type>oid</type></entry>
1599 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1601 The OID of the function to use to perform this cast. Zero is
1602 stored if the cast method doesn't require a function.
1607 <entry><structfield>castcontext</structfield></entry>
1608 <entry><type>char</type></entry>
1611 Indicates what contexts the cast can be invoked in.
1612 <literal>e</> means only as an explicit cast (using
1613 <literal>CAST</> or <literal>::</> syntax).
1614 <literal>a</> means implicitly in assignment
1615 to a target column, as well as explicitly.
1616 <literal>i</> means implicitly in expressions, as well as the
1621 <entry><structfield>castmethod</structfield></entry>
1622 <entry><type>char</type></entry>
1625 Indicates how the cast is performed.
1626 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1627 <literal>i</> means that the input/output functions are used.
1628 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1636 The cast functions listed in <structname>pg_cast</structname> must
1637 always take the cast source type as their first argument type, and
1638 return the cast destination type as their result type. A cast
1639 function can have up to three arguments. The second argument,
1640 if present, must be type <type>integer</>; it receives the type
1641 modifier associated with the destination type, or -1
1642 if there is none. The third argument,
1643 if present, must be type <type>boolean</>; it receives <literal>true</>
1644 if the cast is an explicit cast, <literal>false</> otherwise.
1648 It is legitimate to create a <structname>pg_cast</structname> entry
1649 in which the source and target types are the same, if the associated
1650 function takes more than one argument. Such entries represent
1651 <quote>length coercion functions</> that coerce values of the type
1652 to be legal for a particular type modifier value.
1656 When a <structname>pg_cast</structname> entry has different source and
1657 target types and a function that takes more than one argument, it
1658 represents converting from one type to another and applying a length
1659 coercion in a single step. When no such entry is available, coercion
1660 to a type that uses a type modifier involves two steps, one to
1661 convert between data types and a second to apply the modifier.
1665 <sect1 id="catalog-pg-class">
1666 <title><structname>pg_class</structname></title>
1668 <indexterm zone="catalog-pg-class">
1669 <primary>pg_class</primary>
1673 The catalog <structname>pg_class</structname> catalogs tables and most
1674 everything else that has columns or is otherwise similar to a
1675 table. This includes indexes (but see also
1676 <structname>pg_index</structname>), sequences, views, materialized
1677 views, composite types, and TOAST tables; see <structfield>relkind</>.
1678 Below, when we mean all of these
1679 kinds of objects we speak of <quote>relations</quote>. Not all
1680 columns are meaningful for all relation types.
1684 <title><structname>pg_class</> Columns</title>
1691 <entry>References</entry>
1692 <entry>Description</entry>
1698 <entry><structfield>oid</structfield></entry>
1699 <entry><type>oid</type></entry>
1701 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1705 <entry><structfield>relname</structfield></entry>
1706 <entry><type>name</type></entry>
1708 <entry>Name of the table, index, view, etc.</entry>
1712 <entry><structfield>relnamespace</structfield></entry>
1713 <entry><type>oid</type></entry>
1714 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1716 The OID of the namespace that contains this relation
1721 <entry><structfield>reltype</structfield></entry>
1722 <entry><type>oid</type></entry>
1723 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1725 The OID of the data type that corresponds to this table's row type,
1726 if any (zero for indexes, which have no <structname>pg_type</> entry)
1731 <entry><structfield>reloftype</structfield></entry>
1732 <entry><type>oid</type></entry>
1733 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1735 For typed tables, the OID of the underlying composite type,
1736 zero for all other relations
1741 <entry><structfield>relowner</structfield></entry>
1742 <entry><type>oid</type></entry>
1743 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1744 <entry>Owner of the relation</entry>
1748 <entry><structfield>relam</structfield></entry>
1749 <entry><type>oid</type></entry>
1750 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1751 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1755 <entry><structfield>relfilenode</structfield></entry>
1756 <entry><type>oid</type></entry>
1758 <entry>Name of the on-disk file of this relation; zero means this
1759 is a <quote>mapped</> relation whose disk file name is determined
1760 by low-level state</entry>
1764 <entry><structfield>reltablespace</structfield></entry>
1765 <entry><type>oid</type></entry>
1766 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1768 The tablespace in which this relation is stored. If zero,
1769 the database's default tablespace is implied. (Not meaningful
1770 if the relation has no on-disk file.)
1775 <entry><structfield>relpages</structfield></entry>
1776 <entry><type>int4</type></entry>
1779 Size of the on-disk representation of this table in pages (of size
1780 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1781 planner. It is updated by <command>VACUUM</command>,
1782 <command>ANALYZE</command>, and a few DDL commands such as
1783 <command>CREATE INDEX</command>.
1788 <entry><structfield>reltuples</structfield></entry>
1789 <entry><type>float4</type></entry>
1792 Number of rows in the table. This is only an estimate used by the
1793 planner. It is updated by <command>VACUUM</command>,
1794 <command>ANALYZE</command>, and a few DDL commands such as
1795 <command>CREATE INDEX</command>.
1800 <entry><structfield>relallvisible</structfield></entry>
1801 <entry><type>int4</type></entry>
1804 Number of pages that are marked all-visible in the table's
1805 visibility map. This is only an estimate used by the
1806 planner. It is updated by <command>VACUUM</command>,
1807 <command>ANALYZE</command>, and a few DDL commands such as
1808 <command>CREATE INDEX</command>.
1813 <entry><structfield>reltoastrelid</structfield></entry>
1814 <entry><type>oid</type></entry>
1815 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1817 OID of the TOAST table associated with this table, 0 if none. The
1818 TOAST table stores large attributes <quote>out of line</quote> in a
1824 <entry><structfield>relhasindex</structfield></entry>
1825 <entry><type>bool</type></entry>
1828 True if this is a table and it has (or recently had) any indexes
1833 <entry><structfield>relisshared</structfield></entry>
1834 <entry><type>bool</type></entry>
1837 True if this table is shared across all databases in the cluster. Only
1838 certain system catalogs (such as <structname>pg_database</structname>)
1844 <entry><structfield>relpersistence</structfield></entry>
1845 <entry><type>char</type></entry>
1848 <literal>p</> = permanent table, <literal>u</> = unlogged table,
1849 <literal>t</> = temporary table
1854 <entry><structfield>relkind</structfield></entry>
1855 <entry><type>char</type></entry>
1858 <literal>r</> = ordinary table, <literal>i</> = index,
1859 <literal>S</> = sequence, <literal>v</> = view,
1860 <literal>m</> = materialized view,
1861 <literal>c</> = composite type, <literal>t</> = TOAST table,
1862 <literal>f</> = foreign table
1867 <entry><structfield>relnatts</structfield></entry>
1868 <entry><type>int2</type></entry>
1871 Number of user columns in the relation (system columns not
1872 counted). There must be this many corresponding entries in
1873 <structname>pg_attribute</structname>. See also
1874 <literal>pg_attribute.attnum</literal>.
1879 <entry><structfield>relchecks</structfield></entry>
1880 <entry><type>int2</type></entry>
1883 Number of <literal>CHECK</> constraints on the table; see
1884 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1889 <entry><structfield>relhasoids</structfield></entry>
1890 <entry><type>bool</type></entry>
1893 True if we generate an OID for each row of the relation
1898 <entry><structfield>relhaspkey</structfield></entry>
1899 <entry><type>bool</type></entry>
1902 True if the table has (or once had) a primary key
1907 <entry><structfield>relhasrules</structfield></entry>
1908 <entry><type>bool</type></entry>
1911 True if table has (or once had) rules; see
1912 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1917 <entry><structfield>relhastriggers</structfield></entry>
1918 <entry><type>bool</type></entry>
1921 True if table has (or once had) triggers; see
1922 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1927 <entry><structfield>relhassubclass</structfield></entry>
1928 <entry><type>bool</type></entry>
1930 <entry>True if table has (or once had) any inheritance children</entry>
1934 <entry><structfield>relispopulated</structfield></entry>
1935 <entry><type>bool</type></entry>
1937 <entry>True if relation is populated (this is true for all
1938 relations other than some materialized views)</entry>
1942 <entry><structfield>relreplident</structfield></entry>
1943 <entry><type>char</type></entry>
1946 Columns used to form <quote>replica identity</> for rows:
1947 <literal>d</> = default (primary key, if any),
1948 <literal>n</> = nothing,
1949 <literal>f</> = all columns
1950 <literal>i</> = index with indisreplident set, or default
1955 <entry><structfield>relfrozenxid</structfield></entry>
1956 <entry><type>xid</type></entry>
1959 All transaction IDs before this one have been replaced with a permanent
1960 (<quote>frozen</>) transaction ID in this table. This is used to track
1961 whether the table needs to be vacuumed in order to prevent transaction
1962 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1963 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1968 <entry><structfield>relminmxid</structfield></entry>
1969 <entry><type>xid</type></entry>
1972 All multitransaction IDs before this one have been replaced by a
1973 transaction ID in this table. This is used to track
1974 whether the table needs to be vacuumed in order to prevent multitransaction ID
1975 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1976 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1981 <entry><structfield>relacl</structfield></entry>
1982 <entry><type>aclitem[]</type></entry>
1985 Access privileges; see
1986 <xref linkend="sql-grant"> and
1987 <xref linkend="sql-revoke">
1993 <entry><structfield>reloptions</structfield></entry>
1994 <entry><type>text[]</type></entry>
1997 Access-method-specific options, as <quote>keyword=value</> strings
2005 Several of the Boolean flags in <structname>pg_class</> are maintained
2006 lazily: they are guaranteed to be true if that's the correct state, but
2007 may not be reset to false immediately when the condition is no longer
2008 true. For example, <structfield>relhasindex</> is set by
2009 <command>CREATE INDEX</command>, but it is never cleared by
2010 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
2011 <structfield>relhasindex</> if it finds the table has no indexes. This
2012 arrangement avoids race conditions and improves concurrency.
2016 <sect1 id="catalog-pg-collation">
2017 <title><structname>pg_collation</structname></title>
2019 <indexterm zone="catalog-pg-collation">
2020 <primary>pg_collation</primary>
2024 The catalog <structname>pg_collation</structname> describes the
2025 available collations, which are essentially mappings from an SQL
2026 name to operating system locale categories.
2027 See <xref linkend="collation"> for more information.
2031 <title><structname>pg_collation</> Columns</title>
2038 <entry>References</entry>
2039 <entry>Description</entry>
2045 <entry><structfield>oid</structfield></entry>
2046 <entry><type>oid</type></entry>
2048 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2052 <entry><structfield>collname</structfield></entry>
2053 <entry><type>name</type></entry>
2055 <entry>Collation name (unique per namespace and encoding)</entry>
2059 <entry><structfield>collnamespace</structfield></entry>
2060 <entry><type>oid</type></entry>
2061 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2063 The OID of the namespace that contains this collation
2068 <entry><structfield>collowner</structfield></entry>
2069 <entry><type>oid</type></entry>
2070 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2071 <entry>Owner of the collation</entry>
2075 <entry><structfield>collencoding</structfield></entry>
2076 <entry><type>int4</type></entry>
2078 <entry>Encoding in which the collation is applicable, or -1 if it
2079 works for any encoding</entry>
2083 <entry><structfield>collcollate</structfield></entry>
2084 <entry><type>name</type></entry>
2086 <entry><symbol>LC_COLLATE</> for this collation object</entry>
2090 <entry><structfield>collctype</structfield></entry>
2091 <entry><type>name</type></entry>
2093 <entry><symbol>LC_CTYPE</> for this collation object</entry>
2100 Note that the unique key on this catalog is (<structfield>collname</>,
2101 <structfield>collencoding</>, <structfield>collnamespace</>) not just
2102 (<structfield>collname</>, <structfield>collnamespace</>).
2103 <productname>PostgreSQL</productname> generally ignores all
2104 collations that do not have <structfield>collencoding</> equal to
2105 either the current database's encoding or -1, and creation of new entries
2106 with the same name as an entry with <structfield>collencoding</> = -1
2107 is forbidden. Therefore it is sufficient to use a qualified SQL name
2108 (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2109 even though this is not unique according to the catalog definition.
2110 The reason for defining the catalog this way is that
2111 <application>initdb</> fills it in at cluster initialization time with
2112 entries for all locales available on the system, so it must be able to
2113 hold entries for all encodings that might ever be used in the cluster.
2117 In the <literal>template0</> database, it could be useful to create
2118 collations whose encoding does not match the database encoding,
2119 since they could match the encodings of databases later cloned from
2120 <literal>template0</>. This would currently have to be done manually.
2124 <sect1 id="catalog-pg-constraint">
2125 <title><structname>pg_constraint</structname></title>
2127 <indexterm zone="catalog-pg-constraint">
2128 <primary>pg_constraint</primary>
2132 The catalog <structname>pg_constraint</structname> stores check, primary
2133 key, unique, foreign key, and exclusion constraints on tables.
2134 (Column constraints are not treated specially. Every column constraint is
2135 equivalent to some table constraint.)
2136 Not-null constraints are represented in the <structname>pg_attribute</>
2141 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2142 TRIGGER</>) also give rise to an entry in this table.
2146 Check constraints on domains are stored here, too.
2150 <title><structname>pg_constraint</> Columns</title>
2157 <entry>References</entry>
2158 <entry>Description</entry>
2164 <entry><structfield>oid</structfield></entry>
2165 <entry><type>oid</type></entry>
2167 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2171 <entry><structfield>conname</structfield></entry>
2172 <entry><type>name</type></entry>
2174 <entry>Constraint name (not necessarily unique!)</entry>
2178 <entry><structfield>connamespace</structfield></entry>
2179 <entry><type>oid</type></entry>
2180 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2182 The OID of the namespace that contains this constraint
2187 <entry><structfield>contype</structfield></entry>
2188 <entry><type>char</type></entry>
2191 <literal>c</> = check constraint,
2192 <literal>f</> = foreign key constraint,
2193 <literal>p</> = primary key constraint,
2194 <literal>u</> = unique constraint,
2195 <literal>t</> = constraint trigger,
2196 <literal>x</> = exclusion constraint
2201 <entry><structfield>condeferrable</structfield></entry>
2202 <entry><type>bool</type></entry>
2204 <entry>Is the constraint deferrable?</entry>
2208 <entry><structfield>condeferred</structfield></entry>
2209 <entry><type>bool</type></entry>
2211 <entry>Is the constraint deferred by default?</entry>
2215 <entry><structfield>convalidated</structfield></entry>
2216 <entry><type>bool</type></entry>
2218 <entry>Has the constraint been validated?
2219 Currently, can only be false for foreign keys and CHECK constraints</entry>
2223 <entry><structfield>conrelid</structfield></entry>
2224 <entry><type>oid</type></entry>
2225 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2226 <entry>The table this constraint is on; 0 if not a table constraint</entry>
2230 <entry><structfield>contypid</structfield></entry>
2231 <entry><type>oid</type></entry>
2232 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2233 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2237 <entry><structfield>conindid</structfield></entry>
2238 <entry><type>oid</type></entry>
2239 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2240 <entry>The index supporting this constraint, if it's a unique, primary
2241 key, foreign key, or exclusion constraint; else 0</entry>
2245 <entry><structfield>confrelid</structfield></entry>
2246 <entry><type>oid</type></entry>
2247 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2248 <entry>If a foreign key, the referenced table; else 0</entry>
2252 <entry><structfield>confupdtype</structfield></entry>
2253 <entry><type>char</type></entry>
2255 <entry>Foreign key update action code:
2256 <literal>a</> = no action,
2257 <literal>r</> = restrict,
2258 <literal>c</> = cascade,
2259 <literal>n</> = set null,
2260 <literal>d</> = set default
2265 <entry><structfield>confdeltype</structfield></entry>
2266 <entry><type>char</type></entry>
2268 <entry>Foreign key deletion action code:
2269 <literal>a</> = no action,
2270 <literal>r</> = restrict,
2271 <literal>c</> = cascade,
2272 <literal>n</> = set null,
2273 <literal>d</> = set default
2278 <entry><structfield>confmatchtype</structfield></entry>
2279 <entry><type>char</type></entry>
2281 <entry>Foreign key match type:
2282 <literal>f</> = full,
2283 <literal>p</> = partial,
2284 <literal>s</> = simple
2289 <entry><structfield>conislocal</structfield></entry>
2290 <entry><type>bool</type></entry>
2293 This constraint is defined locally for the relation. Note that a
2294 constraint can be locally defined and inherited simultaneously.
2299 <entry><structfield>coninhcount</structfield></entry>
2300 <entry><type>int4</type></entry>
2303 The number of direct inheritance ancestors this constraint has.
2305 a nonzero number of ancestors cannot be dropped nor renamed.
2310 <entry><structfield>connoinherit</structfield></entry>
2311 <entry><type>bool</type></entry>
2314 This constraint is defined locally for the relation. It is a
2315 non-inheritable constraint.
2320 <entry><structfield>conkey</structfield></entry>
2321 <entry><type>int2[]</type></entry>
2322 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2323 <entry>If a table constraint (including foreign keys, but not constraint
2324 triggers), list of the constrained columns</entry>
2328 <entry><structfield>confkey</structfield></entry>
2329 <entry><type>int2[]</type></entry>
2330 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2331 <entry>If a foreign key, list of the referenced columns</entry>
2335 <entry><structfield>conpfeqop</structfield></entry>
2336 <entry><type>oid[]</type></entry>
2337 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2338 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2342 <entry><structfield>conppeqop</structfield></entry>
2343 <entry><type>oid[]</type></entry>
2344 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2345 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2349 <entry><structfield>conffeqop</structfield></entry>
2350 <entry><type>oid[]</type></entry>
2351 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2352 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2356 <entry><structfield>conexclop</structfield></entry>
2357 <entry><type>oid[]</type></entry>
2358 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2359 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2363 <entry><structfield>conbin</structfield></entry>
2364 <entry><type>pg_node_tree</type></entry>
2366 <entry>If a check constraint, an internal representation of the expression</entry>
2370 <entry><structfield>consrc</structfield></entry>
2371 <entry><type>text</type></entry>
2373 <entry>If a check constraint, a human-readable representation of the expression</entry>
2380 In the case of an exclusion constraint, <structfield>conkey</structfield>
2381 is only useful for constraint elements that are simple column references.
2382 For other cases, a zero appears in <structfield>conkey</structfield>
2383 and the associated index must be consulted to discover the expression
2384 that is constrained. (<structfield>conkey</structfield> thus has the
2385 same contents as <structname>pg_index</>.<structfield>indkey</> for the
2391 <structfield>consrc</structfield> is not updated when referenced objects
2392 change; for example, it won't track renaming of columns. Rather than
2393 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2394 to extract the definition of a check constraint.
2400 <literal>pg_class.relchecks</literal> needs to agree with the
2401 number of check-constraint entries found in this table for each
2408 <sect1 id="catalog-pg-conversion">
2409 <title><structname>pg_conversion</structname></title>
2411 <indexterm zone="catalog-pg-conversion">
2412 <primary>pg_conversion</primary>
2416 The catalog <structname>pg_conversion</structname> describes
2417 encoding conversion procedures. See <xref linkend="sql-createconversion">
2418 for more information.
2422 <title><structname>pg_conversion</> Columns</title>
2429 <entry>References</entry>
2430 <entry>Description</entry>
2436 <entry><structfield>oid</structfield></entry>
2437 <entry><type>oid</type></entry>
2439 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2443 <entry><structfield>conname</structfield></entry>
2444 <entry><type>name</type></entry>
2446 <entry>Conversion name (unique within a namespace)</entry>
2450 <entry><structfield>connamespace</structfield></entry>
2451 <entry><type>oid</type></entry>
2452 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2454 The OID of the namespace that contains this conversion
2459 <entry><structfield>conowner</structfield></entry>
2460 <entry><type>oid</type></entry>
2461 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2462 <entry>Owner of the conversion</entry>
2466 <entry><structfield>conforencoding</structfield></entry>
2467 <entry><type>int4</type></entry>
2469 <entry>Source encoding ID</entry>
2473 <entry><structfield>contoencoding</structfield></entry>
2474 <entry><type>int4</type></entry>
2476 <entry>Destination encoding ID</entry>
2480 <entry><structfield>conproc</structfield></entry>
2481 <entry><type>regproc</type></entry>
2482 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2483 <entry>Conversion procedure</entry>
2487 <entry><structfield>condefault</structfield></entry>
2488 <entry><type>bool</type></entry>
2490 <entry>True if this is the default conversion</entry>
2499 <sect1 id="catalog-pg-database">
2500 <title><structname>pg_database</structname></title>
2502 <indexterm zone="catalog-pg-database">
2503 <primary>pg_database</primary>
2507 The catalog <structname>pg_database</structname> stores information about
2508 the available databases. Databases are created with the <xref
2509 linkend="sql-createdatabase"> command.
2510 Consult <xref linkend="managing-databases"> for details about the meaning
2511 of some of the parameters.
2515 Unlike most system catalogs, <structname>pg_database</structname>
2516 is shared across all databases of a cluster: there is only one
2517 copy of <structname>pg_database</structname> per cluster, not
2522 <title><structname>pg_database</> Columns</title>
2529 <entry>References</entry>
2530 <entry>Description</entry>
2536 <entry><structfield>oid</structfield></entry>
2537 <entry><type>oid</type></entry>
2539 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2543 <entry><structfield>datname</structfield></entry>
2544 <entry><type>name</type></entry>
2546 <entry>Database name</entry>
2550 <entry><structfield>datdba</structfield></entry>
2551 <entry><type>oid</type></entry>
2552 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2553 <entry>Owner of the database, usually the user who created it</entry>
2557 <entry><structfield>encoding</structfield></entry>
2558 <entry><type>int4</type></entry>
2560 <entry>Character encoding for this database
2561 (<function>pg_encoding_to_char()</function> can translate
2562 this number to the encoding name)</entry>
2566 <entry><structfield>datcollate</structfield></entry>
2567 <entry><type>name</type></entry>
2569 <entry>LC_COLLATE for this database</entry>
2573 <entry><structfield>datctype</structfield></entry>
2574 <entry><type>name</type></entry>
2576 <entry>LC_CTYPE for this database</entry>
2580 <entry><structfield>datistemplate</structfield></entry>
2581 <entry><type>bool</type></entry>
2584 If true, then this database can be cloned by
2585 any user with <literal>CREATEDB</> privileges;
2586 if false, then only superusers or the owner of
2587 the database can clone it.
2592 <entry><structfield>datallowconn</structfield></entry>
2593 <entry><type>bool</type></entry>
2596 If false then no one can connect to this database. This is
2597 used to protect the <literal>template0</> database from being altered.
2602 <entry><structfield>datconnlimit</structfield></entry>
2603 <entry><type>int4</type></entry>
2606 Sets maximum number of concurrent connections that can be made
2607 to this database. -1 means no limit.
2612 <entry><structfield>datlastsysoid</structfield></entry>
2613 <entry><type>oid</type></entry>
2616 Last system OID in the database; useful
2617 particularly to <application>pg_dump</application>
2622 <entry><structfield>datfrozenxid</structfield></entry>
2623 <entry><type>xid</type></entry>
2626 All transaction IDs before this one have been replaced with a permanent
2627 (<quote>frozen</>) transaction ID in this database. This is used to
2628 track whether the database needs to be vacuumed in order to prevent
2629 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2630 It is the minimum of the per-table
2631 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2636 <entry><structfield>datminmxid</structfield></entry>
2637 <entry><type>xid</type></entry>
2640 All multitransaction IDs before this one have been replaced with a
2641 transaction ID in this database. This is used to
2642 track whether the database needs to be vacuumed in order to prevent
2643 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2644 It is the minimum of the per-table
2645 <structname>pg_class</>.<structfield>relminmxid</> values.
2650 <entry><structfield>dattablespace</structfield></entry>
2651 <entry><type>oid</type></entry>
2652 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2654 The default tablespace for the database.
2655 Within this database, all tables for which
2656 <structname>pg_class</>.<structfield>reltablespace</> is zero
2657 will be stored in this tablespace; in particular, all the non-shared
2658 system catalogs will be there.
2663 <entry><structfield>datacl</structfield></entry>
2664 <entry><type>aclitem[]</type></entry>
2667 Access privileges; see
2668 <xref linkend="sql-grant"> and
2669 <xref linkend="sql-revoke">
2679 <sect1 id="catalog-pg-db-role-setting">
2680 <title><structname>pg_db_role_setting</structname></title>
2682 <indexterm zone="catalog-pg-db-role-setting">
2683 <primary>pg_db_role_setting</primary>
2687 The catalog <structname>pg_db_role_setting</structname> records the default
2688 values that have been set for run-time configuration variables,
2689 for each role and database combination.
2693 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2694 is shared across all databases of a cluster: there is only one
2695 copy of <structname>pg_db_role_setting</structname> per cluster, not
2700 <title><structname>pg_db_role_setting</> Columns</title>
2707 <entry>References</entry>
2708 <entry>Description</entry>
2714 <entry><structfield>setdatabase</structfield></entry>
2715 <entry><type>oid</type></entry>
2716 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2717 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2721 <entry><structfield>setrole</structfield></entry>
2722 <entry><type>oid</type></entry>
2723 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2724 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2728 <entry><structfield>setconfig</structfield></entry>
2729 <entry><type>text[]</type></entry>
2731 <entry>Defaults for run-time configuration variables</entry>
2739 <sect1 id="catalog-pg-default-acl">
2740 <title><structname>pg_default_acl</structname></title>
2742 <indexterm zone="catalog-pg-default-acl">
2743 <primary>pg_default_acl</primary>
2747 The catalog <structname>pg_default_acl</> stores initial
2748 privileges to be assigned to newly created objects.
2752 <title><structname>pg_default_acl</> Columns</title>
2759 <entry>References</entry>
2760 <entry>Description</entry>
2766 <entry><structfield>oid</structfield></entry>
2767 <entry><type>oid</type></entry>
2769 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2773 <entry><structfield>defaclrole</structfield></entry>
2774 <entry><type>oid</type></entry>
2775 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2776 <entry>The OID of the role associated with this entry</entry>
2780 <entry><structfield>defaclnamespace</structfield></entry>
2781 <entry><type>oid</type></entry>
2782 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2783 <entry>The OID of the namespace associated with this entry,
2784 or 0 if none</entry>
2788 <entry><structfield>defaclobjtype</structfield></entry>
2789 <entry><type>char</type></entry>
2792 Type of object this entry is for:
2793 <literal>r</> = relation (table, view),
2794 <literal>S</> = sequence,
2795 <literal>f</> = function,
2796 <literal>T</> = type
2801 <entry><structfield>defaclacl</structfield></entry>
2802 <entry><type>aclitem[]</type></entry>
2805 Access privileges that this type of object should have on creation
2813 A <structname>pg_default_acl</> entry shows the initial privileges to
2814 be assigned to an object belonging to the indicated user. There are
2815 currently two types of entry: <quote>global</> entries with
2816 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2817 that reference a particular schema. If a global entry is present then
2818 it <emphasis>overrides</> the normal hard-wired default privileges
2819 for the object type. A per-schema entry, if present, represents privileges
2820 to be <emphasis>added to</> the global or hard-wired default privileges.
2824 Note that when an ACL entry in another catalog is null, it is taken
2825 to represent the hard-wired default privileges for its object,
2826 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2827 at the moment. <structname>pg_default_acl</> is only consulted during
2834 <sect1 id="catalog-pg-depend">
2835 <title><structname>pg_depend</structname></title>
2837 <indexterm zone="catalog-pg-depend">
2838 <primary>pg_depend</primary>
2842 The catalog <structname>pg_depend</structname> records the dependency
2843 relationships between database objects. This information allows
2844 <command>DROP</> commands to find which other objects must be dropped
2845 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2850 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2851 which performs a similar function for dependencies involving objects
2852 that are shared across a database cluster.
2856 <title><structname>pg_depend</> Columns</title>
2863 <entry>References</entry>
2864 <entry>Description</entry>
2870 <entry><structfield>classid</structfield></entry>
2871 <entry><type>oid</type></entry>
2872 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2873 <entry>The OID of the system catalog the dependent object is in</entry>
2877 <entry><structfield>objid</structfield></entry>
2878 <entry><type>oid</type></entry>
2879 <entry>any OID column</entry>
2880 <entry>The OID of the specific dependent object</entry>
2884 <entry><structfield>objsubid</structfield></entry>
2885 <entry><type>int4</type></entry>
2888 For a table column, this is the column number (the
2889 <structfield>objid</> and <structfield>classid</> refer to the
2890 table itself). For all other object types, this column is
2896 <entry><structfield>refclassid</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 referenced object is in</entry>
2903 <entry><structfield>refobjid</structfield></entry>
2904 <entry><type>oid</type></entry>
2905 <entry>any OID column</entry>
2906 <entry>The OID of the specific referenced object</entry>
2910 <entry><structfield>refobjsubid</structfield></entry>
2911 <entry><type>int4</type></entry>
2914 For a table column, this is the column number (the
2915 <structfield>refobjid</> and <structfield>refclassid</> refer
2916 to the table itself). For all other object types, this column
2922 <entry><structfield>deptype</structfield></entry>
2923 <entry><type>char</type></entry>
2926 A code defining the specific semantics of this dependency relationship; see text
2935 In all cases, a <structname>pg_depend</structname> entry indicates that the
2936 referenced object cannot be dropped without also dropping the dependent
2937 object. However, there are several subflavors identified by
2938 <structfield>deptype</>:
2942 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2945 A normal relationship between separately-created objects. The
2946 dependent object can be dropped without affecting the
2947 referenced object. The referenced object can only be dropped
2948 by specifying <literal>CASCADE</>, in which case the dependent
2949 object is dropped, too. Example: a table column has a normal
2950 dependency on its data type.
2956 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2959 The dependent object can be dropped separately from the
2960 referenced object, and should be automatically dropped
2961 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2962 mode) if the referenced object is dropped. Example: a named
2963 constraint on a table is made autodependent on the table, so
2964 that it will go away if the table is dropped.
2970 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2973 The dependent object was created as part of creation of the
2974 referenced object, and is really just a part of its internal
2975 implementation. A <command>DROP</> of the dependent object
2976 will be disallowed outright (we'll tell the user to issue a
2977 <command>DROP</> against the referenced object, instead). A
2978 <command>DROP</> of the referenced object will be propagated
2979 through to drop the dependent object whether
2980 <command>CASCADE</> is specified or not. Example: a trigger
2981 that's created to enforce a foreign-key constraint is made
2982 internally dependent on the constraint's
2983 <structname>pg_constraint</> entry.
2989 <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2992 The dependent object is a member of the <firstterm>extension</> that is
2993 the referenced object (see
2994 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2995 The dependent object can be dropped only via
2996 <command>DROP EXTENSION</> on the referenced object. Functionally
2997 this dependency type acts the same as an internal dependency, but
2998 it's kept separate for clarity and to simplify <application>pg_dump</>.
3004 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3007 There is no dependent object; this type of entry is a signal
3008 that the system itself depends on the referenced object, and so
3009 that object must never be deleted. Entries of this type are
3010 created only by <command>initdb</command>. The columns for the
3011 dependent object contain zeroes.
3017 Other dependency flavors might be needed in future.
3023 <sect1 id="catalog-pg-description">
3024 <title><structname>pg_description</structname></title>
3026 <indexterm zone="catalog-pg-description">
3027 <primary>pg_description</primary>
3031 The catalog <structname>pg_description</> stores optional descriptions
3032 (comments) for each database object. Descriptions can be manipulated
3033 with the <xref linkend="sql-comment"> command and viewed with
3034 <application>psql</application>'s <literal>\d</literal> commands.
3035 Descriptions of many built-in system objects are provided in the initial
3036 contents of <structname>pg_description</structname>.
3040 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3041 which performs a similar function for descriptions involving objects that
3042 are shared across a database cluster.
3046 <title><structname>pg_description</> Columns</title>
3053 <entry>References</entry>
3054 <entry>Description</entry>
3060 <entry><structfield>objoid</structfield></entry>
3061 <entry><type>oid</type></entry>
3062 <entry>any OID column</entry>
3063 <entry>The OID of the object this description pertains to</entry>
3067 <entry><structfield>classoid</structfield></entry>
3068 <entry><type>oid</type></entry>
3069 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3070 <entry>The OID of the system catalog this object appears in</entry>
3074 <entry><structfield>objsubid</structfield></entry>
3075 <entry><type>int4</type></entry>
3078 For a comment on a table column, this is the column number (the
3079 <structfield>objoid</> and <structfield>classoid</> refer to
3080 the table itself). For all other object types, this column is
3086 <entry><structfield>description</structfield></entry>
3087 <entry><type>text</type></entry>
3089 <entry>Arbitrary text that serves as the description of this object</entry>
3098 <sect1 id="catalog-pg-enum">
3099 <title><structname>pg_enum</structname></title>
3101 <indexterm zone="catalog-pg-enum">
3102 <primary>pg_enum</primary>
3106 The <structname>pg_enum</structname> catalog contains entries
3107 showing the values and labels for each enum type. The
3108 internal representation of a given enum value is actually the OID
3109 of its associated row in <structname>pg_enum</structname>.
3113 <title><structname>pg_enum</> Columns</title>
3120 <entry>References</entry>
3121 <entry>Description</entry>
3127 <entry><structfield>oid</structfield></entry>
3128 <entry><type>oid</type></entry>
3130 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3134 <entry><structfield>enumtypid</structfield></entry>
3135 <entry><type>oid</type></entry>
3136 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3137 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3141 <entry><structfield>enumsortorder</structfield></entry>
3142 <entry><type>float4</type></entry>
3144 <entry>The sort position of this enum value within its enum type</entry>
3148 <entry><structfield>enumlabel</structfield></entry>
3149 <entry><type>name</type></entry>
3151 <entry>The textual label for this enum value</entry>
3158 The OIDs for <structname>pg_enum</structname> rows follow a special
3159 rule: even-numbered OIDs are guaranteed to be ordered in the same way
3160 as the sort ordering of their enum type. That is, if two even OIDs
3161 belong to the same enum type, the smaller OID must have the smaller
3162 <structfield>enumsortorder</structfield> value. Odd-numbered OID values
3163 need bear no relationship to the sort order. This rule allows the
3164 enum comparison routines to avoid catalog lookups in many common cases.
3165 The routines that create and alter enum types attempt to assign even
3166 OIDs to enum values whenever possible.
3170 When an enum type is created, its members are assigned sort-order
3171 positions 1..<replaceable>n</>. But members added later might be given
3172 negative or fractional values of <structfield>enumsortorder</structfield>.
3173 The only requirement on these values is that they be correctly
3174 ordered and unique within each enum type.
3179 <sect1 id="catalog-pg-event-trigger">
3180 <title><structname>pg_event_trigger</structname></title>
3182 <indexterm zone="catalog-pg-event-trigger">
3183 <primary>pg_event_trigger</primary>
3187 The catalog <structname>pg_event_trigger</structname> stores event triggers.
3188 See <xref linkend="event-triggers"> for more information.
3192 <title><structname>pg_event_trigger</> Columns</title>
3199 <entry>References</entry>
3200 <entry>Description</entry>
3206 <entry><structfield>evtname</structfield></entry>
3207 <entry><type>name</type></entry>
3209 <entry>Trigger name (must be unique)</entry>
3213 <entry><structfield>evtevent</structfield></entry>
3214 <entry><type>name</type></entry>
3216 <entry>Identifies the event for which this trigger fires</entry>
3220 <entry><structfield>evtowner</structfield></entry>
3221 <entry><type>oid</type></entry>
3222 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3223 <entry>Owner of the event trigger</entry>
3227 <entry><structfield>evtfoid</structfield></entry>
3228 <entry><type>oid</type></entry>
3229 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3230 <entry>The function to be called</entry>
3234 <entry><structfield>evtenabled</structfield></entry>
3235 <entry><type>char</type></entry>
3238 Controls in which <xref linkend="guc-session-replication-role"> modes
3239 the event trigger fires.
3240 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3241 <literal>D</> = trigger is disabled,
3242 <literal>R</> = trigger fires in <quote>replica</> mode,
3243 <literal>A</> = trigger fires always.
3248 <entry><structfield>evttags</structfield></entry>
3249 <entry><type>text[]</type></entry>
3252 Command tags for which this trigger will fire. If NULL, the firing
3253 of this trigger is not restricted on the basis of the command tag.
3262 <sect1 id="catalog-pg-extension">
3263 <title><structname>pg_extension</structname></title>
3265 <indexterm zone="catalog-pg-extension">
3266 <primary>pg_extension</primary>
3270 The catalog <structname>pg_extension</structname> stores information
3271 about the installed extensions. See <xref linkend="extend-extensions">
3272 for details about extensions.
3276 <title><structname>pg_extension</> Columns</title>
3283 <entry>References</entry>
3284 <entry>Description</entry>
3290 <entry><structfield>oid</structfield></entry>
3291 <entry><type>oid</type></entry>
3293 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3297 <entry><structfield>extname</structfield></entry>
3298 <entry><type>name</type></entry>
3300 <entry>Name of the extension</entry>
3304 <entry><structfield>extowner</structfield></entry>
3305 <entry><type>oid</type></entry>
3306 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3307 <entry>Owner of the extension</entry>
3311 <entry><structfield>extnamespace</structfield></entry>
3312 <entry><type>oid</type></entry>
3313 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3314 <entry>Schema containing the extension's exported objects</entry>
3318 <entry><structfield>extrelocatable</structfield></entry>
3319 <entry><type>bool</type></entry>
3321 <entry>True if extension can be relocated to another schema</entry>
3325 <entry><structfield>extversion</structfield></entry>
3326 <entry><type>text</type></entry>
3328 <entry>Version name for the extension</entry>
3332 <entry><structfield>extconfig</structfield></entry>
3333 <entry><type>oid[]</type></entry>
3334 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3335 <entry>Array of <type>regclass</> OIDs for the extension's configuration
3336 table(s), or <literal>NULL</> if none</entry>
3340 <entry><structfield>extcondition</structfield></entry>
3341 <entry><type>text[]</type></entry>
3343 <entry>Array of <literal>WHERE</>-clause filter conditions for the
3344 extension's configuration table(s), or <literal>NULL</> if none</entry>
3352 Note that unlike most catalogs with a <quote>namespace</> column,
3353 <structfield>extnamespace</structfield> is not meant to imply
3354 that the extension belongs to that schema. Extension names are never
3355 schema-qualified. Rather, <structfield>extnamespace</structfield>
3356 indicates the schema that contains most or all of the extension's
3357 objects. If <structfield>extrelocatable</structfield> is true, then
3358 this schema must in fact contain all schema-qualifiable objects
3359 belonging to the extension.
3364 <sect1 id="catalog-pg-foreign-data-wrapper">
3365 <title><structname>pg_foreign_data_wrapper</structname></title>
3367 <indexterm zone="catalog-pg-foreign-data-wrapper">
3368 <primary>pg_foreign_data_wrapper</primary>
3372 The catalog <structname>pg_foreign_data_wrapper</structname> stores
3373 foreign-data wrapper definitions. A foreign-data wrapper is the
3374 mechanism by which external data, residing on foreign servers, is
3379 <title><structname>pg_foreign_data_wrapper</> Columns</title>
3386 <entry>References</entry>
3387 <entry>Description</entry>
3393 <entry><structfield>oid</structfield></entry>
3394 <entry><type>oid</type></entry>
3396 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3400 <entry><structfield>fdwname</structfield></entry>
3401 <entry><type>name</type></entry>
3403 <entry>Name of the foreign-data wrapper</entry>
3407 <entry><structfield>fdwowner</structfield></entry>
3408 <entry><type>oid</type></entry>
3409 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3410 <entry>Owner of the foreign-data wrapper</entry>
3414 <entry><structfield>fdwhandler</structfield></entry>
3415 <entry><type>oid</type></entry>
3416 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3418 References a handler function that is responsible for
3419 supplying execution routines for the foreign-data wrapper.
3420 Zero if no handler is provided
3425 <entry><structfield>fdwvalidator</structfield></entry>
3426 <entry><type>oid</type></entry>
3427 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3429 References a validator function that is responsible for
3430 checking the validity of the options given to the
3431 foreign-data wrapper, as well as options for foreign servers and user
3432 mappings using the foreign-data wrapper. Zero if no validator
3438 <entry><structfield>fdwacl</structfield></entry>
3439 <entry><type>aclitem[]</type></entry>
3442 Access privileges; see
3443 <xref linkend="sql-grant"> and
3444 <xref linkend="sql-revoke">
3450 <entry><structfield>fdwoptions</structfield></entry>
3451 <entry><type>text[]</type></entry>
3454 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3463 <sect1 id="catalog-pg-foreign-server">
3464 <title><structname>pg_foreign_server</structname></title>
3466 <indexterm zone="catalog-pg-foreign-server">
3467 <primary>pg_foreign_server</primary>
3471 The catalog <structname>pg_foreign_server</structname> stores
3472 foreign server definitions. A foreign server describes a source
3473 of external data, such as a remote server. Foreign
3474 servers are accessed via foreign-data wrappers.
3478 <title><structname>pg_foreign_server</> Columns</title>
3485 <entry>References</entry>
3486 <entry>Description</entry>
3492 <entry><structfield>oid</structfield></entry>
3493 <entry><type>oid</type></entry>
3495 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3499 <entry><structfield>srvname</structfield></entry>
3500 <entry><type>name</type></entry>
3502 <entry>Name of the foreign server</entry>
3506 <entry><structfield>srvowner</structfield></entry>
3507 <entry><type>oid</type></entry>
3508 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3509 <entry>Owner of the foreign server</entry>
3513 <entry><structfield>srvfdw</structfield></entry>
3514 <entry><type>oid</type></entry>
3515 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3516 <entry>OID of the foreign-data wrapper of this foreign server</entry>
3520 <entry><structfield>srvtype</structfield></entry>
3521 <entry><type>text</type></entry>
3523 <entry>Type of the server (optional)</entry>
3527 <entry><structfield>srvversion</structfield></entry>
3528 <entry><type>text</type></entry>
3530 <entry>Version of the server (optional)</entry>
3534 <entry><structfield>srvacl</structfield></entry>
3535 <entry><type>aclitem[]</type></entry>
3538 Access privileges; see
3539 <xref linkend="sql-grant"> and
3540 <xref linkend="sql-revoke">
3546 <entry><structfield>srvoptions</structfield></entry>
3547 <entry><type>text[]</type></entry>
3550 Foreign server specific options, as <quote>keyword=value</> strings
3559 <sect1 id="catalog-pg-foreign-table">
3560 <title><structname>pg_foreign_table</structname></title>
3562 <indexterm zone="catalog-pg-foreign-table">
3563 <primary>pg_foreign_table</primary>
3567 The catalog <structname>pg_foreign_table</structname> contains
3568 auxiliary information about foreign tables. A foreign table is
3569 primarily represented by a <structname>pg_class</structname> entry,
3570 just like a regular table. Its <structname>pg_foreign_table</structname>
3571 entry contains the information that is pertinent only to foreign tables
3572 and not any other kind of relation.
3576 <title><structname>pg_foreign_table</> Columns</title>
3583 <entry>References</entry>
3584 <entry>Description</entry>
3590 <entry><structfield>ftrelid</structfield></entry>
3591 <entry><type>oid</type></entry>
3592 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3593 <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3597 <entry><structfield>ftserver</structfield></entry>
3598 <entry><type>oid</type></entry>
3599 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3600 <entry>OID of the foreign server for this foreign table</entry>
3604 <entry><structfield>ftoptions</structfield></entry>
3605 <entry><type>text[]</type></entry>
3608 Foreign table options, as <quote>keyword=value</> strings
3617 <sect1 id="catalog-pg-index">
3618 <title><structname>pg_index</structname></title>
3620 <indexterm zone="catalog-pg-index">
3621 <primary>pg_index</primary>
3625 The catalog <structname>pg_index</structname> contains part of the information
3626 about indexes. The rest is mostly in
3627 <structname>pg_class</structname>.
3631 <title><structname>pg_index</> Columns</title>
3638 <entry>References</entry>
3639 <entry>Description</entry>
3645 <entry><structfield>indexrelid</structfield></entry>
3646 <entry><type>oid</type></entry>
3647 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3648 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3652 <entry><structfield>indrelid</structfield></entry>
3653 <entry><type>oid</type></entry>
3654 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3655 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3659 <entry><structfield>indnatts</structfield></entry>
3660 <entry><type>int2</type></entry>
3662 <entry>The number of columns in the index (duplicates
3663 <literal>pg_class.relnatts</literal>)</entry>
3667 <entry><structfield>indisunique</structfield></entry>
3668 <entry><type>bool</type></entry>
3670 <entry>If true, this is a unique index</entry>
3674 <entry><structfield>indisprimary</structfield></entry>
3675 <entry><type>bool</type></entry>
3677 <entry>If true, this index represents the primary key of the table
3678 (<structfield>indisunique</> should always be true when this is true)</entry>
3682 <entry><structfield>indisexclusion</structfield></entry>
3683 <entry><type>bool</type></entry>
3685 <entry>If true, this index supports an exclusion constraint</entry>
3689 <entry><structfield>indimmediate</structfield></entry>
3690 <entry><type>bool</type></entry>
3692 <entry>If true, the uniqueness check is enforced immediately on
3694 (irrelevant if <structfield>indisunique</> is not true)</entry>
3698 <entry><structfield>indisclustered</structfield></entry>
3699 <entry><type>bool</type></entry>
3701 <entry>If true, the table was last clustered on this index</entry>
3705 <entry><structfield>indisvalid</structfield></entry>
3706 <entry><type>bool</type></entry>
3709 If true, the index is currently valid for queries. False means the
3710 index is possibly incomplete: it must still be modified by
3711 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3712 be used for queries. If it is unique, the uniqueness property is not
3713 guaranteed true either.
3718 <entry><structfield>indcheckxmin</structfield></entry>
3719 <entry><type>bool</type></entry>
3722 If true, queries must not use the index until the <structfield>xmin</>
3723 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3724 event horizon, because the table may contain broken HOT chains with
3725 incompatible rows that they can see
3730 <entry><structfield>indisready</structfield></entry>
3731 <entry><type>bool</type></entry>
3734 If true, the index is currently ready for inserts. False means the
3735 index must be ignored by <command>INSERT</>/<command>UPDATE</>
3741 <entry><structfield>indislive</structfield></entry>
3742 <entry><type>bool</type></entry>
3745 If false, the index is in process of being dropped, and should be
3746 ignored for all purposes (including HOT-safety decisions)
3751 <entry><structfield>indisreplident</structfield></entry>
3752 <entry><type>bool</type></entry>
3755 If true this index has been chosen as <quote>replica identity</>
3756 using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3762 <entry><structfield>indkey</structfield></entry>
3763 <entry><type>int2vector</type></entry>
3764 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3766 This is an array of <structfield>indnatts</structfield> values that
3767 indicate which table columns this index indexes. For example a value
3768 of <literal>1 3</literal> would mean that the first and the third table
3769 columns make up the index key. A zero in this array indicates that the
3770 corresponding index attribute is an expression over the table columns,
3771 rather than a simple column reference.
3776 <entry><structfield>indcollation</structfield></entry>
3777 <entry><type>oidvector</type></entry>
3778 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3780 For each column in the index key, this contains the OID of the
3781 collation to use for the index.
3786 <entry><structfield>indclass</structfield></entry>
3787 <entry><type>oidvector</type></entry>
3788 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3790 For each column in the index key, this contains the OID of
3791 the operator class to use. See
3792 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3797 <entry><structfield>indoption</structfield></entry>
3798 <entry><type>int2vector</type></entry>
3801 This is an array of <structfield>indnatts</structfield> values that
3802 store per-column flag bits. The meaning of the bits is defined by
3803 the index's access method.
3808 <entry><structfield>indexprs</structfield></entry>
3809 <entry><type>pg_node_tree</type></entry>
3812 Expression trees (in <function>nodeToString()</function>
3813 representation) for index attributes that are not simple column
3814 references. This is a list with one element for each zero
3815 entry in <structfield>indkey</>. Null if all index attributes
3816 are simple references.
3821 <entry><structfield>indpred</structfield></entry>
3822 <entry><type>pg_node_tree</type></entry>
3825 Expression tree (in <function>nodeToString()</function>
3826 representation) for partial index predicate. Null if not a
3837 <sect1 id="catalog-pg-inherits">
3838 <title><structname>pg_inherits</structname></title>
3840 <indexterm zone="catalog-pg-inherits">
3841 <primary>pg_inherits</primary>
3845 The catalog <structname>pg_inherits</> records information about
3846 table inheritance hierarchies. There is one entry for each direct
3847 child table in the database. (Indirect inheritance can be determined
3848 by following chains of entries.)
3852 <title><structname>pg_inherits</> Columns</title>
3859 <entry>References</entry>
3860 <entry>Description</entry>
3866 <entry><structfield>inhrelid</structfield></entry>
3867 <entry><type>oid</type></entry>
3868 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3870 The OID of the child table
3875 <entry><structfield>inhparent</structfield></entry>
3876 <entry><type>oid</type></entry>
3877 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3879 The OID of the parent table
3884 <entry><structfield>inhseqno</structfield></entry>
3885 <entry><type>int4</type></entry>
3888 If there is more than one direct parent for a child table (multiple
3889 inheritance), this number tells the order in which the
3890 inherited columns are to be arranged. The count starts at 1.
3900 <sect1 id="catalog-pg-language">
3901 <title><structname>pg_language</structname></title>
3903 <indexterm zone="catalog-pg-language">
3904 <primary>pg_language</primary>
3908 The catalog <structname>pg_language</structname> registers
3909 languages in which you can write functions or stored procedures.
3910 See <xref linkend="sql-createlanguage">
3911 and <xref linkend="xplang"> for more information about language handlers.
3915 <title><structname>pg_language</> Columns</title>
3922 <entry>References</entry>
3923 <entry>Description</entry>
3929 <entry><structfield>oid</structfield></entry>
3930 <entry><type>oid</type></entry>
3932 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3936 <entry><structfield>lanname</structfield></entry>
3937 <entry><type>name</type></entry>
3939 <entry>Name of the language</entry>
3943 <entry><structfield>lanowner</structfield></entry>
3944 <entry><type>oid</type></entry>
3945 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3946 <entry>Owner of the language</entry>
3950 <entry><structfield>lanispl</structfield></entry>
3951 <entry><type>bool</type></entry>
3954 This is false for internal languages (such as
3955 <acronym>SQL</acronym>) and true for user-defined languages.
3956 Currently, <application>pg_dump</application> still uses this
3957 to determine which languages need to be dumped, but this might be
3958 replaced by a different mechanism in the future.
3963 <entry><structfield>lanpltrusted</structfield></entry>
3964 <entry><type>bool</type></entry>
3967 True if this is a trusted language, which means that it is believed
3968 not to grant access to anything outside the normal SQL execution
3969 environment. Only superusers can create functions in untrusted
3975 <entry><structfield>lanplcallfoid</structfield></entry>
3976 <entry><type>oid</type></entry>
3977 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3979 For noninternal languages this references the language
3980 handler, which is a special function that is responsible for
3981 executing all functions that are written in the particular
3987 <entry><structfield>laninline</structfield></entry>
3988 <entry><type>oid</type></entry>
3989 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3991 This references a function that is responsible for executing
3992 <quote>inline</> anonymous code blocks
3993 (<xref linkend="sql-do"> blocks).
3994 Zero if inline blocks are not supported.
3999 <entry><structfield>lanvalidator</structfield></entry>
4000 <entry><type>oid</type></entry>
4001 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4003 This references a language validator function that is responsible
4004 for checking the syntax and validity of new functions when they
4005 are created. Zero if no validator is provided.
4010 <entry><structfield>lanacl</structfield></entry>
4011 <entry><type>aclitem[]</type></entry>
4014 Access privileges; see
4015 <xref linkend="sql-grant"> and
4016 <xref linkend="sql-revoke">
4027 <sect1 id="catalog-pg-largeobject">
4028 <title><structname>pg_largeobject</structname></title>
4030 <indexterm zone="catalog-pg-largeobject">
4031 <primary>pg_largeobject</primary>
4035 The catalog <structname>pg_largeobject</structname> holds the data making up
4036 <quote>large objects</quote>. A large object is identified by an OID
4037 assigned when it is created. Each large object is broken into
4038 segments or <quote>pages</> small enough to be conveniently stored as rows
4039 in <structname>pg_largeobject</structname>.
4040 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4041 <literal>BLCKSZ/4</>, or typically 2 kB).
4045 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4046 associated with large objects. As a result,
4047 <structname>pg_largeobject</structname> was publicly readable and could be
4048 used to obtain the OIDs (and contents) of all large objects in the system.
4049 This is no longer the case; use
4050 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4051 to obtain a list of large object OIDs.
4055 <title><structname>pg_largeobject</> Columns</title>
4062 <entry>References</entry>
4063 <entry>Description</entry>
4069 <entry><structfield>loid</structfield></entry>
4070 <entry><type>oid</type></entry>
4071 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4072 <entry>Identifier of the large object that includes this page</entry>
4076 <entry><structfield>pageno</structfield></entry>
4077 <entry><type>int4</type></entry>
4079 <entry>Page number of this page within its large object
4080 (counting from zero)</entry>
4084 <entry><structfield>data</structfield></entry>
4085 <entry><type>bytea</type></entry>
4088 Actual data stored in the large object.
4089 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4097 Each row of <structname>pg_largeobject</structname> holds data
4098 for one page of a large object, beginning at
4099 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
4100 allows sparse storage: pages might be missing, and might be shorter than
4101 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4102 Missing regions within a large object read as zeroes.
4107 <sect1 id="catalog-pg-largeobject-metadata">
4108 <title><structname>pg_largeobject_metadata</structname></title>
4110 <indexterm zone="catalog-pg-largeobject-metadata">
4111 <primary>pg_largeobject_metadata</primary>
4115 The catalog <structname>pg_largeobject_metadata</structname>
4116 holds metadata associated with large objects. The actual large object
4118 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4122 <title><structname>pg_largeobject_metadata</> Columns</title>
4129 <entry>References</entry>
4130 <entry>Description</entry>
4136 <entry><structfield>oid</structfield></entry>
4137 <entry><type>oid</type></entry>
4139 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4143 <entry><structfield>lomowner</structfield></entry>
4144 <entry><type>oid</type></entry>
4145 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4146 <entry>Owner of the large object</entry>
4150 <entry><structfield>lomacl</structfield></entry>
4151 <entry><type>aclitem[]</type></entry>
4154 Access privileges; see
4155 <xref linkend="sql-grant"> and
4156 <xref linkend="sql-revoke">
4166 <sect1 id="catalog-pg-namespace">
4167 <title><structname>pg_namespace</structname></title>
4169 <indexterm zone="catalog-pg-namespace">
4170 <primary>pg_namespace</primary>
4174 The catalog <structname>pg_namespace</> stores namespaces.
4175 A namespace is the structure underlying SQL schemas: each namespace
4176 can have a separate collection of relations, types, etc. without name
4181 <title><structname>pg_namespace</> Columns</title>
4188 <entry>References</entry>
4189 <entry>Description</entry>
4195 <entry><structfield>oid</structfield></entry>
4196 <entry><type>oid</type></entry>
4198 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4202 <entry><structfield>nspname</structfield></entry>
4203 <entry><type>name</type></entry>
4205 <entry>Name of the namespace</entry>
4209 <entry><structfield>nspowner</structfield></entry>
4210 <entry><type>oid</type></entry>
4211 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4212 <entry>Owner of the namespace</entry>
4216 <entry><structfield>nspacl</structfield></entry>
4217 <entry><type>aclitem[]</type></entry>
4220 Access privileges; see
4221 <xref linkend="sql-grant"> and
4222 <xref linkend="sql-revoke">
4233 <sect1 id="catalog-pg-opclass">
4234 <title><structname>pg_opclass</structname></title>
4236 <indexterm zone="catalog-pg-opclass">
4237 <primary>pg_opclass</primary>
4241 The catalog <structname>pg_opclass</structname> defines
4242 index access method operator classes. Each operator class defines
4243 semantics for index columns of a particular data type and a particular
4244 index access method. An operator class essentially specifies that a
4245 particular operator family is applicable to a particular indexable column
4246 data type. The set of operators from the family that are actually usable
4247 with the indexed column are whichever ones accept the column's data type
4248 as their left-hand input.
4252 Operator classes are described at length in <xref linkend="xindex">.
4256 <title><structname>pg_opclass</> Columns</title>
4263 <entry>References</entry>
4264 <entry>Description</entry>
4270 <entry><structfield>oid</structfield></entry>
4271 <entry><type>oid</type></entry>
4273 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4277 <entry><structfield>opcmethod</structfield></entry>
4278 <entry><type>oid</type></entry>
4279 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4280 <entry>Index access method operator class is for</entry>
4284 <entry><structfield>opcname</structfield></entry>
4285 <entry><type>name</type></entry>
4287 <entry>Name of this operator class</entry>
4291 <entry><structfield>opcnamespace</structfield></entry>
4292 <entry><type>oid</type></entry>
4293 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4294 <entry>Namespace of this operator class</entry>
4298 <entry><structfield>opcowner</structfield></entry>
4299 <entry><type>oid</type></entry>
4300 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4301 <entry>Owner of the operator class</entry>
4305 <entry><structfield>opcfamily</structfield></entry>
4306 <entry><type>oid</type></entry>
4307 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4308 <entry>Operator family containing the operator class</entry>
4312 <entry><structfield>opcintype</structfield></entry>
4313 <entry><type>oid</type></entry>
4314 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4315 <entry>Data type that the operator class indexes</entry>
4319 <entry><structfield>opcdefault</structfield></entry>
4320 <entry><type>bool</type></entry>
4322 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4326 <entry><structfield>opckeytype</structfield></entry>
4327 <entry><type>oid</type></entry>
4328 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4329 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4337 An operator class's <structfield>opcmethod</> must match the
4338 <structname>opfmethod</> of its containing operator family.
4339 Also, there must be no more than one <structname>pg_opclass</structname>
4340 row having <structname>opcdefault</> true for any given combination of
4341 <structname>opcmethod</> and <structname>opcintype</>.
4347 <sect1 id="catalog-pg-operator">
4348 <title><structname>pg_operator</structname></title>
4350 <indexterm zone="catalog-pg-operator">
4351 <primary>pg_operator</primary>
4355 The catalog <structname>pg_operator</> stores information about operators.
4356 See <xref linkend="sql-createoperator">
4357 and <xref linkend="xoper"> for more information.
4361 <title><structname>pg_operator</> Columns</title>
4368 <entry>References</entry>
4369 <entry>Description</entry>
4375 <entry><structfield>oid</structfield></entry>
4376 <entry><type>oid</type></entry>
4378 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4382 <entry><structfield>oprname</structfield></entry>
4383 <entry><type>name</type></entry>
4385 <entry>Name of the operator</entry>
4389 <entry><structfield>oprnamespace</structfield></entry>
4390 <entry><type>oid</type></entry>
4391 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4393 The OID of the namespace that contains this operator
4398 <entry><structfield>oprowner</structfield></entry>
4399 <entry><type>oid</type></entry>
4400 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4401 <entry>Owner of the operator</entry>
4405 <entry><structfield>oprkind</structfield></entry>
4406 <entry><type>char</type></entry>
4409 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4410 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4415 <entry><structfield>oprcanmerge</structfield></entry>
4416 <entry><type>bool</type></entry>
4418 <entry>This operator supports merge joins</entry>
4422 <entry><structfield>oprcanhash</structfield></entry>
4423 <entry><type>bool</type></entry>
4425 <entry>This operator supports hash joins</entry>
4429 <entry><structfield>oprleft</structfield></entry>
4430 <entry><type>oid</type></entry>
4431 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4432 <entry>Type of the left operand</entry>
4436 <entry><structfield>oprright</structfield></entry>
4437 <entry><type>oid</type></entry>
4438 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4439 <entry>Type of the right operand</entry>
4443 <entry><structfield>oprresult</structfield></entry>
4444 <entry><type>oid</type></entry>
4445 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4446 <entry>Type of the result</entry>
4450 <entry><structfield>oprcom</structfield></entry>
4451 <entry><type>oid</type></entry>
4452 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4453 <entry>Commutator of this operator, if any</entry>
4457 <entry><structfield>oprnegate</structfield></entry>
4458 <entry><type>oid</type></entry>
4459 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4460 <entry>Negator of this operator, if any</entry>
4464 <entry><structfield>oprcode</structfield></entry>
4465 <entry><type>regproc</type></entry>
4466 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4467 <entry>Function that implements this operator</entry>
4471 <entry><structfield>oprrest</structfield></entry>
4472 <entry><type>regproc</type></entry>
4473 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4474 <entry>Restriction selectivity estimation function for this operator</entry>
4478 <entry><structfield>oprjoin</structfield></entry>
4479 <entry><type>regproc</type></entry>
4480 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4481 <entry>Join selectivity estimation function for this operator</entry>
4488 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4489 is zero for a prefix operator.
4495 <sect1 id="catalog-pg-opfamily">
4496 <title><structname>pg_opfamily</structname></title>
4498 <indexterm zone="catalog-pg-opfamily">
4499 <primary>pg_opfamily</primary>
4503 The catalog <structname>pg_opfamily</structname> defines operator families.
4504 Each operator family is a collection of operators and associated
4505 support routines that implement the semantics specified for a particular
4506 index access method. Furthermore, the operators in a family are all
4507 <quote>compatible</>, in a way that is specified by the access method.
4508 The operator family concept allows cross-data-type operators to be used
4509 with indexes and to be reasoned about using knowledge of access method
4514 Operator families are described at length in <xref linkend="xindex">.
4518 <title><structname>pg_opfamily</> Columns</title>
4525 <entry>References</entry>
4526 <entry>Description</entry>
4532 <entry><structfield>oid</structfield></entry>
4533 <entry><type>oid</type></entry>
4535 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4539 <entry><structfield>opfmethod</structfield></entry>
4540 <entry><type>oid</type></entry>
4541 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4542 <entry>Index access method operator family is for</entry>
4546 <entry><structfield>opfname</structfield></entry>
4547 <entry><type>name</type></entry>
4549 <entry>Name of this operator family</entry>
4553 <entry><structfield>opfnamespace</structfield></entry>
4554 <entry><type>oid</type></entry>
4555 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4556 <entry>Namespace of this operator family</entry>
4560 <entry><structfield>opfowner</structfield></entry>
4561 <entry><type>oid</type></entry>
4562 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4563 <entry>Owner of the operator family</entry>
4571 The majority of the information defining an operator family is not in its
4572 <structname>pg_opfamily</structname> row, but in the associated rows in
4573 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4574 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4576 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4582 <sect1 id="catalog-pg-pltemplate">
4583 <title><structname>pg_pltemplate</structname></title>
4585 <indexterm zone="catalog-pg-pltemplate">
4586 <primary>pg_pltemplate</primary>
4590 The catalog <structname>pg_pltemplate</structname> stores
4591 <quote>template</> information for procedural languages.
4592 A template for a language allows the language to be created in a
4593 particular database by a simple <command>CREATE LANGUAGE</> command,
4594 with no need to specify implementation details.
4598 Unlike most system catalogs, <structname>pg_pltemplate</structname>
4599 is shared across all databases of a cluster: there is only one
4600 copy of <structname>pg_pltemplate</structname> per cluster, not
4601 one per database. This allows the information to be accessible in
4602 each database as it is needed.
4606 <title><structname>pg_pltemplate</> Columns</title>
4613 <entry>Description</entry>
4619 <entry><structfield>tmplname</structfield></entry>
4620 <entry><type>name</type></entry>
4621 <entry>Name of the language this template is for</entry>
4625 <entry><structfield>tmpltrusted</structfield></entry>
4626 <entry><type>boolean</type></entry>
4627 <entry>True if language is considered trusted</entry>
4631 <entry><structfield>tmpldbacreate</structfield></entry>
4632 <entry><type>boolean</type></entry>
4633 <entry>True if language may be created by a database owner</entry>
4637 <entry><structfield>tmplhandler</structfield></entry>
4638 <entry><type>text</type></entry>
4639 <entry>Name of call handler function</entry>
4643 <entry><structfield>tmplinline</structfield></entry>
4644 <entry><type>text</type></entry>
4645 <entry>Name of anonymous-block handler function, or null if none</entry>
4649 <entry><structfield>tmplvalidator</structfield></entry>
4650 <entry><type>text</type></entry>
4651 <entry>Name of validator function, or null if none</entry>
4655 <entry><structfield>tmpllibrary</structfield></entry>
4656 <entry><type>text</type></entry>
4657 <entry>Path of shared library that implements language</entry>
4661 <entry><structfield>tmplacl</structfield></entry>
4662 <entry><type>aclitem[]</type></entry>
4663 <entry>Access privileges for template (not actually used)</entry>
4671 There are not currently any commands that manipulate procedural language
4672 templates; to change the built-in information, a superuser must modify
4673 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4674 or <command>UPDATE</command> commands.
4679 It is likely that <structname>pg_pltemplate</> will be removed in some
4680 future release of <productname>PostgreSQL</productname>, in favor of
4681 keeping this knowledge about procedural languages in their respective
4682 extension installation scripts.
4689 <sect1 id="catalog-pg-proc">
4690 <title><structname>pg_proc</structname></title>
4692 <indexterm zone="catalog-pg-proc">
4693 <primary>pg_proc</primary>
4697 The catalog <structname>pg_proc</> stores information about functions (or procedures).
4698 See <xref linkend="sql-createfunction">
4699 and <xref linkend="xfunc"> for more information.
4703 The table contains data for aggregate functions as well as plain functions.
4704 If <structfield>proisagg</structfield> is true, there should be a matching
4705 row in <structfield>pg_aggregate</structfield>.
4709 <title><structname>pg_proc</> Columns</title>
4716 <entry>References</entry>
4717 <entry>Description</entry>
4723 <entry><structfield>oid</structfield></entry>
4724 <entry><type>oid</type></entry>
4726 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4730 <entry><structfield>proname</structfield></entry>
4731 <entry><type>name</type></entry>
4733 <entry>Name of the function</entry>
4737 <entry><structfield>pronamespace</structfield></entry>
4738 <entry><type>oid</type></entry>
4739 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4741 The OID of the namespace that contains this function
4746 <entry><structfield>proowner</structfield></entry>
4747 <entry><type>oid</type></entry>
4748 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4749 <entry>Owner of the function</entry>
4753 <entry><structfield>prolang</structfield></entry>
4754 <entry><type>oid</type></entry>
4755 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4756 <entry>Implementation language or call interface of this function</entry>
4760 <entry><structfield>procost</structfield></entry>
4761 <entry><type>float4</type></entry>
4763 <entry>Estimated execution cost (in units of
4764 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4765 this is cost per row returned</entry>
4769 <entry><structfield>prorows</structfield></entry>
4770 <entry><type>float4</type></entry>
4772 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4776 <entry><structfield>provariadic</structfield></entry>
4777 <entry><type>oid</type></entry>
4778 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4779 <entry>Data type of the variadic array parameter's elements,
4780 or zero if the function does not have a variadic parameter</entry>
4784 <entry><structfield>protransform</structfield></entry>
4785 <entry><type>regproc</type></entry>
4786 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4787 <entry>Calls to this function can be simplified by this other function
4788 (see <xref linkend="xfunc-transform-functions">)</entry>
4792 <entry><structfield>proisagg</structfield></entry>
4793 <entry><type>bool</type></entry>
4795 <entry>Function is an aggregate function</entry>
4799 <entry><structfield>proiswindow</structfield></entry>
4800 <entry><type>bool</type></entry>
4802 <entry>Function is a window function</entry>
4806 <entry><structfield>prosecdef</structfield></entry>
4807 <entry><type>bool</type></entry>
4809 <entry>Function is a security definer (i.e., a <quote>setuid</>
4814 <entry><structfield>proleakproof</structfield></entry>
4815 <entry><type>bool</type></entry>
4818 The function has no side effects. No information about the
4819 arguments is conveyed except via the return value. Any function
4820 that might throw an error depending on the values of its arguments
4826 <entry><structfield>proisstrict</structfield></entry>
4827 <entry><type>bool</type></entry>
4830 Function returns null if any call argument is null. In that
4831 case the function won't actually be called at all. Functions
4832 that are not <quote>strict</quote> must be prepared to handle
4838 <entry><structfield>proretset</structfield></entry>
4839 <entry><type>bool</type></entry>
4841 <entry>Function returns a set (i.e., multiple values of the specified
4846 <entry><structfield>provolatile</structfield></entry>
4847 <entry><type>char</type></entry>
4850 <structfield>provolatile</structfield> tells whether the function's
4851 result depends only on its input arguments, or is affected by outside
4853 It is <literal>i</literal> for <quote>immutable</> functions,
4854 which always deliver the same result for the same inputs.
4855 It is <literal>s</literal> for <quote>stable</> functions,
4856 whose results (for fixed inputs) do not change within a scan.
4857 It is <literal>v</literal> for <quote>volatile</> functions,
4858 whose results might change at any time. (Use <literal>v</literal> also
4859 for functions with side-effects, so that calls to them cannot get
4865 <entry><structfield>pronargs</structfield></entry>
4866 <entry><type>int2</type></entry>
4868 <entry>Number of input arguments</entry>
4872 <entry><structfield>pronargdefaults</structfield></entry>
4873 <entry><type>int2</type></entry>
4875 <entry>Number of arguments that have defaults</entry>
4879 <entry><structfield>prorettype</structfield></entry>
4880 <entry><type>oid</type></entry>
4881 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4882 <entry>Data type of the return value</entry>
4886 <entry><structfield>proargtypes</structfield></entry>
4887 <entry><type>oidvector</type></entry>
4888 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4890 An array with the data types of the function arguments. This includes
4891 only input arguments (including <literal>INOUT</literal> and
4892 <literal>VARIADIC</> arguments), and thus represents
4893 the call signature of the function.
4898 <entry><structfield>proallargtypes</structfield></entry>
4899 <entry><type>oid[]</type></entry>
4900 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4902 An array with the data types of the function arguments. This includes
4903 all arguments (including <literal>OUT</literal> and
4904 <literal>INOUT</literal> arguments); however, if all the
4905 arguments are <literal>IN</literal> arguments, this field will be null.
4906 Note that subscripting is 1-based, whereas for historical reasons
4907 <structfield>proargtypes</> is subscripted from 0.
4912 <entry><structfield>proargmodes</structfield></entry>
4913 <entry><type>char[]</type></entry>
4916 An array with the modes of the function arguments, encoded as
4917 <literal>i</literal> for <literal>IN</> arguments,
4918 <literal>o</literal> for <literal>OUT</> arguments,
4919 <literal>b</literal> for <literal>INOUT</> arguments,
4920 <literal>v</literal> for <literal>VARIADIC</> arguments,
4921 <literal>t</literal> for <literal>TABLE</> arguments.
4922 If all the arguments are <literal>IN</literal> arguments,
4923 this field will be null.
4924 Note that subscripts correspond to positions of
4925 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4930 <entry><structfield>proargnames</structfield></entry>
4931 <entry><type>text[]</type></entry>
4934 An array with the names of the function arguments.
4935 Arguments without a name are set to empty strings in the array.
4936 If none of the arguments have a name, this field will be null.
4937 Note that subscripts correspond to positions of
4938 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4943 <entry><structfield>proargdefaults</structfield></entry>
4944 <entry><type>pg_node_tree</type></entry>
4947 Expression trees (in <function>nodeToString()</function> representation)
4948 for default values. This is a list with
4949 <structfield>pronargdefaults</> elements, corresponding to the last
4950 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
4951 <replaceable>N</> <structfield>proargtypes</> positions).
4952 If none of the arguments have defaults, this field will be null.
4957 <entry><structfield>prosrc</structfield></entry>
4958 <entry><type>text</type></entry>
4961 This tells the function handler how to invoke the function. It
4962 might be the actual source code of the function for interpreted
4963 languages, a link symbol, a file name, or just about anything
4964 else, depending on the implementation language/call convention.
4969 <entry><structfield>probin</structfield></entry>
4970 <entry><type>text</type></entry>
4973 Additional information about how to invoke the function.
4974 Again, the interpretation is language-specific.
4979 <entry><structfield>proconfig</structfield></entry>
4980 <entry><type>text[]</type></entry>
4982 <entry>Function's local settings for run-time configuration variables</entry>
4986 <entry><structfield>proacl</structfield></entry>
4987 <entry><type>aclitem[]</type></entry>
4990 Access privileges; see
4991 <xref linkend="sql-grant"> and
4992 <xref linkend="sql-revoke">
5001 For compiled functions, both built-in and dynamically loaded,
5002 <structfield>prosrc</structfield> contains the function's C-language
5003 name (link symbol). For all other currently-known language types,
5004 <structfield>prosrc</structfield> contains the function's source
5005 text. <structfield>probin</structfield> is unused except for
5006 dynamically-loaded C functions, for which it gives the name of the
5007 shared library file containing the function.
5012 <sect1 id="catalog-pg-range">
5013 <title><structname>pg_range</structname></title>
5015 <indexterm zone="catalog-pg-range">
5016 <primary>pg_range</primary>
5020 The catalog <structname>pg_range</structname> stores information about
5021 range types. This is in addition to the types' entries in
5022 <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5026 <title><structname>pg_range</> Columns</title>
5033 <entry>References</entry>
5034 <entry>Description</entry>
5040 <entry><structfield>rngtypid</structfield></entry>
5041 <entry><type>oid</type></entry>
5042 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5043 <entry>OID of the range type</entry>
5047 <entry><structfield>rngsubtype</structfield></entry>
5048 <entry><type>oid</type></entry>
5049 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5050 <entry>OID of the element type (subtype) of this range type</entry>
5054 <entry><structfield>rngcollation</structfield></entry>
5055 <entry><type>oid</type></entry>
5056 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5057 <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5061 <entry><structfield>rngsubopc</structfield></entry>
5062 <entry><type>oid</type></entry>
5063 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5064 <entry>OID of the subtype's operator class used for range comparisons</entry>
5068 <entry><structfield>rngcanonical</structfield></entry>
5069 <entry><type>regproc</type></entry>
5070 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5071 <entry>OID of the function to convert a range value into canonical form,
5072 or 0 if none</entry>
5076 <entry><structfield>rngsubdiff</structfield></entry>
5077 <entry><type>regproc</type></entry>
5078 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5079 <entry>OID of the function to return the difference between two element
5080 values as <type>double precision</type>, or 0 if none</entry>
5087 <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5088 element type is collatable) determines the sort ordering used by the range
5089 type. <structfield>rngcanonical</> is used when the element type is
5090 discrete. <structfield>rngsubdiff</> is optional but should be supplied to
5091 improve performance of GiST indexes on the range type.
5096 <sect1 id="catalog-pg-rewrite">
5097 <title><structname>pg_rewrite</structname></title>
5099 <indexterm zone="catalog-pg-rewrite">
5100 <primary>pg_rewrite</primary>
5104 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5108 <title><structname>pg_rewrite</> Columns</title>
5115 <entry>References</entry>
5116 <entry>Description</entry>
5122 <entry><structfield>oid</structfield></entry>
5123 <entry><type>oid</type></entry>
5125 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5129 <entry><structfield>rulename</structfield></entry>
5130 <entry><type>name</type></entry>
5132 <entry>Rule name</entry>
5136 <entry><structfield>ev_class</structfield></entry>
5137 <entry><type>oid</type></entry>
5138 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5139 <entry>The table this rule is for</entry>
5143 <entry><structfield>ev_type</structfield></entry>
5144 <entry><type>char</type></entry>
5147 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5148 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5154 <entry><structfield>ev_enabled</structfield></entry>
5155 <entry><type>char</type></entry>
5158 Controls in which <xref linkend="guc-session-replication-role"> modes
5160 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5161 <literal>D</> = rule is disabled,
5162 <literal>R</> = rule fires in <quote>replica</> mode,
5163 <literal>A</> = rule fires always.
5168 <entry><structfield>is_instead</structfield></entry>
5169 <entry><type>bool</type></entry>
5171 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5175 <entry><structfield>ev_qual</structfield></entry>
5176 <entry><type>pg_node_tree</type></entry>
5179 Expression tree (in the form of a
5180 <function>nodeToString()</function> representation) for the
5181 rule's qualifying condition
5186 <entry><structfield>ev_action</structfield></entry>
5187 <entry><type>pg_node_tree</type></entry>
5190 Query tree (in the form of a
5191 <function>nodeToString()</function> representation) for the
5201 <literal>pg_class.relhasrules</literal>
5202 must be true if a table has any rules in this catalog.
5208 <sect1 id="catalog-pg-replication-slots">
5209 <title><structname>pg_replication_slots</structname></title>
5211 <indexterm zone="catalog-pg-replication-slots">
5212 <primary>pg_replication_slots</primary>
5216 The <structname>pg_replication_slots</structname> view provides a listing
5217 of all replication slots that currently exist on the database cluster,
5218 along with their current state.
5222 For more on replication slots,
5223 see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
5228 <title><structname>pg_replication_slots</structname> Columns</title>
5235 <entry>References</entry>
5236 <entry>Description</entry>
5242 <entry><structfield>slot_name</structfield></entry>
5243 <entry><type>text</type></entry>
5245 <entry>A unique, cluster-wide identifier for the replication slot</entry>
5249 <entry><structfield>slot_type</structfield></entry>
5250 <entry><type>text</type></entry>
5252 <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
5256 <entry><structfield>plugin</structfield></entry>
5257 <entry><type>text</type></entry>
5259 <entry>The basename of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
5263 <entry><structfield>datoid</structfield></entry>
5264 <entry><type>oid</type></entry>
5265 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5266 <entry>The oid of the database this slot is associated with, or
5267 null. Only logical slots have an associated database.</entry>
5271 <entry><structfield>database</structfield></entry>
5272 <entry><type>text</type></entry>
5273 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5274 <entry>The name of the database this slot is associated with, or
5275 null. Only logical slots have an associated database.</entry>
5279 <entry><structfield>active</structfield></entry>
5280 <entry><type>boolean</type></entry>
5282 <entry>True if this slot is currently actively being used</entry>
5286 <entry><structfield>xmin</structfield></entry>
5287 <entry><type>xid</type></entry>
5289 <entry>The oldest transaction that this slot needs the database to
5290 retain. <literal>VACUUM</literal> cannot remove tuples deleted
5291 by any later transaction.
5296 <entry><structfield>xmin</structfield></entry>
5297 <entry><type>xid</type></entry>
5299 <entry>The oldest transaction that this slot needs the database to
5300 retain. <literal>VACUUM</literal> cannot remove catalog tuples deleted
5301 by any later transaction.
5306 <entry><structfield>catalog_xmin</structfield></entry>
5307 <entry><type>xid</type></entry>
5309 <entry>The <literal>xmin</literal>, or oldest transaction ID, that this
5310 slot forces to be retained in the system catalogs. </entry>
5314 <entry><structfield>restart_lsn</structfield></entry>
5315 <entry><type>pg_lsn</type></entry>
5317 <entry>The address (<literal>LSN</literal>) of oldest WAL which still
5318 might be required by the consumer of this slot and thus won't be
5319 automatically removed during checkpoints.
5328 <sect1 id="catalog-pg-seclabel">
5329 <title><structname>pg_seclabel</structname></title>
5331 <indexterm zone="catalog-pg-seclabel">
5332 <primary>pg_seclabel</primary>
5336 The catalog <structname>pg_seclabel</structname> stores security
5337 labels on database objects. Security labels can be manipulated
5338 with the <xref linkend="sql-security-label"> command. For an easier
5339 way to view security labels, see <xref linkend="view-pg-seclabels">.
5343 See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5344 which performs a similar function for security labels of database objects
5345 that are shared across a database cluster.
5349 <title><structname>pg_seclabel</structname> Columns</title>
5356 <entry>References</entry>
5357 <entry>Description</entry>
5363 <entry><structfield>objoid</structfield></entry>
5364 <entry><type>oid</type></entry>
5365 <entry>any OID column</entry>
5366 <entry>The OID of the object this security label pertains to</entry>
5370 <entry><structfield>classoid</structfield></entry>
5371 <entry><type>oid</type></entry>
5372 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5373 <entry>The OID of the system catalog this object appears in</entry>
5377 <entry><structfield>objsubid</structfield></entry>
5378 <entry><type>int4</type></entry>
5381 For a security label on a table column, this is the column number (the
5382 <structfield>objoid</> and <structfield>classoid</> refer to
5383 the table itself). For all other object types, this column is
5389 <entry><structfield>provider</structfield></entry>
5390 <entry><type>text</type></entry>
5392 <entry>The label provider associated with this label.</entry>
5396 <entry><structfield>label</structfield></entry>
5397 <entry><type>text</type></entry>
5399 <entry>The security label applied to this object.</entry>
5406 <sect1 id="catalog-pg-shdepend">
5407 <title><structname>pg_shdepend</structname></title>
5409 <indexterm zone="catalog-pg-shdepend">
5410 <primary>pg_shdepend</primary>
5414 The catalog <structname>pg_shdepend</structname> records the
5415 dependency relationships between database objects and shared objects,
5416 such as roles. This information allows
5417 <productname>PostgreSQL</productname> to ensure that those objects are
5418 unreferenced before attempting to delete them.
5422 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5423 which performs a similar function for dependencies involving objects
5424 within a single database.
5428 Unlike most system catalogs, <structname>pg_shdepend</structname>
5429 is shared across all databases of a cluster: there is only one
5430 copy of <structname>pg_shdepend</structname> per cluster, not
5435 <title><structname>pg_shdepend</> Columns</title>
5442 <entry>References</entry>
5443 <entry>Description</entry>
5449 <entry><structfield>dbid</structfield></entry>
5450 <entry><type>oid</type></entry>
5451 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5452 <entry>The OID of the database the dependent object is in,
5453 or zero for a shared object</entry>
5457 <entry><structfield>classid</structfield></entry>
5458 <entry><type>oid</type></entry>
5459 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5460 <entry>The OID of the system catalog the dependent object is in</entry>
5464 <entry><structfield>objid</structfield></entry>
5465 <entry><type>oid</type></entry>
5466 <entry>any OID column</entry>
5467 <entry>The OID of the specific dependent object</entry>
5471 <entry><structfield>objsubid</structfield></entry>
5472 <entry><type>int4</type></entry>
5475 For a table column, this is the column number (the
5476 <structfield>objid</> and <structfield>classid</> refer to the
5477 table itself). For all other object types, this column is zero.
5482 <entry><structfield>refclassid</structfield></entry>
5483 <entry><type>oid</type></entry>
5484 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5485 <entry>The OID of the system catalog the referenced object is in
5486 (must be a shared catalog)</entry>
5490 <entry><structfield>refobjid</structfield></entry>
5491 <entry><type>oid</type></entry>
5492 <entry>any OID column</entry>
5493 <entry>The OID of the specific referenced object</entry>
5497 <entry><structfield>deptype</structfield></entry>
5498 <entry><type>char</type></entry>
5501 A code defining the specific semantics of this dependency relationship; see text
5510 In all cases, a <structname>pg_shdepend</structname> entry indicates that
5511 the referenced object cannot be dropped without also dropping the dependent
5512 object. However, there are several subflavors identified by
5513 <structfield>deptype</>:
5517 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5520 The referenced object (which must be a role) is the owner of the
5527 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5530 The referenced object (which must be a role) is mentioned in the
5531 ACL (access control list, i.e., privileges list) of the
5532 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5533 not made for the owner of the object, since the owner will have
5534 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5540 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5543 There is no dependent object; this type of entry is a signal
5544 that the system itself depends on the referenced object, and so
5545 that object must never be deleted. Entries of this type are
5546 created only by <command>initdb</command>. The columns for the
5547 dependent object contain zeroes.
5553 Other dependency flavors might be needed in future. Note in particular
5554 that the current definition only supports roles as referenced objects.
5559 <sect1 id="catalog-pg-shdescription">
5560 <title><structname>pg_shdescription</structname></title>
5562 <indexterm zone="catalog-pg-shdescription">
5563 <primary>pg_shdescription</primary>
5567 The catalog <structname>pg_shdescription</structname> stores optional
5568 descriptions (comments) for shared database objects. Descriptions can be
5569 manipulated with the <xref linkend="sql-comment"> command and viewed with
5570 <application>psql</application>'s <literal>\d</literal> commands.
5574 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5575 which performs a similar function for descriptions involving objects
5576 within a single database.
5580 Unlike most system catalogs, <structname>pg_shdescription</structname>
5581 is shared across all databases of a cluster: there is only one
5582 copy of <structname>pg_shdescription</structname> per cluster, not
5587 <title><structname>pg_shdescription</> Columns</title>
5594 <entry>References</entry>
5595 <entry>Description</entry>
5601 <entry><structfield>objoid</structfield></entry>
5602 <entry><type>oid</type></entry>
5603 <entry>any OID column</entry>
5604 <entry>The OID of the object this description pertains to</entry>
5608 <entry><structfield>classoid</structfield></entry>
5609 <entry><type>oid</type></entry>
5610 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5611 <entry>The OID of the system catalog this object appears in</entry>
5615 <entry><structfield>description</structfield></entry>
5616 <entry><type>text</type></entry>
5618 <entry>Arbitrary text that serves as the description of this object</entry>
5626 <sect1 id="catalog-pg-shseclabel">
5627 <title><structname>pg_shseclabel</structname></title>
5629 <indexterm zone="catalog-pg-shseclabel">
5630 <primary>pg_shseclabel</primary>
5634 The catalog <structname>pg_shseclabel</structname> stores security
5635 labels on shared database objects. Security labels can be manipulated
5636 with the <xref linkend="sql-security-label"> command. For an easier
5637 way to view security labels, see <xref linkend="view-pg-seclabels">.
5641 See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5642 which performs a similar function for security labels involving objects
5643 within a single database.
5647 Unlike most system catalogs, <structname>pg_shseclabel</structname>
5648 is shared across all databases of a cluster: there is only one
5649 copy of <structname>pg_shseclabel</structname> per cluster, not
5654 <title><structname>pg_shseclabel</structname> Columns</title>
5660 <entry>References</entry>
5661 <entry>Description</entry>
5666 <entry><structfield>objoid</structfield></entry>
5667 <entry><type>oid</type></entry>
5668 <entry>any OID column</entry>
5669 <entry>The OID of the object this security label pertains to</entry>
5672 <entry><structfield>classoid</structfield></entry>
5673 <entry><type>oid</type></entry>
5674 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5675 <entry>The OID of the system catalog this object appears in</entry>
5678 <entry><structfield>provider</structfield></entry>
5679 <entry><type>text</type></entry>
5681 <entry>The label provider associated with this label.</entry>
5684 <entry><structfield>label</structfield></entry>
5685 <entry><type>text</type></entry>
5687 <entry>The security label applied to this object.</entry>
5694 <sect1 id="catalog-pg-statistic">
5695 <title><structname>pg_statistic</structname></title>
5697 <indexterm zone="catalog-pg-statistic">
5698 <primary>pg_statistic</primary>
5702 The catalog <structname>pg_statistic</structname> stores
5703 statistical data about the contents of the database. Entries are
5704 created by <xref linkend="sql-analyze">
5705 and subsequently used by the query planner. Note that all the
5706 statistical data is inherently approximate, even assuming that it
5711 Normally there is one entry, with <structfield>stainherit</> =
5712 <literal>false</>, for each table column that has been analyzed.
5713 If the table has inheritance children, a second entry with
5714 <structfield>stainherit</> = <literal>true</> is also created. This row
5715 represents the column's statistics over the inheritance tree, i.e.,
5716 statistics for the data you'd see with
5717 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5718 whereas the <structfield>stainherit</> = <literal>false</> row represents
5720 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5724 <structname>pg_statistic</structname> also stores statistical data about
5725 the values of index expressions. These are described as if they were
5726 actual data columns; in particular, <structfield>starelid</structfield>
5727 references the index. No entry is made for an ordinary non-expression
5728 index column, however, since it would be redundant with the entry
5729 for the underlying table column. Currently, entries for index expressions
5730 always have <structfield>stainherit</> = <literal>false</>.
5734 Since different kinds of statistics might be appropriate for different
5735 kinds of data, <structname>pg_statistic</structname> is designed not
5736 to assume very much about what sort of statistics it stores. Only
5737 extremely general statistics (such as nullness) are given dedicated
5738 columns in <structname>pg_statistic</structname>. Everything else
5739 is stored in <quote>slots</quote>, which are groups of associated columns
5740 whose content is identified by a code number in one of the slot's columns.
5741 For more information see
5742 <filename>src/include/catalog/pg_statistic.h</filename>.
5746 <structname>pg_statistic</structname> should not be readable by the
5747 public, since even statistical information about a table's contents
5748 might be considered sensitive. (Example: minimum and maximum values
5749 of a salary column might be quite interesting.)
5750 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
5751 is a publicly readable view on
5752 <structname>pg_statistic</structname> that only exposes information
5753 about those tables that are readable by the current user.
5757 <title><structname>pg_statistic</> Columns</title>
5764 <entry>References</entry>
5765 <entry>Description</entry>
5771 <entry><structfield>starelid</structfield></entry>
5772 <entry><type>oid</type></entry>
5773 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5774 <entry>The table or index that the described column belongs to</entry>
5778 <entry><structfield>staattnum</structfield></entry>
5779 <entry><type>int2</type></entry>
5780 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
5781 <entry>The number of the described column</entry>
5785 <entry><structfield>stainherit</structfield></entry>
5786 <entry><type>bool</type></entry>
5788 <entry>If true, the stats include inheritance child columns, not just the
5789 values in the specified relation</entry>
5793 <entry><structfield>stanullfrac</structfield></entry>
5794 <entry><type>float4</type></entry>
5796 <entry>The fraction of the column's entries that are null</entry>
5800 <entry><structfield>stawidth</structfield></entry>
5801 <entry><type>int4</type></entry>
5803 <entry>The average stored width, in bytes, of nonnull entries</entry>
5807 <entry><structfield>stadistinct</structfield></entry>
5808 <entry><type>float4</type></entry>
5810 <entry>The number of distinct nonnull data values in the column.
5811 A value greater than zero is the actual number of distinct values.
5812 A value less than zero is the negative of a multiplier for the number
5813 of rows in the table; for example, a column in which values appear about
5814 twice on the average could be represented by
5815 <structfield>stadistinct</> = -0.5.
5816 A zero value means the number of distinct values is unknown.
5821 <entry><structfield>stakind<replaceable>N</></structfield></entry>
5822 <entry><type>int2</type></entry>
5825 A code number indicating the kind of statistics stored in the
5826 <replaceable>N</>th <quote>slot</quote> of the
5827 <structname>pg_statistic</structname> row.
5832 <entry><structfield>staop<replaceable>N</></structfield></entry>
5833 <entry><type>oid</type></entry>
5834 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
5836 An operator used to derive the statistics stored in the
5837 <replaceable>N</>th <quote>slot</quote>. For example, a
5838 histogram slot would show the <literal><</literal> operator
5839 that defines the sort order of the data.
5844 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
5845 <entry><type>float4[]</type></entry>
5848 Numerical statistics of the appropriate kind for the
5849 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5850 kind does not involve numerical values
5855 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
5856 <entry><type>anyarray</type></entry>
5859 Column data values of the appropriate kind for the
5860 <replaceable>N</>th <quote>slot</quote>, or null if the slot
5861 kind does not store any data values. Each array's element
5862 values are actually of the specific column's data type, or a related
5863 type such as an array's element type, so there is no way to define
5864 these columns' type more specifically than <type>anyarray</>.
5874 <sect1 id="catalog-pg-tablespace">
5875 <title><structname>pg_tablespace</structname></title>
5877 <indexterm zone="catalog-pg-tablespace">
5878 <primary>pg_tablespace</primary>
5882 The catalog <structname>pg_tablespace</structname> stores information
5883 about the available tablespaces. Tables can be placed in particular
5884 tablespaces to aid administration of disk layout.
5888 Unlike most system catalogs, <structname>pg_tablespace</structname>
5889 is shared across all databases of a cluster: there is only one
5890 copy of <structname>pg_tablespace</structname> per cluster, not
5895 <title><structname>pg_tablespace</> Columns</title>
5902 <entry>References</entry>
5903 <entry>Description</entry>
5909 <entry><structfield>oid</structfield></entry>
5910 <entry><type>oid</type></entry>
5912 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5916 <entry><structfield>spcname</structfield></entry>
5917 <entry><type>name</type></entry>
5919 <entry>Tablespace name</entry>
5923 <entry><structfield>spcowner</structfield></entry>
5924 <entry><type>oid</type></entry>
5925 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5926 <entry>Owner of the tablespace, usually the user who created it</entry>
5930 <entry><structfield>spcacl</structfield></entry>
5931 <entry><type>aclitem[]</type></entry>
5934 Access privileges; see
5935 <xref linkend="sql-grant"> and
5936 <xref linkend="sql-revoke">
5942 <entry><structfield>spcoptions</structfield></entry>
5943 <entry><type>text[]</type></entry>
5946 Tablespace-level options, as <quote>keyword=value</> strings
5955 <sect1 id="catalog-pg-trigger">
5956 <title><structname>pg_trigger</structname></title>
5958 <indexterm zone="catalog-pg-trigger">
5959 <primary>pg_trigger</primary>
5963 The catalog <structname>pg_trigger</structname> stores triggers on tables
5965 See <xref linkend="sql-createtrigger">
5966 for more information.
5970 <title><structname>pg_trigger</> Columns</title>
5977 <entry>References</entry>
5978 <entry>Description</entry>
5984 <entry><structfield>oid</structfield></entry>
5985 <entry><type>oid</type></entry>
5987 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5991 <entry><structfield>tgrelid</structfield></entry>
5992 <entry><type>oid</type></entry>
5993 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5994 <entry>The table this trigger is on</entry>
5998 <entry><structfield>tgname</structfield></entry>
5999 <entry><type>name</type></entry>
6001 <entry>Trigger name (must be unique among triggers of same table)</entry>
6005 <entry><structfield>tgfoid</structfield></entry>
6006 <entry><type>oid</type></entry>
6007 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6008 <entry>The function to be called</entry>
6012 <entry><structfield>tgtype</structfield></entry>
6013 <entry><type>int2</type></entry>
6015 <entry>Bit mask identifying trigger firing conditions</entry>
6019 <entry><structfield>tgenabled</structfield></entry>
6020 <entry><type>char</type></entry>
6023 Controls in which <xref linkend="guc-session-replication-role"> modes
6025 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6026 <literal>D</> = trigger is disabled,
6027 <literal>R</> = trigger fires in <quote>replica</> mode,
6028 <literal>A</> = trigger fires always.
6033 <entry><structfield>tgisinternal</structfield></entry>
6034 <entry><type>bool</type></entry>
6036 <entry>True if trigger is internally generated (usually, to enforce
6037 the constraint identified by <structfield>tgconstraint</>)</entry>
6041 <entry><structfield>tgconstrrelid</structfield></entry>
6042 <entry><type>oid</type></entry>
6043 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6044 <entry>The table referenced by a referential integrity constraint</entry>
6048 <entry><structfield>tgconstrindid</structfield></entry>
6049 <entry><type>oid</type></entry>
6050 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6051 <entry>The index supporting a unique, primary key, referential integrity,
6052 or exclusion constraint</entry>
6056 <entry><structfield>tgconstraint</structfield></entry>
6057 <entry><type>oid</type></entry>
6058 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6059 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6063 <entry><structfield>tgdeferrable</structfield></entry>
6064 <entry><type>bool</type></entry>
6066 <entry>True if constraint trigger is deferrable</entry>
6070 <entry><structfield>tginitdeferred</structfield></entry>
6071 <entry><type>bool</type></entry>
6073 <entry>True if constraint trigger is initially deferred</entry>
6077 <entry><structfield>tgnargs</structfield></entry>
6078 <entry><type>int2</type></entry>
6080 <entry>Number of argument strings passed to trigger function</entry>
6084 <entry><structfield>tgattr</structfield></entry>
6085 <entry><type>int2vector</type></entry>
6086 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6087 <entry>Column numbers, if trigger is column-specific; otherwise an
6092 <entry><structfield>tgargs</structfield></entry>
6093 <entry><type>bytea</type></entry>
6095 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6099 <entry><structfield>tgqual</structfield></entry>
6100 <entry><type>pg_node_tree</type></entry>
6102 <entry>Expression tree (in <function>nodeToString()</function>
6103 representation) for the trigger's <literal>WHEN</> condition, or null
6111 Currently, column-specific triggering is supported only for
6112 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6113 only for that event type. <structfield>tgtype</structfield> might
6114 contain bits for other event types as well, but those are presumed
6115 to be table-wide regardless of what is in <structfield>tgattr</>.
6120 When <structfield>tgconstraint</> is nonzero,
6121 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6122 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6123 largely redundant with the referenced <structname>pg_constraint</> entry.
6124 However, it is possible for a non-deferrable trigger to be associated
6125 with a deferrable constraint: foreign key constraints can have some
6126 deferrable and some non-deferrable triggers.
6132 <literal>pg_class.relhastriggers</literal>
6133 must be true if a relation has any triggers in this catalog.
6140 <sect1 id="catalog-pg-ts-config">
6141 <title><structname>pg_ts_config</structname></title>
6143 <indexterm zone="catalog-pg-ts-config">
6144 <primary>pg_ts_config</primary>
6148 The <structname>pg_ts_config</structname> catalog contains entries
6149 representing text search configurations. A configuration specifies
6150 a particular text search parser and a list of dictionaries to use
6151 for each of the parser's output token types. The parser is shown
6152 in the <structname>pg_ts_config</structname> entry, but the
6153 token-to-dictionary mapping is defined by subsidiary entries in <link
6154 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6158 <productname>PostgreSQL</productname>'s text search features are
6159 described at length in <xref linkend="textsearch">.
6163 <title><structname>pg_ts_config</> Columns</title>
6170 <entry>References</entry>
6171 <entry>Description</entry>
6177 <entry><structfield>oid</structfield></entry>
6178 <entry><type>oid</type></entry>
6180 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6184 <entry><structfield>cfgname</structfield></entry>
6185 <entry><type>name</type></entry>
6187 <entry>Text search configuration name</entry>
6191 <entry><structfield>cfgnamespace</structfield></entry>
6192 <entry><type>oid</type></entry>
6193 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6195 The OID of the namespace that contains this configuration
6200 <entry><structfield>cfgowner</structfield></entry>
6201 <entry><type>oid</type></entry>
6202 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6203 <entry>Owner of the configuration</entry>
6207 <entry><structfield>cfgparser</structfield></entry>
6208 <entry><type>oid</type></entry>
6209 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6210 <entry>The OID of the text search parser for this configuration</entry>
6218 <sect1 id="catalog-pg-ts-config-map">
6219 <title><structname>pg_ts_config_map</structname></title>
6221 <indexterm zone="catalog-pg-ts-config-map">
6222 <primary>pg_ts_config_map</primary>
6226 The <structname>pg_ts_config_map</structname> catalog contains entries
6227 showing which text search dictionaries should be consulted, and in
6228 what order, for each output token type of each text search configuration's
6233 <productname>PostgreSQL</productname>'s text search features are
6234 described at length in <xref linkend="textsearch">.
6238 <title><structname>pg_ts_config_map</> Columns</title>
6245 <entry>References</entry>
6246 <entry>Description</entry>
6252 <entry><structfield>mapcfg</structfield></entry>
6253 <entry><type>oid</type></entry>
6254 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6255 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6259 <entry><structfield>maptokentype</structfield></entry>
6260 <entry><type>integer</type></entry>
6262 <entry>A token type emitted by the configuration's parser</entry>
6266 <entry><structfield>mapseqno</structfield></entry>
6267 <entry><type>integer</type></entry>
6269 <entry>Order in which to consult this entry (lower
6270 <structfield>mapseqno</>s first)</entry>
6274 <entry><structfield>mapdict</structfield></entry>
6275 <entry><type>oid</type></entry>
6276 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6277 <entry>The OID of the text search dictionary to consult</entry>
6285 <sect1 id="catalog-pg-ts-dict">
6286 <title><structname>pg_ts_dict</structname></title>
6288 <indexterm zone="catalog-pg-ts-dict">
6289 <primary>pg_ts_dict</primary>
6293 The <structname>pg_ts_dict</structname> catalog contains entries
6294 defining text search dictionaries. A dictionary depends on a text
6295 search template, which specifies all the implementation functions
6296 needed; the dictionary itself provides values for the user-settable
6297 parameters supported by the template. This division of labor allows
6298 dictionaries to be created by unprivileged users. The parameters
6299 are specified by a text string <structfield>dictinitoption</>,
6300 whose format and meaning vary depending on the template.
6304 <productname>PostgreSQL</productname>'s text search features are
6305 described at length in <xref linkend="textsearch">.
6309 <title><structname>pg_ts_dict</> Columns</title>
6316 <entry>References</entry>
6317 <entry>Description</entry>
6323 <entry><structfield>oid</structfield></entry>
6324 <entry><type>oid</type></entry>
6326 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6330 <entry><structfield>dictname</structfield></entry>
6331 <entry><type>name</type></entry>
6333 <entry>Text search dictionary name</entry>
6337 <entry><structfield>dictnamespace</structfield></entry>
6338 <entry><type>oid</type></entry>
6339 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6341 The OID of the namespace that contains this dictionary
6346 <entry><structfield>dictowner</structfield></entry>
6347 <entry><type>oid</type></entry>
6348 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6349 <entry>Owner of the dictionary</entry>
6353 <entry><structfield>dicttemplate</structfield></entry>
6354 <entry><type>oid</type></entry>
6355 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6356 <entry>The OID of the text search template for this dictionary</entry>
6360 <entry><structfield>dictinitoption</structfield></entry>
6361 <entry><type>text</type></entry>
6363 <entry>Initialization option string for the template</entry>
6371 <sect1 id="catalog-pg-ts-parser">
6372 <title><structname>pg_ts_parser</structname></title>
6374 <indexterm zone="catalog-pg-ts-parser">
6375 <primary>pg_ts_parser</primary>
6379 The <structname>pg_ts_parser</structname> catalog contains entries
6380 defining text search parsers. A parser is responsible for splitting
6381 input text into lexemes and assigning a token type to each lexeme.
6382 Since a parser must be implemented by C-language-level functions,
6383 creation of new parsers is restricted to database superusers.
6387 <productname>PostgreSQL</productname>'s text search features are
6388 described at length in <xref linkend="textsearch">.
6392 <title><structname>pg_ts_parser</> Columns</title>
6399 <entry>References</entry>
6400 <entry>Description</entry>
6406 <entry><structfield>oid</structfield></entry>
6407 <entry><type>oid</type></entry>
6409 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6413 <entry><structfield>prsname</structfield></entry>
6414 <entry><type>name</type></entry>
6416 <entry>Text search parser name</entry>
6420 <entry><structfield>prsnamespace</structfield></entry>
6421 <entry><type>oid</type></entry>
6422 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6424 The OID of the namespace that contains this parser
6429 <entry><structfield>prsstart</structfield></entry>
6430 <entry><type>regproc</type></entry>
6431 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6432 <entry>OID of the parser's startup function</entry>
6436 <entry><structfield>prstoken</structfield></entry>
6437 <entry><type>regproc</type></entry>
6438 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6439 <entry>OID of the parser's next-token function</entry>
6443 <entry><structfield>prsend</structfield></entry>
6444 <entry><type>regproc</type></entry>
6445 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6446 <entry>OID of the parser's shutdown function</entry>
6450 <entry><structfield>prsheadline</structfield></entry>
6451 <entry><type>regproc</type></entry>
6452 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6453 <entry>OID of the parser's headline function</entry>
6457 <entry><structfield>prslextype</structfield></entry>
6458 <entry><type>regproc</type></entry>
6459 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6460 <entry>OID of the parser's lextype function</entry>
6468 <sect1 id="catalog-pg-ts-template">
6469 <title><structname>pg_ts_template</structname></title>
6471 <indexterm zone="catalog-pg-ts-template">
6472 <primary>pg_ts_template</primary>
6476 The <structname>pg_ts_template</structname> catalog contains entries
6477 defining text search templates. A template is the implementation
6478 skeleton for a class of text search dictionaries.
6479 Since a template must be implemented by C-language-level functions,
6480 creation of new templates is restricted to database superusers.
6484 <productname>PostgreSQL</productname>'s text search features are
6485 described at length in <xref linkend="textsearch">.
6489 <title><structname>pg_ts_template</> Columns</title>
6496 <entry>References</entry>
6497 <entry>Description</entry>
6503 <entry><structfield>oid</structfield></entry>
6504 <entry><type>oid</type></entry>
6506 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6510 <entry><structfield>tmplname</structfield></entry>
6511 <entry><type>name</type></entry>
6513 <entry>Text search template name</entry>
6517 <entry><structfield>tmplnamespace</structfield></entry>
6518 <entry><type>oid</type></entry>
6519 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6521 The OID of the namespace that contains this template
6526 <entry><structfield>tmplinit</structfield></entry>
6527 <entry><type>regproc</type></entry>
6528 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6529 <entry>OID of the template's initialization function</entry>
6533 <entry><structfield>tmpllexize</structfield></entry>
6534 <entry><type>regproc</type></entry>
6535 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6536 <entry>OID of the template's lexize function</entry>
6544 <sect1 id="catalog-pg-type">
6545 <title><structname>pg_type</structname></title>
6547 <indexterm zone="catalog-pg-type">
6548 <primary>pg_type</primary>
6552 The catalog <structname>pg_type</structname> stores information about data
6553 types. Base types and enum types (scalar types) are created with
6554 <xref linkend="sql-createtype">, and
6556 <xref linkend="sql-createdomain">.
6557 A composite type is automatically created for each table in the database, to
6558 represent the row structure of the table. It is also possible to create
6559 composite types with <command>CREATE TYPE AS</command>.
6563 <title><structname>pg_type</> Columns</title>
6570 <entry>References</entry>
6571 <entry>Description</entry>
6577 <entry><structfield>oid</structfield></entry>
6578 <entry><type>oid</type></entry>
6580 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6584 <entry><structfield>typname</structfield></entry>
6585 <entry><type>name</type></entry>
6587 <entry>Data type name</entry>
6591 <entry><structfield>typnamespace</structfield></entry>
6592 <entry><type>oid</type></entry>
6593 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6595 The OID of the namespace that contains this type
6600 <entry><structfield>typowner</structfield></entry>
6601 <entry><type>oid</type></entry>
6602 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6603 <entry>Owner of the type</entry>
6607 <entry><structfield>typlen</structfield></entry>
6608 <entry><type>int2</type></entry>
6611 For a fixed-size type, <structfield>typlen</structfield> is the number
6612 of bytes in the internal representation of the type. But for a
6613 variable-length type, <structfield>typlen</structfield> is negative.
6614 -1 indicates a <quote>varlena</> type (one that has a length word),
6615 -2 indicates a null-terminated C string.
6620 <entry><structfield>typbyval</structfield></entry>
6621 <entry><type>bool</type></entry>
6624 <structfield>typbyval</structfield> determines whether internal
6625 routines pass a value of this type by value or by reference.
6626 <structfield>typbyval</structfield> had better be false if
6627 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6628 where Datum is 8 bytes).
6629 Variable-length types are always passed by reference. Note that
6630 <structfield>typbyval</structfield> can be false even if the
6631 length would allow pass-by-value.
6636 <entry><structfield>typtype</structfield></entry>
6637 <entry><type>char</type></entry>
6640 <structfield>typtype</structfield> is
6641 <literal>b</literal> for a base type,
6642 <literal>c</literal> for a composite type (e.g., a table's row type),
6643 <literal>d</literal> for a domain,
6644 <literal>e</literal> for an enum type,
6645 <literal>p</literal> for a pseudo-type, or
6646 <literal>r</literal> for a range type.
6647 See also <structfield>typrelid</structfield> and
6648 <structfield>typbasetype</structfield>.
6653 <entry><structfield>typcategory</structfield></entry>
6654 <entry><type>char</type></entry>
6657 <structfield>typcategory</structfield> is an arbitrary classification
6658 of data types that is used by the parser to determine which implicit
6659 casts should be <quote>preferred</>.
6660 See <xref linkend="catalog-typcategory-table">.
6665 <entry><structfield>typispreferred</structfield></entry>
6666 <entry><type>bool</type></entry>
6669 True if the type is a preferred cast target within its
6670 <structfield>typcategory</structfield>
6675 <entry><structfield>typisdefined</structfield></entry>
6676 <entry><type>bool</type></entry>
6679 True if the type is defined, false if this is a placeholder
6680 entry for a not-yet-defined type. When
6681 <structfield>typisdefined</structfield> is false, nothing
6682 except the type name, namespace, and OID can be relied on.
6687 <entry><structfield>typdelim</structfield></entry>
6688 <entry><type>char</type></entry>
6691 Character that separates two values of this type when parsing
6692 array input. Note that the delimiter is associated with the array
6693 element data type, not the array data type.
6698 <entry><structfield>typrelid</structfield></entry>
6699 <entry><type>oid</type></entry>
6700 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6702 If this is a composite type (see
6703 <structfield>typtype</structfield>), then this column points to
6704 the <structname>pg_class</structname> entry that defines the
6705 corresponding table. (For a free-standing composite type, the
6706 <structname>pg_class</structname> entry doesn't really represent
6707 a table, but it is needed anyway for the type's
6708 <structname>pg_attribute</structname> entries to link to.)
6709 Zero for non-composite types.
6714 <entry><structfield>typelem</structfield></entry>
6715 <entry><type>oid</type></entry>
6716 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6718 If <structfield>typelem</structfield> is not 0 then it
6719 identifies another row in <structname>pg_type</structname>.
6720 The current type can then be subscripted like an array yielding
6721 values of type <structfield>typelem</structfield>. A
6722 <quote>true</quote> array type is variable length
6723 (<structfield>typlen</structfield> = -1),
6724 but some fixed-length (<structfield>typlen</structfield> > 0) types
6725 also have nonzero <structfield>typelem</structfield>, for example
6726 <type>name</type> and <type>point</type>.
6727 If a fixed-length type has a <structfield>typelem</structfield> then
6728 its internal representation must be some number of values of the
6729 <structfield>typelem</structfield> data type with no other data.
6730 Variable-length array types have a header defined by the array
6736 <entry><structfield>typarray</structfield></entry>
6737 <entry><type>oid</type></entry>
6738 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6740 If <structfield>typarray</structfield> is not 0 then it
6741 identifies another row in <structname>pg_type</structname>, which
6742 is the <quote>true</quote> array type having this type as element
6747 <entry><structfield>typinput</structfield></entry>
6748 <entry><type>regproc</type></entry>
6749 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6750 <entry>Input conversion function (text format)</entry>
6754 <entry><structfield>typoutput</structfield></entry>
6755 <entry><type>regproc</type></entry>
6756 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6757 <entry>Output conversion function (text format)</entry>
6761 <entry><structfield>typreceive</structfield></entry>
6762 <entry><type>regproc</type></entry>
6763 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6764 <entry>Input conversion function (binary format), or 0 if none</entry>
6768 <entry><structfield>typsend</structfield></entry>
6769 <entry><type>regproc</type></entry>
6770 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6771 <entry>Output conversion function (binary format), or 0 if none</entry>
6775 <entry><structfield>typmodin</structfield></entry>
6776 <entry><type>regproc</type></entry>
6777 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6778 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
6782 <entry><structfield>typmodout</structfield></entry>
6783 <entry><type>regproc</type></entry>
6784 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6785 <entry>Type modifier output function, or 0 to use the standard format</entry>
6789 <entry><structfield>typanalyze</structfield></entry>
6790 <entry><type>regproc</type></entry>
6791 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6792 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
6796 <entry><structfield>typalign</structfield></entry>
6797 <entry><type>char</type></entry>
6801 <structfield>typalign</structfield> is the alignment required
6802 when storing a value of this type. It applies to storage on
6803 disk as well as most representations of the value inside
6804 <productname>PostgreSQL</>.
6805 When multiple values are stored consecutively, such
6806 as in the representation of a complete row on disk, padding is
6807 inserted before a datum of this type so that it begins on the
6808 specified boundary. The alignment reference is the beginning
6809 of the first datum in the sequence.
6813 Possible values are:
6816 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
6819 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
6822 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
6825 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
6830 For types used in system tables, it is critical that the size
6831 and alignment defined in <structname>pg_type</structname>
6832 agree with the way that the compiler will lay out the column in
6833 a structure representing a table row.
6839 <entry><structfield>typstorage</structfield></entry>
6840 <entry><type>char</type></entry>
6843 <structfield>typstorage</structfield> tells for varlena
6844 types (those with <structfield>typlen</structfield> = -1) if
6845 the type is prepared for toasting and what the default strategy
6846 for attributes of this type should be.
6850 <para><literal>p</>: Value must always be stored plain.</para>
6854 <literal>e</>: Value can be stored in a <quote>secondary</quote>
6855 relation (if relation has one, see
6856 <literal>pg_class.reltoastrelid</literal>).
6860 <para><literal>m</>: Value can be stored compressed inline.</para>
6863 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
6866 Note that <literal>m</> columns can also be moved out to secondary
6867 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
6873 <entry><structfield>typnotnull</structfield></entry>
6874 <entry><type>bool</type></entry>
6877 <structfield>typnotnull</structfield> represents a not-null
6878 constraint on a type. Used for domains only.
6883 <entry><structfield>typbasetype</structfield></entry>
6884 <entry><type>oid</type></entry>
6885 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6887 If this is a domain (see <structfield>typtype</structfield>), then
6888 <structfield>typbasetype</structfield> identifies the type that this
6889 one is based on. Zero if this type is not a domain.
6894 <entry><structfield>typtypmod</structfield></entry>
6895 <entry><type>int4</type></entry>
6898 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
6899 to be applied to their base type (-1 if base type does not use a
6900 <literal>typmod</>). -1 if this type is not a domain.
6905 <entry><structfield>typndims</structfield></entry>
6906 <entry><type>int4</type></entry>
6909 <structfield>typndims</structfield> is the number of array dimensions
6910 for a domain over an array (that is, <structfield>typbasetype</> is
6912 Zero for types other than domains over array types.
6917 <entry><structfield>typcollation</structfield></entry>
6918 <entry><type>oid</type></entry>
6919 <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
6921 <structfield>typcollation</structfield> specifies the collation
6922 of the type. If the type does not support collations, this will
6923 be zero. A base type that supports collations will have
6924 <symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
6925 collatable type can have some other collation OID, if one was
6926 specified for the domain.
6931 <entry><structfield>typdefaultbin</structfield></entry>
6932 <entry><type>pg_node_tree</type></entry>
6935 If <structfield>typdefaultbin</> is not null, it is the
6936 <function>nodeToString()</function>
6937 representation of a default expression for the type. This is
6938 only used for domains.
6943 <entry><structfield>typdefault</structfield></entry>
6944 <entry><type>text</type></entry>
6947 <structfield>typdefault</> is null if the type has no associated
6948 default value. If <structfield>typdefaultbin</> is not null,
6949 <structfield>typdefault</> must contain a human-readable version of the
6950 default expression represented by <structfield>typdefaultbin</>. If
6951 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
6952 not, then <structfield>typdefault</> is the external representation of
6953 the type's default value, which can be fed to the type's input
6954 converter to produce a constant.
6959 <entry><structfield>typacl</structfield></entry>
6960 <entry><type>aclitem[]</type></entry>
6963 Access privileges; see
6964 <xref linkend="sql-grant"> and
6965 <xref linkend="sql-revoke">
6974 <xref linkend="catalog-typcategory-table"> lists the system-defined values
6975 of <structfield>typcategory</>. Any future additions to this list will
6976 also be upper-case ASCII letters. All other ASCII characters are reserved
6977 for user-defined categories.
6980 <table id="catalog-typcategory-table">
6981 <title><structfield>typcategory</> Codes</title>
6987 <entry>Category</entry>
6993 <entry><literal>A</literal></entry>
6994 <entry>Array types</entry>
6997 <entry><literal>B</literal></entry>
6998 <entry>Boolean types</entry>
7001 <entry><literal>C</literal></entry>
7002 <entry>Composite types</entry>
7005 <entry><literal>D</literal></entry>
7006 <entry>Date/time types</entry>
7009 <entry><literal>E</literal></entry>
7010 <entry>Enum types</entry>
7013 <entry><literal>G</literal></entry>
7014 <entry>Geometric types</entry>
7017 <entry><literal>I</literal></entry>
7018 <entry>Network address types</entry>
7021 <entry><literal>N</literal></entry>
7022 <entry>Numeric types</entry>
7025 <entry><literal>P</literal></entry>
7026 <entry>Pseudo-types</entry>
7029 <entry><literal>R</literal></entry>
7030 <entry>Range types</entry>
7033 <entry><literal>S</literal></entry>
7034 <entry>String types</entry>
7037 <entry><literal>T</literal></entry>
7038 <entry>Timespan types</entry>
7041 <entry><literal>U</literal></entry>
7042 <entry>User-defined types</entry>
7045 <entry><literal>V</literal></entry>
7046 <entry>Bit-string types</entry>
7049 <entry><literal>X</literal></entry>
7050 <entry><type>unknown</> type</entry>
7059 <sect1 id="catalog-pg-user-mapping">
7060 <title><structname>pg_user_mapping</structname></title>
7062 <indexterm zone="catalog-pg-user-mapping">
7063 <primary>pg_user_mapping</primary>
7067 The catalog <structname>pg_user_mapping</structname> stores
7068 the mappings from local user to remote. Access to this catalog is
7069 restricted from normal users, use the view
7070 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7075 <title><structname>pg_user_mapping</> Columns</title>
7082 <entry>References</entry>
7083 <entry>Description</entry>
7089 <entry><structfield>oid</structfield></entry>
7090 <entry><type>oid</type></entry>
7092 <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7096 <entry><structfield>umuser</structfield></entry>
7097 <entry><type>oid</type></entry>
7098 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7099 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7103 <entry><structfield>umserver</structfield></entry>
7104 <entry><type>oid</type></entry>
7105 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7107 The OID of the foreign server that contains this mapping
7112 <entry><structfield>umoptions</structfield></entry>
7113 <entry><type>text[]</type></entry>
7116 User mapping specific options, as <quote>keyword=value</> strings
7125 <sect1 id="views-overview">
7126 <title>System Views</title>
7129 In addition to the system catalogs, <productname>PostgreSQL</productname>
7130 provides a number of built-in views. Some system views provide convenient
7131 access to some commonly used queries on the system catalogs. Other views
7132 provide access to internal server state.
7136 The information schema (<xref linkend="information-schema">) provides
7137 an alternative set of views which overlap the functionality of the system
7138 views. Since the information schema is SQL-standard whereas the views
7139 described here are <productname>PostgreSQL</productname>-specific,
7140 it's usually better to use the information schema if it provides all
7141 the information you need.
7145 <xref linkend="view-table"> lists the system views described here.
7146 More detailed documentation of each view follows below.
7147 There are some additional views that provide access to the results of
7148 the statistics collector; they are described in <xref
7149 linkend="monitoring-stats-views-table">.
7153 Except where noted, all the views described here are read-only.
7156 <table id="view-table">
7157 <title>System Views</title>
7162 <entry>View Name</entry>
7163 <entry>Purpose</entry>
7169 <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7170 <entry>available extensions</entry>
7174 <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7175 <entry>available versions of extensions</entry>
7179 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7180 <entry>open cursors</entry>
7184 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7185 <entry>groups of database users</entry>
7189 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7190 <entry>indexes</entry>
7194 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7195 <entry>currently held locks</entry>
7199 <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7200 <entry>materialized views</entry>
7204 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7205 <entry>prepared statements</entry>
7209 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7210 <entry>prepared transactions</entry>
7214 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7215 <entry>database roles</entry>
7219 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7220 <entry>rules</entry>
7224 <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7225 <entry>security labels</entry>
7229 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7230 <entry>parameter settings</entry>
7234 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7235 <entry>database users</entry>
7239 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7240 <entry>planner statistics</entry>
7244 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7245 <entry>tables</entry>
7249 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7250 <entry>time zone abbreviations</entry>
7254 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7255 <entry>time zone names</entry>
7259 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7260 <entry>database users</entry>
7264 <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7265 <entry>user mappings</entry>
7269 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7270 <entry>views</entry>
7278 <sect1 id="view-pg-available-extensions">
7279 <title><structname>pg_available_extensions</structname></title>
7281 <indexterm zone="view-pg-available-extensions">
7282 <primary>pg_available_extensions</primary>
7286 The <structname>pg_available_extensions</structname> view lists the
7287 extensions that are available for installation.
7289 <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7290 catalog, which shows the extensions currently installed.
7294 <title><structname>pg_available_extensions</> Columns</title>
7301 <entry>Description</entry>
7307 <entry><structfield>name</structfield></entry>
7308 <entry><type>name</type></entry>
7309 <entry>Extension name</entry>
7313 <entry><structfield>default_version</structfield></entry>
7314 <entry><type>text</type></entry>
7315 <entry>Name of default version, or <literal>NULL</literal> if none is
7320 <entry><structfield>installed_version</structfield></entry>
7321 <entry><type>text</type></entry>
7322 <entry>Currently installed version of the extension,
7323 or <literal>NULL</literal> if not installed</entry>
7327 <entry><structfield>comment</structfield></entry>
7328 <entry><type>text</type></entry>
7329 <entry>Comment string from the extension's control file</entry>
7336 The <structname>pg_available_extensions</structname> view is read only.
7340 <sect1 id="view-pg-available-extension-versions">
7341 <title><structname>pg_available_extension_versions</structname></title>
7343 <indexterm zone="view-pg-available-extension-versions">
7344 <primary>pg_available_extension_versions</primary>
7348 The <structname>pg_available_extension_versions</structname> view lists the
7349 specific extension versions that are available for installation.
7351 linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7352 catalog, which shows the extensions currently installed.
7356 <title><structname>pg_available_extension_versions</> Columns</title>
7363 <entry>Description</entry>
7369 <entry><structfield>name</structfield></entry>
7370 <entry><type>name</type></entry>
7371 <entry>Extension name</entry>
7375 <entry><structfield>version</structfield></entry>
7376 <entry><type>text</type></entry>
7377 <entry>Version name</entry>
7381 <entry><structfield>installed</structfield></entry>
7382 <entry><type>bool</type></entry>
7383 <entry>True if this version of this extension is currently
7388 <entry><structfield>superuser</structfield></entry>
7389 <entry><type>bool</type></entry>
7390 <entry>True if only superusers are allowed to install this extension</entry>
7394 <entry><structfield>relocatable</structfield></entry>
7395 <entry><type>bool</type></entry>
7396 <entry>True if extension can be relocated to another schema</entry>
7400 <entry><structfield>schema</structfield></entry>
7401 <entry><type>name</type></entry>
7402 <entry>Name of the schema that the extension must be installed into,
7403 or <literal>NULL</literal> if partially or fully relocatable</entry>
7407 <entry><structfield>requires</structfield></entry>
7408 <entry><type>name[]</type></entry>
7409 <entry>Names of prerequisite extensions,
7410 or <literal>NULL</literal> if none</entry>
7414 <entry><structfield>comment</structfield></entry>
7415 <entry><type>text</type></entry>
7416 <entry>Comment string from the extension's control file</entry>
7423 The <structname>pg_available_extension_versions</structname> view is read
7428 <sect1 id="view-pg-cursors">
7429 <title><structname>pg_cursors</structname></title>
7431 <indexterm zone="view-pg-cursors">
7432 <primary>pg_cursors</primary>
7436 The <structname>pg_cursors</structname> view lists the cursors that
7437 are currently available. Cursors can be defined in several ways:
7441 via the <xref linkend="sql-declare">
7448 via the Bind message in the frontend/backend protocol, as
7449 described in <xref linkend="protocol-flow-ext-query">
7455 via the Server Programming Interface (SPI), as described in
7456 <xref linkend="spi-interface">
7461 The <structname>pg_cursors</structname> view displays cursors
7462 created by any of these means. Cursors only exist for the duration
7463 of the transaction that defines them, unless they have been
7464 declared <literal>WITH HOLD</literal>. Therefore non-holdable
7465 cursors are only present in the view until the end of their
7466 creating transaction.
7470 Cursors are used internally to implement some of the components
7471 of <productname>PostgreSQL</>, such as procedural languages.
7472 Therefore, the <structname>pg_cursors</> view might include cursors
7473 that have not been explicitly created by the user.
7479 <title><structname>pg_cursors</> Columns</title>
7486 <entry>Description</entry>
7492 <entry><structfield>name</structfield></entry>
7493 <entry><type>text</type></entry>
7494 <entry>The name of the cursor</entry>
7498 <entry><structfield>statement</structfield></entry>
7499 <entry><type>text</type></entry>
7500 <entry>The verbatim query string submitted to declare this cursor</entry>
7504 <entry><structfield>is_holdable</structfield></entry>
7505 <entry><type>boolean</type></entry>
7507 <literal>true</literal> if the cursor is holdable (that is, it
7508 can be accessed after the transaction that declared the cursor
7509 has committed); <literal>false</literal> otherwise
7514 <entry><structfield>is_binary</structfield></entry>
7515 <entry><type>boolean</type></entry>
7517 <literal>true</literal> if the cursor was declared
7518 <literal>BINARY</literal>; <literal>false</literal>
7524 <entry><structfield>is_scrollable</structfield></entry>
7525 <entry><type>boolean</type></entry>
7527 <literal>true</> if the cursor is scrollable (that is, it
7528 allows rows to be retrieved in a nonsequential manner);
7529 <literal>false</literal> otherwise
7534 <entry><structfield>creation_time</structfield></entry>
7535 <entry><type>timestamptz</type></entry>
7536 <entry>The time at which the cursor was declared</entry>
7543 The <structname>pg_cursors</structname> view is read only.
7548 <sect1 id="view-pg-group">
7549 <title><structname>pg_group</structname></title>
7551 <indexterm zone="view-pg-group">
7552 <primary>pg_group</primary>
7556 The view <structname>pg_group</structname> exists for backwards
7557 compatibility: it emulates a catalog that existed in
7558 <productname>PostgreSQL</productname> before version 8.1.
7559 It shows the names and members of all roles that are marked as not
7560 <structfield>rolcanlogin</>, which is an approximation to the set
7561 of roles that are being used as groups.
7565 <title><structname>pg_group</> Columns</title>
7572 <entry>References</entry>
7573 <entry>Description</entry>
7579 <entry><structfield>groname</structfield></entry>
7580 <entry><type>name</type></entry>
7581 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7582 <entry>Name of the group</entry>
7586 <entry><structfield>grosysid</structfield></entry>
7587 <entry><type>oid</type></entry>
7588 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7589 <entry>ID of this group</entry>
7593 <entry><structfield>grolist</structfield></entry>
7594 <entry><type>oid[]</type></entry>
7595 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7596 <entry>An array containing the IDs of the roles in this group</entry>
7604 <sect1 id="view-pg-indexes">
7605 <title><structname>pg_indexes</structname></title>
7607 <indexterm zone="view-pg-indexes">
7608 <primary>pg_indexes</primary>
7612 The view <structname>pg_indexes</structname> provides access to
7613 useful information about each index in the database.
7617 <title><structname>pg_indexes</> Columns</title>
7624 <entry>References</entry>
7625 <entry>Description</entry>
7630 <entry><structfield>schemaname</structfield></entry>
7631 <entry><type>name</type></entry>
7632 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7633 <entry>Name of schema containing table and index</entry>
7636 <entry><structfield>tablename</structfield></entry>
7637 <entry><type>name</type></entry>
7638 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7639 <entry>Name of table the index is for</entry>
7642 <entry><structfield>indexname</structfield></entry>
7643 <entry><type>name</type></entry>
7644 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7645 <entry>Name of index</entry>
7648 <entry><structfield>tablespace</structfield></entry>
7649 <entry><type>name</type></entry>
7650 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7651 <entry>Name of tablespace containing index (null if default for database)</entry>
7654 <entry><structfield>indexdef</structfield></entry>
7655 <entry><type>text</type></entry>
7657 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
7666 <sect1 id="view-pg-locks">
7667 <title><structname>pg_locks</structname></title>
7669 <indexterm zone="view-pg-locks">
7670 <primary>pg_locks</primary>
7674 The view <structname>pg_locks</structname> provides access to
7675 information about the locks held by open transactions within the
7676 database server. See <xref linkend="mvcc"> for more discussion
7681 <structname>pg_locks</structname> contains one row per active lockable
7682 object, requested lock mode, and relevant transaction. Thus, the same
7683 lockable object might
7684 appear many times, if multiple transactions are holding or waiting
7685 for locks on it. However, an object that currently has no locks on it
7686 will not appear at all.
7690 There are several distinct types of lockable objects:
7691 whole relations (e.g., tables), individual pages of relations,
7692 individual tuples of relations,
7693 transaction IDs (both virtual and permanent IDs),
7694 and general database objects (identified by class OID and object OID,
7695 in the same way as in <structname>pg_description</structname> or
7696 <structname>pg_depend</structname>). Also, the right to extend a
7697 relation is represented as a separate lockable object.
7698 Also, <quote>advisory</> locks can be taken on numbers that have
7699 user-defined meanings.
7703 <title><structname>pg_locks</> Columns</title>
7710 <entry>References</entry>
7711 <entry>Description</entry>
7716 <entry><structfield>locktype</structfield></entry>
7717 <entry><type>text</type></entry>
7720 Type of the lockable object:
7721 <literal>relation</>,
7725 <literal>transactionid</>,
7726 <literal>virtualxid</>,
7728 <literal>userlock</>, or
7729 <literal>advisory</>
7733 <entry><structfield>database</structfield></entry>
7734 <entry><type>oid</type></entry>
7735 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
7737 OID of the database in which the lock target exists, or
7738 zero if the target is a shared object, or
7739 null if the target is a transaction ID
7743 <entry><structfield>relation</structfield></entry>
7744 <entry><type>oid</type></entry>
7745 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7747 OID of the relation targeted by the lock, or null if the target is not
7748 a relation or part of a relation
7752 <entry><structfield>page</structfield></entry>
7753 <entry><type>integer</type></entry>
7756 Page number targeted by the lock within the relation,
7757 or null if the target is not a relation page or tuple
7761 <entry><structfield>tuple</structfield></entry>
7762 <entry><type>smallint</type></entry>
7765 Tuple number targeted by the lock within the page,
7766 or null if the target is not a tuple
7770 <entry><structfield>virtualxid</structfield></entry>
7771 <entry><type>text</type></entry>
7774 Virtual ID of the transaction targeted by the lock,
7775 or null if the target is not a virtual transaction ID
7779 <entry><structfield>transactionid</structfield></entry>
7780 <entry><type>xid</type></entry>
7783 ID of the transaction targeted by the lock,
7784 or null if the target is not a transaction ID
7788 <entry><structfield>classid</structfield></entry>
7789 <entry><type>oid</type></entry>
7790 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7792 OID of the system catalog containing the lock target, or null if the
7793 target is not a general database object
7797 <entry><structfield>objid</structfield></entry>
7798 <entry><type>oid</type></entry>
7799 <entry>any OID column</entry>
7801 OID of the lock target within its system catalog, or null if the
7802 target is not a general database object
7806 <entry><structfield>objsubid</structfield></entry>
7807 <entry><type>smallint</type></entry>
7810 Column number targeted by the lock (the
7811 <structfield>classid</> and <structfield>objid</> refer to the
7813 or zero if the target is some other general database object,
7814 or null if the target is not a general database object
7818 <entry><structfield>virtualtransaction</structfield></entry>
7819 <entry><type>text</type></entry>
7822 Virtual ID of the transaction that is holding or awaiting this lock
7826 <entry><structfield>pid</structfield></entry>
7827 <entry><type>integer</type></entry>
7830 Process ID of the server process holding or awaiting this
7831 lock, or null if the lock is held by a prepared transaction
7835 <entry><structfield>mode</structfield></entry>
7836 <entry><type>text</type></entry>
7838 <entry>Name of the lock mode held or desired by this process (see <xref
7839 linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
7842 <entry><structfield>granted</structfield></entry>
7843 <entry><type>boolean</type></entry>
7845 <entry>True if lock is held, false if lock is awaited</entry>
7848 <entry><structfield>fastpath</structfield></entry>
7849 <entry><type>boolean</type></entry>
7851 <entry>True if lock was taken via fast path, false if taken via main
7859 <structfield>granted</structfield> is true in a row representing a lock
7860 held by the indicated transaction. False indicates that this transaction is
7861 currently waiting to acquire this lock, which implies that some other
7862 transaction is holding a conflicting lock mode on the same lockable object.
7863 The waiting transaction will sleep until the other lock is released (or a
7864 deadlock situation is detected). A single transaction can be waiting to
7865 acquire at most one lock at a time.
7869 Every transaction holds an exclusive lock on its virtual transaction ID for
7870 its entire duration. If a permanent ID is assigned to the transaction
7871 (which normally happens only if the transaction changes the state of the
7872 database), it also holds an exclusive lock on its permanent transaction ID
7873 until it ends. When one transaction finds it necessary to wait specifically
7874 for another transaction, it does so by attempting to acquire share lock on
7875 the other transaction ID (either virtual or permanent ID depending on the
7876 situation). That will succeed only when the other transaction
7877 terminates and releases its locks.
7881 Although tuples are a lockable type of object,
7882 information about row-level locks is stored on disk, not in memory,
7883 and therefore row-level locks normally do not appear in this view.
7884 If a transaction is waiting for a
7885 row-level lock, it will usually appear in the view as waiting for the
7886 permanent transaction ID of the current holder of that row lock.
7890 Advisory locks can be acquired on keys consisting of either a single
7891 <type>bigint</type> value or two integer values.
7892 A <type>bigint</type> key is displayed with its
7893 high-order half in the <structfield>classid</> column, its low-order half
7894 in the <structfield>objid</> column, and <structfield>objsubid</> equal
7895 to 1. The original <type>bigint</type> value can be reassembled with the
7896 expression <literal>(classid::bigint << 32) |
7897 objid::bigint</literal>. Integer keys are displayed with the
7899 <structfield>classid</> column, the second key in the <structfield>objid</>
7900 column, and <structfield>objsubid</> equal to 2. The actual meaning of
7901 the keys is up to the user. Advisory locks are local to each database,
7902 so the <structfield>database</> column is meaningful for an advisory lock.
7906 <structname>pg_locks</structname> provides a global view of all locks
7907 in the database cluster, not only those relevant to the current database.
7908 Although its <structfield>relation</structfield> column can be joined
7909 against <structname>pg_class</>.<structfield>oid</> to identify locked
7910 relations, this will only work correctly for relations in the current
7911 database (those for which the <structfield>database</structfield> column
7912 is either the current database's OID or zero).
7916 The <structfield>pid</structfield> column can be joined to the
7917 <structfield>pid</structfield> column of the <link
7918 linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
7920 information on the session holding or waiting to hold each lock,
7923 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
7924 ON pl.pid = psa.pid;
7926 Also, if you are using prepared transactions, the
7927 <structfield>virtualtransaction</> column can be joined to the
7928 <structfield>transaction</structfield> column of the <link
7929 linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
7930 view to get more information on prepared transactions that hold locks.
7931 (A prepared transaction can never be waiting for a lock,
7932 but it continues to hold the locks it acquired while running.)
7935 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
7936 ON pl.virtualtransaction = '-1/' || ppx.transaction;
7941 The <structname>pg_locks</structname> view displays data from both the
7942 regular lock manager and the predicate lock manager, which are
7943 separate systems; in addition, the regular lock manager subdivides its
7944 locks into regular and <firstterm>fast-path</> locks.
7945 This data is not guaranteed to be entirely consistent.
7946 When the view is queried,
7947 data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
7948 is gathered from each backend one at a time, without freezing the state of
7949 the entire lock manager, so it is possible for locks to be taken or
7950 released while information is gathered. Note, however, that these locks are
7951 known not to conflict with any other lock currently in place. After
7952 all backends have been queried for fast-path locks, the remainder of the
7953 regular lock manager is locked as a unit, and a consistent snapshot of all
7954 remaining locks is collected as an atomic action. After unlocking the
7955 regular lock manager, the predicate lock manager is similarly locked and all
7956 predicate locks are collected as an atomic action. Thus, with the exception
7957 of fast-path locks, each lock manager will deliver a consistent set of
7958 results, but as we do not lock both lock managers simultaneously, it is
7959 possible for locks to be taken or released after we interrogate the regular
7960 lock manager and before we interrogate the predicate lock manager.
7964 Locking the regular and/or predicate lock manager could have some
7965 impact on database performance if this view is very frequently accessed.
7966 The locks are held only for the minimum amount of time necessary to
7967 obtain data from the lock managers, but this does not completely eliminate
7968 the possibility of a performance impact.
7973 <sect1 id="view-pg-matviews">
7974 <title><structname>pg_matviews</structname></title>
7976 <indexterm zone="view-pg-matviews">
7977 <primary>pg_matviews</primary>
7980 <indexterm zone="view-pg-matviews">
7981 <primary>materialized views</primary>
7985 The view <structname>pg_matviews</structname> provides access to
7986 useful information about each materialized view in the database.
7990 <title><structname>pg_matviews</> Columns</title>
7997 <entry>References</entry>
7998 <entry>Description</entry>
8003 <entry><structfield>schemaname</structfield></entry>
8004 <entry><type>name</type></entry>
8005 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8006 <entry>Name of schema containing materialized view</entry>
8009 <entry><structfield>matviewname</structfield></entry>
8010 <entry><type>name</type></entry>
8011 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8012 <entry>Name of materialized view</entry>
8015 <entry><structfield>matviewowner</structfield></entry>
8016 <entry><type>name</type></entry>
8017 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8018 <entry>Name of materialized view's owner</entry>
8021 <entry><structfield>tablespace</structfield></entry>
8022 <entry><type>name</type></entry>
8023 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8024 <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8027 <entry><structfield>hasindexes</structfield></entry>
8028 <entry><type>boolean</type></entry>
8030 <entry>True if materialized view has (or recently had) any indexes</entry>
8033 <entry><structfield>ispopulated</structfield></entry>
8034 <entry><type>boolean</type></entry>
8036 <entry>True if materialized view is currently populated</entry>
8039 <entry><structfield>definition</structfield></entry>
8040 <entry><type>text</type></entry>
8042 <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8050 <sect1 id="view-pg-prepared-statements">
8051 <title><structname>pg_prepared_statements</structname></title>
8053 <indexterm zone="view-pg-prepared-statements">
8054 <primary>pg_prepared_statements</primary>
8058 The <structname>pg_prepared_statements</structname> view displays
8059 all the prepared statements that are available in the current
8060 session. See <xref linkend="sql-prepare"> for more information about prepared
8065 <structname>pg_prepared_statements</structname> contains one row
8066 for each prepared statement. Rows are added to the view when a new
8067 prepared statement is created and removed when a prepared statement
8068 is released (for example, via the <xref linkend="sql-deallocate"> command).
8072 <title><structname>pg_prepared_statements</> Columns</title>
8079 <entry>Description</entry>
8084 <entry><structfield>name</structfield></entry>
8085 <entry><type>text</type></entry>
8087 The identifier of the prepared statement
8091 <entry><structfield>statement</structfield></entry>
8092 <entry><type>text</type></entry>
8094 The query string submitted by the client to create this
8095 prepared statement. For prepared statements created via SQL,
8096 this is the <command>PREPARE</command> statement submitted by
8097 the client. For prepared statements created via the
8098 frontend/backend protocol, this is the text of the prepared
8103 <entry><structfield>prepare_time</structfield></entry>
8104 <entry><type>timestamptz</type></entry>
8106 The time at which the prepared statement was created
8110 <entry><structfield>parameter_types</structfield></entry>
8111 <entry><type>regtype[]</type></entry>
8113 The expected parameter types for the prepared statement in the
8114 form of an array of <type>regtype</type>. The OID corresponding
8115 to an element of this array can be obtained by casting the
8116 <type>regtype</type> value to <type>oid</type>.
8120 <entry><structfield>from_sql</structfield></entry>
8121 <entry><type>boolean</type></entry>
8123 <literal>true</literal> if the prepared statement was created
8124 via the <command>PREPARE</command> SQL statement;
8125 <literal>false</literal> if the statement was prepared via the
8126 frontend/backend protocol
8134 The <structname>pg_prepared_statements</structname> view is read only.
8138 <sect1 id="view-pg-prepared-xacts">
8139 <title><structname>pg_prepared_xacts</structname></title>
8141 <indexterm zone="view-pg-prepared-xacts">
8142 <primary>pg_prepared_xacts</primary>
8146 The view <structname>pg_prepared_xacts</structname> displays
8147 information about transactions that are currently prepared for two-phase
8148 commit (see <xref linkend="sql-prepare-transaction"> for details).
8152 <structname>pg_prepared_xacts</structname> contains one row per prepared
8153 transaction. An entry is removed when the transaction is committed or
8158 <title><structname>pg_prepared_xacts</> Columns</title>
8165 <entry>References</entry>
8166 <entry>Description</entry>
8171 <entry><structfield>transaction</structfield></entry>
8172 <entry><type>xid</type></entry>
8175 Numeric transaction identifier of the prepared transaction
8179 <entry><structfield>gid</structfield></entry>
8180 <entry><type>text</type></entry>
8183 Global transaction identifier that was assigned to the transaction
8187 <entry><structfield>prepared</structfield></entry>
8188 <entry><type>timestamp with time zone</type></entry>
8191 Time at which the transaction was prepared for commit
8195 <entry><structfield>owner</structfield></entry>
8196 <entry><type>name</type></entry>
8197 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8199 Name of the user that executed the transaction
8203 <entry><structfield>database</structfield></entry>
8204 <entry><type>name</type></entry>
8205 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8207 Name of the database in which the transaction was executed
8215 When the <structname>pg_prepared_xacts</structname> view is accessed, the
8216 internal transaction manager data structures are momentarily locked, and
8217 a copy is made for the view to display. This ensures that the
8218 view produces a consistent set of results, while not blocking
8219 normal operations longer than necessary. Nonetheless
8220 there could be some impact on database performance if this view is
8221 frequently accessed.
8226 <sect1 id="view-pg-roles">
8227 <title><structname>pg_roles</structname></title>
8229 <indexterm zone="view-pg-roles">
8230 <primary>pg_roles</primary>
8234 The view <structname>pg_roles</structname> provides access to
8235 information about database roles. This is simply a publicly
8237 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8238 that blanks out the password field.
8242 This view explicitly exposes the OID column of the underlying table,
8243 since that is needed to do joins to other catalogs.
8247 <title><structname>pg_roles</> Columns</title>
8254 <entry>References</entry>
8255 <entry>Description</entry>
8261 <entry><structfield>rolname</structfield></entry>
8262 <entry><type>name</type></entry>
8264 <entry>Role name</entry>
8268 <entry><structfield>rolsuper</structfield></entry>
8269 <entry><type>bool</type></entry>
8271 <entry>Role has superuser privileges</entry>
8275 <entry><structfield>rolinherit</structfield></entry>
8276 <entry><type>bool</type></entry>
8278 <entry>Role automatically inherits privileges of roles it is a
8283 <entry><structfield>rolcreaterole</structfield></entry>
8284 <entry><type>bool</type></entry>
8286 <entry>Role can create more roles</entry>
8290 <entry><structfield>rolcreatedb</structfield></entry>
8291 <entry><type>bool</type></entry>
8293 <entry>Role can create databases</entry>
8297 <entry><structfield>rolcatupdate</structfield></entry>
8298 <entry><type>bool</type></entry>
8301 Role can update system catalogs directly. (Even a superuser cannot do
8302 this unless this column is true)
8307 <entry><structfield>rolcanlogin</structfield></entry>
8308 <entry><type>bool</type></entry>
8311 Role can log in. That is, this role can be given as the initial
8312 session authorization identifier
8317 <entry><structfield>rolreplication</structfield></entry>
8318 <entry><type>bool</type></entry>
8321 Role is a replication role. That is, this role can initiate streaming
8322 replication (see <xref linkend="streaming-replication">) and set/unset
8323 the system backup mode using <function>pg_start_backup</> and
8324 <function>pg_stop_backup</>
8329 <entry><structfield>rolconnlimit</structfield></entry>
8330 <entry><type>int4</type></entry>
8333 For roles that can log in, this sets maximum number of concurrent
8334 connections this role can make. -1 means no limit.
8339 <entry><structfield>rolpassword</structfield></entry>
8340 <entry><type>text</type></entry>
8342 <entry>Not the password (always reads as <literal>********</>)</entry>
8346 <entry><structfield>rolvaliduntil</structfield></entry>
8347 <entry><type>timestamptz</type></entry>
8349 <entry>Password expiry time (only used for password authentication);
8350 null if no expiration</entry>
8354 <entry><structfield>rolconfig</structfield></entry>
8355 <entry><type>text[]</type></entry>
8357 <entry>Role-specific defaults for run-time configuration variables</entry>
8361 <entry><structfield>oid</structfield></entry>
8362 <entry><type>oid</type></entry>
8363 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8364 <entry>ID of role</entry>
8372 <sect1 id="view-pg-rules">
8373 <title><structname>pg_rules</structname></title>
8375 <indexterm zone="view-pg-rules">
8376 <primary>pg_rules</primary>
8380 The view <structname>pg_rules</structname> provides access to
8381 useful information about query rewrite rules.
8385 <title><structname>pg_rules</> Columns</title>
8392 <entry>References</entry>
8393 <entry>Description</entry>
8398 <entry><structfield>schemaname</structfield></entry>
8399 <entry><type>name</type></entry>
8400 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8401 <entry>Name of schema containing table</entry>
8404 <entry><structfield>tablename</structfield></entry>
8405 <entry><type>name</type></entry>
8406 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8407 <entry>Name of table the rule is for</entry>
8410 <entry><structfield>rulename</structfield></entry>
8411 <entry><type>name</type></entry>
8412 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8413 <entry>Name of rule</entry>
8416 <entry><structfield>definition</structfield></entry>
8417 <entry><type>text</type></entry>
8419 <entry>Rule definition (a reconstructed creation command)</entry>
8426 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8427 of views and materialized views; those can be seen in
8428 <structname>pg_views</> and <structname>pg_matviews</>.
8433 <sect1 id="view-pg-seclabels">
8434 <title><structname>pg_seclabels</structname></title>
8436 <indexterm zone="view-pg-seclabels">
8437 <primary>pg_seclabels</primary>
8441 The view <structname>pg_seclabels</structname> provides information about
8442 security labels. It as an easier-to-query version of the
8443 <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
8447 <title><structname>pg_seclabels</> Columns</title>
8454 <entry>References</entry>
8455 <entry>Description</entry>
8460 <entry><structfield>objoid</structfield></entry>
8461 <entry><type>oid</type></entry>
8462 <entry>any OID column</entry>
8463 <entry>The OID of the object this security label pertains to</entry>
8466 <entry><structfield>classoid</structfield></entry>
8467 <entry><type>oid</type></entry>
8468 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8469 <entry>The OID of the system catalog this object appears in</entry>
8472 <entry><structfield>objsubid</structfield></entry>
8473 <entry><type>int4</type></entry>
8476 For a security label on a table column, this is the column number (the
8477 <structfield>objoid</> and <structfield>classoid</> refer to
8478 the table itself). For all other object types, this column is
8483 <entry><structfield>objtype</structfield></entry>
8484 <entry><type>text</type></entry>
8487 The type of object to which this label applies, as text.
8491 <entry><structfield>objnamespace</structfield></entry>
8492 <entry><type>oid</type></entry>
8493 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
8495 The OID of the namespace for this object, if applicable;
8500 <entry><structfield>objname</structfield></entry>
8501 <entry><type>text</type></entry>
8504 The name of the object to which this label applies, as text.
8508 <entry><structfield>provider</structfield></entry>
8509 <entry><type>text</type></entry>
8510 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
8511 <entry>The label provider associated with this label.</entry>
8514 <entry><structfield>label</structfield></entry>
8515 <entry><type>text</type></entry>
8516 <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
8517 <entry>The security label applied to this object.</entry>
8524 <sect1 id="view-pg-settings">
8525 <title><structname>pg_settings</structname></title>
8527 <indexterm zone="view-pg-settings">
8528 <primary>pg_settings</primary>
8532 The view <structname>pg_settings</structname> provides access to
8533 run-time parameters of the server. It is essentially an alternative
8534 interface to the <xref linkend="sql-show">
8535 and <xref linkend="sql-set"> commands.
8536 It also provides access to some facts about each parameter that are
8537 not directly available from <command>SHOW</>, such as minimum and
8542 <title><structname>pg_settings</> Columns</title>
8549 <entry>Description</entry>
8554 <entry><structfield>name</structfield></entry>
8555 <entry><type>text</type></entry>
8556 <entry>Run-time configuration parameter name</entry>
8559 <entry><structfield>setting</structfield></entry>
8560 <entry><type>text</type></entry>
8561 <entry>Current value of the parameter</entry>
8564 <entry><structfield>unit</structfield></entry>
8565 <entry><type>text</type></entry>
8566 <entry>Implicit unit of the parameter</entry>
8569 <entry><structfield>category</structfield></entry>
8570 <entry><type>text</type></entry>
8571 <entry>Logical group of the parameter</entry>
8574 <entry><structfield>short_desc</structfield></entry>
8575 <entry><type>text</type></entry>
8576 <entry>A brief description of the parameter</entry>
8579 <entry><structfield>extra_desc</structfield></entry>
8580 <entry><type>text</type></entry>
8581 <entry>Additional, more detailed, description of the parameter</entry>
8584 <entry><structfield>context</structfield></entry>
8585 <entry><type>text</type></entry>
8586 <entry>Context required to set the parameter's value (see below)</entry>
8589 <entry><structfield>vartype</structfield></entry>
8590 <entry><type>text</type></entry>
8591 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
8592 <literal>integer</>, <literal>real</>, or <literal>string</>)
8596 <entry><structfield>source</structfield></entry>
8597 <entry><type>text</type></entry>
8598 <entry>Source of the current parameter value</entry>
8601 <entry><structfield>min_val</structfield></entry>
8602 <entry><type>text</type></entry>
8603 <entry>Minimum allowed value of the parameter (null for non-numeric
8607 <entry><structfield>max_val</structfield></entry>
8608 <entry><type>text</type></entry>
8609 <entry>Maximum allowed value of the parameter (null for non-numeric
8613 <entry><structfield>enumvals</structfield></entry>
8614 <entry><type>text[]</type></entry>
8615 <entry>Allowed values of an enum parameter (null for non-enum
8619 <entry><structfield>boot_val</structfield></entry>
8620 <entry><type>text</type></entry>
8621 <entry>Parameter value assumed at server startup if the parameter is
8622 not otherwise set</entry>
8625 <entry><structfield>reset_val</structfield></entry>
8626 <entry><type>text</type></entry>
8627 <entry>Value that <command>RESET</command> would reset the parameter to
8628 in the current session</entry>
8631 <entry><structfield>sourcefile</structfield></entry>
8632 <entry><type>text</type></entry>
8633 <entry>Configuration file the current value was set in (null for
8634 values set from sources other than configuration files, or when
8635 examined by a non-superuser);
8636 helpful when using <literal>include</> directives in configuration files</entry>
8639 <entry><structfield>sourceline</structfield></entry>
8640 <entry><type>integer</type></entry>
8641 <entry>Line number within the configuration file the current value was
8642 set at (null for values set from sources other than configuration files,
8643 or when examined by a non-superuser)
8651 There are several possible values of <structfield>context</structfield>.
8652 In order of decreasing difficulty of changing the setting, they are:
8657 <term><literal>internal</literal></term>
8660 These settings cannot be changed directly; they reflect internally
8661 determined values. Some of them may be adjustable by rebuilding the
8662 server with different configuration options, or by changing options
8663 supplied to <command>initdb</command>.
8668 <term><literal>postmaster</literal></term>
8671 These settings can only be applied when the server starts, so any change
8672 requires restarting the server. Values for these settings are typically
8673 stored in the <filename>postgresql.conf</filename> file, or passed on
8674 the command line when starting the server. Of course, settings with any
8675 of the lower <structfield>context</structfield> types can also be
8676 set at server start time.
8681 <term><literal>sighup</literal></term>
8684 Changes to these settings can be made in
8685 <filename>postgresql.conf</filename> without restarting the server.
8686 Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
8687 cause it to re-read <filename>postgresql.conf</filename> and apply
8688 the changes. The postmaster will also forward the
8689 <systemitem>SIGHUP</systemitem> signal to its child processes so that
8690 they all pick up the new value.
8695 <term><literal>backend</literal></term>
8698 Changes to these settings can be made in
8699 <filename>postgresql.conf</filename> without restarting the server;
8700 they can also be set for a particular session in the connection request
8701 packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
8702 environment variable). However, these settings never change in a
8703 session after it is started. If you change them in
8704 <filename>postgresql.conf</filename>, send a
8705 <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
8706 re-read <filename>postgresql.conf</filename>. The new values will only
8707 affect subsequently-launched sessions.
8712 <term><literal>superuser</literal></term>
8715 These settings can be set from <filename>postgresql.conf</filename>,
8716 or within a session via the <command>SET</> command; but only superusers
8717 can change them via <command>SET</>. Changes in
8718 <filename>postgresql.conf</filename> will affect existing sessions
8719 only if no session-local value has been established with <command>SET</>.
8724 <term><literal>user</literal></term>
8727 These settings can be set from <filename>postgresql.conf</filename>,
8728 or within a session via the <command>SET</> command. Any user is
8729 allowed to change his session-local value. Changes in
8730 <filename>postgresql.conf</filename> will affect existing sessions
8731 only if no session-local value has been established with <command>SET</>.
8738 See <xref linkend="config-setting"> for more information about the various
8739 ways to change these parameters.
8743 The <structname>pg_settings</structname> view cannot be inserted into or
8744 deleted from, but it can be updated. An <command>UPDATE</command> applied
8745 to a row of <structname>pg_settings</structname> is equivalent to executing
8746 the <xref linkend="sql-set"> command on that named
8747 parameter. The change only affects the value used by the current
8748 session. If an <command>UPDATE</command> is issued within a transaction
8749 that is later aborted, the effects of the <command>UPDATE</command> command
8750 disappear when the transaction is rolled back. Once the surrounding
8751 transaction is committed, the effects will persist until the end of the
8752 session, unless overridden by another <command>UPDATE</command> or
8753 <command>SET</command>.
8758 <sect1 id="view-pg-shadow">
8759 <title><structname>pg_shadow</structname></title>
8761 <indexterm zone="view-pg-shadow">
8762 <primary>pg_shadow</primary>
8766 The view <structname>pg_shadow</structname> exists for backwards
8767 compatibility: it emulates a catalog that existed in
8768 <productname>PostgreSQL</productname> before version 8.1.
8769 It shows properties of all roles that are marked as
8770 <structfield>rolcanlogin</> in
8771 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
8775 The name stems from the fact that this table
8776 should not be readable by the public since it contains passwords.
8777 <link linkend="view-pg-user"><structname>pg_user</structname></link>
8778 is a publicly readable view on
8779 <structname>pg_shadow</structname> that blanks out the password field.
8783 <title><structname>pg_shadow</> Columns</title>
8790 <entry>References</entry>
8791 <entry>Description</entry>
8797 <entry><structfield>usename</structfield></entry>
8798 <entry><type>name</type></entry>
8799 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8800 <entry>User name</entry>
8804 <entry><structfield>usesysid</structfield></entry>
8805 <entry><type>oid</type></entry>
8806 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8807 <entry>ID of this user</entry>
8811 <entry><structfield>usecreatedb</structfield></entry>
8812 <entry><type>bool</type></entry>
8814 <entry>User can create databases</entry>
8818 <entry><structfield>usesuper</structfield></entry>
8819 <entry><type>bool</type></entry>
8821 <entry>User is a superuser</entry>
8825 <entry><structfield>usecatupd</structfield></entry>
8826 <entry><type>bool</type></entry>
8829 User can update system catalogs. (Even a superuser cannot do
8830 this unless this column is true.)
8835 <entry><structfield>userepl</structfield></entry>
8836 <entry><type>bool</type></entry>
8839 User can initiate streaming replication and put the system in and
8845 <entry><structfield>passwd</structfield></entry>
8846 <entry><type>text</type></entry>
8848 <entry>Password (possibly encrypted); null if none. See
8849 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8850 for details of how encrypted passwords are stored.</entry>
8854 <entry><structfield>valuntil</structfield></entry>
8855 <entry><type>abstime</type></entry>
8857 <entry>Password expiry time (only used for password authentication)</entry>
8861 <entry><structfield>useconfig</structfield></entry>
8862 <entry><type>text[]</type></entry>
8864 <entry>Session defaults for run-time configuration variables</entry>
8872 <sect1 id="view-pg-stats">
8873 <title><structname>pg_stats</structname></title>
8875 <indexterm zone="view-pg-stats">
8876 <primary>pg_stats</primary>
8880 The view <structname>pg_stats</structname> provides access to
8881 the information stored in the <link
8882 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
8883 catalog. This view allows access only to rows of
8884 <structname>pg_statistic</structname> that correspond to tables the
8885 user has permission to read, and therefore it is safe to allow public
8886 read access to this view.
8890 <structname>pg_stats</structname> is also designed to present the
8891 information in a more readable format than the underlying catalog
8892 — at the cost that its schema must be extended whenever new slot types
8893 are defined for <structname>pg_statistic</structname>.
8897 <title><structname>pg_stats</> Columns</title>
8904 <entry>References</entry>
8905 <entry>Description</entry>
8910 <entry><structfield>schemaname</structfield></entry>
8911 <entry><type>name</type></entry>
8912 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8913 <entry>Name of schema containing table</entry>
8917 <entry><structfield>tablename</structfield></entry>
8918 <entry><type>name</type></entry>
8919 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8920 <entry>Name of table</entry>
8924 <entry><structfield>attname</structfield></entry>
8925 <entry><type>name</type></entry>
8926 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
8927 <entry>Name of the column described by this row</entry>
8931 <entry><structfield>inherited</structfield></entry>
8932 <entry><type>bool</type></entry>
8934 <entry>If true, this row includes inheritance child columns, not just the
8935 values in the specified table</entry>
8939 <entry><structfield>null_frac</structfield></entry>
8940 <entry><type>real</type></entry>
8942 <entry>Fraction of column entries that are null</entry>
8946 <entry><structfield>avg_width</structfield></entry>
8947 <entry><type>integer</type></entry>
8949 <entry>Average width in bytes of column's entries</entry>
8953 <entry><structfield>n_distinct</structfield></entry>
8954 <entry><type>real</type></entry>
8957 If greater than zero, the estimated number of distinct values in the
8958 column. If less than zero, the negative of the number of distinct
8959 values divided by the number of rows. (The negated form is used when
8960 <command>ANALYZE</> believes that the number of distinct values is
8961 likely to increase as the table grows; the positive form is used when
8962 the column seems to have a fixed number of possible values.) For
8963 example, -1 indicates a unique column in which the number of distinct
8964 values is the same as the number of rows.
8969 <entry><structfield>most_common_vals</structfield></entry>
8970 <entry><type>anyarray</type></entry>
8973 A list of the most common values in the column. (Null if
8974 no values seem to be more common than any others.)
8979 <entry><structfield>most_common_freqs</structfield></entry>
8980 <entry><type>real[]</type></entry>
8983 A list of the frequencies of the most common values,
8984 i.e., number of occurrences of each divided by total number of rows.
8985 (Null when <structfield>most_common_vals</structfield> is.)
8990 <entry><structfield>histogram_bounds</structfield></entry>
8991 <entry><type>anyarray</type></entry>
8994 A list of values that divide the column's values into groups of
8995 approximately equal population. The values in
8996 <structfield>most_common_vals</>, if present, are omitted from this
8997 histogram calculation. (This column is null if the column data type
8998 does not have a <literal><</> operator or if the
8999 <structfield>most_common_vals</> list accounts for the entire
9005 <entry><structfield>correlation</structfield></entry>
9006 <entry><type>real</type></entry>
9009 Statistical correlation between physical row ordering and
9010 logical ordering of the column values. This ranges from -1 to +1.
9011 When the value is near -1 or +1, an index scan on the column will
9012 be estimated to be cheaper than when it is near zero, due to reduction
9013 of random access to the disk. (This column is null if the column data
9014 type does not have a <literal><</> operator.)
9019 <entry><structfield>most_common_elems</structfield></entry>
9020 <entry><type>anyarray</type></entry>
9023 A list of non-null element values most often appearing within values of
9024 the column. (Null for scalar types.)
9029 <entry><structfield>most_common_elem_freqs</structfield></entry>
9030 <entry><type>real[]</type></entry>
9033 A list of the frequencies of the most common element values, i.e., the
9034 fraction of rows containing at least one instance of the given value.
9035 Two or three additional values follow the per-element frequencies;
9036 these are the minimum and maximum of the preceding per-element
9037 frequencies, and optionally the frequency of null elements.
9038 (Null when <structfield>most_common_elems</structfield> is.)
9043 <entry><structfield>elem_count_histogram</structfield></entry>
9044 <entry><type>real[]</type></entry>
9047 A histogram of the counts of distinct non-null element values within the
9048 values of the column, followed by the average number of distinct
9049 non-null elements. (Null for scalar types.)
9057 The maximum number of entries in the array fields can be controlled on a
9058 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9059 command, or globally by setting the
9060 <xref linkend="guc-default-statistics-target"> run-time parameter.
9065 <sect1 id="view-pg-tables">
9066 <title><structname>pg_tables</structname></title>
9068 <indexterm zone="view-pg-tables">
9069 <primary>pg_tables</primary>
9073 The view <structname>pg_tables</structname> provides access to
9074 useful information about each table in the database.
9078 <title><structname>pg_tables</> Columns</title>
9085 <entry>References</entry>
9086 <entry>Description</entry>
9091 <entry><structfield>schemaname</structfield></entry>
9092 <entry><type>name</type></entry>
9093 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9094 <entry>Name of schema containing table</entry>
9097 <entry><structfield>tablename</structfield></entry>
9098 <entry><type>name</type></entry>
9099 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9100 <entry>Name of table</entry>
9103 <entry><structfield>tableowner</structfield></entry>
9104 <entry><type>name</type></entry>
9105 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9106 <entry>Name of table's owner</entry>
9109 <entry><structfield>tablespace</structfield></entry>
9110 <entry><type>name</type></entry>
9111 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9112 <entry>Name of tablespace containing table (null if default for database)</entry>
9115 <entry><structfield>hasindexes</structfield></entry>
9116 <entry><type>boolean</type></entry>
9117 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9118 <entry>True if table has (or recently had) any indexes</entry>
9121 <entry><structfield>hasrules</structfield></entry>
9122 <entry><type>boolean</type></entry>
9123 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9124 <entry>True if table has (or once had) rules</entry>
9127 <entry><structfield>hastriggers</structfield></entry>
9128 <entry><type>boolean</type></entry>
9129 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9130 <entry>True if table has (or once had) triggers</entry>
9138 <sect1 id="view-pg-timezone-abbrevs">
9139 <title><structname>pg_timezone_abbrevs</structname></title>
9141 <indexterm zone="view-pg-timezone-abbrevs">
9142 <primary>pg_timezone_abbrevs</primary>
9146 The view <structname>pg_timezone_abbrevs</structname> provides a list
9147 of time zone abbreviations that are currently recognized by the datetime
9148 input routines. The contents of this view change when the
9149 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9153 <title><structname>pg_timezone_abbrevs</> Columns</title>
9160 <entry>Description</entry>
9165 <entry><structfield>abbrev</structfield></entry>
9166 <entry><type>text</type></entry>
9167 <entry>Time zone abbreviation</entry>
9170 <entry><structfield>utc_offset</structfield></entry>
9171 <entry><type>interval</type></entry>
9172 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9175 <entry><structfield>is_dst</structfield></entry>
9176 <entry><type>boolean</type></entry>
9177 <entry>True if this is a daylight-savings abbreviation</entry>
9185 <sect1 id="view-pg-timezone-names">
9186 <title><structname>pg_timezone_names</structname></title>
9188 <indexterm zone="view-pg-timezone-names">
9189 <primary>pg_timezone_names</primary>
9193 The view <structname>pg_timezone_names</structname> provides a list
9194 of time zone names that are recognized by <command>SET TIMEZONE</>,
9195 along with their associated abbreviations, UTC offsets,
9196 and daylight-savings status. (Technically,
9197 <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9198 than UTC because leap seconds are not handled.)
9199 Unlike the abbreviations shown in <link
9200 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9201 date rules. Therefore, the associated information changes across local DST
9202 boundaries. The displayed information is computed based on the current
9203 value of <function>CURRENT_TIMESTAMP</>.
9207 <title><structname>pg_timezone_names</> Columns</title>
9214 <entry>Description</entry>
9219 <entry><structfield>name</structfield></entry>
9220 <entry><type>text</type></entry>
9221 <entry>Time zone name</entry>
9224 <entry><structfield>abbrev</structfield></entry>
9225 <entry><type>text</type></entry>
9226 <entry>Time zone abbreviation</entry>
9229 <entry><structfield>utc_offset</structfield></entry>
9230 <entry><type>interval</type></entry>
9231 <entry>Offset from UTC (positive means east of Greenwich)</entry>
9234 <entry><structfield>is_dst</structfield></entry>
9235 <entry><type>boolean</type></entry>
9236 <entry>True if currently observing daylight savings</entry>
9244 <sect1 id="view-pg-user">
9245 <title><structname>pg_user</structname></title>
9247 <indexterm zone="view-pg-user">
9248 <primary>pg_user</primary>
9252 The view <structname>pg_user</structname> provides access to
9253 information about database users. This is simply a publicly
9255 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9256 that blanks out the password field.
9260 <title><structname>pg_user</> Columns</title>
9267 <entry>Description</entry>
9272 <entry><structfield>usename</structfield></entry>
9273 <entry><type>name</type></entry>
9274 <entry>User name</entry>
9278 <entry><structfield>usesysid</structfield></entry>
9279 <entry><type>oid</type></entry>
9280 <entry>ID of this user</entry>
9284 <entry><structfield>usecreatedb</structfield></entry>
9285 <entry><type>bool</type></entry>
9286 <entry>User can create databases</entry>
9290 <entry><structfield>usesuper</structfield></entry>
9291 <entry><type>bool</type></entry>
9292 <entry>User is a superuser</entry>
9296 <entry><structfield>usecatupd</structfield></entry>
9297 <entry><type>bool</type></entry>
9299 User can update system catalogs. (Even a superuser cannot do
9300 this unless this column is true.)
9305 <entry><structfield>userepl</structfield></entry>
9306 <entry><type>bool</type></entry>
9308 User can initiate streaming replication and put the system in and
9314 <entry><structfield>passwd</structfield></entry>
9315 <entry><type>text</type></entry>
9316 <entry>Not the password (always reads as <literal>********</>)</entry>
9320 <entry><structfield>valuntil</structfield></entry>
9321 <entry><type>abstime</type></entry>
9322 <entry>Password expiry time (only used for password authentication)</entry>
9326 <entry><structfield>useconfig</structfield></entry>
9327 <entry><type>text[]</type></entry>
9328 <entry>Session defaults for run-time configuration variables</entry>
9336 <sect1 id="view-pg-user-mappings">
9337 <title><structname>pg_user_mappings</structname></title>
9339 <indexterm zone="view-pg-user-mappings">
9340 <primary>pg_user_mappings</primary>
9344 The view <structname>pg_user_mappings</structname> provides access
9345 to information about user mappings. This is essentially a publicly
9347 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9348 that leaves out the options field if the user has no rights to use
9353 <title><structname>pg_user_mappings</> Columns</title>
9360 <entry>References</entry>
9361 <entry>Description</entry>
9367 <entry><structfield>umid</structfield></entry>
9368 <entry><type>oid</type></entry>
9369 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
9370 <entry>OID of the user mapping</entry>
9374 <entry><structfield>srvid</structfield></entry>
9375 <entry><type>oid</type></entry>
9376 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
9378 The OID of the foreign server that contains this mapping
9383 <entry><structfield>srvname</structfield></entry>
9384 <entry><type>name</type></entry>
9385 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
9387 Name of the foreign server
9392 <entry><structfield>umuser</structfield></entry>
9393 <entry><type>oid</type></entry>
9394 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9395 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
9399 <entry><structfield>usename</structfield></entry>
9400 <entry><type>name</type></entry>
9402 <entry>Name of the local user to be mapped</entry>
9406 <entry><structfield>umoptions</structfield></entry>
9407 <entry><type>text[]</type></entry>
9410 User mapping specific options, as <quote>keyword=value</>
9411 strings, if the current user is the owner of the foreign
9421 <sect1 id="view-pg-views">
9422 <title><structname>pg_views</structname></title>
9424 <indexterm zone="view-pg-views">
9425 <primary>pg_views</primary>
9429 The view <structname>pg_views</structname> provides access to
9430 useful information about each view in the database.
9434 <title><structname>pg_views</> Columns</title>
9441 <entry>References</entry>
9442 <entry>Description</entry>
9447 <entry><structfield>schemaname</structfield></entry>
9448 <entry><type>name</type></entry>
9449 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9450 <entry>Name of schema containing view</entry>
9453 <entry><structfield>viewname</structfield></entry>
9454 <entry><type>name</type></entry>
9455 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9456 <entry>Name of view</entry>
9459 <entry><structfield>viewowner</structfield></entry>
9460 <entry><type>name</type></entry>
9461 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9462 <entry>Name of view's owner</entry>
9465 <entry><structfield>definition</structfield></entry>
9466 <entry><type>text</type></entry>
9468 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>