1 <!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.194 2009/02/04 21:30:41 alvherre Exp $ -->
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-autovacuum"><structname>pg_autovacuum</structname></link></entry>
93 <entry>per-relation autovacuum configuration parameters</entry>
97 <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
98 <entry>casts (data type conversions)</entry>
102 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
103 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</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-depend"><structname>pg_depend</structname></link></entry>
123 <entry>dependencies between database objects</entry>
127 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
128 <entry>descriptions or comments on database objects</entry>
132 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
133 <entry>enum label and value definitions</entry>
137 <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
138 <entry>foreign-data wrapper definitions</entry>
142 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
143 <entry>foreign server definitions</entry>
147 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
148 <entry>additional index information</entry>
152 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
153 <entry>table inheritance hierarchy</entry>
157 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
158 <entry>languages for writing functions</entry>
162 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
163 <entry>large objects</entry>
167 <entry><link linkend="catalog-pg-listener"><structname>pg_listener</structname></link></entry>
168 <entry>asynchronous notification support</entry>
172 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
173 <entry>schemas</entry>
177 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
178 <entry>access method operator classes</entry>
182 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
183 <entry>operators</entry>
187 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
188 <entry>access method operator families</entry>
192 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
193 <entry>template data for procedural languages</entry>
197 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
198 <entry>functions and procedures</entry>
202 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
203 <entry>query rewrite rules</entry>
207 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
208 <entry>dependencies on shared objects</entry>
212 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
213 <entry>comments on shared objects</entry>
217 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
218 <entry>planner statistics</entry>
222 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
223 <entry>tablespaces within this database cluster</entry>
227 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
228 <entry>triggers</entry>
232 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
233 <entry>text search configurations</entry>
237 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
238 <entry>text search configurations' token mappings</entry>
242 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
243 <entry>text search dictionaries</entry>
247 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
248 <entry>text search parsers</entry>
252 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
253 <entry>text search templates</entry>
257 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
258 <entry>data types</entry>
262 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
263 <entry>mappings of users to foreign servers</entry>
271 <sect1 id="catalog-pg-aggregate">
272 <title><structname>pg_aggregate</structname></title>
274 <indexterm zone="catalog-pg-aggregate">
275 <primary>pg_aggregate</primary>
279 The catalog <structname>pg_aggregate</structname> stores information about
280 aggregate functions. An aggregate function is a function that
281 operates on a set of values (typically one column from each row
282 that matches a query condition) and returns a single value computed
283 from all these values. Typical aggregate functions are
284 <function>sum</function>, <function>count</function>, and
285 <function>max</function>. Each entry in
286 <structname>pg_aggregate</structname> is an extension of an entry
287 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
288 entry carries the aggregate's name, input and output data types, and
289 other information that is similar to ordinary functions.
293 <title><structname>pg_aggregate</> Columns</title>
300 <entry>References</entry>
301 <entry>Description</entry>
306 <entry><structfield>aggfnoid</structfield></entry>
307 <entry><type>regproc</type></entry>
308 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
309 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
312 <entry><structfield>aggtransfn</structfield></entry>
313 <entry><type>regproc</type></entry>
314 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
315 <entry>Transition function</entry>
318 <entry><structfield>aggfinalfn</structfield></entry>
319 <entry><type>regproc</type></entry>
320 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
321 <entry>Final function (zero if none)</entry>
324 <entry><structfield>aggsortop</structfield></entry>
325 <entry><type>oid</type></entry>
326 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
327 <entry>Associated sort operator (zero if none)</entry>
330 <entry><structfield>aggtranstype</structfield></entry>
331 <entry><type>oid</type></entry>
332 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
333 <entry>Data type of the aggregate function's internal transition (state) data</entry>
336 <entry><structfield>agginitval</structfield></entry>
337 <entry><type>text</type></entry>
340 The initial value of the transition state. This is a text
341 field containing the initial value in its external string
342 representation. If this field is NULL, the transition state
343 value starts out NULL
351 New aggregate functions are registered with the <xref
352 linkend="sql-createaggregate" endterm="sql-createaggregate-title">
353 command. See <xref linkend="xaggr"> for more information about
354 writing aggregate functions and the meaning of the transition
361 <sect1 id="catalog-pg-am">
362 <title><structname>pg_am</structname></title>
364 <indexterm zone="catalog-pg-am">
365 <primary>pg_am</primary>
369 The catalog <structname>pg_am</structname> stores information about index
370 access methods. There is one row for each index access method supported by
371 the system. The contents of this catalog are discussed in detail in
372 <xref linkend="indexam">.
376 <title><structname>pg_am</> Columns</title>
383 <entry>References</entry>
384 <entry>Description</entry>
390 <entry><structfield>amname</structfield></entry>
391 <entry><type>name</type></entry>
393 <entry>Name of the access method</entry>
397 <entry><structfield>amstrategies</structfield></entry>
398 <entry><type>int2</type></entry>
400 <entry>Number of operator strategies for this access method,
401 or zero if access method does not have a fixed set of operator
406 <entry><structfield>amsupport</structfield></entry>
407 <entry><type>int2</type></entry>
409 <entry>Number of support routines for this access method</entry>
413 <entry><structfield>amcanorder</structfield></entry>
414 <entry><type>bool</type></entry>
416 <entry>Does the access method support ordered scans?</entry>
420 <entry><structfield>amcanbackward</structfield></entry>
421 <entry><type>bool</type></entry>
423 <entry>Does the access method support backward scanning?</entry>
427 <entry><structfield>amcanunique</structfield></entry>
428 <entry><type>bool</type></entry>
430 <entry>Does the access method support unique indexes?</entry>
434 <entry><structfield>amcanmulticol</structfield></entry>
435 <entry><type>bool</type></entry>
437 <entry>Does the access method support multicolumn indexes?</entry>
441 <entry><structfield>amoptionalkey</structfield></entry>
442 <entry><type>bool</type></entry>
444 <entry>Does the access method support a scan without any constraint
445 for the first index column?</entry>
449 <entry><structfield>amindexnulls</structfield></entry>
450 <entry><type>bool</type></entry>
452 <entry>Does the access method support null index entries?</entry>
456 <entry><structfield>amsearchnulls</structfield></entry>
457 <entry><type>bool</type></entry>
459 <entry>Does the access method support IS NULL searches?</entry>
463 <entry><structfield>amstorage</structfield></entry>
464 <entry><type>bool</type></entry>
466 <entry>Can index storage data type differ from column data type?</entry>
470 <entry><structfield>amclusterable</structfield></entry>
471 <entry><type>bool</type></entry>
473 <entry>Can an index of this type be clustered on?</entry>
477 <entry><structfield>amkeytype</structfield></entry>
478 <entry><type>oid</type></entry>
479 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
480 <entry>Type of data stored in index, or zero if not a fixed type</entry>
484 <entry><structfield>aminsert</structfield></entry>
485 <entry><type>regproc</type></entry>
486 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
487 <entry><quote>Insert this tuple</quote> function</entry>
491 <entry><structfield>ambeginscan</structfield></entry>
492 <entry><type>regproc</type></entry>
493 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
494 <entry><quote>Start new scan</quote> function</entry>
498 <entry><structfield>amgettuple</structfield></entry>
499 <entry><type>regproc</type></entry>
500 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
501 <entry><quote>Next valid tuple</quote> function</entry>
505 <entry><structfield>amgetbitmap</structfield></entry>
506 <entry><type>regproc</type></entry>
507 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
508 <entry><quote>Fetch all valid tuples</quote> function</entry>
512 <entry><structfield>amrescan</structfield></entry>
513 <entry><type>regproc</type></entry>
514 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
515 <entry><quote>Restart this scan</quote> function</entry>
519 <entry><structfield>amendscan</structfield></entry>
520 <entry><type>regproc</type></entry>
521 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
522 <entry><quote>End this scan</quote> function</entry>
526 <entry><structfield>ammarkpos</structfield></entry>
527 <entry><type>regproc</type></entry>
528 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
529 <entry><quote>Mark current scan position</quote> function</entry>
533 <entry><structfield>amrestrpos</structfield></entry>
534 <entry><type>regproc</type></entry>
535 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
536 <entry><quote>Restore marked scan position</quote> function</entry>
540 <entry><structfield>ambuild</structfield></entry>
541 <entry><type>regproc</type></entry>
542 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
543 <entry><quote>Build new index</quote> function</entry>
547 <entry><structfield>ambulkdelete</structfield></entry>
548 <entry><type>regproc</type></entry>
549 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
550 <entry>Bulk-delete function</entry>
554 <entry><structfield>amvacuumcleanup</structfield></entry>
555 <entry><type>regproc</type></entry>
556 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
557 <entry>Post-<command>VACUUM</command> cleanup function</entry>
561 <entry><structfield>amcostestimate</structfield></entry>
562 <entry><type>regproc</type></entry>
563 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
564 <entry>Function to estimate cost of an index scan</entry>
568 <entry><structfield>amoptions</structfield></entry>
569 <entry><type>regproc</type></entry>
570 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
571 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
581 <sect1 id="catalog-pg-amop">
582 <title><structname>pg_amop</structname></title>
584 <indexterm zone="catalog-pg-amop">
585 <primary>pg_amop</primary>
589 The catalog <structname>pg_amop</structname> stores information about
590 operators associated with access method operator families. There is one
591 row for each operator that is a member of an operator family. An operator
592 can appear in more than one family, but cannot appear in more than one
593 position within a family.
597 <title><structname>pg_amop</> Columns</title>
604 <entry>References</entry>
605 <entry>Description</entry>
611 <entry><structfield>amopfamily</structfield></entry>
612 <entry><type>oid</type></entry>
613 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
614 <entry>The operator family this entry is for</entry>
618 <entry><structfield>amoplefttype</structfield></entry>
619 <entry><type>oid</type></entry>
620 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
621 <entry>Left-hand input data type of operator</entry>
625 <entry><structfield>amoprighttype</structfield></entry>
626 <entry><type>oid</type></entry>
627 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
628 <entry>Right-hand input data type of operator</entry>
632 <entry><structfield>amopstrategy</structfield></entry>
633 <entry><type>int2</type></entry>
635 <entry>Operator strategy number</entry>
639 <entry><structfield>amopopr</structfield></entry>
640 <entry><type>oid</type></entry>
641 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
642 <entry>OID of the operator</entry>
646 <entry><structfield>amopmethod</structfield></entry>
647 <entry><type>oid</type></entry>
648 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
649 <entry>Index access method operator family is for</entry>
657 An entry's <structfield>amopmethod</> must match the
658 <structname>opfmethod</> of its containing operator family (including
659 <structfield>amopmethod</> here is an intentional denormalization of the
660 catalog structure for performance reasons). Also,
661 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
662 the <structfield>oprleft</> and <structfield>oprright</> fields of the
663 referenced <structname>pg_operator</> entry.
669 <sect1 id="catalog-pg-amproc">
670 <title><structname>pg_amproc</structname></title>
672 <indexterm zone="catalog-pg-amproc">
673 <primary>pg_amproc</primary>
677 The catalog <structname>pg_amproc</structname> stores information about
678 support procedures associated with access method operator families. There
679 is one row for each support procedure belonging to an operator family.
683 <title><structname>pg_amproc</structname> Columns</title>
690 <entry>References</entry>
691 <entry>Description</entry>
697 <entry><structfield>amprocfamily</structfield></entry>
698 <entry><type>oid</type></entry>
699 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
700 <entry>The operator family this entry is for</entry>
704 <entry><structfield>amproclefttype</structfield></entry>
705 <entry><type>oid</type></entry>
706 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
707 <entry>Left-hand input data type of associated operator</entry>
711 <entry><structfield>amprocrighttype</structfield></entry>
712 <entry><type>oid</type></entry>
713 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
714 <entry>Right-hand input data type of associated operator</entry>
718 <entry><structfield>amprocnum</structfield></entry>
719 <entry><type>int2</type></entry>
721 <entry>Support procedure number</entry>
725 <entry><structfield>amproc</structfield></entry>
726 <entry><type>regproc</type></entry>
727 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
728 <entry>OID of the procedure</entry>
736 The usual interpretation of the
737 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
738 is that they identify the left and right input types of the operator(s)
739 that a particular support procedure supports. For some access methods
740 these match the input data type(s) of the support procedure itself, for
741 others not. There is a notion of <quote>default</> support procedures for
742 an index, which are those with <structfield>amproclefttype</> and
743 <structfield>amprocrighttype</> both equal to the index opclass's
744 <structfield>opcintype</>.
750 <sect1 id="catalog-pg-attrdef">
751 <title><structname>pg_attrdef</structname></title>
753 <indexterm zone="catalog-pg-attrdef">
754 <primary>pg_attrdef</primary>
758 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
759 about columns is stored in <structname>pg_attribute</structname>
760 (see below). Only columns that explicitly specify a default value
761 (when the table is created or the column is added) will have an
766 <title><structname>pg_attrdef</> Columns</title>
773 <entry>References</entry>
774 <entry>Description</entry>
780 <entry><structfield>adrelid</structfield></entry>
781 <entry><type>oid</type></entry>
782 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
783 <entry>The table this column belongs to</entry>
787 <entry><structfield>adnum</structfield></entry>
788 <entry><type>int2</type></entry>
789 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
790 <entry>The number of the column</entry>
794 <entry><structfield>adbin</structfield></entry>
795 <entry><type>text</type></entry>
797 <entry>The internal representation of the column default value</entry>
801 <entry><structfield>adsrc</structfield></entry>
802 <entry><type>text</type></entry>
804 <entry>A human-readable representation of the default value</entry>
811 The <structfield>adsrc</structfield> field is historical, and is best
812 not used, because it does not track outside changes that might affect
813 the representation of the default value. Reverse-compiling the
814 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
815 example) is a better way to display the default value.
821 <sect1 id="catalog-pg-attribute">
822 <title><structname>pg_attribute</structname></title>
824 <indexterm zone="catalog-pg-attribute">
825 <primary>pg_attribute</primary>
829 The catalog <structname>pg_attribute</structname> stores information about
830 table columns. There will be exactly one
831 <structname>pg_attribute</structname> row for every column in every
832 table in the database. (There will also be attribute entries for
833 indexes, and indeed all objects that have <structname>pg_class</structname>
838 The term attribute is equivalent to column and is used for
843 <title><structname>pg_attribute</> Columns</title>
850 <entry>References</entry>
851 <entry>Description</entry>
857 <entry><structfield>attrelid</structfield></entry>
858 <entry><type>oid</type></entry>
859 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
860 <entry>The table this column belongs to</entry>
864 <entry><structfield>attname</structfield></entry>
865 <entry><type>name</type></entry>
867 <entry>The column name</entry>
871 <entry><structfield>atttypid</structfield></entry>
872 <entry><type>oid</type></entry>
873 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
874 <entry>The data type of this column</entry>
878 <entry><structfield>attstattarget</structfield></entry>
879 <entry><type>int4</type></entry>
882 <structfield>attstattarget</structfield> controls the level of detail
883 of statistics accumulated for this column by
884 <xref linkend="sql-analyze" endterm="sql-analyze-title">.
885 A zero value indicates that no statistics should be collected.
886 A negative value says to use the system default statistics target.
887 The exact meaning of positive values is data type-dependent.
888 For scalar data types, <structfield>attstattarget</structfield>
889 is both the target number of <quote>most common values</quote>
890 to collect, and the target number of histogram bins to create
895 <entry><structfield>attlen</structfield></entry>
896 <entry><type>int2</type></entry>
899 A copy of <literal>pg_type.typlen</literal> of this column's
905 <entry><structfield>attnum</structfield></entry>
906 <entry><type>int2</type></entry>
909 The number of the column. Ordinary columns are numbered from 1
910 up. System columns, such as <structfield>oid</structfield>,
911 have (arbitrary) negative numbers
916 <entry><structfield>attndims</structfield></entry>
917 <entry><type>int4</type></entry>
920 Number of dimensions, if the column is an array type; otherwise 0.
921 (Presently, the number of dimensions of an array is not enforced,
922 so any nonzero value effectively means <quote>it's an array</>)
927 <entry><structfield>attcacheoff</structfield></entry>
928 <entry><type>int4</type></entry>
931 Always -1 in storage, but when loaded into a row descriptor
932 in memory this might be updated to cache the offset of the attribute
938 <entry><structfield>atttypmod</structfield></entry>
939 <entry><type>int4</type></entry>
942 <structfield>atttypmod</structfield> records type-specific data
943 supplied at table creation time (for example, the maximum
944 length of a <type>varchar</type> column). It is passed to
945 type-specific input functions and length coercion functions.
946 The value will generally be -1 for types that do not need <structfield>atttypmod</>
951 <entry><structfield>attbyval</structfield></entry>
952 <entry><type>bool</type></entry>
955 A copy of <literal>pg_type.typbyval</> of this column's type
960 <entry><structfield>attstorage</structfield></entry>
961 <entry><type>char</type></entry>
964 Normally a copy of <literal>pg_type.typstorage</> of this
965 column's type. For TOAST-able data types, this can be altered
966 after column creation to control storage policy
971 <entry><structfield>attalign</structfield></entry>
972 <entry><type>char</type></entry>
975 A copy of <literal>pg_type.typalign</> of this column's type
980 <entry><structfield>attnotnull</structfield></entry>
981 <entry><type>bool</type></entry>
984 This represents a not-null constraint. It is possible to
985 change this column to enable or disable the constraint
990 <entry><structfield>atthasdef</structfield></entry>
991 <entry><type>bool</type></entry>
994 This column has a default value, in which case there will be a
995 corresponding entry in the <structname>pg_attrdef</structname>
996 catalog that actually defines the value
1001 <entry><structfield>attisdropped</structfield></entry>
1002 <entry><type>bool</type></entry>
1005 This column has been dropped and is no longer valid. A dropped
1006 column is still physically present in the table, but is
1007 ignored by the parser and so cannot be accessed via SQL
1012 <entry><structfield>attislocal</structfield></entry>
1013 <entry><type>bool</type></entry>
1016 This column is defined locally in the relation. Note that a column can
1017 be locally defined and inherited simultaneously
1022 <entry><structfield>attinhcount</structfield></entry>
1023 <entry><type>int4</type></entry>
1026 The number of direct ancestors this column has. A column with a
1027 nonzero number of ancestors cannot be dropped nor renamed
1032 <entry><structfield>attacl</structfield></entry>
1033 <entry><type>aclitem[]</type></entry>
1036 Column-level access privileges, if any have been granted specifically
1046 In a dropped column's <structname>pg_attribute</structname> entry,
1047 <structfield>atttypid</structfield> is reset to zero, but
1048 <structfield>attlen</structfield> and the other fields copied from
1049 <structname>pg_type</> are still valid. This arrangement is needed
1050 to cope with the situation where the dropped column's data type was
1051 later dropped, and so there is no <structname>pg_type</> row anymore.
1052 <structfield>attlen</structfield> and the other fields can be used
1053 to interpret the contents of a row of the table.
1058 <sect1 id="catalog-pg-authid">
1059 <title><structname>pg_authid</structname></title>
1061 <indexterm zone="catalog-pg-authid">
1062 <primary>pg_authid</primary>
1066 The catalog <structname>pg_authid</structname> contains information about
1067 database authorization identifiers (roles). A role subsumes the concepts
1068 of <quote>users</> and <quote>groups</>. A user is essentially just a
1069 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1070 without <structfield>rolcanlogin</>) can have other roles as members; see
1071 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1075 Since this catalog contains passwords, it must not be publicly readable.
1076 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1077 is a publicly readable view on
1078 <structname>pg_authid</structname> that blanks out the password field.
1082 <xref linkend="user-manag"> contains detailed information about user and
1083 privilege management.
1087 Because user identities are cluster-wide,
1088 <structname>pg_authid</structname>
1089 is shared across all databases of a cluster: there is only one
1090 copy of <structname>pg_authid</structname> per cluster, not
1095 <title><structname>pg_authid</> Columns</title>
1102 <entry>Description</entry>
1108 <entry><structfield>rolname</structfield></entry>
1109 <entry><type>name</type></entry>
1110 <entry>Role name</entry>
1114 <entry><structfield>rolsuper</structfield></entry>
1115 <entry><type>bool</type></entry>
1116 <entry>Role has superuser privileges</entry>
1120 <entry><structfield>rolinherit</structfield></entry>
1121 <entry><type>bool</type></entry>
1122 <entry>Role automatically inherits privileges of roles it is a
1127 <entry><structfield>rolcreaterole</structfield></entry>
1128 <entry><type>bool</type></entry>
1129 <entry>Role can create more roles</entry>
1133 <entry><structfield>rolcreatedb</structfield></entry>
1134 <entry><type>bool</type></entry>
1135 <entry>Role can create databases</entry>
1139 <entry><structfield>rolcatupdate</structfield></entry>
1140 <entry><type>bool</type></entry>
1142 Role can update system catalogs directly. (Even a superuser cannot do
1143 this unless this column is true)
1148 <entry><structfield>rolcanlogin</structfield></entry>
1149 <entry><type>bool</type></entry>
1151 Role can log in. That is, this role can be given as the initial
1152 session authorization identifier
1157 <entry><structfield>rolconnlimit</structfield></entry>
1158 <entry><type>int4</type></entry>
1160 For roles that can log in, this sets maximum number of concurrent
1161 connections this role can make. -1 means no limit
1166 <entry><structfield>rolpassword</structfield></entry>
1167 <entry><type>text</type></entry>
1168 <entry>Password (possibly encrypted); NULL if none</entry>
1172 <entry><structfield>rolvaliduntil</structfield></entry>
1173 <entry><type>timestamptz</type></entry>
1174 <entry>Password expiry time (only used for password authentication);
1175 NULL if no expiration</entry>
1179 <entry><structfield>rolconfig</structfield></entry>
1180 <entry><type>text[]</type></entry>
1181 <entry>Session defaults for run-time configuration variables</entry>
1190 <sect1 id="catalog-pg-auth-members">
1191 <title><structname>pg_auth_members</structname></title>
1193 <indexterm zone="catalog-pg-auth-members">
1194 <primary>pg_auth_members</primary>
1198 The catalog <structname>pg_auth_members</structname> shows the membership
1199 relations between roles. Any non-circular set of relationships is allowed.
1203 Because user identities are cluster-wide,
1204 <structname>pg_auth_members</structname>
1205 is shared across all databases of a cluster: there is only one
1206 copy of <structname>pg_auth_members</structname> per cluster, not
1211 <title><structname>pg_auth_members</> Columns</title>
1218 <entry>References</entry>
1219 <entry>Description</entry>
1225 <entry><structfield>roleid</structfield></entry>
1226 <entry><type>oid</type></entry>
1227 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1228 <entry>ID of a role that has a member</entry>
1232 <entry><structfield>member</structfield></entry>
1233 <entry><type>oid</type></entry>
1234 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1235 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1239 <entry><structfield>grantor</structfield></entry>
1240 <entry><type>oid</type></entry>
1241 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1242 <entry>ID of the role that granted this membership</entry>
1246 <entry><structfield>admin_option</structfield></entry>
1247 <entry><type>bool</type></entry>
1249 <entry>True if <structfield>member</> can grant membership in
1250 <structfield>roleid</> to others</entry>
1259 <sect1 id="catalog-pg-autovacuum">
1260 <title><structname>pg_autovacuum</structname></title>
1262 <indexterm zone="catalog-pg-autovacuum">
1263 <primary>pg_autovacuum</primary>
1266 <indexterm zone="catalog-pg-autovacuum">
1267 <primary>autovacuum</primary>
1268 <secondary>table-specific configuration</secondary>
1272 The catalog <structname>pg_autovacuum</structname> stores optional
1273 per-relation configuration parameters for the autovacuum daemon.
1274 If there is an entry here for a particular relation, the given
1275 parameters will be used for autovacuuming that table. If no entry
1276 is present, the system-wide defaults will be used. For more information
1277 about the autovacuum daemon, see <xref linkend="autovacuum">.
1282 It is likely that <structname>pg_autovacuum</structname> will disappear
1283 in a future release, with the information instead being kept in
1284 <structname>pg_class</>.<structfield>reloptions</> entries.
1289 <title><structname>pg_autovacuum</> Columns</title>
1296 <entry>References</entry>
1297 <entry>Description</entry>
1303 <entry><structfield>vacrelid</structfield></entry>
1304 <entry><type>oid</type></entry>
1305 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1306 <entry>The table this entry is for</entry>
1310 <entry><structfield>enabled</structfield></entry>
1311 <entry><type>bool</type></entry>
1313 <entry>If false, this table will not be autovacuumed, except
1314 to prevent transaction ID wraparound</entry>
1318 <entry><structfield>vac_base_thresh</structfield></entry>
1319 <entry><type>integer</type></entry>
1321 <entry>Minimum number of modified tuples before vacuum</entry>
1325 <entry><structfield>vac_scale_factor</structfield></entry>
1326 <entry><type>float4</type></entry>
1328 <entry>Multiplier for <structfield>reltuples</> to add to
1329 <structfield>vac_base_thresh</></entry>
1333 <entry><structfield>anl_base_thresh</structfield></entry>
1334 <entry><type>integer</type></entry>
1336 <entry>Minimum number of modified tuples before analyze</entry>
1340 <entry><structfield>anl_scale_factor</structfield></entry>
1341 <entry><type>float4</type></entry>
1343 <entry>Multiplier for <structfield>reltuples</> to add to
1344 <structfield>anl_base_thresh</></entry>
1348 <entry><structfield>vac_cost_delay</structfield></entry>
1349 <entry><type>integer</type></entry>
1351 <entry>Custom <varname>vacuum_cost_delay</> parameter</entry>
1355 <entry><structfield>vac_cost_limit</structfield></entry>
1356 <entry><type>integer</type></entry>
1358 <entry>Custom <varname>vacuum_cost_limit</> parameter</entry>
1362 <entry><structfield>freeze_min_age</structfield></entry>
1363 <entry><type>integer</type></entry>
1365 <entry>Custom <varname>vacuum_freeze_min_age</> parameter</entry>
1369 <entry><structfield>freeze_max_age</structfield></entry>
1370 <entry><type>integer</type></entry>
1372 <entry>Custom <varname>autovacuum_freeze_max_age</> parameter</entry>
1376 <entry><structfield>freeze_table_age</structfield></entry>
1377 <entry><type>integer</type></entry>
1379 <entry>Custom <varname>vacuum_freeze_table_age</> parameter</entry>
1386 The autovacuum daemon will initiate a <command>VACUUM</> operation
1387 on a particular table when the number of updated or deleted tuples
1388 exceeds <structfield>vac_base_thresh</structfield> plus
1389 <structfield>vac_scale_factor</structfield> times the number of
1390 live tuples currently estimated to be in the relation.
1391 Similarly, it will initiate an <command>ANALYZE</> operation
1392 when the number of inserted, updated or deleted tuples
1393 exceeds <structfield>anl_base_thresh</structfield> plus
1394 <structfield>anl_scale_factor</structfield> times the number of
1395 live tuples currently estimated to be in the relation.
1399 Also, the autovacuum daemon will perform a <command>VACUUM</> operation
1400 to prevent transaction ID wraparound if the table's
1401 <structname>pg_class</>.<structfield>relfrozenxid</> field attains an age
1402 of more than <structfield>freeze_max_age</> transactions, whether the table
1403 has been changed or not, even if
1404 <structname>pg_autovacuum</>.<structfield>enabled</> is set to
1405 <literal>false</> for it. The system will launch autovacuum to perform
1406 such <command>VACUUM</>s even if autovacuum is otherwise disabled.
1407 See <xref linkend="vacuum-for-wraparound"> for more about wraparound
1412 Any of the numerical fields can contain <literal>-1</> (or indeed
1413 any negative value) to indicate that the system-wide default should
1414 be used for this particular value. Observe that the
1415 <structfield>vac_cost_delay</> variable inherits its default value from the
1416 <xref linkend="guc-autovacuum-vacuum-cost-delay"> configuration parameter,
1417 or from <xref linkend="guc-vacuum-cost-delay"> if the former is set to a
1418 negative value. The same applies to <structfield>vac_cost_limit</>.
1419 Also, autovacuum will ignore attempts to set a per-table
1420 <structfield>freeze_max_age</> larger than the system-wide setting (it can
1421 only be set smaller), and the <structfield>freeze_min_age</> value will be
1422 limited to half the system-wide <xref
1423 linkend="guc-autovacuum-freeze-max-age"> setting. Note that while you
1424 can set <structfield>freeze_max_age</> very small, or even zero, this
1425 is usually unwise since it will force frequent vacuuming.
1431 <sect1 id="catalog-pg-cast">
1432 <title><structname>pg_cast</structname></title>
1434 <indexterm zone="catalog-pg-cast">
1435 <primary>pg_cast</primary>
1439 The catalog <structname>pg_cast</structname> stores data type conversion
1440 paths, both built-in paths and those defined with
1441 <xref linkend="sql-createcast" endterm="sql-createcast-title">.
1445 It should be noted that <structname>pg_cast</structname> does not represent
1446 every type conversion that the system knows how to perform; only those that
1447 cannot be deduced from some generic rule. For example, casting between a
1448 domain and its base type is not explicitly represented in
1449 <structname>pg_cast</structname>. Another important exception is that
1450 <quote>automatic I/O conversion casts</>, those performed using a data
1451 type's own I/O functions to convert to or from <type>text</> or other
1452 string types, are not explicitly represented in
1453 <structname>pg_cast</structname>.
1457 <title><structname>pg_cast</> Columns</title>
1464 <entry>References</entry>
1465 <entry>Description</entry>
1471 <entry><structfield>castsource</structfield></entry>
1472 <entry><type>oid</type></entry>
1473 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1474 <entry>OID of the source data type</entry>
1478 <entry><structfield>casttarget</structfield></entry>
1479 <entry><type>oid</type></entry>
1480 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1481 <entry>OID of the target data type</entry>
1485 <entry><structfield>castfunc</structfield></entry>
1486 <entry><type>oid</type></entry>
1487 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1489 The OID of the function to use to perform this cast. Zero is
1490 stored if the cast method doesn't require a function.
1495 <entry><structfield>castcontext</structfield></entry>
1496 <entry><type>char</type></entry>
1499 Indicates what contexts the cast can be invoked in.
1500 <literal>e</> means only as an explicit cast (using
1501 <literal>CAST</> or <literal>::</> syntax).
1502 <literal>a</> means implicitly in assignment
1503 to a target column, as well as explicitly.
1504 <literal>i</> means implicitly in expressions, as well as the
1509 <entry><structfield>castmethod</structfield></entry>
1510 <entry><type>char</type></entry>
1513 Indicates how the cast is performed.
1514 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1515 <literal>i</> means that the input/output functions are used.
1516 <literal>b</> means that the types are binary-coercible, thus no conversion is required
1524 The cast functions listed in <structname>pg_cast</structname> must
1525 always take the cast source type as their first argument type, and
1526 return the cast destination type as their result type. A cast
1527 function can have up to three arguments. The second argument,
1528 if present, must be type <type>integer</>; it receives the type
1529 modifier associated with the destination type, or <literal>-1</>
1530 if there is none. The third argument,
1531 if present, must be type <type>boolean</>; it receives <literal>true</>
1532 if the cast is an explicit cast, <literal>false</> otherwise.
1536 It is legitimate to create a <structname>pg_cast</structname> entry
1537 in which the source and target types are the same, if the associated
1538 function takes more than one argument. Such entries represent
1539 <quote>length coercion functions</> that coerce values of the type
1540 to be legal for a particular type modifier value.
1544 When a <structname>pg_cast</structname> entry has different source and
1545 target types and a function that takes more than one argument, it
1546 represents converting from one type to another and applying a length
1547 coercion in a single step. When no such entry is available, coercion
1548 to a type that uses a type modifier involves two steps, one to
1549 convert between data types and a second to apply the modifier.
1553 <sect1 id="catalog-pg-class">
1554 <title><structname>pg_class</structname></title>
1556 <indexterm zone="catalog-pg-class">
1557 <primary>pg_class</primary>
1561 The catalog <structname>pg_class</structname> catalogs tables and most
1562 everything else that has columns or is otherwise similar to a
1563 table. This includes indexes (but see also
1564 <structname>pg_index</structname>), sequences, views, composite types,
1565 and TOAST tables; see <structfield>relkind</>.
1566 Below, when we mean all of these
1567 kinds of objects we speak of <quote>relations</quote>. Not all
1568 columns are meaningful for all relation types.
1572 <title><structname>pg_class</> Columns</title>
1579 <entry>References</entry>
1580 <entry>Description</entry>
1586 <entry><structfield>relname</structfield></entry>
1587 <entry><type>name</type></entry>
1589 <entry>Name of the table, index, view, etc.</entry>
1593 <entry><structfield>relnamespace</structfield></entry>
1594 <entry><type>oid</type></entry>
1595 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1597 The OID of the namespace that contains this relation
1602 <entry><structfield>reltype</structfield></entry>
1603 <entry><type>oid</type></entry>
1604 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1606 The OID of the data type that corresponds to this table's row type,
1607 if any (zero for indexes, which have no <structname>pg_type</> entry)
1612 <entry><structfield>relowner</structfield></entry>
1613 <entry><type>oid</type></entry>
1614 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1615 <entry>Owner of the relation</entry>
1619 <entry><structfield>relam</structfield></entry>
1620 <entry><type>oid</type></entry>
1621 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1622 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1626 <entry><structfield>relfilenode</structfield></entry>
1627 <entry><type>oid</type></entry>
1629 <entry>Name of the on-disk file of this relation; 0 if none</entry>
1633 <entry><structfield>reltablespace</structfield></entry>
1634 <entry><type>oid</type></entry>
1635 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1637 The tablespace in which this relation is stored. If zero,
1638 the database's default tablespace is implied. (Not meaningful
1639 if the relation has no on-disk file.)
1644 <entry><structfield>relpages</structfield></entry>
1645 <entry><type>int4</type></entry>
1648 Size of the on-disk representation of this table in pages (of size
1649 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1650 planner. It is updated by <command>VACUUM</command>,
1651 <command>ANALYZE</command>, and a few DDL commands such as
1652 <command>CREATE INDEX</command>
1657 <entry><structfield>reltuples</structfield></entry>
1658 <entry><type>float4</type></entry>
1661 Number of rows in the table. This is only an estimate used by the
1662 planner. It is updated by <command>VACUUM</command>,
1663 <command>ANALYZE</command>, and a few DDL commands such as
1664 <command>CREATE INDEX</command>
1669 <entry><structfield>reltoastrelid</structfield></entry>
1670 <entry><type>oid</type></entry>
1671 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1673 OID of the TOAST table associated with this table, 0 if none. The
1674 TOAST table stores large attributes <quote>out of line</quote> in a
1680 <entry><structfield>reltoastidxid</structfield></entry>
1681 <entry><type>oid</type></entry>
1682 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1684 For a TOAST table, the OID of its index. 0 if not a TOAST table
1689 <entry><structfield>relhasindex</structfield></entry>
1690 <entry><type>bool</type></entry>
1693 True if this is a table and it has (or recently had) any
1694 indexes. This is set by <command>CREATE INDEX</command>, but
1695 not cleared immediately by <command>DROP INDEX</command>.
1696 <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the
1697 table has no indexes
1702 <entry><structfield>relisshared</structfield></entry>
1703 <entry><type>bool</type></entry>
1706 True if this table is shared across all databases in the cluster. Only
1707 certain system catalogs (such as <structname>pg_database</structname>)
1713 <entry><structfield>relkind</structfield></entry>
1714 <entry><type>char</type></entry>
1717 <literal>r</> = ordinary table, <literal>i</> = index,
1718 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1719 composite type, <literal>t</> = TOAST
1725 <entry><structfield>relnatts</structfield></entry>
1726 <entry><type>int2</type></entry>
1729 Number of user columns in the relation (system columns not
1730 counted). There must be this many corresponding entries in
1731 <structname>pg_attribute</structname>. See also
1732 <literal>pg_attribute.attnum</literal>
1737 <entry><structfield>relchecks</structfield></entry>
1738 <entry><type>int2</type></entry>
1741 Number of check constraints on the table; see
1742 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1747 <entry><structfield>relhasoids</structfield></entry>
1748 <entry><type>bool</type></entry>
1751 True if we generate an OID for each row of the relation
1756 <entry><structfield>relhaspkey</structfield></entry>
1757 <entry><type>bool</type></entry>
1760 True if the table has (or once had) a primary key
1765 <entry><structfield>relhasrules</structfield></entry>
1766 <entry><type>bool</type></entry>
1769 True if table has (or once had) rules; see
1770 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1775 <entry><structfield>relhastriggers</structfield></entry>
1776 <entry><type>bool</type></entry>
1779 True if table has (or once had) triggers; see
1780 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1785 <entry><structfield>relhassubclass</structfield></entry>
1786 <entry><type>bool</type></entry>
1788 <entry>True if table has (or once had) any inheritance children</entry>
1792 <entry><structfield>relfrozenxid</structfield></entry>
1793 <entry><type>xid</type></entry>
1796 All transaction IDs before this one have been replaced with a permanent
1797 (<quote>frozen</>) transaction ID in this table. This is used to track
1798 whether the table needs to be vacuumed in order to prevent transaction
1799 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1800 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table
1805 <entry><structfield>relacl</structfield></entry>
1806 <entry><type>aclitem[]</type></entry>
1809 Access privileges; see
1810 <xref linkend="sql-grant" endterm="sql-grant-title"> and
1811 <xref linkend="sql-revoke" endterm="sql-revoke-title">
1817 <entry><structfield>reloptions</structfield></entry>
1818 <entry><type>text[]</type></entry>
1821 Access-method-specific options, as <quote>keyword=value</> strings
1829 <sect1 id="catalog-pg-constraint">
1830 <title><structname>pg_constraint</structname></title>
1832 <indexterm zone="catalog-pg-constraint">
1833 <primary>pg_constraint</primary>
1837 The catalog <structname>pg_constraint</structname> stores check, primary key, unique, and foreign
1838 key constraints on tables. (Column constraints are not treated
1839 specially. Every column constraint is equivalent to some table
1840 constraint.) Not-null constraints are represented in the
1841 <structname>pg_attribute</> catalog.
1845 Check constraints on domains are stored here, too.
1849 <title><structname>pg_constraint</> Columns</title>
1856 <entry>References</entry>
1857 <entry>Description</entry>
1863 <entry><structfield>conname</structfield></entry>
1864 <entry><type>name</type></entry>
1866 <entry>Constraint name (not necessarily unique!)</entry>
1870 <entry><structfield>connamespace</structfield></entry>
1871 <entry><type>oid</type></entry>
1872 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1874 The OID of the namespace that contains this constraint
1879 <entry><structfield>contype</structfield></entry>
1880 <entry><type>char</type></entry>
1883 <literal>c</> = check constraint,
1884 <literal>f</> = foreign key constraint,
1885 <literal>p</> = primary key constraint,
1886 <literal>u</> = unique constraint
1891 <entry><structfield>condeferrable</structfield></entry>
1892 <entry><type>bool</type></entry>
1894 <entry>Is the constraint deferrable?</entry>
1898 <entry><structfield>condeferred</structfield></entry>
1899 <entry><type>bool</type></entry>
1901 <entry>Is the constraint deferred by default?</entry>
1905 <entry><structfield>conrelid</structfield></entry>
1906 <entry><type>oid</type></entry>
1907 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1908 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1912 <entry><structfield>contypid</structfield></entry>
1913 <entry><type>oid</type></entry>
1914 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1915 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1919 <entry><structfield>confrelid</structfield></entry>
1920 <entry><type>oid</type></entry>
1921 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1922 <entry>If a foreign key, the referenced table; else 0</entry>
1926 <entry><structfield>confupdtype</structfield></entry>
1927 <entry><type>char</type></entry>
1929 <entry>Foreign key update action code:
1930 <literal>a</> = no action,
1931 <literal>r</> = restrict,
1932 <literal>c</> = cascade,
1933 <literal>n</> = set null,
1934 <literal>d</> = set default
1939 <entry><structfield>confdeltype</structfield></entry>
1940 <entry><type>char</type></entry>
1942 <entry>Foreign key deletion action code:
1943 <literal>a</> = no action,
1944 <literal>r</> = restrict,
1945 <literal>c</> = cascade,
1946 <literal>n</> = set null,
1947 <literal>d</> = set default
1952 <entry><structfield>confmatchtype</structfield></entry>
1953 <entry><type>char</type></entry>
1955 <entry>Foreign key match type:
1956 <literal>f</> = full,
1957 <literal>p</> = partial,
1958 <literal>u</> = simple (unspecified)
1963 <entry><structfield>conislocal</structfield></entry>
1964 <entry><type>bool</type></entry>
1967 This constraint is defined locally in the relation. Note that a
1968 constraint can be locally defined and inherited simultaneously
1973 <entry><structfield>coninhcount</structfield></entry>
1974 <entry><type>int4</type></entry>
1977 The number of direct ancestors this constraint has. A constraint with
1978 a nonzero number of ancestors cannot be dropped nor renamed
1983 <entry><structfield>conkey</structfield></entry>
1984 <entry><type>int2[]</type></entry>
1985 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1986 <entry>If a table constraint, list of columns which the constraint constrains</entry>
1990 <entry><structfield>confkey</structfield></entry>
1991 <entry><type>int2[]</type></entry>
1992 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1993 <entry>If a foreign key, list of the referenced columns</entry>
1997 <entry><structfield>conpfeqop</structfield></entry>
1998 <entry><type>oid[]</type></entry>
1999 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2000 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2004 <entry><structfield>conppeqop</structfield></entry>
2005 <entry><type>oid[]</type></entry>
2006 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2007 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2011 <entry><structfield>conffeqop</structfield></entry>
2012 <entry><type>oid[]</type></entry>
2013 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2014 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2018 <entry><structfield>conbin</structfield></entry>
2019 <entry><type>text</type></entry>
2021 <entry>If a check constraint, an internal representation of the expression</entry>
2025 <entry><structfield>consrc</structfield></entry>
2026 <entry><type>text</type></entry>
2028 <entry>If a check constraint, a human-readable representation of the expression</entry>
2036 <structfield>consrc</structfield> is not updated when referenced objects
2037 change; for example, it won't track renaming of columns. Rather than
2038 relying on this field, it's best to use <function>pg_get_constraintdef()</>
2039 to extract the definition of a check constraint.
2045 <literal>pg_class.relchecks</literal> needs to agree with the
2046 number of check-constraint entries found in this table for each
2053 <sect1 id="catalog-pg-conversion">
2054 <title><structname>pg_conversion</structname></title>
2056 <indexterm zone="catalog-pg-conversion">
2057 <primary>pg_conversion</primary>
2061 The catalog <structname>pg_conversion</structname> describes the
2062 available encoding conversion procedures. See
2063 <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
2064 for more information.
2068 <title><structname>pg_conversion</> Columns</title>
2075 <entry>References</entry>
2076 <entry>Description</entry>
2082 <entry><structfield>conname</structfield></entry>
2083 <entry><type>name</type></entry>
2085 <entry>Conversion name (unique within a namespace)</entry>
2089 <entry><structfield>connamespace</structfield></entry>
2090 <entry><type>oid</type></entry>
2091 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2093 The OID of the namespace that contains this conversion
2098 <entry><structfield>conowner</structfield></entry>
2099 <entry><type>oid</type></entry>
2100 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2101 <entry>Owner of the conversion</entry>
2105 <entry><structfield>conforencoding</structfield></entry>
2106 <entry><type>int4</type></entry>
2108 <entry>Source encoding ID</entry>
2112 <entry><structfield>contoencoding</structfield></entry>
2113 <entry><type>int4</type></entry>
2115 <entry>Destination encoding ID</entry>
2119 <entry><structfield>conproc</structfield></entry>
2120 <entry><type>regproc</type></entry>
2121 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2122 <entry>Conversion procedure</entry>
2126 <entry><structfield>condefault</structfield></entry>
2127 <entry><type>bool</type></entry>
2129 <entry>True if this is the default conversion</entry>
2138 <sect1 id="catalog-pg-database">
2139 <title><structname>pg_database</structname></title>
2141 <indexterm zone="catalog-pg-database">
2142 <primary>pg_database</primary>
2146 The catalog <structname>pg_database</structname> stores information about
2147 the available databases. Databases are created with the <xref
2148 linkend="sql-createdatabase" endterm="sql-createdatabase-title"> command.
2149 Consult <xref linkend="managing-databases"> for details about the meaning
2150 of some of the parameters.
2154 Unlike most system catalogs, <structname>pg_database</structname>
2155 is shared across all databases of a cluster: there is only one
2156 copy of <structname>pg_database</structname> per cluster, not
2161 <title><structname>pg_database</> Columns</title>
2168 <entry>References</entry>
2169 <entry>Description</entry>
2175 <entry><structfield>datname</structfield></entry>
2176 <entry><type>name</type></entry>
2178 <entry>Database name</entry>
2182 <entry><structfield>datdba</structfield></entry>
2183 <entry><type>oid</type></entry>
2184 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2185 <entry>Owner of the database, usually the user who created it</entry>
2189 <entry><structfield>encoding</structfield></entry>
2190 <entry><type>int4</type></entry>
2192 <entry>Character encoding for this database
2193 (<function>pg_encoding_to_char()</function> can translate
2194 this number to the encoding name)</entry>
2198 <entry><structfield>datcollate</structfield></entry>
2199 <entry><type>name</type></entry>
2201 <entry>LC_COLLATE for this database</entry>
2205 <entry><structfield>datctype</structfield></entry>
2206 <entry><type>name</type></entry>
2208 <entry>LC_CTYPE for this database</entry>
2212 <entry><structfield>datistemplate</structfield></entry>
2213 <entry><type>bool</type></entry>
2216 If true then this database can be used in the
2217 <literal>TEMPLATE</literal> clause of <command>CREATE
2218 DATABASE</command> to create a new database as a clone of
2224 <entry><structfield>datallowconn</structfield></entry>
2225 <entry><type>bool</type></entry>
2228 If false then no one can connect to this database. This is
2229 used to protect the <literal>template0</> database from being altered
2234 <entry><structfield>datconnlimit</structfield></entry>
2235 <entry><type>int4</type></entry>
2238 Sets maximum number of concurrent connections that can be made
2239 to this database. -1 means no limit
2244 <entry><structfield>datlastsysoid</structfield></entry>
2245 <entry><type>oid</type></entry>
2248 Last system OID in the database; useful
2249 particularly to <application>pg_dump</application>
2254 <entry><structfield>datfrozenxid</structfield></entry>
2255 <entry><type>xid</type></entry>
2258 All transaction IDs before this one have been replaced with a permanent
2259 (<quote>frozen</>) transaction ID in this database. This is used to
2260 track whether the database needs to be vacuumed in order to prevent
2261 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2262 It is the minimum of the per-table
2263 <structname>pg_class</>.<structfield>relfrozenxid</> values
2268 <entry><structfield>dattablespace</structfield></entry>
2269 <entry><type>oid</type></entry>
2270 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2272 The default tablespace for the database.
2273 Within this database, all tables for which
2274 <structname>pg_class</>.<structfield>reltablespace</> is zero
2275 will be stored in this tablespace; in particular, all the non-shared
2276 system catalogs will be there
2281 <entry><structfield>datconfig</structfield></entry>
2282 <entry><type>text[]</type></entry>
2284 <entry>Session defaults for run-time configuration variables</entry>
2288 <entry><structfield>datacl</structfield></entry>
2289 <entry><type>aclitem[]</type></entry>
2292 Access privileges; see
2293 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2294 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2304 <sect1 id="catalog-pg-depend">
2305 <title><structname>pg_depend</structname></title>
2307 <indexterm zone="catalog-pg-depend">
2308 <primary>pg_depend</primary>
2312 The catalog <structname>pg_depend</structname> records the dependency
2313 relationships between database objects. This information allows
2314 <command>DROP</> commands to find which other objects must be dropped
2315 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2320 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2321 which performs a similar function for dependencies involving objects
2322 that are shared across a database cluster.
2326 <title><structname>pg_depend</> Columns</title>
2333 <entry>References</entry>
2334 <entry>Description</entry>
2340 <entry><structfield>classid</structfield></entry>
2341 <entry><type>oid</type></entry>
2342 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2343 <entry>The OID of the system catalog the dependent object is in</entry>
2347 <entry><structfield>objid</structfield></entry>
2348 <entry><type>oid</type></entry>
2349 <entry>any OID column</entry>
2350 <entry>The OID of the specific dependent object</entry>
2354 <entry><structfield>objsubid</structfield></entry>
2355 <entry><type>int4</type></entry>
2358 For a table column, this is the column number (the
2359 <structfield>objid</> and <structfield>classid</> refer to the
2360 table itself). For all other object types, this column is
2366 <entry><structfield>refclassid</structfield></entry>
2367 <entry><type>oid</type></entry>
2368 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2369 <entry>The OID of the system catalog the referenced object is in</entry>
2373 <entry><structfield>refobjid</structfield></entry>
2374 <entry><type>oid</type></entry>
2375 <entry>any OID column</entry>
2376 <entry>The OID of the specific referenced object</entry>
2380 <entry><structfield>refobjsubid</structfield></entry>
2381 <entry><type>int4</type></entry>
2384 For a table column, this is the column number (the
2385 <structfield>refobjid</> and <structfield>refclassid</> refer
2386 to the table itself). For all other object types, this column
2392 <entry><structfield>deptype</structfield></entry>
2393 <entry><type>char</type></entry>
2396 A code defining the specific semantics of this dependency relationship; see text
2405 In all cases, a <structname>pg_depend</structname> entry indicates that the
2406 referenced object cannot be dropped without also dropping the dependent
2407 object. However, there are several subflavors identified by
2408 <structfield>deptype</>:
2412 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2415 A normal relationship between separately-created objects. The
2416 dependent object can be dropped without affecting the
2417 referenced object. The referenced object can only be dropped
2418 by specifying <literal>CASCADE</>, in which case the dependent
2419 object is dropped, too. Example: a table column has a normal
2420 dependency on its data type.
2426 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2429 The dependent object can be dropped separately from the
2430 referenced object, and should be automatically dropped
2431 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2432 mode) if the referenced object is dropped. Example: a named
2433 constraint on a table is made autodependent on the table, so
2434 that it will go away if the table is dropped.
2440 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2443 The dependent object was created as part of creation of the
2444 referenced object, and is really just a part of its internal
2445 implementation. A <command>DROP</> of the dependent object
2446 will be disallowed outright (we'll tell the user to issue a
2447 <command>DROP</> against the referenced object, instead). A
2448 <command>DROP</> of the referenced object will be propagated
2449 through to drop the dependent object whether
2450 <command>CASCADE</> is specified or not. Example: a trigger
2451 that's created to enforce a foreign-key constraint is made
2452 internally dependent on the constraint's
2453 <structname>pg_constraint</> entry.
2459 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2462 There is no dependent object; this type of entry is a signal
2463 that the system itself depends on the referenced object, and so
2464 that object must never be deleted. Entries of this type are
2465 created only by <command>initdb</command>. The columns for the
2466 dependent object contain zeroes.
2472 Other dependency flavors might be needed in future.
2478 <sect1 id="catalog-pg-description">
2479 <title><structname>pg_description</structname></title>
2481 <indexterm zone="catalog-pg-description">
2482 <primary>pg_description</primary>
2486 The catalog <structname>pg_description</> stores optional descriptions
2487 (comments) for each database object. Descriptions can be manipulated
2488 with the <xref linkend="sql-comment" endterm="sql-comment-title"> command and viewed with
2489 <application>psql</application>'s <literal>\d</literal> commands.
2490 Descriptions of many built-in system objects are provided in the initial
2491 contents of <structname>pg_description</structname>.
2495 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2496 which performs a similar function for descriptions involving objects that
2497 are shared across a database cluster.
2501 <title><structname>pg_description</> Columns</title>
2508 <entry>References</entry>
2509 <entry>Description</entry>
2515 <entry><structfield>objoid</structfield></entry>
2516 <entry><type>oid</type></entry>
2517 <entry>any OID column</entry>
2518 <entry>The OID of the object this description pertains to</entry>
2522 <entry><structfield>classoid</structfield></entry>
2523 <entry><type>oid</type></entry>
2524 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2525 <entry>The OID of the system catalog this object appears in</entry>
2529 <entry><structfield>objsubid</structfield></entry>
2530 <entry><type>int4</type></entry>
2533 For a comment on a table column, this is the column number (the
2534 <structfield>objoid</> and <structfield>classoid</> refer to
2535 the table itself). For all other object types, this column is
2541 <entry><structfield>description</structfield></entry>
2542 <entry><type>text</type></entry>
2544 <entry>Arbitrary text that serves as the description of this object</entry>
2553 <sect1 id="catalog-pg-enum">
2554 <title><structname>pg_enum</structname></title>
2556 <indexterm zone="catalog-pg-enum">
2557 <primary>pg_enum</primary>
2561 The <structname>pg_enum</structname> catalog contains entries
2562 matching enum types to their associated values and labels. The
2563 internal representation of a given enum value is actually the OID
2564 of its associated row in <structname>pg_enum</structname>. The
2565 OIDs for a particular enum type are guaranteed to be ordered in
2566 the way the type should sort, but there is no guarantee about the
2567 ordering of OIDs of unrelated enum types.
2571 <title><structname>pg_enum</> Columns</title>
2578 <entry>References</entry>
2579 <entry>Description</entry>
2585 <entry><structfield>enumtypid</structfield></entry>
2586 <entry><type>oid</type></entry>
2587 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2588 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2592 <entry><structfield>enumlabel</structfield></entry>
2593 <entry><type>name</type></entry>
2595 <entry>The textual label for this enum value</entry>
2603 <sect1 id="catalog-pg-foreign-data-wrapper">
2604 <title><structname>pg_foreign_data_wrapper</structname></title>
2606 <indexterm zone="catalog-pg-foreign-data-wrapper">
2607 <primary>pg_foreign_data_wrapper</primary>
2611 The catalog <structname>pg_foreign_data_wrapper</structname> stores
2612 foreign-data wrapper definitions. A foreign-data wrapper is the
2613 mechanism by which external data, residing on foreign servers, is
2618 <title><structname>pg_foreign_data_wrapper</> Columns</title>
2625 <entry>References</entry>
2626 <entry>Description</entry>
2632 <entry><structfield>fdwname</structfield></entry>
2633 <entry><type>name</type></entry>
2635 <entry>Name of the foreign-data wrapper</entry>
2639 <entry><structfield>fdwowner</structfield></entry>
2640 <entry><type>oid</type></entry>
2641 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2642 <entry>Owner of the foreign-data wrapper</entry>
2646 <entry><structfield>fdwlibrary</structfield></entry>
2647 <entry><type>text</type></entry>
2649 <entry>File name of the library implementing this foreign-data wrapper</entry>
2653 <entry><structfield>fdwacl</structfield></entry>
2654 <entry><type>aclitem[]</type></entry>
2657 Access privileges; see
2658 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2659 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2665 <entry><structfield>fdwoptions</structfield></entry>
2666 <entry><type>text[]</type></entry>
2669 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
2678 <sect1 id="catalog-pg-foreign-server">
2679 <title><structname>pg_foreign_server</structname></title>
2681 <indexterm zone="catalog-pg-foreign-server">
2682 <primary>pg_foreign_server</primary>
2686 The catalog <structname>pg_foreign_server</structname> stores
2687 foreign server definitions. A foreign server describes the
2688 connection to a remote server, managing external data. Foreign
2689 servers are accessed via foreign-data wrappers.
2693 <title><structname>pg_foreign_server</> Columns</title>
2700 <entry>References</entry>
2701 <entry>Description</entry>
2707 <entry><structfield>srvname</structfield></entry>
2708 <entry><type>name</type></entry>
2710 <entry>Name of the foreign server</entry>
2714 <entry><structfield>srvowner</structfield></entry>
2715 <entry><type>oid</type></entry>
2716 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2717 <entry>Owner of the foreign server</entry>
2721 <entry><structfield>srvfdw</structfield></entry>
2722 <entry><type>oid</type></entry>
2723 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
2724 <entry>The OID of the foreign-data wrapper of this foreign server</entry>
2728 <entry><structfield>srvtype</structfield></entry>
2729 <entry><type>text</type></entry>
2731 <entry>Type of the server (optional)</entry>
2735 <entry><structfield>srvversion</structfield></entry>
2736 <entry><type>text</type></entry>
2738 <entry>Version of the server (optional)</entry>
2742 <entry><structfield>srvacl</structfield></entry>
2743 <entry><type>aclitem[]</type></entry>
2746 Access privileges; see
2747 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2748 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2754 <entry><structfield>srvoptions</structfield></entry>
2755 <entry><type>text[]</type></entry>
2758 Foreign server specific options, as <quote>keyword=value</> strings.
2767 <sect1 id="catalog-pg-index">
2768 <title><structname>pg_index</structname></title>
2770 <indexterm zone="catalog-pg-index">
2771 <primary>pg_index</primary>
2775 The catalog <structname>pg_index</structname> contains part of the information
2776 about indexes. The rest is mostly in
2777 <structname>pg_class</structname>.
2781 <title><structname>pg_index</> Columns</title>
2788 <entry>References</entry>
2789 <entry>Description</entry>
2795 <entry><structfield>indexrelid</structfield></entry>
2796 <entry><type>oid</type></entry>
2797 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2798 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2802 <entry><structfield>indrelid</structfield></entry>
2803 <entry><type>oid</type></entry>
2804 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2805 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2809 <entry><structfield>indnatts</structfield></entry>
2810 <entry><type>int2</type></entry>
2812 <entry>The number of columns in the index (duplicates
2813 <literal>pg_class.relnatts</literal>)</entry>
2817 <entry><structfield>indisunique</structfield></entry>
2818 <entry><type>bool</type></entry>
2820 <entry>If true, this is a unique index</entry>
2824 <entry><structfield>indisprimary</structfield></entry>
2825 <entry><type>bool</type></entry>
2827 <entry>If true, this index represents the primary key of the table
2828 (<structfield>indisunique</> should always be true when this is true)</entry>
2832 <entry><structfield>indisclustered</structfield></entry>
2833 <entry><type>bool</type></entry>
2835 <entry>If true, the table was last clustered on this index</entry>
2839 <entry><structfield>indisvalid</structfield></entry>
2840 <entry><type>bool</type></entry>
2843 If true, the index is currently valid for queries. False means the
2844 index is possibly incomplete: it must still be modified by
2845 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2846 be used for queries. If it is unique, the uniqueness property is not
2852 <entry><structfield>indcheckxmin</structfield></entry>
2853 <entry><type>bool</type></entry>
2856 If true, queries must not use the index until the <structfield>xmin</>
2857 of this <structname>pg_index</> row is below their TransactionXmin
2858 event horizon, because the table may contain broken HOT chains with
2859 incompatible rows that they can see
2864 <entry><structfield>indisready</structfield></entry>
2865 <entry><type>bool</type></entry>
2868 If true, the index is currently ready for inserts. False means the
2869 index must be ignored by <command>INSERT</>/<command>UPDATE</>
2875 <entry><structfield>indkey</structfield></entry>
2876 <entry><type>int2vector</type></entry>
2877 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2879 This is an array of <structfield>indnatts</structfield> values that
2880 indicate which table columns this index indexes. For example a value
2881 of <literal>1 3</literal> would mean that the first and the third table
2882 columns make up the index key. A zero in this array indicates that the
2883 corresponding index attribute is an expression over the table columns,
2884 rather than a simple column reference
2889 <entry><structfield>indclass</structfield></entry>
2890 <entry><type>oidvector</type></entry>
2891 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2893 For each column in the index key, this contains the OID of
2894 the operator class to use. See
2895 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details
2900 <entry><structfield>indoption</structfield></entry>
2901 <entry><type>int2vector</type></entry>
2904 This is an array of <structfield>indnatts</structfield> values that
2905 store per-column flag bits. The meaning of the bits is defined by
2906 the index's access method
2911 <entry><structfield>indexprs</structfield></entry>
2912 <entry><type>text</type></entry>
2914 <entry>Expression trees (in <function>nodeToString()</function> representation)
2915 for index attributes that are not simple column references. This is a
2916 list with one element for each zero entry in <structfield>indkey</>.
2917 NULL if all index attributes are simple references</entry>
2921 <entry><structfield>indpred</structfield></entry>
2922 <entry><type>text</type></entry>
2924 <entry>Expression tree (in <function>nodeToString()</function> representation)
2925 for partial index predicate. NULL if not a partial index</entry>
2934 <sect1 id="catalog-pg-inherits">
2935 <title><structname>pg_inherits</structname></title>
2937 <indexterm zone="catalog-pg-inherits">
2938 <primary>pg_inherits</primary>
2942 The catalog <structname>pg_inherits</> records information about
2943 table inheritance hierarchies. There is one entry for each direct
2944 child table in the database. (Indirect inheritance can be determined
2945 by following chains of entries.)
2949 <title><structname>pg_inherits</> Columns</title>
2956 <entry>References</entry>
2957 <entry>Description</entry>
2963 <entry><structfield>inhrelid</structfield></entry>
2964 <entry><type>oid</type></entry>
2965 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2967 The OID of the child table
2972 <entry><structfield>inhparent</structfield></entry>
2973 <entry><type>oid</type></entry>
2974 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2976 The OID of the parent table
2981 <entry><structfield>inhseqno</structfield></entry>
2982 <entry><type>int4</type></entry>
2985 If there is more than one direct parent for a child table (multiple
2986 inheritance), this number tells the order in which the
2987 inherited columns are to be arranged. The count starts at 1
2997 <sect1 id="catalog-pg-language">
2998 <title><structname>pg_language</structname></title>
3000 <indexterm zone="catalog-pg-language">
3001 <primary>pg_language</primary>
3005 The catalog <structname>pg_language</structname> registers
3006 languages in which you can write functions or stored procedures.
3007 See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
3008 and <xref linkend="xplang"> for more information about language handlers.
3012 <title><structname>pg_language</> Columns</title>
3019 <entry>References</entry>
3020 <entry>Description</entry>
3026 <entry><structfield>lanname</structfield></entry>
3027 <entry><type>name</type></entry>
3029 <entry>Name of the language</entry>
3033 <entry><structfield>lanowner</structfield></entry>
3034 <entry><type>oid</type></entry>
3035 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3036 <entry>Owner of the language</entry>
3040 <entry><structfield>lanispl</structfield></entry>
3041 <entry><type>bool</type></entry>
3044 This is false for internal languages (such as
3045 <acronym>SQL</acronym>) and true for user-defined languages.
3046 Currently, <application>pg_dump</application> still uses this
3047 to determine which languages need to be dumped, but this might be
3048 replaced by a different mechanism in the future
3053 <entry><structfield>lanpltrusted</structfield></entry>
3054 <entry><type>bool</type></entry>
3057 True if this is a trusted language, which means that it is believed
3058 not to grant access to anything outside the normal SQL execution
3059 environment. Only superusers can create functions in untrusted
3065 <entry><structfield>lanplcallfoid</structfield></entry>
3066 <entry><type>oid</type></entry>
3067 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3069 For noninternal languages this references the language
3070 handler, which is a special function that is responsible for
3071 executing all functions that are written in the particular
3077 <entry><structfield>lanvalidator</structfield></entry>
3078 <entry><type>oid</type></entry>
3079 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3081 This references a language validator function that is responsible
3082 for checking the syntax and validity of new functions when they
3083 are created. Zero if no validator is provided
3088 <entry><structfield>lanacl</structfield></entry>
3089 <entry><type>aclitem[]</type></entry>
3092 Access privileges; see
3093 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3094 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3105 <sect1 id="catalog-pg-largeobject">
3106 <title><structname>pg_largeobject</structname></title>
3108 <indexterm zone="catalog-pg-largeobject">
3109 <primary>pg_largeobject</primary>
3113 The catalog <structname>pg_largeobject</structname> holds the data making up
3114 <quote>large objects</quote>. A large object is identified by an
3115 OID assigned when it is created. Each large object is broken into
3116 segments or <quote>pages</> small enough to be conveniently stored as rows
3117 in <structname>pg_largeobject</structname>.
3118 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
3119 <literal>BLCKSZ/4</>, or typically 2 kB).
3123 <title><structname>pg_largeobject</> Columns</title>
3130 <entry>Description</entry>
3136 <entry><structfield>loid</structfield></entry>
3137 <entry><type>oid</type></entry>
3138 <entry>Identifier of the large object that includes this page</entry>
3142 <entry><structfield>pageno</structfield></entry>
3143 <entry><type>int4</type></entry>
3144 <entry>Page number of this page within its large object
3145 (counting from zero)</entry>
3149 <entry><structfield>data</structfield></entry>
3150 <entry><type>bytea</type></entry>
3152 Actual data stored in the large object.
3153 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less
3161 Each row of <structname>pg_largeobject</structname> holds data
3162 for one page of a large object, beginning at
3163 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
3164 allows sparse storage: pages might be missing, and might be shorter than
3165 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
3166 Missing regions within a large object read as zeroes.
3172 <sect1 id="catalog-pg-listener">
3173 <title><structname>pg_listener</structname></title>
3175 <indexterm zone="catalog-pg-listener">
3176 <primary>pg_listener</primary>
3180 The catalog <structname>pg_listener</structname> supports the
3181 <xref linkend="sql-listen" endterm="sql-listen-title"> and
3182 <xref linkend="sql-notify" endterm="sql-notify-title">
3183 commands. A listener creates an entry in
3184 <structname>pg_listener</structname> for each notification name
3185 it is listening for. A notifier scans <structname>pg_listener</structname>
3186 and updates each matching entry to show that a notification has occurred.
3187 The notifier also sends a signal (using the PID recorded in the table)
3188 to awaken the listener from sleep.
3192 <title><structname>pg_listener</> Columns</title>
3199 <entry>References</entry>
3200 <entry>Description</entry>
3206 <entry><structfield>relname</structfield></entry>
3207 <entry><type>name</type></entry>
3209 Notify condition name. (The name need not match any actual
3210 relation in the database; the name <structfield>relname</> is historical.)
3215 <entry><structfield>listenerpid</structfield></entry>
3216 <entry><type>int4</type></entry>
3217 <entry>PID of the server process that created this entry</entry>
3221 <entry><structfield>notification</structfield></entry>
3222 <entry><type>int4</type></entry>
3224 Zero if no event is pending for this listener. If an event is
3225 pending, the PID of the server process that sent the notification
3235 <sect1 id="catalog-pg-namespace">
3236 <title><structname>pg_namespace</structname></title>
3238 <indexterm zone="catalog-pg-namespace">
3239 <primary>pg_namespace</primary>
3243 The catalog <structname>pg_namespace</> stores namespaces.
3244 A namespace is the structure underlying SQL schemas: each namespace
3245 can have a separate collection of relations, types, etc. without name
3250 <title><structname>pg_namespace</> Columns</title>
3257 <entry>References</entry>
3258 <entry>Description</entry>
3264 <entry><structfield>nspname</structfield></entry>
3265 <entry><type>name</type></entry>
3267 <entry>Name of the namespace</entry>
3271 <entry><structfield>nspowner</structfield></entry>
3272 <entry><type>oid</type></entry>
3273 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3274 <entry>Owner of the namespace</entry>
3278 <entry><structfield>nspacl</structfield></entry>
3279 <entry><type>aclitem[]</type></entry>
3282 Access privileges; see
3283 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3284 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3295 <sect1 id="catalog-pg-opclass">
3296 <title><structname>pg_opclass</structname></title>
3298 <indexterm zone="catalog-pg-opclass">
3299 <primary>pg_opclass</primary>
3303 The catalog <structname>pg_opclass</structname> defines
3304 index access method operator classes. Each operator class defines
3305 semantics for index columns of a particular data type and a particular
3306 index access method. An operator class essentially specifies that a
3307 particular operator family is applicable to a particular indexable column
3308 data type. The set of operators from the family that are actually usable
3309 with the indexed column are whichever ones accept the column's data type
3310 as their lefthand input.
3314 Operator classes are described at length in <xref linkend="xindex">.
3318 <title><structname>pg_opclass</> Columns</title>
3325 <entry>References</entry>
3326 <entry>Description</entry>
3332 <entry><structfield>opcmethod</structfield></entry>
3333 <entry><type>oid</type></entry>
3334 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3335 <entry>Index access method operator class is for</entry>
3339 <entry><structfield>opcname</structfield></entry>
3340 <entry><type>name</type></entry>
3342 <entry>Name of this operator class</entry>
3346 <entry><structfield>opcnamespace</structfield></entry>
3347 <entry><type>oid</type></entry>
3348 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3349 <entry>Namespace of this operator class</entry>
3353 <entry><structfield>opcowner</structfield></entry>
3354 <entry><type>oid</type></entry>
3355 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3356 <entry>Owner of the operator class</entry>
3360 <entry><structfield>opcfamily</structfield></entry>
3361 <entry><type>oid</type></entry>
3362 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3363 <entry>Operator family containing the operator class</entry>
3367 <entry><structfield>opcintype</structfield></entry>
3368 <entry><type>oid</type></entry>
3369 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3370 <entry>Data type that the operator class indexes</entry>
3374 <entry><structfield>opcdefault</structfield></entry>
3375 <entry><type>bool</type></entry>
3377 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3381 <entry><structfield>opckeytype</structfield></entry>
3382 <entry><type>oid</type></entry>
3383 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3384 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3392 An operator class's <structfield>opcmethod</> must match the
3393 <structname>opfmethod</> of its containing operator family.
3394 Also, there must be no more than one <structname>pg_opclass</structname>
3395 row having <structname>opcdefault</> true for any given combination of
3396 <structname>opcmethod</> and <structname>opcintype</>.
3402 <sect1 id="catalog-pg-operator">
3403 <title><structname>pg_operator</structname></title>
3405 <indexterm zone="catalog-pg-operator">
3406 <primary>pg_operator</primary>
3410 The catalog <structname>pg_operator</> stores information about operators.
3411 See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
3412 and <xref linkend="xoper"> for more information.
3416 <title><structname>pg_operator</> Columns</title>
3423 <entry>References</entry>
3424 <entry>Description</entry>
3430 <entry><structfield>oprname</structfield></entry>
3431 <entry><type>name</type></entry>
3433 <entry>Name of the operator</entry>
3437 <entry><structfield>oprnamespace</structfield></entry>
3438 <entry><type>oid</type></entry>
3439 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3441 The OID of the namespace that contains this operator
3446 <entry><structfield>oprowner</structfield></entry>
3447 <entry><type>oid</type></entry>
3448 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3449 <entry>Owner of the operator</entry>
3453 <entry><structfield>oprkind</structfield></entry>
3454 <entry><type>char</type></entry>
3457 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3458 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3463 <entry><structfield>oprcanmerge</structfield></entry>
3464 <entry><type>bool</type></entry>
3466 <entry>This operator supports merge joins</entry>
3470 <entry><structfield>oprcanhash</structfield></entry>
3471 <entry><type>bool</type></entry>
3473 <entry>This operator supports hash joins</entry>
3477 <entry><structfield>oprleft</structfield></entry>
3478 <entry><type>oid</type></entry>
3479 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3480 <entry>Type of the left operand</entry>
3484 <entry><structfield>oprright</structfield></entry>
3485 <entry><type>oid</type></entry>
3486 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3487 <entry>Type of the right operand</entry>
3491 <entry><structfield>oprresult</structfield></entry>
3492 <entry><type>oid</type></entry>
3493 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3494 <entry>Type of the result</entry>
3498 <entry><structfield>oprcom</structfield></entry>
3499 <entry><type>oid</type></entry>
3500 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3501 <entry>Commutator of this operator, if any</entry>
3505 <entry><structfield>oprnegate</structfield></entry>
3506 <entry><type>oid</type></entry>
3507 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3508 <entry>Negator of this operator, if any</entry>
3512 <entry><structfield>oprcode</structfield></entry>
3513 <entry><type>regproc</type></entry>
3514 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3515 <entry>Function that implements this operator</entry>
3519 <entry><structfield>oprrest</structfield></entry>
3520 <entry><type>regproc</type></entry>
3521 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3522 <entry>Restriction selectivity estimation function for this operator</entry>
3526 <entry><structfield>oprjoin</structfield></entry>
3527 <entry><type>regproc</type></entry>
3528 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3529 <entry>Join selectivity estimation function for this operator</entry>
3536 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3537 is zero for a prefix operator.
3543 <sect1 id="catalog-pg-opfamily">
3544 <title><structname>pg_opfamily</structname></title>
3546 <indexterm zone="catalog-pg-opfamily">
3547 <primary>pg_opfamily</primary>
3551 The catalog <structname>pg_opfamily</structname> defines operator families.
3552 Each operator family is a collection of operators and associated
3553 support routines that implement the semantics specified for a particular
3554 index access method. Furthermore, the operators in a family are all
3555 <quote>compatible</>, in a way that is specified by the access method.
3556 The operator family concept allows cross-data-type operators to be used
3557 with indexes and to be reasoned about using knowledge of access method
3562 Operator families are described at length in <xref linkend="xindex">.
3566 <title><structname>pg_opfamily</> Columns</title>
3573 <entry>References</entry>
3574 <entry>Description</entry>
3580 <entry><structfield>opfmethod</structfield></entry>
3581 <entry><type>oid</type></entry>
3582 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3583 <entry>Index access method operator family is for</entry>
3587 <entry><structfield>opfname</structfield></entry>
3588 <entry><type>name</type></entry>
3590 <entry>Name of this operator family</entry>
3594 <entry><structfield>opfnamespace</structfield></entry>
3595 <entry><type>oid</type></entry>
3596 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3597 <entry>Namespace of this operator family</entry>
3601 <entry><structfield>opfowner</structfield></entry>
3602 <entry><type>oid</type></entry>
3603 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3604 <entry>Owner of the operator family</entry>
3612 The majority of the information defining an operator family is not in its
3613 <structname>pg_opfamily</structname> row, but in the associated rows in
3614 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3615 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3617 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3623 <sect1 id="catalog-pg-pltemplate">
3624 <title><structname>pg_pltemplate</structname></title>
3626 <indexterm zone="catalog-pg-pltemplate">
3627 <primary>pg_pltemplate</primary>
3631 The catalog <structname>pg_pltemplate</structname> stores
3632 <quote>template</> information for procedural languages.
3633 A template for a language allows the language to be created in a
3634 particular database by a simple <command>CREATE LANGUAGE</> command,
3635 with no need to specify implementation details.
3639 Unlike most system catalogs, <structname>pg_pltemplate</structname>
3640 is shared across all databases of a cluster: there is only one
3641 copy of <structname>pg_pltemplate</structname> per cluster, not
3642 one per database. This allows the information to be accessible in
3643 each database as it is needed.
3647 <title><structname>pg_pltemplate</> Columns</title>
3654 <entry>Description</entry>
3660 <entry><structfield>tmplname</structfield></entry>
3661 <entry><type>name</type></entry>
3662 <entry>Name of the language this template is for</entry>
3666 <entry><structfield>tmpltrusted</structfield></entry>
3667 <entry><type>boolean</type></entry>
3668 <entry>True if language is considered trusted</entry>
3672 <entry><structfield>tmpldbacreate</structfield></entry>
3673 <entry><type>boolean</type></entry>
3674 <entry>True if language may be created by a database owner</entry>
3678 <entry><structfield>tmplhandler</structfield></entry>
3679 <entry><type>text</type></entry>
3680 <entry>Name of call handler function</entry>
3684 <entry><structfield>tmplvalidator</structfield></entry>
3685 <entry><type>text</type></entry>
3686 <entry>Name of validator function, or NULL if none</entry>
3690 <entry><structfield>tmpllibrary</structfield></entry>
3691 <entry><type>text</type></entry>
3692 <entry>Path of shared library that implements language</entry>
3696 <entry><structfield>tmplacl</structfield></entry>
3697 <entry><type>aclitem[]</type></entry>
3698 <entry>Access privileges for template (not yet used)</entry>
3706 There are not currently any commands that manipulate procedural language
3707 templates; to change the built-in information, a superuser must modify
3708 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3709 or <command>UPDATE</command> commands. It is likely that a future
3710 release of <productname>PostgreSQL</productname> will offer
3711 commands to change the entries in a cleaner fashion.
3715 When implemented, the <structfield>tmplacl</structfield> field will provide
3716 access control for the template itself (i.e., the right to create a
3717 language using it), not for the languages created from the template.
3723 <sect1 id="catalog-pg-proc">
3724 <title><structname>pg_proc</structname></title>
3726 <indexterm zone="catalog-pg-proc">
3727 <primary>pg_proc</primary>
3731 The catalog <structname>pg_proc</> stores information about functions (or procedures).
3732 See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
3733 and <xref linkend="xfunc"> for more information.
3737 The table contains data for aggregate functions as well as plain functions.
3738 If <structfield>proisagg</structfield> is true, there should be a matching
3739 row in <structfield>pg_aggregate</structfield>.
3743 <title><structname>pg_proc</> Columns</title>
3750 <entry>References</entry>
3751 <entry>Description</entry>
3757 <entry><structfield>proname</structfield></entry>
3758 <entry><type>name</type></entry>
3760 <entry>Name of the function</entry>
3764 <entry><structfield>pronamespace</structfield></entry>
3765 <entry><type>oid</type></entry>
3766 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3768 The OID of the namespace that contains this function
3773 <entry><structfield>proowner</structfield></entry>
3774 <entry><type>oid</type></entry>
3775 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3776 <entry>Owner of the function</entry>
3780 <entry><structfield>prolang</structfield></entry>
3781 <entry><type>oid</type></entry>
3782 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3783 <entry>Implementation language or call interface of this function</entry>
3787 <entry><structfield>procost</structfield></entry>
3788 <entry><type>float4</type></entry>
3790 <entry>Estimated execution cost (in units of
3791 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3792 this is cost per row returned</entry>
3796 <entry><structfield>prorows</structfield></entry>
3797 <entry><type>float4</type></entry>
3799 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3803 <entry><structfield>provariadic</structfield></entry>
3804 <entry><type>oid</type></entry>
3805 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3806 <entry>Data type of the variadic array parameter's elements,
3807 or zero if the function does not have a variadic parameter</entry>
3811 <entry><structfield>proisagg</structfield></entry>
3812 <entry><type>bool</type></entry>
3814 <entry>Function is an aggregate function</entry>
3818 <entry><structfield>proiswindow</structfield></entry>
3819 <entry><type>bool</type></entry>
3821 <entry>Function is a window function</entry>
3825 <entry><structfield>prosecdef</structfield></entry>
3826 <entry><type>bool</type></entry>
3828 <entry>Function is a security definer (i.e., a <quote>setuid</>
3833 <entry><structfield>proisstrict</structfield></entry>
3834 <entry><type>bool</type></entry>
3837 Function returns null if any call argument is null. In that
3838 case the function won't actually be called at all. Functions
3839 that are not <quote>strict</quote> must be prepared to handle
3845 <entry><structfield>proretset</structfield></entry>
3846 <entry><type>bool</type></entry>
3848 <entry>Function returns a set (i.e., multiple values of the specified
3853 <entry><structfield>provolatile</structfield></entry>
3854 <entry><type>char</type></entry>
3857 <structfield>provolatile</structfield> tells whether the function's
3858 result depends only on its input arguments, or is affected by outside
3860 It is <literal>i</literal> for <quote>immutable</> functions,
3861 which always deliver the same result for the same inputs.
3862 It is <literal>s</literal> for <quote>stable</> functions,
3863 whose results (for fixed inputs) do not change within a scan.
3864 It is <literal>v</literal> for <quote>volatile</> functions,
3865 whose results might change at any time. (Use <literal>v</literal> also
3866 for functions with side-effects, so that calls to them cannot get
3872 <entry><structfield>pronargs</structfield></entry>
3873 <entry><type>int2</type></entry>
3875 <entry>Number of input arguments</entry>
3879 <entry><structfield>pronargdefaults</structfield></entry>
3880 <entry><type>int2</type></entry>
3882 <entry>Number of arguments that have defaults</entry>
3886 <entry><structfield>prorettype</structfield></entry>
3887 <entry><type>oid</type></entry>
3888 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3889 <entry>Data type of the return value</entry>
3893 <entry><structfield>proargtypes</structfield></entry>
3894 <entry><type>oidvector</type></entry>
3895 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3897 An array with the data types of the function arguments. This includes
3898 only input arguments (including <literal>INOUT</literal> and
3899 <literal>VARIADIC</> arguments), and thus represents
3900 the call signature of the function
3905 <entry><structfield>proallargtypes</structfield></entry>
3906 <entry><type>oid[]</type></entry>
3907 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3909 An array with the data types of the function arguments. This includes
3910 all arguments (including <literal>OUT</literal> and
3911 <literal>INOUT</literal> arguments); however, if all the
3912 arguments are <literal>IN</literal> arguments, this field will be null.
3913 Note that subscripting is 1-based, whereas for historical reasons
3914 <structfield>proargtypes</> is subscripted from 0
3919 <entry><structfield>proargmodes</structfield></entry>
3920 <entry><type>char[]</type></entry>
3923 An array with the modes of the function arguments, encoded as
3924 <literal>i</literal> for <literal>IN</> arguments,
3925 <literal>o</literal> for <literal>OUT</> arguments,
3926 <literal>b</literal> for <literal>INOUT</> arguments,
3927 <literal>v</literal> for <literal>VARIADIC</> arguments,
3928 <literal>t</literal> for <literal>TABLE</> arguments.
3929 If all the arguments are <literal>IN</literal> arguments,
3930 this field will be null.
3931 Note that subscripts correspond to positions of
3932 <structfield>proallargtypes</> not <structfield>proargtypes</>
3937 <entry><structfield>proargnames</structfield></entry>
3938 <entry><type>text[]</type></entry>
3941 An array with the names of the function arguments.
3942 Arguments without a name are set to empty strings in the array.
3943 If none of the arguments have a name, this field will be null.
3944 Note that subscripts correspond to positions of
3945 <structfield>proallargtypes</> not <structfield>proargtypes</>
3950 <entry><structfield>proargdefaults</structfield></entry>
3951 <entry><type>text</type></entry>
3954 Expression trees (in <function>nodeToString()</function> representation)
3955 for default values. This is a list with
3956 <structfield>pronargdefaults</> elements, corresponding to the last
3957 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
3958 <replaceable>N</> <structfield>proargtypes</> positions).
3959 If none of the arguments have defaults, this field will be null
3964 <entry><structfield>prosrc</structfield></entry>
3965 <entry><type>text</type></entry>
3968 This tells the function handler how to invoke the function. It
3969 might be the actual source code of the function for interpreted
3970 languages, a link symbol, a file name, or just about anything
3971 else, depending on the implementation language/call convention
3976 <entry><structfield>probin</structfield></entry>
3977 <entry><type>bytea</type></entry>
3980 Additional information about how to invoke the function.
3981 Again, the interpretation is language-specific
3986 <entry><structfield>proconfig</structfield></entry>
3987 <entry><type>text[]</type></entry>
3989 <entry>Function's local settings for run-time configuration variables</entry>
3993 <entry><structfield>proacl</structfield></entry>
3994 <entry><type>aclitem[]</type></entry>
3997 Access privileges; see
3998 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3999 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4008 For compiled functions, both built-in and dynamically loaded,
4009 <structfield>prosrc</structfield> contains the function's C-language
4010 name (link symbol). For all other currently-known language types,
4011 <structfield>prosrc</structfield> contains the function's source
4012 text. <structfield>probin</structfield> is unused except for
4013 dynamically-loaded C functions, for which it gives the name of the
4014 shared library file containing the function.
4019 <sect1 id="catalog-pg-rewrite">
4020 <title><structname>pg_rewrite</structname></title>
4022 <indexterm zone="catalog-pg-rewrite">
4023 <primary>pg_rewrite</primary>
4027 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
4031 <title><structname>pg_rewrite</> Columns</title>
4038 <entry>References</entry>
4039 <entry>Description</entry>
4045 <entry><structfield>rulename</structfield></entry>
4046 <entry><type>name</type></entry>
4048 <entry>Rule name</entry>
4052 <entry><structfield>ev_class</structfield></entry>
4053 <entry><type>oid</type></entry>
4054 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4055 <entry>The table this rule is for</entry>
4059 <entry><structfield>ev_attr</structfield></entry>
4060 <entry><type>int2</type></entry>
4062 <entry>The column this rule is for (currently, always zero to
4063 indicate the whole table)</entry>
4067 <entry><structfield>ev_type</structfield></entry>
4068 <entry><type>char</type></entry>
4071 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
4072 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
4078 <entry><structfield>ev_enabled</structfield></entry>
4079 <entry><type>char</type></entry>
4082 Controls in which <xref linkend="guc-session-replication-role"> modes
4084 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
4085 <literal>D</> = rule is disabled,
4086 <literal>R</> = rule fires in <quote>replica</> mode,
4087 <literal>A</> = rule fires always.
4092 <entry><structfield>is_instead</structfield></entry>
4093 <entry><type>bool</type></entry>
4095 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
4099 <entry><structfield>ev_qual</structfield></entry>
4100 <entry><type>text</type></entry>
4103 Expression tree (in the form of a
4104 <function>nodeToString()</function> representation) for the
4105 rule's qualifying condition
4110 <entry><structfield>ev_action</structfield></entry>
4111 <entry><type>text</type></entry>
4114 Query tree (in the form of a
4115 <function>nodeToString()</function> representation) for the
4125 <literal>pg_class.relhasrules</literal>
4126 must be true if a table has any rules in this catalog.
4133 <sect1 id="catalog-pg-shdepend">
4134 <title><structname>pg_shdepend</structname></title>
4136 <indexterm zone="catalog-pg-shdepend">
4137 <primary>pg_shdepend</primary>
4141 The catalog <structname>pg_shdepend</structname> records the
4142 dependency relationships between database objects and shared objects,
4143 such as roles. This information allows
4144 <productname>PostgreSQL</productname> to ensure that those objects are
4145 unreferenced before attempting to delete them.
4149 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
4150 which performs a similar function for dependencies involving objects
4151 within a single database.
4155 Unlike most system catalogs, <structname>pg_shdepend</structname>
4156 is shared across all databases of a cluster: there is only one
4157 copy of <structname>pg_shdepend</structname> per cluster, not
4162 <title><structname>pg_shdepend</> Columns</title>
4169 <entry>References</entry>
4170 <entry>Description</entry>
4176 <entry><structfield>dbid</structfield></entry>
4177 <entry><type>oid</type></entry>
4178 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
4179 <entry>The OID of the database the dependent object is in,
4180 or zero for a shared object</entry>
4184 <entry><structfield>classid</structfield></entry>
4185 <entry><type>oid</type></entry>
4186 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4187 <entry>The OID of the system catalog the dependent object is in</entry>
4191 <entry><structfield>objid</structfield></entry>
4192 <entry><type>oid</type></entry>
4193 <entry>any OID column</entry>
4194 <entry>The OID of the specific dependent object</entry>
4198 <entry><structfield>objsubid</structfield></entry>
4199 <entry><type>int4</type></entry>
4202 For a table column, this is the column number (the
4203 <structfield>objid</> and <structfield>classid</> refer to the
4204 table itself). For all other object types, this column is zero
4209 <entry><structfield>refclassid</structfield></entry>
4210 <entry><type>oid</type></entry>
4211 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4212 <entry>The OID of the system catalog the referenced object is in
4213 (must be a shared catalog)</entry>
4217 <entry><structfield>refobjid</structfield></entry>
4218 <entry><type>oid</type></entry>
4219 <entry>any OID column</entry>
4220 <entry>The OID of the specific referenced object</entry>
4224 <entry><structfield>deptype</structfield></entry>
4225 <entry><type>char</type></entry>
4228 A code defining the specific semantics of this dependency relationship; see text
4237 In all cases, a <structname>pg_shdepend</structname> entry indicates that
4238 the referenced object cannot be dropped without also dropping the dependent
4239 object. However, there are several subflavors identified by
4240 <structfield>deptype</>:
4244 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
4247 The referenced object (which must be a role) is the owner of the
4254 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
4257 The referenced object (which must be a role) is mentioned in the
4258 ACL (access control list, i.e., privileges list) of the
4259 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
4260 not made for the owner of the object, since the owner will have
4261 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
4267 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
4270 There is no dependent object; this type of entry is a signal
4271 that the system itself depends on the referenced object, and so
4272 that object must never be deleted. Entries of this type are
4273 created only by <command>initdb</command>. The columns for the
4274 dependent object contain zeroes.
4280 Other dependency flavors might be needed in future. Note in particular
4281 that the current definition only supports roles as referenced objects.
4286 <sect1 id="catalog-pg-shdescription">
4287 <title><structname>pg_shdescription</structname></title>
4289 <indexterm zone="catalog-pg-shdescription">
4290 <primary>pg_shdescription</primary>
4294 The catalog <structname>pg_shdescription</structname> stores optional
4295 descriptions (comments) for shared database objects. Descriptions can be
4296 manipulated with the <xref linkend="sql-comment"
4297 endterm="sql-comment-title"> command and viewed with
4298 <application>psql</application>'s <literal>\d</literal> commands.
4302 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4303 which performs a similar function for descriptions involving objects
4304 within a single database.
4308 Unlike most system catalogs, <structname>pg_shdescription</structname>
4309 is shared across all databases of a cluster: there is only one
4310 copy of <structname>pg_shdescription</structname> per cluster, not
4315 <title><structname>pg_shdescription</> Columns</title>
4322 <entry>References</entry>
4323 <entry>Description</entry>
4329 <entry><structfield>objoid</structfield></entry>
4330 <entry><type>oid</type></entry>
4331 <entry>any OID column</entry>
4332 <entry>The OID of the object this description pertains to</entry>
4336 <entry><structfield>classoid</structfield></entry>
4337 <entry><type>oid</type></entry>
4338 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4339 <entry>The OID of the system catalog this object appears in</entry>
4343 <entry><structfield>description</structfield></entry>
4344 <entry><type>text</type></entry>
4346 <entry>Arbitrary text that serves as the description of this object</entry>
4355 <sect1 id="catalog-pg-statistic">
4356 <title><structname>pg_statistic</structname></title>
4358 <indexterm zone="catalog-pg-statistic">
4359 <primary>pg_statistic</primary>
4363 The catalog <structname>pg_statistic</structname> stores
4364 statistical data about the contents of the database. Entries are
4365 created by <xref linkend="sql-analyze" endterm="sql-analyze-title">
4366 and subsequently used by the query planner. There is one entry for
4367 each table column that has been analyzed. Note that all the
4368 statistical data is inherently approximate, even assuming that it
4373 <structname>pg_statistic</structname> also stores statistical data about
4374 the values of index expressions. These are described as if they were
4375 actual data columns; in particular, <structfield>starelid</structfield>
4376 references the index. No entry is made for an ordinary non-expression
4377 index column, however, since it would be redundant with the entry
4378 for the underlying table column.
4382 Since different kinds of statistics might be appropriate for different
4383 kinds of data, <structname>pg_statistic</structname> is designed not
4384 to assume very much about what sort of statistics it stores. Only
4385 extremely general statistics (such as nullness) are given dedicated
4386 columns in <structname>pg_statistic</structname>. Everything else
4387 is stored in <quote>slots</quote>, which are groups of associated columns
4388 whose content is identified by a code number in one of the slot's columns.
4389 For more information see
4390 <filename>src/include/catalog/pg_statistic.h</filename>.
4394 <structname>pg_statistic</structname> should not be readable by the
4395 public, since even statistical information about a table's contents
4396 might be considered sensitive. (Example: minimum and maximum values
4397 of a salary column might be quite interesting.)
4398 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4399 is a publicly readable view on
4400 <structname>pg_statistic</structname> that only exposes information
4401 about those tables that are readable by the current user.
4405 <title><structname>pg_statistic</> Columns</title>
4412 <entry>References</entry>
4413 <entry>Description</entry>
4419 <entry><structfield>starelid</structfield></entry>
4420 <entry><type>oid</type></entry>
4421 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4422 <entry>The table or index that the described column belongs to</entry>
4426 <entry><structfield>staattnum</structfield></entry>
4427 <entry><type>int2</type></entry>
4428 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4429 <entry>The number of the described column</entry>
4433 <entry><structfield>stanullfrac</structfield></entry>
4434 <entry><type>float4</type></entry>
4436 <entry>The fraction of the column's entries that are null</entry>
4440 <entry><structfield>stawidth</structfield></entry>
4441 <entry><type>int4</type></entry>
4443 <entry>The average stored width, in bytes, of nonnull entries</entry>
4447 <entry><structfield>stadistinct</structfield></entry>
4448 <entry><type>float4</type></entry>
4450 <entry>The number of distinct nonnull data values in the column.
4451 A value greater than zero is the actual number of distinct values.
4452 A value less than zero is the negative of a fraction of the number
4453 of rows in the table (for example, a column in which values appear about
4454 twice on the average could be represented by <structfield>stadistinct</> = -0.5).
4455 A zero value means the number of distinct values is unknown
4460 <entry><structfield>stakind<replaceable>N</></structfield></entry>
4461 <entry><type>int2</type></entry>
4464 A code number indicating the kind of statistics stored in the
4465 <replaceable>N</>th <quote>slot</quote> of the
4466 <structname>pg_statistic</structname> row
4471 <entry><structfield>staop<replaceable>N</></structfield></entry>
4472 <entry><type>oid</type></entry>
4473 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4475 An operator used to derive the statistics stored in the
4476 <replaceable>N</>th <quote>slot</quote>. For example, a
4477 histogram slot would show the <literal><</literal> operator
4478 that defines the sort order of the data
4483 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4484 <entry><type>float4[]</type></entry>
4487 Numerical statistics of the appropriate kind for the
4488 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4489 kind does not involve numerical values
4494 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4495 <entry><type>anyarray</type></entry>
4498 Column data values of the appropriate kind for the
4499 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4500 kind does not store any data values. Each array's element
4501 values are actually of the specific column's data type, so there
4502 is no way to define these columns' type more specifically than
4513 <sect1 id="catalog-pg-tablespace">
4514 <title><structname>pg_tablespace</structname></title>
4516 <indexterm zone="catalog-pg-tablespace">
4517 <primary>pg_tablespace</primary>
4521 The catalog <structname>pg_tablespace</structname> stores information
4522 about the available tablespaces. Tables can be placed in particular
4523 tablespaces to aid administration of disk layout.
4527 Unlike most system catalogs, <structname>pg_tablespace</structname>
4528 is shared across all databases of a cluster: there is only one
4529 copy of <structname>pg_tablespace</structname> per cluster, not
4534 <title><structname>pg_tablespace</> Columns</title>
4541 <entry>References</entry>
4542 <entry>Description</entry>
4548 <entry><structfield>spcname</structfield></entry>
4549 <entry><type>name</type></entry>
4551 <entry>Tablespace name</entry>
4555 <entry><structfield>spcowner</structfield></entry>
4556 <entry><type>oid</type></entry>
4557 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4558 <entry>Owner of the tablespace, usually the user who created it</entry>
4562 <entry><structfield>spclocation</structfield></entry>
4563 <entry><type>text</type></entry>
4565 <entry>Location (directory path) of the tablespace</entry>
4569 <entry><structfield>spcacl</structfield></entry>
4570 <entry><type>aclitem[]</type></entry>
4573 Access privileges; see
4574 <xref linkend="sql-grant" endterm="sql-grant-title"> and
4575 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4585 <sect1 id="catalog-pg-trigger">
4586 <title><structname>pg_trigger</structname></title>
4588 <indexterm zone="catalog-pg-trigger">
4589 <primary>pg_trigger</primary>
4593 The catalog <structname>pg_trigger</structname> stores triggers on tables.
4594 See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
4595 for more information.
4599 <title><structname>pg_trigger</> Columns</title>
4606 <entry>References</entry>
4607 <entry>Description</entry>
4613 <entry><structfield>tgrelid</structfield></entry>
4614 <entry><type>oid</type></entry>
4615 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4616 <entry>The table this trigger is on</entry>
4620 <entry><structfield>tgname</structfield></entry>
4621 <entry><type>name</type></entry>
4623 <entry>Trigger name (must be unique among triggers of same table)</entry>
4627 <entry><structfield>tgfoid</structfield></entry>
4628 <entry><type>oid</type></entry>
4629 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4630 <entry>The function to be called</entry>
4634 <entry><structfield>tgtype</structfield></entry>
4635 <entry><type>int2</type></entry>
4637 <entry>Bit mask identifying trigger conditions</entry>
4641 <entry><structfield>tgenabled</structfield></entry>
4642 <entry><type>char</type></entry>
4645 Controls in which <xref linkend="guc-session-replication-role"> modes
4647 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4648 <literal>D</> = trigger is disabled,
4649 <literal>R</> = trigger fires in <quote>replica</> mode,
4650 <literal>A</> = trigger fires always.
4655 <entry><structfield>tgisconstraint</structfield></entry>
4656 <entry><type>bool</type></entry>
4658 <entry>True if trigger is a <quote>constraint trigger</></entry>
4662 <entry><structfield>tgconstrname</structfield></entry>
4663 <entry><type>name</type></entry>
4665 <entry>Constraint name, if a constraint trigger</entry>
4669 <entry><structfield>tgconstrrelid</structfield></entry>
4670 <entry><type>oid</type></entry>
4671 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4672 <entry>The table referenced by a referential integrity constraint</entry>
4676 <entry><structfield>tgconstraint</structfield></entry>
4677 <entry><type>oid</type></entry>
4678 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4679 <entry>The <structname>pg_constraint</> entry owning the trigger, if any</entry>
4683 <entry><structfield>tgdeferrable</structfield></entry>
4684 <entry><type>bool</type></entry>
4686 <entry>True if constraint trigger is deferrable</entry>
4690 <entry><structfield>tginitdeferred</structfield></entry>
4691 <entry><type>bool</type></entry>
4693 <entry>True if constraint trigger is initially deferred</entry>
4697 <entry><structfield>tgnargs</structfield></entry>
4698 <entry><type>int2</type></entry>
4700 <entry>Number of argument strings passed to trigger function</entry>
4704 <entry><structfield>tgattr</structfield></entry>
4705 <entry><type>int2vector</type></entry>
4707 <entry>Currently unused</entry>
4711 <entry><structfield>tgargs</structfield></entry>
4712 <entry><type>bytea</type></entry>
4714 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4722 When <structfield>tgconstraint</> is nonzero,
4723 <structfield>tgisconstraint</> must be true, and
4724 <structfield>tgconstrname</>, <structfield>tgconstrrelid</>,
4725 <structfield>tgdeferrable</>, <structfield>tginitdeferred</> are redundant
4726 with the referenced <structname>pg_constraint</> entry. The reason we
4727 keep these fields is that we support <quote>stand-alone</> constraint
4728 triggers with no corresponding <structname>pg_constraint</> entry.
4734 <literal>pg_class.relhastriggers</literal>
4735 must be true if a table has any triggers in this catalog.
4742 <sect1 id="catalog-pg-ts-config">
4743 <title><structname>pg_ts_config</structname></title>
4745 <indexterm zone="catalog-pg-ts-config">
4746 <primary>pg_ts_config</primary>
4750 The <structname>pg_ts_config</structname> catalog contains entries
4751 representing text search configurations. A configuration specifies
4752 a particular text search parser and a list of dictionaries to use
4753 for each of the parser's output token types. The parser is shown
4754 in the <structname>pg_ts_config</structname> entry, but the
4755 token-to-dictionary mapping is defined by subsidiary entries in <link
4756 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4760 <productname>PostgreSQL</productname>'s text search features are
4761 described at length in <xref linkend="textsearch">.
4765 <title><structname>pg_ts_config</> Columns</title>
4772 <entry>References</entry>
4773 <entry>Description</entry>
4779 <entry><structfield>cfgname</structfield></entry>
4780 <entry><type>name</type></entry>
4782 <entry>Text search configuration name</entry>
4786 <entry><structfield>cfgnamespace</structfield></entry>
4787 <entry><type>oid</type></entry>
4788 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4790 The OID of the namespace that contains this configuration
4795 <entry><structfield>cfgowner</structfield></entry>
4796 <entry><type>oid</type></entry>
4797 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4798 <entry>Owner of the configuration</entry>
4802 <entry><structfield>cfgparser</structfield></entry>
4803 <entry><type>oid</type></entry>
4804 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4805 <entry>The OID of the text search parser for this configuration</entry>
4813 <sect1 id="catalog-pg-ts-config-map">
4814 <title><structname>pg_ts_config_map</structname></title>
4816 <indexterm zone="catalog-pg-ts-config-map">
4817 <primary>pg_ts_config_map</primary>
4821 The <structname>pg_ts_config_map</structname> catalog contains entries
4822 showing which text search dictionaries should be consulted, and in
4823 what order, for each output token type of each text search configuration's
4828 <productname>PostgreSQL</productname>'s text search features are
4829 described at length in <xref linkend="textsearch">.
4833 <title><structname>pg_ts_config_map</> Columns</title>
4840 <entry>References</entry>
4841 <entry>Description</entry>
4847 <entry><structfield>mapcfg</structfield></entry>
4848 <entry><type>oid</type></entry>
4849 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4850 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
4854 <entry><structfield>maptokentype</structfield></entry>
4855 <entry><type>integer</type></entry>
4857 <entry>A token type emitted by the configuration's parser</entry>
4861 <entry><structfield>mapseqno</structfield></entry>
4862 <entry><type>integer</type></entry>
4864 <entry>Order in which to consult this entry (lower
4865 <structfield>mapseqno</>s first)</entry>
4869 <entry><structfield>mapdict</structfield></entry>
4870 <entry><type>oid</type></entry>
4871 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
4872 <entry>The OID of the text search dictionary to consult</entry>
4880 <sect1 id="catalog-pg-ts-dict">
4881 <title><structname>pg_ts_dict</structname></title>
4883 <indexterm zone="catalog-pg-ts-dict">
4884 <primary>pg_ts_dict</primary>
4888 The <structname>pg_ts_dict</structname> catalog contains entries
4889 defining text search dictionaries. A dictionary depends on a text
4890 search template, which specifies all the implementation functions
4891 needed; the dictionary itself provides values for the user-settable
4892 parameters supported by the template. This division of labor allows
4893 dictionaries to be created by unprivileged users. The parameters
4894 are specified by a text string <structfield>dictinitoption</>,
4895 whose format and meaning vary depending on the template.
4899 <productname>PostgreSQL</productname>'s text search features are
4900 described at length in <xref linkend="textsearch">.
4904 <title><structname>pg_ts_dict</> Columns</title>
4911 <entry>References</entry>
4912 <entry>Description</entry>
4918 <entry><structfield>dictname</structfield></entry>
4919 <entry><type>name</type></entry>
4921 <entry>Text search dictionary name</entry>
4925 <entry><structfield>dictnamespace</structfield></entry>
4926 <entry><type>oid</type></entry>
4927 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4929 The OID of the namespace that contains this dictionary
4934 <entry><structfield>dictowner</structfield></entry>
4935 <entry><type>oid</type></entry>
4936 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4937 <entry>Owner of the dictionary</entry>
4941 <entry><structfield>dicttemplate</structfield></entry>
4942 <entry><type>oid</type></entry>
4943 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
4944 <entry>The OID of the text search template for this dictionary</entry>
4948 <entry><structfield>dictinitoption</structfield></entry>
4949 <entry><type>text</type></entry>
4951 <entry>Initialization option string for the template</entry>
4959 <sect1 id="catalog-pg-ts-parser">
4960 <title><structname>pg_ts_parser</structname></title>
4962 <indexterm zone="catalog-pg-ts-parser">
4963 <primary>pg_ts_parser</primary>
4967 The <structname>pg_ts_parser</structname> catalog contains entries
4968 defining text search parsers. A parser is responsible for splitting
4969 input text into lexemes and assigning a token type to each lexeme.
4970 Since a parser must be implemented by C-language-level functions,
4971 creation of new parsers is restricted to database superusers.
4975 <productname>PostgreSQL</productname>'s text search features are
4976 described at length in <xref linkend="textsearch">.
4980 <title><structname>pg_ts_parser</> Columns</title>
4987 <entry>References</entry>
4988 <entry>Description</entry>
4994 <entry><structfield>prsname</structfield></entry>
4995 <entry><type>name</type></entry>
4997 <entry>Text search parser name</entry>
5001 <entry><structfield>prsnamespace</structfield></entry>
5002 <entry><type>oid</type></entry>
5003 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5005 The OID of the namespace that contains this parser
5010 <entry><structfield>prsstart</structfield></entry>
5011 <entry><type>regproc</type></entry>
5012 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5013 <entry>OID of the parser's startup function</entry>
5017 <entry><structfield>prstoken</structfield></entry>
5018 <entry><type>regproc</type></entry>
5019 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5020 <entry>OID of the parser's next-token function</entry>
5024 <entry><structfield>prsend</structfield></entry>
5025 <entry><type>regproc</type></entry>
5026 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5027 <entry>OID of the parser's shutdown function</entry>
5031 <entry><structfield>prsheadline</structfield></entry>
5032 <entry><type>regproc</type></entry>
5033 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5034 <entry>OID of the parser's headline function</entry>
5038 <entry><structfield>prslextype</structfield></entry>
5039 <entry><type>regproc</type></entry>
5040 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5041 <entry>OID of the parser's lextype function</entry>
5049 <sect1 id="catalog-pg-ts-template">
5050 <title><structname>pg_ts_template</structname></title>
5052 <indexterm zone="catalog-pg-ts-template">
5053 <primary>pg_ts_template</primary>
5057 The <structname>pg_ts_template</structname> catalog contains entries
5058 defining text search templates. A template is the implementation
5059 skeleton for a class of text search dictionaries.
5060 Since a template must be implemented by C-language-level functions,
5061 creation of new templates is restricted to database superusers.
5065 <productname>PostgreSQL</productname>'s text search features are
5066 described at length in <xref linkend="textsearch">.
5070 <title><structname>pg_ts_template</> Columns</title>
5077 <entry>References</entry>
5078 <entry>Description</entry>
5084 <entry><structfield>tmplname</structfield></entry>
5085 <entry><type>name</type></entry>
5087 <entry>Text search template name</entry>
5091 <entry><structfield>tmplnamespace</structfield></entry>
5092 <entry><type>oid</type></entry>
5093 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5095 The OID of the namespace that contains this template
5100 <entry><structfield>tmplinit</structfield></entry>
5101 <entry><type>regproc</type></entry>
5102 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5103 <entry>OID of the template's initialization function</entry>
5107 <entry><structfield>tmpllexize</structfield></entry>
5108 <entry><type>regproc</type></entry>
5109 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5110 <entry>OID of the template's lexize function</entry>
5118 <sect1 id="catalog-pg-type">
5119 <title><structname>pg_type</structname></title>
5121 <indexterm zone="catalog-pg-type">
5122 <primary>pg_type</primary>
5126 The catalog <structname>pg_type</structname> stores information about data
5127 types. Base types and enum types (scalar types) are created with
5128 <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
5130 <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
5131 A composite type is automatically created for each table in the database, to
5132 represent the row structure of the table. It is also possible to create
5133 composite types with <command>CREATE TYPE AS</command>.
5137 <title><structname>pg_type</> Columns</title>
5144 <entry>References</entry>
5145 <entry>Description</entry>
5151 <entry><structfield>typname</structfield></entry>
5152 <entry><type>name</type></entry>
5154 <entry>Data type name</entry>
5158 <entry><structfield>typnamespace</structfield></entry>
5159 <entry><type>oid</type></entry>
5160 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5162 The OID of the namespace that contains this type
5167 <entry><structfield>typowner</structfield></entry>
5168 <entry><type>oid</type></entry>
5169 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5170 <entry>Owner of the type</entry>
5174 <entry><structfield>typlen</structfield></entry>
5175 <entry><type>int2</type></entry>
5178 For a fixed-size type, <structfield>typlen</structfield> is the number
5179 of bytes in the internal representation of the type. But for a
5180 variable-length type, <structfield>typlen</structfield> is negative.
5181 -1 indicates a <quote>varlena</> type (one that has a length word),
5182 -2 indicates a null-terminated C string.
5187 <entry><structfield>typbyval</structfield></entry>
5188 <entry><type>bool</type></entry>
5191 <structfield>typbyval</structfield> determines whether internal
5192 routines pass a value of this type by value or by reference.
5193 <structfield>typbyval</structfield> had better be false if
5194 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
5195 where Datum is 8 bytes).
5196 Variable-length types are always passed by reference. Note that
5197 <structfield>typbyval</structfield> can be false even if the
5198 length would allow pass-by-value
5203 <entry><structfield>typtype</structfield></entry>
5204 <entry><type>char</type></entry>
5207 <structfield>typtype</structfield> is
5208 <literal>b</literal> for a base type,
5209 <literal>c</literal> for a composite type (e.g., a table's row type),
5210 <literal>d</literal> for a domain,
5211 <literal>e</literal> for an enum type,
5212 or <literal>p</literal> for a pseudo-type.
5213 See also <structfield>typrelid</structfield> and
5214 <structfield>typbasetype</structfield>
5219 <entry><structfield>typcategory</structfield></entry>
5220 <entry><type>char</type></entry>
5223 <structfield>typcategory</structfield> is an arbitrary classification
5224 of data types that is used by the parser to determine which implicit
5225 casts should be <quote>preferred</>.
5226 See <xref linkend="catalog-typcategory-table">
5231 <entry><structfield>typispreferred</structfield></entry>
5232 <entry><type>bool</type></entry>
5235 True if the type is a preferred cast target within its
5236 <structfield>typcategory</structfield>
5241 <entry><structfield>typisdefined</structfield></entry>
5242 <entry><type>bool</type></entry>
5245 True if the type is defined, false if this is a placeholder
5246 entry for a not-yet-defined type. When
5247 <structfield>typisdefined</structfield> is false, nothing
5248 except the type name, namespace, and OID can be relied on
5253 <entry><structfield>typdelim</structfield></entry>
5254 <entry><type>char</type></entry>
5257 Character that separates two values of this type when parsing
5258 array input. Note that the delimiter is associated with the array
5259 element data type, not the array data type
5264 <entry><structfield>typrelid</structfield></entry>
5265 <entry><type>oid</type></entry>
5266 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5268 If this is a composite type (see
5269 <structfield>typtype</structfield>), then this column points to
5270 the <structname>pg_class</structname> entry that defines the
5271 corresponding table. (For a free-standing composite type, the
5272 <structname>pg_class</structname> entry doesn't really represent
5273 a table, but it is needed anyway for the type's
5274 <structname>pg_attribute</structname> entries to link to.)
5275 Zero for non-composite types
5280 <entry><structfield>typelem</structfield></entry>
5281 <entry><type>oid</type></entry>
5282 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5284 If <structfield>typelem</structfield> is not 0 then it
5285 identifies another row in <structname>pg_type</structname>.
5286 The current type can then be subscripted like an array yielding
5287 values of type <structfield>typelem</structfield>. A
5288 <quote>true</quote> array type is variable length
5289 (<structfield>typlen</structfield> = -1),
5290 but some fixed-length (<structfield>typlen</structfield> > 0) types
5291 also have nonzero <structfield>typelem</structfield>, for example
5292 <type>name</type> and <type>point</type>.
5293 If a fixed-length type has a <structfield>typelem</structfield> then
5294 its internal representation must be some number of values of the
5295 <structfield>typelem</structfield> data type with no other data.
5296 Variable-length array types have a header defined by the array
5302 <entry><structfield>typarray</structfield></entry>
5303 <entry><type>oid</type></entry>
5304 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5306 If <structfield>typarray</structfield> is not 0 then it
5307 identifies another row in <structname>pg_type</structname>, which
5308 is the <quote>true</quote> array type having this type as element
5313 <entry><structfield>typinput</structfield></entry>
5314 <entry><type>regproc</type></entry>
5315 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5316 <entry>Input conversion function (text format)</entry>
5320 <entry><structfield>typoutput</structfield></entry>
5321 <entry><type>regproc</type></entry>
5322 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5323 <entry>Output conversion function (text format)</entry>
5327 <entry><structfield>typreceive</structfield></entry>
5328 <entry><type>regproc</type></entry>
5329 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5330 <entry>Input conversion function (binary format), or 0 if none</entry>
5334 <entry><structfield>typsend</structfield></entry>
5335 <entry><type>regproc</type></entry>
5336 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5337 <entry>Output conversion function (binary format), or 0 if none</entry>
5341 <entry><structfield>typmodin</structfield></entry>
5342 <entry><type>regproc</type></entry>
5343 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5344 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5348 <entry><structfield>typmodout</structfield></entry>
5349 <entry><type>regproc</type></entry>
5350 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5351 <entry>Type modifier output function, or 0 to use the standard format</entry>
5355 <entry><structfield>typanalyze</structfield></entry>
5356 <entry><type>regproc</type></entry>
5357 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5358 <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
5362 <entry><structfield>typalign</structfield></entry>
5363 <entry><type>char</type></entry>
5367 <structfield>typalign</structfield> is the alignment required
5368 when storing a value of this type. It applies to storage on
5369 disk as well as most representations of the value inside
5370 <productname>PostgreSQL</>.
5371 When multiple values are stored consecutively, such
5372 as in the representation of a complete row on disk, padding is
5373 inserted before a datum of this type so that it begins on the
5374 specified boundary. The alignment reference is the beginning
5375 of the first datum in the sequence.
5377 Possible values are:
5380 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5383 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5386 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5389 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5394 For types used in system tables, it is critical that the size
5395 and alignment defined in <structname>pg_type</structname>
5396 agree with the way that the compiler will lay out the column in
5397 a structure representing a table row.
5403 <entry><structfield>typstorage</structfield></entry>
5404 <entry><type>char</type></entry>
5407 <structfield>typstorage</structfield> tells for varlena
5408 types (those with <structfield>typlen</structfield> = -1) if
5409 the type is prepared for toasting and what the default strategy
5410 for attributes of this type should be.
5414 <para><literal>p</>: Value must always be stored plain.</para>
5418 <literal>e</>: Value can be stored in a <quote>secondary</quote>
5419 relation (if relation has one, see
5420 <literal>pg_class.reltoastrelid</literal>).
5424 <para><literal>m</>: Value can be stored compressed inline.</para>
5427 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5430 Note that <literal>m</> columns can also be moved out to secondary
5431 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5437 <entry><structfield>typnotnull</structfield></entry>
5438 <entry><type>bool</type></entry>
5441 <structfield>typnotnull</structfield> represents a not-null
5442 constraint on a type. Used for domains only
5447 <entry><structfield>typbasetype</structfield></entry>
5448 <entry><type>oid</type></entry>
5449 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5451 If this is a domain (see <structfield>typtype</structfield>), then
5452 <structfield>typbasetype</structfield> identifies the type that this
5453 one is based on. Zero if this type is not a domain
5458 <entry><structfield>typtypmod</structfield></entry>
5459 <entry><type>int4</type></entry>
5462 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5463 to be applied to their base type (-1 if base type does not use a
5464 <literal>typmod</>). -1 if this type is not a domain
5469 <entry><structfield>typndims</structfield></entry>
5470 <entry><type>int4</type></entry>
5473 <structfield>typndims</structfield> is the number of array dimensions
5474 for a domain that is an array (that is, <structfield>typbasetype</> is
5475 an array type; the domain's <structfield>typelem</> will match the base
5476 type's <structfield>typelem</structfield>).
5477 Zero for types other than domains over array types
5482 <entry><structfield>typdefaultbin</structfield></entry>
5483 <entry><type>text</type></entry>
5486 If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5487 representation of a default expression for the type. This is
5488 only used for domains
5493 <entry><structfield>typdefault</structfield></entry>
5494 <entry><type>text</type></entry>
5497 <structfield>typdefault</> is null if the type has no associated
5498 default value. If <structfield>typdefaultbin</> is not null,
5499 <structfield>typdefault</> must contain a human-readable version of the
5500 default expression represented by <structfield>typdefaultbin</>. If
5501 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5502 not, then <structfield>typdefault</> is the external representation of
5503 the type's default value, which might be fed to the type's input
5504 converter to produce a constant
5512 <xref linkend="catalog-typcategory-table"> lists the system-defined values
5513 of <structfield>typcategory</>. Any future additions to this list will
5514 also be upper-case ASCII letters. All other ASCII characters are reserved
5515 for user-defined categories.
5518 <table id="catalog-typcategory-table">
5519 <title><structfield>typcategory</> Codes</title>
5525 <entry>Category</entry>
5531 <entry><literal>A</literal></entry>
5532 <entry>Array types</entry>
5535 <entry><literal>B</literal></entry>
5536 <entry>Boolean types</entry>
5539 <entry><literal>C</literal></entry>
5540 <entry>Composite types</entry>
5543 <entry><literal>D</literal></entry>
5544 <entry>Date/time types</entry>
5547 <entry><literal>E</literal></entry>
5548 <entry>Enum types</entry>
5551 <entry><literal>G</literal></entry>
5552 <entry>Geometric types</entry>
5555 <entry><literal>I</literal></entry>
5556 <entry>Network address types</entry>
5559 <entry><literal>N</literal></entry>
5560 <entry>Numeric types</entry>
5563 <entry><literal>P</literal></entry>
5564 <entry>Pseudo-types</entry>
5567 <entry><literal>S</literal></entry>
5568 <entry>String types</entry>
5571 <entry><literal>T</literal></entry>
5572 <entry>Timespan types</entry>
5575 <entry><literal>U</literal></entry>
5576 <entry>User-defined types</entry>
5579 <entry><literal>V</literal></entry>
5580 <entry>Bit-string types</entry>
5583 <entry><literal>X</literal></entry>
5584 <entry><type>unknown</> type</entry>
5593 <sect1 id="catalog-pg-user-mapping">
5594 <title><structname>pg_user_mapping</structname></title>
5596 <indexterm zone="catalog-pg-user-mapping">
5597 <primary>pg_user_mapping</primary>
5601 The catalog <structname>pg_user_mapping</structname> stores
5602 the mappings from local user to remote. Access to this catalog is
5603 restricted from normal users, use the view
5604 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
5609 <title><structname>pg_user_mapping</> Columns</title>
5616 <entry>References</entry>
5617 <entry>Description</entry>
5623 <entry><structfield>umuser</structfield></entry>
5624 <entry><type>oid</type></entry>
5625 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5626 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
5630 <entry><structfield>umserver</structfield></entry>
5631 <entry><type>oid</type></entry>
5632 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
5634 The OID of the foreign server that contains this mapping
5639 <entry><structfield>umoptions</structfield></entry>
5640 <entry><type>text[]</type></entry>
5643 User mapping specific options, as <quote>keyword=value</> strings.
5652 <sect1 id="views-overview">
5653 <title>System Views</title>
5656 In addition to the system catalogs, <productname>PostgreSQL</productname>
5657 provides a number of built-in views. Some system views provide convenient
5658 access to some commonly used queries on the system catalogs. Other views
5659 provide access to internal server state.
5663 The information schema (<xref linkend="information-schema">) provides
5664 an alternative set of views which overlap the functionality of the system
5665 views. Since the information schema is SQL-standard whereas the views
5666 described here are <productname>PostgreSQL</productname>-specific,
5667 it's usually better to use the information schema if it provides all
5668 the information you need.
5672 <xref linkend="view-table"> lists the system views described here.
5673 More detailed documentation of each view follows below.
5674 There are some additional views that provide access to the results of
5675 the statistics collector; they are described in <xref
5676 linkend="monitoring-stats-views-table">.
5680 Except where noted, all the views described here are read-only.
5683 <table id="view-table">
5684 <title>System Views</title>
5689 <entry>View Name</entry>
5690 <entry>Purpose</entry>
5696 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5697 <entry>open cursors</entry>
5701 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5702 <entry>groups of database users</entry>
5706 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5707 <entry>indexes</entry>
5711 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5712 <entry>currently held locks</entry>
5716 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5717 <entry>prepared statements</entry>
5721 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5722 <entry>prepared transactions</entry>
5726 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5727 <entry>database roles</entry>
5731 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5732 <entry>rules</entry>
5736 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5737 <entry>parameter settings</entry>
5741 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5742 <entry>database users</entry>
5746 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5747 <entry>planner statistics</entry>
5751 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5752 <entry>tables</entry>
5756 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5757 <entry>time zone abbreviations</entry>
5761 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5762 <entry>time zone names</entry>
5766 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5767 <entry>database users</entry>
5771 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5772 <entry>views</entry>
5780 <sect1 id="view-pg-cursors">
5781 <title><structname>pg_cursors</structname></title>
5783 <indexterm zone="view-pg-cursors">
5784 <primary>pg_cursors</primary>
5788 The <structname>pg_cursors</structname> view lists the cursors that
5789 are currently available. Cursors can be defined in several ways:
5793 via the <xref linkend="sql-declare" endterm="sql-declare-title">
5800 via the Bind message in the frontend/backend protocol, as
5801 described in <xref linkend="protocol-flow-ext-query">
5807 via the Server Programming Interface (SPI), as described in
5808 <xref linkend="spi-interface">
5813 The <structname>pg_cursors</structname> view displays cursors
5814 created by any of these means. Cursors only exist for the duration
5815 of the transaction that defines them, unless they have been
5816 declared <literal>WITH HOLD</literal>. Therefore non-holdable
5817 cursors are only present in the view until the end of their
5818 creating transaction.
5822 Cursors are used internally to implement some of the components
5823 of <productname>PostgreSQL</>, such as procedural languages.
5824 Therefore, the <structname>pg_cursors</> view might include cursors
5825 that have not been explicitly created by the user.
5831 <title><structname>pg_cursors</> Columns</title>
5838 <entry>Description</entry>
5844 <entry><structfield>name</structfield></entry>
5845 <entry><type>text</type></entry>
5846 <entry>The name of the cursor</entry>
5850 <entry><structfield>statement</structfield></entry>
5851 <entry><type>text</type></entry>
5852 <entry>The verbatim query string submitted to declare this cursor</entry>
5856 <entry><structfield>is_holdable</structfield></entry>
5857 <entry><type>boolean</type></entry>
5859 <literal>true</literal> if the cursor is holdable (that is, it
5860 can be accessed after the transaction that declared the cursor
5861 has committed); <literal>false</literal> otherwise
5866 <entry><structfield>is_binary</structfield></entry>
5867 <entry><type>boolean</type></entry>
5869 <literal>true</literal> if the cursor was declared
5870 <literal>BINARY</literal>; <literal>false</literal>
5876 <entry><structfield>is_scrollable</structfield></entry>
5877 <entry><type>boolean</type></entry>
5879 <literal>true</> if the cursor is scrollable (that is, it
5880 allows rows to be retrieved in a nonsequential manner);
5881 <literal>false</literal> otherwise
5886 <entry><structfield>creation_time</structfield></entry>
5887 <entry><type>timestamptz</type></entry>
5888 <entry>The time at which the cursor was declared</entry>
5895 The <structname>pg_cursors</structname> view is read only.
5900 <sect1 id="view-pg-group">
5901 <title><structname>pg_group</structname></title>
5903 <indexterm zone="view-pg-group">
5904 <primary>pg_group</primary>
5908 The view <structname>pg_group</structname> exists for backwards
5909 compatibility: it emulates a catalog that existed in
5910 <productname>PostgreSQL</productname> before version 8.1.
5911 It shows the names and members of all roles that are marked as not
5912 <structfield>rolcanlogin</>, which is an approximation to the set
5913 of roles that are being used as groups.
5917 <title><structname>pg_group</> Columns</title>
5924 <entry>References</entry>
5925 <entry>Description</entry>
5931 <entry><structfield>groname</structfield></entry>
5932 <entry><type>name</type></entry>
5933 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5934 <entry>Name of the group</entry>
5938 <entry><structfield>grosysid</structfield></entry>
5939 <entry><type>oid</type></entry>
5940 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5941 <entry>ID of this group</entry>
5945 <entry><structfield>grolist</structfield></entry>
5946 <entry><type>oid[]</type></entry>
5947 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5948 <entry>An array containing the IDs of the roles in this group</entry>
5956 <sect1 id="view-pg-indexes">
5957 <title><structname>pg_indexes</structname></title>
5959 <indexterm zone="view-pg-indexes">
5960 <primary>pg_indexes</primary>
5964 The view <structname>pg_indexes</structname> provides access to
5965 useful information about each index in the database.
5969 <title><structname>pg_indexes</> Columns</title>
5976 <entry>References</entry>
5977 <entry>Description</entry>
5982 <entry><structfield>schemaname</structfield></entry>
5983 <entry><type>name</type></entry>
5984 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
5985 <entry>Name of schema containing table and index</entry>
5988 <entry><structfield>tablename</structfield></entry>
5989 <entry><type>name</type></entry>
5990 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5991 <entry>Name of table the index is for</entry>
5994 <entry><structfield>indexname</structfield></entry>
5995 <entry><type>name</type></entry>
5996 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5997 <entry>Name of index</entry>
6000 <entry><structfield>tablespace</structfield></entry>
6001 <entry><type>name</type></entry>
6002 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6003 <entry>Name of tablespace containing index (NULL if default for database)</entry>
6006 <entry><structfield>indexdef</structfield></entry>
6007 <entry><type>text</type></entry>
6009 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
6018 <sect1 id="view-pg-locks">
6019 <title><structname>pg_locks</structname></title>
6021 <indexterm zone="view-pg-locks">
6022 <primary>pg_locks</primary>
6026 The view <structname>pg_locks</structname> provides access to
6027 information about the locks held by open transactions within the
6028 database server. See <xref linkend="mvcc"> for more discussion
6033 <structname>pg_locks</structname> contains one row per active lockable
6034 object, requested lock mode, and relevant transaction. Thus, the same
6035 lockable object might
6036 appear many times, if multiple transactions are holding or waiting
6037 for locks on it. However, an object that currently has no locks on it
6038 will not appear at all.
6042 There are several distinct types of lockable objects:
6043 whole relations (e.g., tables), individual pages of relations,
6044 individual tuples of relations,
6045 transaction IDs (both virtual and permanent IDs),
6046 and general database objects (identified by class OID and object OID,
6047 in the same way as in <structname>pg_description</structname> or
6048 <structname>pg_depend</structname>). Also, the right to extend a
6049 relation is represented as a separate lockable object.
6053 <title><structname>pg_locks</> Columns</title>
6060 <entry>References</entry>
6061 <entry>Description</entry>
6066 <entry><structfield>locktype</structfield></entry>
6067 <entry><type>text</type></entry>
6070 type of the lockable object:
6071 <literal>relation</>,
6075 <literal>transactionid</>,
6076 <literal>virtualxid</>,
6078 <literal>userlock</>, or
6079 <literal>advisory</>
6083 <entry><structfield>database</structfield></entry>
6084 <entry><type>oid</type></entry>
6085 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6087 OID of the database in which the object exists, or
6088 zero if the object is a shared object, or
6089 NULL if the object is a transaction ID
6093 <entry><structfield>relation</structfield></entry>
6094 <entry><type>oid</type></entry>
6095 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6097 OID of the relation, or NULL if the object is not
6098 a relation or part of a relation
6102 <entry><structfield>page</structfield></entry>
6103 <entry><type>integer</type></entry>
6106 Page number within the relation, or NULL if the object
6107 is not a tuple or relation page
6111 <entry><structfield>tuple</structfield></entry>
6112 <entry><type>smallint</type></entry>
6115 Tuple number within the page, or NULL if the object is not a tuple
6119 <entry><structfield>virtualxid</structfield></entry>
6120 <entry><type>text</type></entry>
6123 Virtual ID of a transaction, or NULL if the object is not a
6124 virtual transaction ID
6128 <entry><structfield>transactionid</structfield></entry>
6129 <entry><type>xid</type></entry>
6132 ID of a transaction, or NULL if the object is not a transaction ID
6136 <entry><structfield>classid</structfield></entry>
6137 <entry><type>oid</type></entry>
6138 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6140 OID of the system catalog containing the object, or NULL if the
6141 object is not a general database object
6145 <entry><structfield>objid</structfield></entry>
6146 <entry><type>oid</type></entry>
6147 <entry>any OID column</entry>
6149 OID of the object within its system catalog, or NULL if the
6150 object is not a general database object.
6151 For advisory locks it is used to distinguish the two key
6152 spaces (<literal>1</> for an int8 key, <literal>2</> for two
6157 <entry><structfield>objsubid</structfield></entry>
6158 <entry><type>smallint</type></entry>
6161 For a table column, this is the column number (the
6162 <structfield>classid</> and <structfield>objid</> refer to the
6163 table itself). For all other object types, this column is
6164 zero. NULL if the object is not a general database object
6168 <entry><structfield>virtualtransaction</structfield></entry>
6169 <entry><type>text</type></entry>
6172 Virtual ID of the transaction that is holding or awaiting this lock
6176 <entry><structfield>pid</structfield></entry>
6177 <entry><type>integer</type></entry>
6180 Process ID of the server process holding or awaiting this
6181 lock. NULL if the lock is held by a prepared transaction
6185 <entry><structfield>mode</structfield></entry>
6186 <entry><type>text</type></entry>
6188 <entry>Name of the lock mode held or desired by this process (see <xref
6189 linkend="locking-tables">)</entry>
6192 <entry><structfield>granted</structfield></entry>
6193 <entry><type>boolean</type></entry>
6195 <entry>True if lock is held, false if lock is awaited</entry>
6202 <structfield>granted</structfield> is true in a row representing a lock
6203 held by the indicated transaction. False indicates that this transaction is
6204 currently waiting to acquire this lock, which implies that some other
6205 transaction is holding a conflicting lock mode on the same lockable object.
6206 The waiting transaction will sleep until the other lock is released (or a
6207 deadlock situation is detected). A single transaction can be waiting to
6208 acquire at most one lock at a time.
6212 Every transaction holds an exclusive lock on its virtual transaction ID for
6213 its entire duration. If a permanent ID is assigned to the transaction
6214 (which normally happens only if the transaction changes the state of the
6215 database), it also holds an exclusive lock on its permanent transaction ID
6216 until it ends. When one transaction finds it necessary to wait specifically
6217 for another transaction, it does so by attempting to acquire share lock on
6218 the other transaction ID (either virtual or permanent ID depending on the
6219 situation). That will succeed only when the other transaction
6220 terminates and releases its locks.
6224 Although tuples are a lockable type of object,
6225 information about row-level locks is stored on disk, not in memory,
6226 and therefore row-level locks normally do not appear in this view.
6227 If a transaction is waiting for a
6228 row-level lock, it will usually appear in the view as waiting for the
6229 permanent transaction ID of the current holder of that row lock.
6233 Advisory locks can be acquired on keys consisting of either a single
6234 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
6235 high-order half in the <structfield>classid</> column, its low-order half
6236 in the <structfield>objid</> column, and <structfield>objsubid</> equal
6237 to 1. Integer keys are displayed with the first key in the
6238 <structfield>classid</> column, the second key in the <structfield>objid</>
6239 column, and <structfield>objsubid</> equal to 2. The actual meaning of
6240 the keys is up to the user. Advisory locks are local to each database,
6241 so the <structfield>database</> column is meaningful for an advisory lock.
6245 When the <structname>pg_locks</structname> view is accessed, the
6246 internal lock manager data structures are momentarily locked, and
6247 a copy is made for the view to display. This ensures that the
6248 view produces a consistent set of results, while not blocking
6249 normal lock manager operations longer than necessary. Nonetheless
6250 there could be some impact on database performance if this view is
6251 frequently accessed.
6255 <structname>pg_locks</structname> provides a global view of all locks
6256 in the database cluster, not only those relevant to the current database.
6257 Although its <structfield>relation</structfield> column can be joined
6258 against <structname>pg_class</>.<structfield>oid</> to identify locked
6259 relations, this will only work correctly for relations in the current
6260 database (those for which the <structfield>database</structfield> column
6261 is either the current database's OID or zero).
6265 The <structfield>pid</structfield> column can be joined to the
6266 <structfield>procpid</structfield> column of the
6267 <structname>pg_stat_activity</structname> view to get more
6268 information on the session holding or waiting to hold each lock.
6269 Also, if you are using prepared transactions, the
6270 <structfield>transaction</> column can be joined to the
6271 <structfield>transaction</structfield> column of the
6272 <structname>pg_prepared_xacts</structname> view to get more
6273 information on prepared transactions that hold locks.
6274 (A prepared transaction can never be waiting for a lock,
6275 but it continues to hold the locks it acquired while running.)
6280 <sect1 id="view-pg-prepared-statements">
6281 <title><structname>pg_prepared_statements</structname></title>
6283 <indexterm zone="view-pg-prepared-statements">
6284 <primary>pg_prepared_statements</primary>
6288 The <structname>pg_prepared_statements</structname> view displays
6289 all the prepared statements that are available in the current
6290 session. See <xref linkend="sql-prepare"
6291 endterm="sql-prepare-title"> for more information about prepared
6296 <structname>pg_prepared_statements</structname> contains one row
6297 for each prepared statement. Rows are added to the view when a new
6298 prepared statement is created and removed when a prepared statement
6299 is released (for example, via the <xref linkend="sql-deallocate"
6300 endterm="sql-deallocate-title"> command).
6304 <title><structname>pg_prepared_statements</> Columns</title>
6311 <entry>Description</entry>
6316 <entry><structfield>name</structfield></entry>
6317 <entry><type>text</type></entry>
6319 The identifier of the prepared statement
6323 <entry><structfield>statement</structfield></entry>
6324 <entry><type>text</type></entry>
6326 The query string submitted by the client to create this
6327 prepared statement. For prepared statements created via SQL,
6328 this is the <command>PREPARE</command> statement submitted by
6329 the client. For prepared statements created via the
6330 frontend/backend protocol, this is the text of the prepared
6335 <entry><structfield>prepare_time</structfield></entry>
6336 <entry><type>timestamptz</type></entry>
6338 The time at which the prepared statement was created
6342 <entry><structfield>parameter_types</structfield></entry>
6343 <entry><type>regtype[]</type></entry>
6345 The expected parameter types for the prepared statement in the
6346 form of an array of <type>regtype</type>. The OID corresponding
6347 to an element of this array can be obtained by casting the
6348 <type>regtype</type> value to <type>oid</type>
6352 <entry><structfield>from_sql</structfield></entry>
6353 <entry><type>boolean</type></entry>
6355 <literal>true</literal> if the prepared statement was created
6356 via the <command>PREPARE</command> SQL statement;
6357 <literal>false</literal> if the statement was prepared via the
6358 frontend/backend protocol
6366 The <structname>pg_prepared_statements</structname> view is read only.
6370 <sect1 id="view-pg-prepared-xacts">
6371 <title><structname>pg_prepared_xacts</structname></title>
6373 <indexterm zone="view-pg-prepared-xacts">
6374 <primary>pg_prepared_xacts</primary>
6378 The view <structname>pg_prepared_xacts</structname> displays
6379 information about transactions that are currently prepared for two-phase
6380 commit (see <xref linkend="sql-prepare-transaction"
6381 endterm="sql-prepare-transaction-title"> for details).
6385 <structname>pg_prepared_xacts</structname> contains one row per prepared
6386 transaction. An entry is removed when the transaction is committed or
6391 <title><structname>pg_prepared_xacts</> Columns</title>
6398 <entry>References</entry>
6399 <entry>Description</entry>
6404 <entry><structfield>transaction</structfield></entry>
6405 <entry><type>xid</type></entry>
6408 Numeric transaction identifier of the prepared transaction
6412 <entry><structfield>gid</structfield></entry>
6413 <entry><type>text</type></entry>
6416 Global transaction identifier that was assigned to the transaction
6420 <entry><structfield>prepared</structfield></entry>
6421 <entry><type>timestamp with time zone</type></entry>
6424 Time at which the transaction was prepared for commit
6428 <entry><structfield>owner</structfield></entry>
6429 <entry><type>name</type></entry>
6430 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6432 Name of the user that executed the transaction
6436 <entry><structfield>database</structfield></entry>
6437 <entry><type>name</type></entry>
6438 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
6440 Name of the database in which the transaction was executed
6448 When the <structname>pg_prepared_xacts</structname> view is accessed, the
6449 internal transaction manager data structures are momentarily locked, and
6450 a copy is made for the view to display. This ensures that the
6451 view produces a consistent set of results, while not blocking
6452 normal operations longer than necessary. Nonetheless
6453 there could be some impact on database performance if this view is
6454 frequently accessed.
6459 <sect1 id="view-pg-roles">
6460 <title><structname>pg_roles</structname></title>
6462 <indexterm zone="view-pg-roles">
6463 <primary>pg_roles</primary>
6467 The view <structname>pg_roles</structname> provides access to
6468 information about database roles. This is simply a publicly
6470 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6471 that blanks out the password field.
6475 This view explicitly exposes the OID column of the underlying table,
6476 since that is needed to do joins to other catalogs.
6480 <title><structname>pg_roles</> Columns</title>
6487 <entry>References</entry>
6488 <entry>Description</entry>
6494 <entry><structfield>rolname</structfield></entry>
6495 <entry><type>name</type></entry>
6497 <entry>Role name</entry>
6501 <entry><structfield>rolsuper</structfield></entry>
6502 <entry><type>bool</type></entry>
6504 <entry>Role has superuser privileges</entry>
6508 <entry><structfield>rolinherit</structfield></entry>
6509 <entry><type>bool</type></entry>
6511 <entry>Role automatically inherits privileges of roles it is a
6516 <entry><structfield>rolcreaterole</structfield></entry>
6517 <entry><type>bool</type></entry>
6519 <entry>Role can create more roles</entry>
6523 <entry><structfield>rolcreatedb</structfield></entry>
6524 <entry><type>bool</type></entry>
6526 <entry>Role can create databases</entry>
6530 <entry><structfield>rolcatupdate</structfield></entry>
6531 <entry><type>bool</type></entry>
6534 Role can update system catalogs directly. (Even a superuser cannot do
6535 this unless this column is true.)
6540 <entry><structfield>rolcanlogin</structfield></entry>
6541 <entry><type>bool</type></entry>
6544 Role can log in. That is, this role can be given as the initial
6545 session authorization identifier
6550 <entry><structfield>rolconnlimit</structfield></entry>
6551 <entry><type>int4</type></entry>
6554 For roles that can log in, this sets maximum number of concurrent
6555 connections this role can make. -1 means no limit
6560 <entry><structfield>rolpassword</structfield></entry>
6561 <entry><type>text</type></entry>
6563 <entry>Not the password (always reads as <literal>********</>)</entry>
6567 <entry><structfield>rolvaliduntil</structfield></entry>
6568 <entry><type>timestamptz</type></entry>
6570 <entry>Password expiry time (only used for password authentication);
6571 NULL if no expiration</entry>
6575 <entry><structfield>rolconfig</structfield></entry>
6576 <entry><type>text[]</type></entry>
6578 <entry>Session defaults for run-time configuration variables</entry>
6582 <entry><structfield>oid</structfield></entry>
6583 <entry><type>oid</type></entry>
6584 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6585 <entry>ID of role</entry>
6593 <sect1 id="view-pg-rules">
6594 <title><structname>pg_rules</structname></title>
6596 <indexterm zone="view-pg-rules">
6597 <primary>pg_rules</primary>
6601 The view <structname>pg_rules</structname> provides access to
6602 useful information about query rewrite rules.
6606 <title><structname>pg_rules</> Columns</title>
6613 <entry>References</entry>
6614 <entry>Description</entry>
6619 <entry><structfield>schemaname</structfield></entry>
6620 <entry><type>name</type></entry>
6621 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6622 <entry>Name of schema containing table</entry>
6625 <entry><structfield>tablename</structfield></entry>
6626 <entry><type>name</type></entry>
6627 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6628 <entry>Name of table the rule is for</entry>
6631 <entry><structfield>rulename</structfield></entry>
6632 <entry><type>name</type></entry>
6633 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6634 <entry>Name of rule</entry>
6637 <entry><structfield>definition</structfield></entry>
6638 <entry><type>text</type></entry>
6640 <entry>Rule definition (a reconstructed creation command)</entry>
6647 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6648 of views; those can be seen in <structname>pg_views</>.
6653 <sect1 id="view-pg-settings">
6654 <title><structname>pg_settings</structname></title>
6656 <indexterm zone="view-pg-settings">
6657 <primary>pg_settings</primary>
6661 The view <structname>pg_settings</structname> provides access to
6662 run-time parameters of the server. It is essentially an alternative
6663 interface to the <xref linkend="sql-show" endterm="sql-show-title">
6664 and <xref linkend="sql-set" endterm="sql-set-title"> commands.
6665 It also provides access to some facts about each parameter that are
6666 not directly available from <command>SHOW</>, such as minimum and
6671 <title><structname>pg_settings</> Columns</title>
6678 <entry>Description</entry>
6683 <entry><structfield>name</structfield></entry>
6684 <entry><type>text</type></entry>
6685 <entry>Run-time configuration parameter name</entry>
6688 <entry><structfield>setting</structfield></entry>
6689 <entry><type>text</type></entry>
6690 <entry>Current value of the parameter</entry>
6693 <entry><structfield>unit</structfield></entry>
6694 <entry><type>text</type></entry>
6695 <entry>Implicit unit of the parameter</entry>
6698 <entry><structfield>category</structfield></entry>
6699 <entry><type>text</type></entry>
6700 <entry>Logical group of the parameter</entry>
6703 <entry><structfield>short_desc</structfield></entry>
6704 <entry><type>text</type></entry>
6705 <entry>A brief description of the parameter</entry>
6708 <entry><structfield>extra_desc</structfield></entry>
6709 <entry><type>text</type></entry>
6710 <entry>Additional, more detailed, description of the parameter</entry>
6713 <entry><structfield>context</structfield></entry>
6714 <entry><type>text</type></entry>
6715 <entry>Context required to set the parameter's value</entry>
6718 <entry><structfield>vartype</structfield></entry>
6719 <entry><type>text</type></entry>
6720 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6721 <literal>integer</>, <literal>real</>, or <literal>string</>)
6725 <entry><structfield>source</structfield></entry>
6726 <entry><type>text</type></entry>
6727 <entry>Source of the current parameter value</entry>
6730 <entry><structfield>min_val</structfield></entry>
6731 <entry><type>text</type></entry>
6732 <entry>Minimum allowed value of the parameter (NULL for non-numeric
6736 <entry><structfield>max_val</structfield></entry>
6737 <entry><type>text</type></entry>
6738 <entry>Maximum allowed value of the parameter (NULL for non-numeric
6742 <entry><structfield>enumvals</structfield></entry>
6743 <entry><type>text[]</type></entry>
6744 <entry>Allowed values of an enum parameter (NULL for non-enum
6748 <entry><structfield>boot_val</structfield></entry>
6749 <entry><type>text</type></entry>
6750 <entry>Parameter value assumed at server startup if the parameter is
6751 not otherwise set</entry>
6754 <entry><structfield>reset_val</structfield></entry>
6755 <entry><type>text</type></entry>
6756 <entry>Value that <command>RESET</command> would reset the parameter to
6757 in the current session</entry>
6760 <entry><structfield>sourcefile</structfield></entry>
6761 <entry><type>text</type></entry>
6762 <entry>Configuration file the current value was set in (NULL for
6763 values set from sources other than configuration files, or when
6764 examined by a non-superuser).
6765 Helpful when using configuration include directives</entry>
6768 <entry><structfield>sourceline</structfield></entry>
6769 <entry><type>integer</type></entry>
6770 <entry>Line number within the configuration file the current value was
6771 set at (NULL for values set from sources other than configuration files,
6772 or when examined by a non-superuser)
6780 The <structname>pg_settings</structname> view cannot be inserted into or
6781 deleted from, but it can be updated. An <command>UPDATE</command> applied
6782 to a row of <structname>pg_settings</structname> is equivalent to executing
6783 the <xref linkend="sql-set" endterm="sql-set-title"> command on that named
6784 parameter. The change only affects the value used by the current
6785 session. If an <command>UPDATE</command> is issued within a transaction
6786 that is later aborted, the effects of the <command>UPDATE</command> command
6787 disappear when the transaction is rolled back. Once the surrounding
6788 transaction is committed, the effects will persist until the end of the
6789 session, unless overridden by another <command>UPDATE</command> or
6790 <command>SET</command>.
6795 <sect1 id="view-pg-shadow">
6796 <title><structname>pg_shadow</structname></title>
6798 <indexterm zone="view-pg-shadow">
6799 <primary>pg_shadow</primary>
6803 The view <structname>pg_shadow</structname> exists for backwards
6804 compatibility: it emulates a catalog that existed in
6805 <productname>PostgreSQL</productname> before version 8.1.
6806 It shows properties of all roles that are marked as
6807 <structfield>rolcanlogin</>.
6811 The name stems from the fact that this table
6812 should not be readable by the public since it contains passwords.
6813 <link linkend="view-pg-user"><structname>pg_user</structname></link>
6814 is a publicly readable view on
6815 <structname>pg_shadow</structname> that blanks out the password field.
6819 <title><structname>pg_shadow</> Columns</title>
6826 <entry>References</entry>
6827 <entry>Description</entry>
6833 <entry><structfield>usename</structfield></entry>
6834 <entry><type>name</type></entry>
6835 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6836 <entry>User name</entry>
6840 <entry><structfield>usesysid</structfield></entry>
6841 <entry><type>oid</type></entry>
6842 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6843 <entry>ID of this user</entry>
6847 <entry><structfield>usecreatedb</structfield></entry>
6848 <entry><type>bool</type></entry>
6850 <entry>User can create databases</entry>
6854 <entry><structfield>usesuper</structfield></entry>
6855 <entry><type>bool</type></entry>
6857 <entry>User is a superuser</entry>
6861 <entry><structfield>usecatupd</structfield></entry>
6862 <entry><type>bool</type></entry>
6865 User can update system catalogs. (Even a superuser cannot do
6866 this unless this column is true.)
6871 <entry><structfield>passwd</structfield></entry>
6872 <entry><type>text</type></entry>
6874 <entry>Password (possibly encrypted)</entry>
6878 <entry><structfield>valuntil</structfield></entry>
6879 <entry><type>abstime</type></entry>
6881 <entry>Password expiry time (only used for password authentication)</entry>
6885 <entry><structfield>useconfig</structfield></entry>
6886 <entry><type>text[]</type></entry>
6888 <entry>Session defaults for run-time configuration variables</entry>
6896 <sect1 id="view-pg-stats">
6897 <title><structname>pg_stats</structname></title>
6899 <indexterm zone="view-pg-stats">
6900 <primary>pg_stats</primary>
6904 The view <structname>pg_stats</structname> provides access to
6905 the information stored in the <link
6906 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
6907 catalog. This view allows access only to rows of
6908 <structname>pg_statistic</structname> that correspond to tables the
6909 user has permission to read, and therefore it is safe to allow public
6910 read access to this view.
6914 <structname>pg_stats</structname> is also designed to present the
6915 information in a more readable format than the underlying catalog
6916 — at the cost that its schema must be extended whenever new slot types
6917 are defined for <structname>pg_statistic</structname>.
6921 <title><structname>pg_stats</> Columns</title>
6928 <entry>References</entry>
6929 <entry>Description</entry>
6934 <entry><structfield>schemaname</structfield></entry>
6935 <entry><type>name</type></entry>
6936 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6937 <entry>Name of schema containing table</entry>
6941 <entry><structfield>tablename</structfield></entry>
6942 <entry><type>name</type></entry>
6943 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6944 <entry>Name of table</entry>
6948 <entry><structfield>attname</structfield></entry>
6949 <entry><type>name</type></entry>
6950 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
6951 <entry>Name of the column described by this row</entry>
6955 <entry><structfield>null_frac</structfield></entry>
6956 <entry><type>real</type></entry>
6958 <entry>Fraction of column entries that are null</entry>
6962 <entry><structfield>avg_width</structfield></entry>
6963 <entry><type>integer</type></entry>
6965 <entry>Average width in bytes of column's entries</entry>
6969 <entry><structfield>n_distinct</structfield></entry>
6970 <entry><type>real</type></entry>
6973 If greater than zero, the estimated number of distinct values in the
6974 column. If less than zero, the negative of the number of distinct
6975 values divided by the number of rows. (The negated form is used when
6976 <command>ANALYZE</> believes that the number of distinct values is
6977 likely to increase as the table grows; the positive form is used when
6978 the column seems to have a fixed number of possible values.) For
6979 example, -1 indicates a unique column in which the number of distinct
6980 values is the same as the number of rows
6985 <entry><structfield>most_common_vals</structfield></entry>
6986 <entry><type>anyarray</type></entry>
6989 A list of the most common values in the column. (NULL if
6990 no values seem to be more common than any others.)
6991 For some datatypes such as <type>tsvector</>, this is a list of
6992 the most common element values rather than values of the type itself.
6997 <entry><structfield>most_common_freqs</structfield></entry>
6998 <entry><type>real[]</type></entry>
7001 A list of the frequencies of the most common values or elements,
7002 i.e., number of occurrences of each divided by total number of rows.
7003 (NULL when <structfield>most_common_vals</structfield> is.)
7004 For some datatypes such as <type>tsvector</>, it can also store some
7005 additional information, making it longer than the
7006 <structfield>most_common_vals</> array.
7011 <entry><structfield>histogram_bounds</structfield></entry>
7012 <entry><type>anyarray</type></entry>
7015 A list of values that divide the column's values into groups of
7016 approximately equal population. The values in
7017 <structfield>most_common_vals</>, if present, are omitted from this
7018 histogram calculation. (This column is NULL if the column data type
7019 does not have a <literal><</> operator or if the
7020 <structfield>most_common_vals</> list accounts for the entire
7026 <entry><structfield>correlation</structfield></entry>
7027 <entry><type>real</type></entry>
7030 Statistical correlation between physical row ordering and
7031 logical ordering of the column values. This ranges from -1 to +1.
7032 When the value is near -1 or +1, an index scan on the column will
7033 be estimated to be cheaper than when it is near zero, due to reduction
7034 of random access to the disk. (This column is NULL if the column data
7035 type does not have a <literal><</> operator.)
7043 The maximum number of entries in the <structfield>most_common_vals</>
7044 and <structfield>histogram_bounds</> arrays can be set on a
7045 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
7046 command, or globally by setting the
7047 <xref linkend="guc-default-statistics-target"> run-time parameter.
7052 <sect1 id="view-pg-tables">
7053 <title><structname>pg_tables</structname></title>
7055 <indexterm zone="view-pg-tables">
7056 <primary>pg_tables</primary>
7060 The view <structname>pg_tables</structname> provides access to
7061 useful information about each table in the database.
7065 <title><structname>pg_tables</> Columns</title>
7072 <entry>References</entry>
7073 <entry>Description</entry>
7078 <entry><structfield>schemaname</structfield></entry>
7079 <entry><type>name</type></entry>
7080 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7081 <entry>Name of schema containing table</entry>
7084 <entry><structfield>tablename</structfield></entry>
7085 <entry><type>name</type></entry>
7086 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7087 <entry>Name of table</entry>
7090 <entry><structfield>tableowner</structfield></entry>
7091 <entry><type>name</type></entry>
7092 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7093 <entry>Name of table's owner</entry>
7096 <entry><structfield>tablespace</structfield></entry>
7097 <entry><type>name</type></entry>
7098 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7099 <entry>Name of tablespace containing table (NULL if default for database)</entry>
7102 <entry><structfield>hasindexes</structfield></entry>
7103 <entry><type>boolean</type></entry>
7104 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
7105 <entry>true if table has (or recently had) any indexes</entry>
7108 <entry><structfield>hasrules</structfield></entry>
7109 <entry><type>boolean</type></entry>
7110 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
7111 <entry>true if table has (or once had) rules</entry>
7114 <entry><structfield>hastriggers</structfield></entry>
7115 <entry><type>boolean</type></entry>
7116 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
7117 <entry>true if table has (or once had) triggers</entry>
7125 <sect1 id="view-pg-timezone-abbrevs">
7126 <title><structname>pg_timezone_abbrevs</structname></title>
7128 <indexterm zone="view-pg-timezone-abbrevs">
7129 <primary>pg_timezone_abbrevs</primary>
7133 The view <structname>pg_timezone_abbrevs</structname> provides a list
7134 of time zone abbreviations that are currently recognized by the datetime
7135 input routines. The contents of this view change when the
7136 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
7140 <title><structname>pg_timezone_abbrevs</> Columns</title>
7147 <entry>Description</entry>
7152 <entry><structfield>abbrev</structfield></entry>
7153 <entry><type>text</type></entry>
7154 <entry>Time zone abbreviation</entry>
7157 <entry><structfield>utc_offset</structfield></entry>
7158 <entry><type>interval</type></entry>
7159 <entry>Offset from UTC (positive means east of Greenwich)</entry>
7162 <entry><structfield>is_dst</structfield></entry>
7163 <entry><type>boolean</type></entry>
7164 <entry>True if this is a daylight-savings abbreviation</entry>
7172 <sect1 id="view-pg-timezone-names">
7173 <title><structname>pg_timezone_names</structname></title>
7175 <indexterm zone="view-pg-timezone-names">
7176 <primary>pg_timezone_names</primary>
7180 The view <structname>pg_timezone_names</structname> provides a list
7181 of time zone names that are recognized by <command>SET TIMEZONE</>,
7182 along with their associated abbreviations, UTC offsets,
7183 and daylight-savings status.
7184 Unlike the abbreviations shown in <link
7185 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
7186 date rules. Therefore, the associated information changes across local DST
7187 boundaries. The displayed information is computed based on the current
7188 value of <function>CURRENT_TIMESTAMP</>.
7192 <title><structname>pg_timezone_names</> Columns</title>
7199 <entry>Description</entry>
7204 <entry><structfield>name</structfield></entry>
7205 <entry><type>text</type></entry>
7206 <entry>Time zone name</entry>
7209 <entry><structfield>abbrev</structfield></entry>
7210 <entry><type>text</type></entry>
7211 <entry>Time zone abbreviation</entry>
7214 <entry><structfield>utc_offset</structfield></entry>
7215 <entry><type>interval</type></entry>
7216 <entry>Offset from UTC (positive means east of Greenwich)</entry>
7219 <entry><structfield>is_dst</structfield></entry>
7220 <entry><type>boolean</type></entry>
7221 <entry>True if currently observing daylight savings</entry>
7229 <sect1 id="view-pg-user">
7230 <title><structname>pg_user</structname></title>
7232 <indexterm zone="view-pg-user">
7233 <primary>pg_user</primary>
7237 The view <structname>pg_user</structname> provides access to
7238 information about database users. This is simply a publicly
7240 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
7241 that blanks out the password field.
7245 <title><structname>pg_user</> Columns</title>
7252 <entry>Description</entry>
7257 <entry><structfield>usename</structfield></entry>
7258 <entry><type>name</type></entry>
7259 <entry>User name</entry>
7263 <entry><structfield>usesysid</structfield></entry>
7264 <entry><type>int4</type></entry>
7265 <entry>User ID (arbitrary number used to reference this user)</entry>
7269 <entry><structfield>usecreatedb</structfield></entry>
7270 <entry><type>bool</type></entry>
7271 <entry>User can create databases</entry>
7275 <entry><structfield>usesuper</structfield></entry>
7276 <entry><type>bool</type></entry>
7277 <entry>User is a superuser</entry>
7281 <entry><structfield>usecatupd</structfield></entry>
7282 <entry><type>bool</type></entry>
7284 User can update system catalogs. (Even a superuser cannot do
7285 this unless this column is true.)
7290 <entry><structfield>passwd</structfield></entry>
7291 <entry><type>text</type></entry>
7292 <entry>Not the password (always reads as <literal>********</>)</entry>
7296 <entry><structfield>valuntil</structfield></entry>
7297 <entry><type>abstime</type></entry>
7298 <entry>Password expiry time (only used for password authentication)</entry>
7302 <entry><structfield>useconfig</structfield></entry>
7303 <entry><type>text[]</type></entry>
7304 <entry>Session defaults for run-time configuration variables</entry>
7312 <sect1 id="view-pg-user-mappings">
7313 <title><structname>pg_user_mappings</structname></title>
7315 <indexterm zone="view-pg-user-mappings">
7316 <primary>pg_user_mappings</primary>
7320 The view <structname>pg_user_mappings</structname> provides access
7321 to information about user mappings. This is essentially a publicly
7323 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
7324 that leaves out the options field if the user has no rights to use
7329 <title><structname>pg_user_mappings</> Columns</title>
7336 <entry>References</entry>
7337 <entry>Description</entry>
7343 <entry><structfield>umid</structfield></entry>
7344 <entry><type>oid</type></entry>
7345 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
7346 <entry>OID of the user mapping</entry>
7350 <entry><structfield>srvid</structfield></entry>
7351 <entry><type>oid</type></entry>
7352 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7354 The OID of the foreign server that contains this mapping
7359 <entry><structfield>srvname</structfield></entry>
7360 <entry><type>text</type></entry>
7363 Name of the foreign server
7368 <entry><structfield>umuser</structfield></entry>
7369 <entry><type>oid</type></entry>
7370 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7371 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7375 <entry><structfield>usename</structfield></entry>
7376 <entry><type>name</type></entry>
7378 <entry>Name of the local user to be mapped</entry>
7382 <entry><structfield>umoptions</structfield></entry>
7383 <entry><type>text[]</type></entry>
7386 User mapping specific options, as <quote>keyword=value</>
7387 strings, if the current user is the owner of the foreign
7397 <sect1 id="view-pg-views">
7398 <title><structname>pg_views</structname></title>
7400 <indexterm zone="view-pg-views">
7401 <primary>pg_views</primary>
7405 The view <structname>pg_views</structname> provides access to
7406 useful information about each view in the database.
7410 <title><structname>pg_views</> Columns</title>
7417 <entry>References</entry>
7418 <entry>Description</entry>
7423 <entry><structfield>schemaname</structfield></entry>
7424 <entry><type>name</type></entry>
7425 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7426 <entry>Name of schema containing view</entry>
7429 <entry><structfield>viewname</structfield></entry>
7430 <entry><type>name</type></entry>
7431 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7432 <entry>Name of view</entry>
7435 <entry><structfield>viewowner</structfield></entry>
7436 <entry><type>name</type></entry>
7437 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7438 <entry>Name of view's owner</entry>
7441 <entry><structfield>definition</structfield></entry>
7442 <entry><type>text</type></entry>
7444 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>