1 <!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.165 2008/04/14 17:05:32 tgl 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-index"><structname>pg_index</structname></link></entry>
138 <entry>additional index information</entry>
142 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
143 <entry>table inheritance hierarchy</entry>
147 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
148 <entry>languages for writing functions</entry>
152 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
153 <entry>large objects</entry>
157 <entry><link linkend="catalog-pg-listener"><structname>pg_listener</structname></link></entry>
158 <entry>asynchronous notification support</entry>
162 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
163 <entry>schemas</entry>
167 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
168 <entry>access method operator classes</entry>
172 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
173 <entry>operators</entry>
177 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
178 <entry>access method operator families</entry>
182 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
183 <entry>template data for procedural languages</entry>
187 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
188 <entry>functions and procedures</entry>
192 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
193 <entry>query rewrite rules</entry>
197 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
198 <entry>dependencies on shared objects</entry>
202 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
203 <entry>comments on shared objects</entry>
207 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
208 <entry>planner statistics</entry>
212 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
213 <entry>tablespaces within this database cluster</entry>
217 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
218 <entry>triggers</entry>
222 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
223 <entry>text search configurations</entry>
227 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
228 <entry>text search configurations' token mappings</entry>
232 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
233 <entry>text search dictionaries</entry>
237 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
238 <entry>text search parsers</entry>
242 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
243 <entry>text search templates</entry>
247 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
248 <entry>data types</entry>
256 <sect1 id="catalog-pg-aggregate">
257 <title><structname>pg_aggregate</structname></title>
259 <indexterm zone="catalog-pg-aggregate">
260 <primary>pg_aggregate</primary>
264 The catalog <structname>pg_aggregate</structname> stores information about
265 aggregate functions. An aggregate function is a function that
266 operates on a set of values (typically one column from each row
267 that matches a query condition) and returns a single value computed
268 from all these values. Typical aggregate functions are
269 <function>sum</function>, <function>count</function>, and
270 <function>max</function>. Each entry in
271 <structname>pg_aggregate</structname> is an extension of an entry
272 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
273 entry carries the aggregate's name, input and output data types, and
274 other information that is similar to ordinary functions.
278 <title><structname>pg_aggregate</> Columns</title>
285 <entry>References</entry>
286 <entry>Description</entry>
291 <entry><structfield>aggfnoid</structfield></entry>
292 <entry><type>regproc</type></entry>
293 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
294 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
297 <entry><structfield>aggtransfn</structfield></entry>
298 <entry><type>regproc</type></entry>
299 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
300 <entry>Transition function</entry>
303 <entry><structfield>aggfinalfn</structfield></entry>
304 <entry><type>regproc</type></entry>
305 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
306 <entry>Final function (zero if none)</entry>
309 <entry><structfield>aggsortop</structfield></entry>
310 <entry><type>oid</type></entry>
311 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
312 <entry>Associated sort operator (zero if none)</entry>
315 <entry><structfield>aggtranstype</structfield></entry>
316 <entry><type>oid</type></entry>
317 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
318 <entry>Data type of the aggregate function's internal transition (state) data</entry>
321 <entry><structfield>agginitval</structfield></entry>
322 <entry><type>text</type></entry>
325 The initial value of the transition state. This is a text
326 field containing the initial value in its external string
327 representation. If this field is NULL, the transition state
328 value starts out NULL
336 New aggregate functions are registered with the <xref
337 linkend="sql-createaggregate" endterm="sql-createaggregate-title">
338 command. See <xref linkend="xaggr"> for more information about
339 writing aggregate functions and the meaning of the transition
346 <sect1 id="catalog-pg-am">
347 <title><structname>pg_am</structname></title>
349 <indexterm zone="catalog-pg-am">
350 <primary>pg_am</primary>
354 The catalog <structname>pg_am</structname> stores information about index
355 access methods. There is one row for each index access method supported by
356 the system. The contents of this catalog are discussed in detail in
357 <xref linkend="indexam">.
361 <title><structname>pg_am</> Columns</title>
368 <entry>References</entry>
369 <entry>Description</entry>
375 <entry><structfield>amname</structfield></entry>
376 <entry><type>name</type></entry>
378 <entry>Name of the access method</entry>
382 <entry><structfield>amstrategies</structfield></entry>
383 <entry><type>int2</type></entry>
385 <entry>Number of operator strategies for this access method,
386 or zero if access method does not have a fixed set of operator
391 <entry><structfield>amsupport</structfield></entry>
392 <entry><type>int2</type></entry>
394 <entry>Number of support routines for this access method</entry>
398 <entry><structfield>amcanorder</structfield></entry>
399 <entry><type>bool</type></entry>
401 <entry>Does the access method support ordered scans?</entry>
405 <entry><structfield>amcanunique</structfield></entry>
406 <entry><type>bool</type></entry>
408 <entry>Does the access method support unique indexes?</entry>
412 <entry><structfield>amcanmulticol</structfield></entry>
413 <entry><type>bool</type></entry>
415 <entry>Does the access method support multicolumn indexes?</entry>
419 <entry><structfield>amoptionalkey</structfield></entry>
420 <entry><type>bool</type></entry>
422 <entry>Does the access method support a scan without any constraint
423 for the first index column?</entry>
427 <entry><structfield>amindexnulls</structfield></entry>
428 <entry><type>bool</type></entry>
430 <entry>Does the access method support null index entries?</entry>
434 <entry><structfield>amsearchnulls</structfield></entry>
435 <entry><type>bool</type></entry>
437 <entry>Does the access method support IS NULL searches?</entry>
441 <entry><structfield>amstorage</structfield></entry>
442 <entry><type>bool</type></entry>
444 <entry>Can index storage data type differ from column data type?</entry>
448 <entry><structfield>amclusterable</structfield></entry>
449 <entry><type>bool</type></entry>
451 <entry>Can an index of this type be clustered on?</entry>
455 <entry><structfield>aminsert</structfield></entry>
456 <entry><type>regproc</type></entry>
457 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
458 <entry><quote>Insert this tuple</quote> function</entry>
462 <entry><structfield>ambeginscan</structfield></entry>
463 <entry><type>regproc</type></entry>
464 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
465 <entry><quote>Start new scan</quote> function</entry>
469 <entry><structfield>amgettuple</structfield></entry>
470 <entry><type>regproc</type></entry>
471 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
472 <entry><quote>Next valid tuple</quote> function</entry>
476 <entry><structfield>amgetbitmap</structfield></entry>
477 <entry><type>regproc</type></entry>
478 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
479 <entry><quote>Fetch all valid tuples</quote> function</entry>
483 <entry><structfield>amrescan</structfield></entry>
484 <entry><type>regproc</type></entry>
485 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
486 <entry><quote>Restart this scan</quote> function</entry>
490 <entry><structfield>amendscan</structfield></entry>
491 <entry><type>regproc</type></entry>
492 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
493 <entry><quote>End this scan</quote> function</entry>
497 <entry><structfield>ammarkpos</structfield></entry>
498 <entry><type>regproc</type></entry>
499 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
500 <entry><quote>Mark current scan position</quote> function</entry>
504 <entry><structfield>amrestrpos</structfield></entry>
505 <entry><type>regproc</type></entry>
506 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
507 <entry><quote>Restore marked scan position</quote> function</entry>
511 <entry><structfield>ambuild</structfield></entry>
512 <entry><type>regproc</type></entry>
513 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
514 <entry><quote>Build new index</quote> function</entry>
518 <entry><structfield>ambulkdelete</structfield></entry>
519 <entry><type>regproc</type></entry>
520 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
521 <entry>Bulk-delete function</entry>
525 <entry><structfield>amvacuumcleanup</structfield></entry>
526 <entry><type>regproc</type></entry>
527 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
528 <entry>Post-<command>VACUUM</command> cleanup function</entry>
532 <entry><structfield>amcostestimate</structfield></entry>
533 <entry><type>regproc</type></entry>
534 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
535 <entry>Function to estimate cost of an index scan</entry>
539 <entry><structfield>amoptions</structfield></entry>
540 <entry><type>regproc</type></entry>
541 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
542 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
552 <sect1 id="catalog-pg-amop">
553 <title><structname>pg_amop</structname></title>
555 <indexterm zone="catalog-pg-amop">
556 <primary>pg_amop</primary>
560 The catalog <structname>pg_amop</structname> stores information about
561 operators associated with access method operator families. There is one
562 row for each operator that is a member of an operator family. An operator
563 can appear in more than one family, but cannot appear in more than one
564 position within a family.
568 <title><structname>pg_amop</> Columns</title>
575 <entry>References</entry>
576 <entry>Description</entry>
582 <entry><structfield>amopfamily</structfield></entry>
583 <entry><type>oid</type></entry>
584 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
585 <entry>The operator family this entry is for</entry>
589 <entry><structfield>amoplefttype</structfield></entry>
590 <entry><type>oid</type></entry>
591 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
592 <entry>Left-hand input data type of operator</entry>
596 <entry><structfield>amoprighttype</structfield></entry>
597 <entry><type>oid</type></entry>
598 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
599 <entry>Right-hand input data type of operator</entry>
603 <entry><structfield>amopstrategy</structfield></entry>
604 <entry><type>int2</type></entry>
606 <entry>Operator strategy number</entry>
610 <entry><structfield>amopopr</structfield></entry>
611 <entry><type>oid</type></entry>
612 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
613 <entry>OID of the operator</entry>
617 <entry><structfield>amopmethod</structfield></entry>
618 <entry><type>oid</type></entry>
619 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
620 <entry>Index access method operator family is for</entry>
628 An entry's <structfield>amopmethod</> must match the
629 <structname>opfmethod</> of its containing operator family (including
630 <structfield>amopmethod</> here is an intentional denormalization of the
631 catalog structure for performance reasons). Also,
632 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
633 the <structfield>oprleft</> and <structfield>oprright</> fields of the
634 referenced <structname>pg_operator</> entry.
640 <sect1 id="catalog-pg-amproc">
641 <title><structname>pg_amproc</structname></title>
643 <indexterm zone="catalog-pg-amproc">
644 <primary>pg_amproc</primary>
648 The catalog <structname>pg_amproc</structname> stores information about
649 support procedures associated with access method operator families. There
650 is one row for each support procedure belonging to an operator family.
654 <title><structname>pg_amproc</structname> Columns</title>
661 <entry>References</entry>
662 <entry>Description</entry>
668 <entry><structfield>amprocfamily</structfield></entry>
669 <entry><type>oid</type></entry>
670 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
671 <entry>The operator family this entry is for</entry>
675 <entry><structfield>amproclefttype</structfield></entry>
676 <entry><type>oid</type></entry>
677 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
678 <entry>Left-hand input data type of associated operator</entry>
682 <entry><structfield>amprocrighttype</structfield></entry>
683 <entry><type>oid</type></entry>
684 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
685 <entry>Right-hand input data type of associated operator</entry>
689 <entry><structfield>amprocnum</structfield></entry>
690 <entry><type>int2</type></entry>
692 <entry>Support procedure number</entry>
696 <entry><structfield>amproc</structfield></entry>
697 <entry><type>regproc</type></entry>
698 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
699 <entry>OID of the procedure</entry>
707 The usual interpretation of the
708 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
709 is that they identify the left and right input types of the operator(s)
710 that a particular support procedure supports. For some access methods
711 these match the input data type(s) of the support procedure itself, for
712 others not. There is a notion of <quote>default</> support procedures for
713 an index, which are those with <structfield>amproclefttype</> and
714 <structfield>amprocrighttype</> both equal to the index opclass's
715 <structfield>opcintype</>.
721 <sect1 id="catalog-pg-attrdef">
722 <title><structname>pg_attrdef</structname></title>
724 <indexterm zone="catalog-pg-attrdef">
725 <primary>pg_attrdef</primary>
729 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
730 about columns is stored in <structname>pg_attribute</structname>
731 (see below). Only columns that explicitly specify a default value
732 (when the table is created or the column is added) will have an
737 <title><structname>pg_attrdef</> Columns</title>
744 <entry>References</entry>
745 <entry>Description</entry>
751 <entry><structfield>adrelid</structfield></entry>
752 <entry><type>oid</type></entry>
753 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
754 <entry>The table this column belongs to</entry>
758 <entry><structfield>adnum</structfield></entry>
759 <entry><type>int2</type></entry>
760 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
761 <entry>The number of the column</entry>
765 <entry><structfield>adbin</structfield></entry>
766 <entry><type>text</type></entry>
768 <entry>The internal representation of the column default value</entry>
772 <entry><structfield>adsrc</structfield></entry>
773 <entry><type>text</type></entry>
775 <entry>A human-readable representation of the default value</entry>
782 The <structfield>adsrc</structfield> field is historical, and is best
783 not used, because it does not track outside changes that might affect
784 the representation of the default value. Reverse-compiling the
785 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
786 example) is a better way to display the default value.
792 <sect1 id="catalog-pg-attribute">
793 <title><structname>pg_attribute</structname></title>
795 <indexterm zone="catalog-pg-attribute">
796 <primary>pg_attribute</primary>
800 The catalog <structname>pg_attribute</structname> stores information about
801 table columns. There will be exactly one
802 <structname>pg_attribute</structname> row for every column in every
803 table in the database. (There will also be attribute entries for
804 indexes, and indeed all objects that have <structname>pg_class</structname>
809 The term attribute is equivalent to column and is used for
814 <title><structname>pg_attribute</> Columns</title>
821 <entry>References</entry>
822 <entry>Description</entry>
828 <entry><structfield>attrelid</structfield></entry>
829 <entry><type>oid</type></entry>
830 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
831 <entry>The table this column belongs to</entry>
835 <entry><structfield>attname</structfield></entry>
836 <entry><type>name</type></entry>
838 <entry>The column name</entry>
842 <entry><structfield>atttypid</structfield></entry>
843 <entry><type>oid</type></entry>
844 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
845 <entry>The data type of this column</entry>
849 <entry><structfield>attstattarget</structfield></entry>
850 <entry><type>int4</type></entry>
853 <structfield>attstattarget</structfield> controls the level of detail
854 of statistics accumulated for this column by
855 <xref linkend="sql-analyze" endterm="sql-analyze-title">.
856 A zero value indicates that no statistics should be collected.
857 A negative value says to use the system default statistics target.
858 The exact meaning of positive values is data type-dependent.
859 For scalar data types, <structfield>attstattarget</structfield>
860 is both the target number of <quote>most common values</quote>
861 to collect, and the target number of histogram bins to create
866 <entry><structfield>attlen</structfield></entry>
867 <entry><type>int2</type></entry>
870 A copy of <literal>pg_type.typlen</literal> of this column's
876 <entry><structfield>attnum</structfield></entry>
877 <entry><type>int2</type></entry>
880 The number of the column. Ordinary columns are numbered from 1
881 up. System columns, such as <structfield>oid</structfield>,
882 have (arbitrary) negative numbers
887 <entry><structfield>attndims</structfield></entry>
888 <entry><type>int4</type></entry>
891 Number of dimensions, if the column is an array type; otherwise 0.
892 (Presently, the number of dimensions of an array is not enforced,
893 so any nonzero value effectively means <quote>it's an array</>)
898 <entry><structfield>attcacheoff</structfield></entry>
899 <entry><type>int4</type></entry>
902 Always -1 in storage, but when loaded into a row descriptor
903 in memory this might be updated to cache the offset of the attribute
909 <entry><structfield>atttypmod</structfield></entry>
910 <entry><type>int4</type></entry>
913 <structfield>atttypmod</structfield> records type-specific data
914 supplied at table creation time (for example, the maximum
915 length of a <type>varchar</type> column). It is passed to
916 type-specific input functions and length coercion functions.
917 The value will generally be -1 for types that do not need <structfield>atttypmod</>
922 <entry><structfield>attbyval</structfield></entry>
923 <entry><type>bool</type></entry>
926 A copy of <literal>pg_type.typbyval</> of this column's type
931 <entry><structfield>attstorage</structfield></entry>
932 <entry><type>char</type></entry>
935 Normally a copy of <literal>pg_type.typstorage</> of this
936 column's type. For TOAST-able data types, this can be altered
937 after column creation to control storage policy
942 <entry><structfield>attalign</structfield></entry>
943 <entry><type>char</type></entry>
946 A copy of <literal>pg_type.typalign</> of this column's type
951 <entry><structfield>attnotnull</structfield></entry>
952 <entry><type>bool</type></entry>
955 This represents a not-null constraint. It is possible to
956 change this column to enable or disable the constraint
961 <entry><structfield>atthasdef</structfield></entry>
962 <entry><type>bool</type></entry>
965 This column has a default value, in which case there will be a
966 corresponding entry in the <structname>pg_attrdef</structname>
967 catalog that actually defines the value
972 <entry><structfield>attisdropped</structfield></entry>
973 <entry><type>bool</type></entry>
976 This column has been dropped and is no longer valid. A dropped
977 column is still physically present in the table, but is
978 ignored by the parser and so cannot be accessed via SQL
983 <entry><structfield>attislocal</structfield></entry>
984 <entry><type>bool</type></entry>
987 This column is defined locally in the relation. Note that a column can
988 be locally defined and inherited simultaneously
993 <entry><structfield>attinhcount</structfield></entry>
994 <entry><type>int4</type></entry>
997 The number of direct ancestors this column has. A column with a
998 nonzero number of ancestors cannot be dropped nor renamed
1007 In a dropped column's <structname>pg_attribute</structname> entry,
1008 <structfield>atttypid</structfield> is reset to zero, but
1009 <structfield>attlen</structfield> and the other fields copied from
1010 <structname>pg_type</> are still valid. This arrangement is needed
1011 to cope with the situation where the dropped column's data type was
1012 later dropped, and so there is no <structname>pg_type</> row anymore.
1013 <structfield>attlen</structfield> and the other fields can be used
1014 to interpret the contents of a row of the table.
1019 <sect1 id="catalog-pg-authid">
1020 <title><structname>pg_authid</structname></title>
1022 <indexterm zone="catalog-pg-authid">
1023 <primary>pg_authid</primary>
1027 The catalog <structname>pg_authid</structname> contains information about
1028 database authorization identifiers (roles). A role subsumes the concepts
1029 of <quote>users</> and <quote>groups</>. A user is essentially just a
1030 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1031 without <structfield>rolcanlogin</>) can have other roles as members; see
1032 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1036 Since this catalog contains passwords, it must not be publicly readable.
1037 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1038 is a publicly readable view on
1039 <structname>pg_authid</structname> that blanks out the password field.
1043 <xref linkend="user-manag"> contains detailed information about user and
1044 privilege management.
1048 Because user identities are cluster-wide,
1049 <structname>pg_authid</structname>
1050 is shared across all databases of a cluster: there is only one
1051 copy of <structname>pg_authid</structname> per cluster, not
1056 <title><structname>pg_authid</> Columns</title>
1063 <entry>Description</entry>
1069 <entry><structfield>rolname</structfield></entry>
1070 <entry><type>name</type></entry>
1071 <entry>Role name</entry>
1075 <entry><structfield>rolsuper</structfield></entry>
1076 <entry><type>bool</type></entry>
1077 <entry>Role has superuser privileges</entry>
1081 <entry><structfield>rolinherit</structfield></entry>
1082 <entry><type>bool</type></entry>
1083 <entry>Role automatically inherits privileges of roles it is a
1088 <entry><structfield>rolcreaterole</structfield></entry>
1089 <entry><type>bool</type></entry>
1090 <entry>Role can create more roles</entry>
1094 <entry><structfield>rolcreatedb</structfield></entry>
1095 <entry><type>bool</type></entry>
1096 <entry>Role can create databases</entry>
1100 <entry><structfield>rolcatupdate</structfield></entry>
1101 <entry><type>bool</type></entry>
1103 Role can update system catalogs directly. (Even a superuser cannot do
1104 this unless this column is true)
1109 <entry><structfield>rolcanlogin</structfield></entry>
1110 <entry><type>bool</type></entry>
1112 Role can log in. That is, this role can be given as the initial
1113 session authorization identifier
1118 <entry><structfield>rolconnlimit</structfield></entry>
1119 <entry><type>int4</type></entry>
1121 For roles that can log in, this sets maximum number of concurrent
1122 connections this role can make. -1 means no limit
1127 <entry><structfield>rolpassword</structfield></entry>
1128 <entry><type>text</type></entry>
1129 <entry>Password (possibly encrypted); NULL if none</entry>
1133 <entry><structfield>rolvaliduntil</structfield></entry>
1134 <entry><type>timestamptz</type></entry>
1135 <entry>Password expiry time (only used for password authentication);
1136 NULL if no expiration</entry>
1140 <entry><structfield>rolconfig</structfield></entry>
1141 <entry><type>text[]</type></entry>
1142 <entry>Session defaults for run-time configuration variables</entry>
1151 <sect1 id="catalog-pg-auth-members">
1152 <title><structname>pg_auth_members</structname></title>
1154 <indexterm zone="catalog-pg-auth-members">
1155 <primary>pg_auth_members</primary>
1159 The catalog <structname>pg_auth_members</structname> shows the membership
1160 relations between roles. Any non-circular set of relationships is allowed.
1164 Because user identities are cluster-wide,
1165 <structname>pg_auth_members</structname>
1166 is shared across all databases of a cluster: there is only one
1167 copy of <structname>pg_auth_members</structname> per cluster, not
1172 <title><structname>pg_auth_members</> Columns</title>
1179 <entry>References</entry>
1180 <entry>Description</entry>
1186 <entry><structfield>roleid</structfield></entry>
1187 <entry><type>oid</type></entry>
1188 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1189 <entry>ID of a role that has a member</entry>
1193 <entry><structfield>member</structfield></entry>
1194 <entry><type>oid</type></entry>
1195 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1196 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1200 <entry><structfield>grantor</structfield></entry>
1201 <entry><type>oid</type></entry>
1202 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1203 <entry>ID of the role that granted this membership</entry>
1207 <entry><structfield>admin_option</structfield></entry>
1208 <entry><type>bool</type></entry>
1210 <entry>True if <structfield>member</> can grant membership in
1211 <structfield>roleid</> to others</entry>
1220 <sect1 id="catalog-pg-autovacuum">
1221 <title><structname>pg_autovacuum</structname></title>
1223 <indexterm zone="catalog-pg-autovacuum">
1224 <primary>pg_autovacuum</primary>
1227 <indexterm zone="catalog-pg-autovacuum">
1228 <primary>autovacuum</primary>
1229 <secondary>table-specific configuration</secondary>
1233 The catalog <structname>pg_autovacuum</structname> stores optional
1234 per-relation configuration parameters for the autovacuum daemon.
1235 If there is an entry here for a particular relation, the given
1236 parameters will be used for autovacuuming that table. If no entry
1237 is present, the system-wide defaults will be used. For more information
1238 about the autovacuum daemon, see <xref linkend="autovacuum">.
1243 It is likely that <structname>pg_autovacuum</structname> will disappear
1244 in a future release, with the information instead being kept in
1245 <structname>pg_class</>.<structfield>reloptions</> entries.
1250 <title><structname>pg_autovacuum</> Columns</title>
1257 <entry>References</entry>
1258 <entry>Description</entry>
1264 <entry><structfield>vacrelid</structfield></entry>
1265 <entry><type>oid</type></entry>
1266 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1267 <entry>The table this entry is for</entry>
1271 <entry><structfield>enabled</structfield></entry>
1272 <entry><type>bool</type></entry>
1274 <entry>If false, this table will not be autovacuumed, except
1275 to prevent transaction ID wraparound</entry>
1279 <entry><structfield>vac_base_thresh</structfield></entry>
1280 <entry><type>integer</type></entry>
1282 <entry>Minimum number of modified tuples before vacuum</entry>
1286 <entry><structfield>vac_scale_factor</structfield></entry>
1287 <entry><type>float4</type></entry>
1289 <entry>Multiplier for <structfield>reltuples</> to add to
1290 <structfield>vac_base_thresh</></entry>
1294 <entry><structfield>anl_base_thresh</structfield></entry>
1295 <entry><type>integer</type></entry>
1297 <entry>Minimum number of modified tuples before analyze</entry>
1301 <entry><structfield>anl_scale_factor</structfield></entry>
1302 <entry><type>float4</type></entry>
1304 <entry>Multiplier for <structfield>reltuples</> to add to
1305 <structfield>anl_base_thresh</></entry>
1309 <entry><structfield>vac_cost_delay</structfield></entry>
1310 <entry><type>integer</type></entry>
1312 <entry>Custom <varname>vacuum_cost_delay</> parameter</entry>
1316 <entry><structfield>vac_cost_limit</structfield></entry>
1317 <entry><type>integer</type></entry>
1319 <entry>Custom <varname>vacuum_cost_limit</> parameter</entry>
1323 <entry><structfield>freeze_min_age</structfield></entry>
1324 <entry><type>integer</type></entry>
1326 <entry>Custom <varname>vacuum_freeze_min_age</> parameter</entry>
1330 <entry><structfield>freeze_max_age</structfield></entry>
1331 <entry><type>integer</type></entry>
1333 <entry>Custom <varname>autovacuum_freeze_max_age</> parameter</entry>
1340 The autovacuum daemon will initiate a <command>VACUUM</> operation
1341 on a particular table when the number of updated or deleted tuples
1342 exceeds <structfield>vac_base_thresh</structfield> plus
1343 <structfield>vac_scale_factor</structfield> times the number of
1344 live tuples currently estimated to be in the relation.
1345 Similarly, it will initiate an <command>ANALYZE</> operation
1346 when the number of inserted, updated or deleted tuples
1347 exceeds <structfield>anl_base_thresh</structfield> plus
1348 <structfield>anl_scale_factor</structfield> times the number of
1349 live tuples currently estimated to be in the relation.
1353 Also, the autovacuum daemon will perform a <command>VACUUM</> operation
1354 to prevent transaction ID wraparound if the table's
1355 <structname>pg_class</>.<structfield>relfrozenxid</> field attains an age
1356 of more than <structfield>freeze_max_age</> transactions, whether the table
1357 has been changed or not, even if
1358 <structname>pg_autovacuum</>.<structfield>enabled</> is set to
1359 <literal>false</> for it. The system will launch autovacuum to perform
1360 such <command>VACUUM</>s even if autovacuum is otherwise disabled.
1361 See <xref linkend="vacuum-for-wraparound"> for more about wraparound
1366 Any of the numerical fields can contain <literal>-1</> (or indeed
1367 any negative value) to indicate that the system-wide default should
1368 be used for this particular value. Observe that the
1369 <structfield>vac_cost_delay</> variable inherits its default value from the
1370 <xref linkend="guc-autovacuum-vacuum-cost-delay"> configuration parameter,
1371 or from <xref linkend="guc-vacuum-cost-delay"> if the former is set to a
1372 negative value. The same applies to <structfield>vac_cost_limit</>.
1373 Also, autovacuum will ignore attempts to set a per-table
1374 <structfield>freeze_max_age</> larger than the system-wide setting (it can
1375 only be set smaller), and the <structfield>freeze_min_age</> value will be
1376 limited to half the system-wide <xref
1377 linkend="guc-autovacuum-freeze-max-age"> setting. Note that while you
1378 can set <structfield>freeze_max_age</> very small, or even zero, this
1379 is usually unwise since it will force frequent vacuuming.
1385 <sect1 id="catalog-pg-cast">
1386 <title><structname>pg_cast</structname></title>
1388 <indexterm zone="catalog-pg-cast">
1389 <primary>pg_cast</primary>
1393 The catalog <structname>pg_cast</structname> stores data type conversion
1394 paths, both built-in paths and those defined with
1395 <xref linkend="sql-createcast" endterm="sql-createcast-title">.
1399 It should be noted that <structname>pg_cast</structname> does not represent
1400 every type conversion that the system knows how to perform; only those that
1401 cannot be deduced from some generic rule. For example, casting between a
1402 domain and its base type is not explicitly represented in
1403 <structname>pg_cast</structname>. Another important exception is that
1404 <quote>I/O conversion casts</>, those performed using a data type's own
1405 I/O functions to convert to or from <type>text</> or other string types,
1406 are not explicitly represented in <structname>pg_cast</structname>.
1410 <title><structname>pg_cast</> Columns</title>
1417 <entry>References</entry>
1418 <entry>Description</entry>
1424 <entry><structfield>castsource</structfield></entry>
1425 <entry><type>oid</type></entry>
1426 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1427 <entry>OID of the source data type</entry>
1431 <entry><structfield>casttarget</structfield></entry>
1432 <entry><type>oid</type></entry>
1433 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1434 <entry>OID of the target data type</entry>
1438 <entry><structfield>castfunc</structfield></entry>
1439 <entry><type>oid</type></entry>
1440 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1442 The OID of the function to use to perform this cast. Zero is
1443 stored if the data types are binary compatible (that is, no
1444 run-time operation is needed to perform the cast)
1449 <entry><structfield>castcontext</structfield></entry>
1450 <entry><type>char</type></entry>
1453 Indicates what contexts the cast can be invoked in.
1454 <literal>e</> means only as an explicit cast (using
1455 <literal>CAST</> or <literal>::</> syntax).
1456 <literal>a</> means implicitly in assignment
1457 to a target column, as well as explicitly.
1458 <literal>i</> means implicitly in expressions, as well as the
1467 The cast functions listed in <structname>pg_cast</structname> must
1468 always take the cast source type as their first argument type, and
1469 return the cast destination type as their result type. A cast
1470 function can have up to three arguments. The second argument,
1471 if present, must be type <type>integer</>; it receives the type
1472 modifier associated with the destination type, or <literal>-1</>
1473 if there is none. The third argument,
1474 if present, must be type <type>boolean</>; it receives <literal>true</>
1475 if the cast is an explicit cast, <literal>false</> otherwise.
1479 It is legitimate to create a <structname>pg_cast</structname> entry
1480 in which the source and target types are the same, if the associated
1481 function takes more than one argument. Such entries represent
1482 <quote>length coercion functions</> that coerce values of the type
1483 to be legal for a particular type modifier value.
1487 When a <structname>pg_cast</structname> entry has different source and
1488 target types and a function that takes more than one argument, it
1489 represents converting from one type to another and applying a length
1490 coercion in a single step. When no such entry is available, coercion
1491 to a type that uses a type modifier involves two steps, one to
1492 convert between data types and a second to apply the modifier.
1496 <sect1 id="catalog-pg-class">
1497 <title><structname>pg_class</structname></title>
1499 <indexterm zone="catalog-pg-class">
1500 <primary>pg_class</primary>
1504 The catalog <structname>pg_class</structname> catalogs tables and most
1505 everything else that has columns or is otherwise similar to a
1506 table. This includes indexes (but see also
1507 <structname>pg_index</structname>), sequences, views, composite types,
1508 and TOAST tables; see <structfield>relkind</>.
1509 Below, when we mean all of these
1510 kinds of objects we speak of <quote>relations</quote>. Not all
1511 columns are meaningful for all relation types.
1515 <title><structname>pg_class</> Columns</title>
1522 <entry>References</entry>
1523 <entry>Description</entry>
1529 <entry><structfield>relname</structfield></entry>
1530 <entry><type>name</type></entry>
1532 <entry>Name of the table, index, view, etc.</entry>
1536 <entry><structfield>relnamespace</structfield></entry>
1537 <entry><type>oid</type></entry>
1538 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1540 The OID of the namespace that contains this relation
1545 <entry><structfield>reltype</structfield></entry>
1546 <entry><type>oid</type></entry>
1547 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1549 The OID of the data type that corresponds to this table's row type,
1550 if any (zero for indexes, which have no <structname>pg_type</> entry)
1555 <entry><structfield>relowner</structfield></entry>
1556 <entry><type>oid</type></entry>
1557 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1558 <entry>Owner of the relation</entry>
1562 <entry><structfield>relam</structfield></entry>
1563 <entry><type>oid</type></entry>
1564 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1565 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1569 <entry><structfield>relfilenode</structfield></entry>
1570 <entry><type>oid</type></entry>
1572 <entry>Name of the on-disk file of this relation; 0 if none</entry>
1576 <entry><structfield>reltablespace</structfield></entry>
1577 <entry><type>oid</type></entry>
1578 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1580 The tablespace in which this relation is stored. If zero,
1581 the database's default tablespace is implied. (Not meaningful
1582 if the relation has no on-disk file.)
1587 <entry><structfield>relpages</structfield></entry>
1588 <entry><type>int4</type></entry>
1591 Size of the on-disk representation of this table in pages (of size
1592 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1593 planner. It is updated by <command>VACUUM</command>,
1594 <command>ANALYZE</command>, and a few DDL commands such as
1595 <command>CREATE INDEX</command>
1600 <entry><structfield>reltuples</structfield></entry>
1601 <entry><type>float4</type></entry>
1604 Number of rows in the table. This is only an estimate used by the
1605 planner. It is updated by <command>VACUUM</command>,
1606 <command>ANALYZE</command>, and a few DDL commands such as
1607 <command>CREATE INDEX</command>
1612 <entry><structfield>reltoastrelid</structfield></entry>
1613 <entry><type>oid</type></entry>
1614 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1616 OID of the TOAST table associated with this table, 0 if none. The
1617 TOAST table stores large attributes <quote>out of line</quote> in a
1623 <entry><structfield>reltoastidxid</structfield></entry>
1624 <entry><type>oid</type></entry>
1625 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1627 For a TOAST table, the OID of its index. 0 if not a TOAST table
1632 <entry><structfield>relhasindex</structfield></entry>
1633 <entry><type>bool</type></entry>
1636 True if this is a table and it has (or recently had) any
1637 indexes. This is set by <command>CREATE INDEX</command>, but
1638 not cleared immediately by <command>DROP INDEX</command>.
1639 <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the
1640 table has no indexes
1645 <entry><structfield>relisshared</structfield></entry>
1646 <entry><type>bool</type></entry>
1649 True if this table is shared across all databases in the cluster. Only
1650 certain system catalogs (such as <structname>pg_database</structname>)
1656 <entry><structfield>relkind</structfield></entry>
1657 <entry><type>char</type></entry>
1660 <literal>r</> = ordinary table, <literal>i</> = index,
1661 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1662 composite type, <literal>t</> = TOAST
1668 <entry><structfield>relnatts</structfield></entry>
1669 <entry><type>int2</type></entry>
1672 Number of user columns in the relation (system columns not
1673 counted). There must be this many corresponding entries in
1674 <structname>pg_attribute</structname>. See also
1675 <literal>pg_attribute.attnum</literal>
1680 <entry><structfield>relchecks</structfield></entry>
1681 <entry><type>int2</type></entry>
1684 Number of check constraints on the table; see
1685 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1690 <entry><structfield>reltriggers</structfield></entry>
1691 <entry><type>int2</type></entry>
1694 Number of triggers on the table; see
1695 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1700 <entry><structfield>relukeys</structfield></entry>
1701 <entry><type>int2</type></entry>
1703 <entry>Unused (<emphasis>not</emphasis> the number of unique keys)</entry>
1707 <entry><structfield>relfkeys</structfield></entry>
1708 <entry><type>int2</type></entry>
1710 <entry>Unused (<emphasis>not</emphasis> the number of foreign keys on the table)</entry>
1714 <entry><structfield>relrefs</structfield></entry>
1715 <entry><type>int2</type></entry>
1717 <entry>Unused</entry>
1721 <entry><structfield>relhasoids</structfield></entry>
1722 <entry><type>bool</type></entry>
1725 True if we generate an OID for each row of the relation
1730 <entry><structfield>relhaspkey</structfield></entry>
1731 <entry><type>bool</type></entry>
1734 True if the table has (or once had) a primary key
1739 <entry><structfield>relhasrules</structfield></entry>
1740 <entry><type>bool</type></entry>
1743 True if table has rules; see
1744 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1749 <entry><structfield>relhassubclass</structfield></entry>
1750 <entry><type>bool</type></entry>
1752 <entry>True if table has (or once had) any inheritance children</entry>
1756 <entry><structfield>relfrozenxid</structfield></entry>
1757 <entry><type>xid</type></entry>
1760 All transaction IDs before this one have been replaced with a permanent
1761 (<quote>frozen</>) transaction ID in this table. This is used to track
1762 whether the table needs to be vacuumed in order to prevent transaction
1763 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1764 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table
1769 <entry><structfield>relacl</structfield></entry>
1770 <entry><type>aclitem[]</type></entry>
1773 Access privileges; see
1774 <xref linkend="sql-grant" endterm="sql-grant-title"> and
1775 <xref linkend="sql-revoke" endterm="sql-revoke-title">
1781 <entry><structfield>reloptions</structfield></entry>
1782 <entry><type>text[]</type></entry>
1785 Access-method-specific options, as <quote>keyword=value</> strings
1793 <sect1 id="catalog-pg-constraint">
1794 <title><structname>pg_constraint</structname></title>
1796 <indexterm zone="catalog-pg-constraint">
1797 <primary>pg_constraint</primary>
1801 The catalog <structname>pg_constraint</structname> stores check, primary key, unique, and foreign
1802 key constraints on tables. (Column constraints are not treated
1803 specially. Every column constraint is equivalent to some table
1804 constraint.) Not-null constraints are represented in the
1805 <structname>pg_attribute</> catalog.
1809 Check constraints on domains are stored here, too.
1813 <title><structname>pg_constraint</> Columns</title>
1820 <entry>References</entry>
1821 <entry>Description</entry>
1827 <entry><structfield>conname</structfield></entry>
1828 <entry><type>name</type></entry>
1830 <entry>Constraint name (not necessarily unique!)</entry>
1834 <entry><structfield>connamespace</structfield></entry>
1835 <entry><type>oid</type></entry>
1836 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1838 The OID of the namespace that contains this constraint
1843 <entry><structfield>contype</structfield></entry>
1844 <entry><type>char</type></entry>
1847 <literal>c</> = check constraint,
1848 <literal>f</> = foreign key constraint,
1849 <literal>p</> = primary key constraint,
1850 <literal>u</> = unique constraint
1855 <entry><structfield>condeferrable</structfield></entry>
1856 <entry><type>bool</type></entry>
1858 <entry>Is the constraint deferrable?</entry>
1862 <entry><structfield>condeferred</structfield></entry>
1863 <entry><type>bool</type></entry>
1865 <entry>Is the constraint deferred by default?</entry>
1869 <entry><structfield>conrelid</structfield></entry>
1870 <entry><type>oid</type></entry>
1871 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1872 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1876 <entry><structfield>contypid</structfield></entry>
1877 <entry><type>oid</type></entry>
1878 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1879 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1883 <entry><structfield>confrelid</structfield></entry>
1884 <entry><type>oid</type></entry>
1885 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1886 <entry>If a foreign key, the referenced table; else 0</entry>
1890 <entry><structfield>confupdtype</structfield></entry>
1891 <entry><type>char</type></entry>
1893 <entry>Foreign key update action code</entry>
1897 <entry><structfield>confdeltype</structfield></entry>
1898 <entry><type>char</type></entry>
1900 <entry>Foreign key deletion action code</entry>
1904 <entry><structfield>confmatchtype</structfield></entry>
1905 <entry><type>char</type></entry>
1907 <entry>Foreign key match type</entry>
1911 <entry><structfield>conkey</structfield></entry>
1912 <entry><type>int2[]</type></entry>
1913 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1914 <entry>If a table constraint, list of columns which the constraint constrains</entry>
1918 <entry><structfield>confkey</structfield></entry>
1919 <entry><type>int2[]</type></entry>
1920 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1921 <entry>If a foreign key, list of the referenced columns</entry>
1925 <entry><structfield>conpfeqop</structfield></entry>
1926 <entry><type>oid[]</type></entry>
1927 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1928 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
1932 <entry><structfield>conppeqop</structfield></entry>
1933 <entry><type>oid[]</type></entry>
1934 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1935 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
1939 <entry><structfield>conffeqop</structfield></entry>
1940 <entry><type>oid[]</type></entry>
1941 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1942 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
1946 <entry><structfield>conbin</structfield></entry>
1947 <entry><type>text</type></entry>
1949 <entry>If a check constraint, an internal representation of the expression</entry>
1953 <entry><structfield>consrc</structfield></entry>
1954 <entry><type>text</type></entry>
1956 <entry>If a check constraint, a human-readable representation of the expression</entry>
1964 <structfield>consrc</structfield> is not updated when referenced objects
1965 change; for example, it won't track renaming of columns. Rather than
1966 relying on this field, it's best to use <function>pg_get_constraintdef()</>
1967 to extract the definition of a check constraint.
1973 <literal>pg_class.relchecks</literal> needs to agree with the
1974 number of check-constraint entries found in this table for each
1981 <sect1 id="catalog-pg-conversion">
1982 <title><structname>pg_conversion</structname></title>
1984 <indexterm zone="catalog-pg-conversion">
1985 <primary>pg_conversion</primary>
1989 The catalog <structname>pg_conversion</structname> describes the
1990 available encoding conversion procedures. See
1991 <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
1992 for more information.
1996 <title><structname>pg_conversion</> Columns</title>
2003 <entry>References</entry>
2004 <entry>Description</entry>
2010 <entry><structfield>conname</structfield></entry>
2011 <entry><type>name</type></entry>
2013 <entry>Conversion name (unique within a namespace)</entry>
2017 <entry><structfield>connamespace</structfield></entry>
2018 <entry><type>oid</type></entry>
2019 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2021 The OID of the namespace that contains this conversion
2026 <entry><structfield>conowner</structfield></entry>
2027 <entry><type>oid</type></entry>
2028 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2029 <entry>Owner of the conversion</entry>
2033 <entry><structfield>conforencoding</structfield></entry>
2034 <entry><type>int4</type></entry>
2036 <entry>Source encoding ID</entry>
2040 <entry><structfield>contoencoding</structfield></entry>
2041 <entry><type>int4</type></entry>
2043 <entry>Destination encoding ID</entry>
2047 <entry><structfield>conproc</structfield></entry>
2048 <entry><type>regproc</type></entry>
2049 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2050 <entry>Conversion procedure</entry>
2054 <entry><structfield>condefault</structfield></entry>
2055 <entry><type>bool</type></entry>
2057 <entry>True if this is the default conversion</entry>
2066 <sect1 id="catalog-pg-database">
2067 <title><structname>pg_database</structname></title>
2069 <indexterm zone="catalog-pg-database">
2070 <primary>pg_database</primary>
2074 The catalog <structname>pg_database</structname> stores information about
2075 the available databases. Databases are created with the <xref
2076 linkend="sql-createdatabase" endterm="sql-createdatabase-title"> command.
2077 Consult <xref linkend="managing-databases"> for details about the meaning
2078 of some of the parameters.
2082 Unlike most system catalogs, <structname>pg_database</structname>
2083 is shared across all databases of a cluster: there is only one
2084 copy of <structname>pg_database</structname> per cluster, not
2089 <title><structname>pg_database</> Columns</title>
2096 <entry>References</entry>
2097 <entry>Description</entry>
2103 <entry><structfield>datname</structfield></entry>
2104 <entry><type>name</type></entry>
2106 <entry>Database name</entry>
2110 <entry><structfield>datdba</structfield></entry>
2111 <entry><type>oid</type></entry>
2112 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2113 <entry>Owner of the database, usually the user who created it</entry>
2117 <entry><structfield>encoding</structfield></entry>
2118 <entry><type>int4</type></entry>
2120 <entry>Character encoding for this database
2121 (<function>pg_encoding_to_char()</function> can translate
2122 this number to the encoding name)</entry>
2126 <entry><structfield>datistemplate</structfield></entry>
2127 <entry><type>bool</type></entry>
2130 If true then this database can be used in the
2131 <literal>TEMPLATE</literal> clause of <command>CREATE
2132 DATABASE</command> to create a new database as a clone of
2138 <entry><structfield>datallowconn</structfield></entry>
2139 <entry><type>bool</type></entry>
2142 If false then no one can connect to this database. This is
2143 used to protect the <literal>template0</> database from being altered
2148 <entry><structfield>datconnlimit</structfield></entry>
2149 <entry><type>int4</type></entry>
2152 Sets maximum number of concurrent connections that can be made
2153 to this database. -1 means no limit
2158 <entry><structfield>datlastsysoid</structfield></entry>
2159 <entry><type>oid</type></entry>
2162 Last system OID in the database; useful
2163 particularly to <application>pg_dump</application>
2168 <entry><structfield>datfrozenxid</structfield></entry>
2169 <entry><type>xid</type></entry>
2172 All transaction IDs before this one have been replaced with a permanent
2173 (<quote>frozen</>) transaction ID in this database. This is used to
2174 track whether the database needs to be vacuumed in order to prevent
2175 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2176 It is the minimum of the per-table
2177 <structname>pg_class</>.<structfield>relfrozenxid</> values
2182 <entry><structfield>dattablespace</structfield></entry>
2183 <entry><type>oid</type></entry>
2184 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2186 The default tablespace for the database.
2187 Within this database, all tables for which
2188 <structname>pg_class</>.<structfield>reltablespace</> is zero
2189 will be stored in this tablespace; in particular, all the non-shared
2190 system catalogs will be there
2195 <entry><structfield>datconfig</structfield></entry>
2196 <entry><type>text[]</type></entry>
2198 <entry>Session defaults for run-time configuration variables</entry>
2202 <entry><structfield>datacl</structfield></entry>
2203 <entry><type>aclitem[]</type></entry>
2206 Access privileges; see
2207 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2208 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2218 <sect1 id="catalog-pg-depend">
2219 <title><structname>pg_depend</structname></title>
2221 <indexterm zone="catalog-pg-depend">
2222 <primary>pg_depend</primary>
2226 The catalog <structname>pg_depend</structname> records the dependency
2227 relationships between database objects. This information allows
2228 <command>DROP</> commands to find which other objects must be dropped
2229 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2234 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2235 which performs a similar function for dependencies involving objects
2236 that are shared across a database cluster.
2240 <title><structname>pg_depend</> Columns</title>
2247 <entry>References</entry>
2248 <entry>Description</entry>
2254 <entry><structfield>classid</structfield></entry>
2255 <entry><type>oid</type></entry>
2256 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2257 <entry>The OID of the system catalog the dependent object is in</entry>
2261 <entry><structfield>objid</structfield></entry>
2262 <entry><type>oid</type></entry>
2263 <entry>any OID column</entry>
2264 <entry>The OID of the specific dependent object</entry>
2268 <entry><structfield>objsubid</structfield></entry>
2269 <entry><type>int4</type></entry>
2272 For a table column, this is the column number (the
2273 <structfield>objid</> and <structfield>classid</> refer to the
2274 table itself). For all other object types, this column is
2280 <entry><structfield>refclassid</structfield></entry>
2281 <entry><type>oid</type></entry>
2282 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2283 <entry>The OID of the system catalog the referenced object is in</entry>
2287 <entry><structfield>refobjid</structfield></entry>
2288 <entry><type>oid</type></entry>
2289 <entry>any OID column</entry>
2290 <entry>The OID of the specific referenced object</entry>
2294 <entry><structfield>refobjsubid</structfield></entry>
2295 <entry><type>int4</type></entry>
2298 For a table column, this is the column number (the
2299 <structfield>refobjid</> and <structfield>refclassid</> refer
2300 to the table itself). For all other object types, this column
2306 <entry><structfield>deptype</structfield></entry>
2307 <entry><type>char</type></entry>
2310 A code defining the specific semantics of this dependency relationship; see text
2319 In all cases, a <structname>pg_depend</structname> entry indicates that the
2320 referenced object cannot be dropped without also dropping the dependent
2321 object. However, there are several subflavors identified by
2322 <structfield>deptype</>:
2326 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2329 A normal relationship between separately-created objects. The
2330 dependent object can be dropped without affecting the
2331 referenced object. The referenced object can only be dropped
2332 by specifying <literal>CASCADE</>, in which case the dependent
2333 object is dropped, too. Example: a table column has a normal
2334 dependency on its data type.
2340 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2343 The dependent object can be dropped separately from the
2344 referenced object, and should be automatically dropped
2345 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2346 mode) if the referenced object is dropped. Example: a named
2347 constraint on a table is made autodependent on the table, so
2348 that it will go away if the table is dropped.
2354 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2357 The dependent object was created as part of creation of the
2358 referenced object, and is really just a part of its internal
2359 implementation. A <command>DROP</> of the dependent object
2360 will be disallowed outright (we'll tell the user to issue a
2361 <command>DROP</> against the referenced object, instead). A
2362 <command>DROP</> of the referenced object will be propagated
2363 through to drop the dependent object whether
2364 <command>CASCADE</> is specified or not. Example: a trigger
2365 that's created to enforce a foreign-key constraint is made
2366 internally dependent on the constraint's
2367 <structname>pg_constraint</> entry.
2373 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2376 There is no dependent object; this type of entry is a signal
2377 that the system itself depends on the referenced object, and so
2378 that object must never be deleted. Entries of this type are
2379 created only by <command>initdb</command>. The columns for the
2380 dependent object contain zeroes.
2386 Other dependency flavors might be needed in future.
2392 <sect1 id="catalog-pg-description">
2393 <title><structname>pg_description</structname></title>
2395 <indexterm zone="catalog-pg-description">
2396 <primary>pg_description</primary>
2400 The catalog <structname>pg_description</> stores optional descriptions
2401 (comments) for each database object. Descriptions can be manipulated
2402 with the <xref linkend="sql-comment" endterm="sql-comment-title"> command and viewed with
2403 <application>psql</application>'s <literal>\d</literal> commands.
2404 Descriptions of many built-in system objects are provided in the initial
2405 contents of <structname>pg_description</structname>.
2409 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2410 which performs a similar function for descriptions involving objects that
2411 are shared across a database cluster.
2415 <title><structname>pg_description</> Columns</title>
2422 <entry>References</entry>
2423 <entry>Description</entry>
2429 <entry><structfield>objoid</structfield></entry>
2430 <entry><type>oid</type></entry>
2431 <entry>any OID column</entry>
2432 <entry>The OID of the object this description pertains to</entry>
2436 <entry><structfield>classoid</structfield></entry>
2437 <entry><type>oid</type></entry>
2438 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2439 <entry>The OID of the system catalog this object appears in</entry>
2443 <entry><structfield>objsubid</structfield></entry>
2444 <entry><type>int4</type></entry>
2447 For a comment on a table column, this is the column number (the
2448 <structfield>objoid</> and <structfield>classoid</> refer to
2449 the table itself). For all other object types, this column is
2455 <entry><structfield>description</structfield></entry>
2456 <entry><type>text</type></entry>
2458 <entry>Arbitrary text that serves as the description of this object</entry>
2467 <sect1 id="catalog-pg-enum">
2468 <title><structname>pg_enum</structname></title>
2470 <indexterm zone="catalog-pg-enum">
2471 <primary>pg_enum</primary>
2475 The <structname>pg_enum</structname> catalog contains entries
2476 matching enum types to their associated values and labels. The
2477 internal representation of a given enum value is actually the OID
2478 of its associated row in <structname>pg_enum</structname>. The
2479 OIDs for a particular enum type are guaranteed to be ordered in
2480 the way the type should sort, but there is no guarantee about the
2481 ordering of OIDs of unrelated enum types.
2485 <title><structname>pg_enum</> Columns</title>
2492 <entry>References</entry>
2493 <entry>Description</entry>
2499 <entry><structfield>enumtypid</structfield></entry>
2500 <entry><type>oid</type></entry>
2501 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2502 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2506 <entry><structfield>enumlabel</structfield></entry>
2507 <entry><type>name</type></entry>
2509 <entry>The textual label for this enum value</entry>
2517 <sect1 id="catalog-pg-index">
2518 <title><structname>pg_index</structname></title>
2520 <indexterm zone="catalog-pg-index">
2521 <primary>pg_index</primary>
2525 The catalog <structname>pg_index</structname> contains part of the information
2526 about indexes. The rest is mostly in
2527 <structname>pg_class</structname>.
2531 <title><structname>pg_index</> Columns</title>
2538 <entry>References</entry>
2539 <entry>Description</entry>
2545 <entry><structfield>indexrelid</structfield></entry>
2546 <entry><type>oid</type></entry>
2547 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2548 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2552 <entry><structfield>indrelid</structfield></entry>
2553 <entry><type>oid</type></entry>
2554 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2555 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2559 <entry><structfield>indnatts</structfield></entry>
2560 <entry><type>int2</type></entry>
2562 <entry>The number of columns in the index (duplicates
2563 <literal>pg_class.relnatts</literal>)</entry>
2567 <entry><structfield>indisunique</structfield></entry>
2568 <entry><type>bool</type></entry>
2570 <entry>If true, this is a unique index</entry>
2574 <entry><structfield>indisprimary</structfield></entry>
2575 <entry><type>bool</type></entry>
2577 <entry>If true, this index represents the primary key of the table
2578 (<structfield>indisunique</> should always be true when this is true)</entry>
2582 <entry><structfield>indisclustered</structfield></entry>
2583 <entry><type>bool</type></entry>
2585 <entry>If true, the table was last clustered on this index</entry>
2589 <entry><structfield>indisvalid</structfield></entry>
2590 <entry><type>bool</type></entry>
2593 If true, the index is currently valid for queries. False means the
2594 index is possibly incomplete: it must still be modified by
2595 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2596 be used for queries. If it is unique, the uniqueness property is not
2602 <entry><structfield>indcheckxmin</structfield></entry>
2603 <entry><type>bool</type></entry>
2606 If true, queries must not use the index until the <structfield>xmin</>
2607 of this <structname>pg_index</> row is below their TransactionXmin
2608 event horizon, because the table may contain broken HOT chains with
2609 incompatible rows that they can see
2614 <entry><structfield>indisready</structfield></entry>
2615 <entry><type>bool</type></entry>
2618 If true, the index is currently ready for inserts. False means the
2619 index must be ignored by <command>INSERT</>/<command>UPDATE</>
2625 <entry><structfield>indkey</structfield></entry>
2626 <entry><type>int2vector</type></entry>
2627 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2629 This is an array of <structfield>indnatts</structfield> values that
2630 indicate which table columns this index indexes. For example a value
2631 of <literal>1 3</literal> would mean that the first and the third table
2632 columns make up the index key. A zero in this array indicates that the
2633 corresponding index attribute is an expression over the table columns,
2634 rather than a simple column reference
2639 <entry><structfield>indclass</structfield></entry>
2640 <entry><type>oidvector</type></entry>
2641 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2643 For each column in the index key, this contains the OID of
2644 the operator class to use. See
2645 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details
2650 <entry><structfield>indoption</structfield></entry>
2651 <entry><type>int2vector</type></entry>
2654 This is an array of <structfield>indnatts</structfield> values that
2655 store per-column flag bits. The meaning of the bits is defined by
2656 the index's access method
2661 <entry><structfield>indexprs</structfield></entry>
2662 <entry><type>text</type></entry>
2664 <entry>Expression trees (in <function>nodeToString()</function> representation)
2665 for index attributes that are not simple column references. This is a
2666 list with one element for each zero entry in <structfield>indkey</>.
2667 NULL if all index attributes are simple references</entry>
2671 <entry><structfield>indpred</structfield></entry>
2672 <entry><type>text</type></entry>
2674 <entry>Expression tree (in <function>nodeToString()</function> representation)
2675 for partial index predicate. NULL if not a partial index</entry>
2684 <sect1 id="catalog-pg-inherits">
2685 <title><structname>pg_inherits</structname></title>
2687 <indexterm zone="catalog-pg-inherits">
2688 <primary>pg_inherits</primary>
2692 The catalog <structname>pg_inherits</> records information about
2693 table inheritance hierarchies. There is one entry for each direct
2694 child table in the database. (Indirect inheritance can be determined
2695 by following chains of entries.)
2699 <title><structname>pg_inherits</> Columns</title>
2706 <entry>References</entry>
2707 <entry>Description</entry>
2713 <entry><structfield>inhrelid</structfield></entry>
2714 <entry><type>oid</type></entry>
2715 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2717 The OID of the child table
2722 <entry><structfield>inhparent</structfield></entry>
2723 <entry><type>oid</type></entry>
2724 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2726 The OID of the parent table
2731 <entry><structfield>inhseqno</structfield></entry>
2732 <entry><type>int4</type></entry>
2735 If there is more than one direct parent for a child table (multiple
2736 inheritance), this number tells the order in which the
2737 inherited columns are to be arranged. The count starts at 1
2747 <sect1 id="catalog-pg-language">
2748 <title><structname>pg_language</structname></title>
2750 <indexterm zone="catalog-pg-language">
2751 <primary>pg_language</primary>
2755 The catalog <structname>pg_language</structname> registers
2756 languages in which you can write functions or stored procedures.
2757 See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
2758 and <xref linkend="xplang"> for more information about language handlers.
2762 <title><structname>pg_language</> Columns</title>
2769 <entry>References</entry>
2770 <entry>Description</entry>
2776 <entry><structfield>lanname</structfield></entry>
2777 <entry><type>name</type></entry>
2779 <entry>Name of the language</entry>
2783 <entry><structfield>lanowner</structfield></entry>
2784 <entry><type>oid</type></entry>
2785 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2786 <entry>Owner of the language</entry>
2790 <entry><structfield>lanispl</structfield></entry>
2791 <entry><type>bool</type></entry>
2794 This is false for internal languages (such as
2795 <acronym>SQL</acronym>) and true for user-defined languages.
2796 Currently, <application>pg_dump</application> still uses this
2797 to determine which languages need to be dumped, but this might be
2798 replaced by a different mechanism in the future
2803 <entry><structfield>lanpltrusted</structfield></entry>
2804 <entry><type>bool</type></entry>
2807 True if this is a trusted language, which means that it is believed
2808 not to grant access to anything outside the normal SQL execution
2809 environment. Only superusers can create functions in untrusted
2815 <entry><structfield>lanplcallfoid</structfield></entry>
2816 <entry><type>oid</type></entry>
2817 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2819 For noninternal languages this references the language
2820 handler, which is a special function that is responsible for
2821 executing all functions that are written in the particular
2827 <entry><structfield>lanvalidator</structfield></entry>
2828 <entry><type>oid</type></entry>
2829 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2831 This references a language validator function that is responsible
2832 for checking the syntax and validity of new functions when they
2833 are created. Zero if no validator is provided
2838 <entry><structfield>lanacl</structfield></entry>
2839 <entry><type>aclitem[]</type></entry>
2842 Access privileges; see
2843 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2844 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2855 <sect1 id="catalog-pg-largeobject">
2856 <title><structname>pg_largeobject</structname></title>
2858 <indexterm zone="catalog-pg-largeobject">
2859 <primary>pg_largeobject</primary>
2863 The catalog <structname>pg_largeobject</structname> holds the data making up
2864 <quote>large objects</quote>. A large object is identified by an
2865 OID assigned when it is created. Each large object is broken into
2866 segments or <quote>pages</> small enough to be conveniently stored as rows
2867 in <structname>pg_largeobject</structname>.
2868 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
2869 <literal>BLCKSZ/4</>, or typically 2 kB).
2873 <title><structname>pg_largeobject</> Columns</title>
2880 <entry>Description</entry>
2886 <entry><structfield>loid</structfield></entry>
2887 <entry><type>oid</type></entry>
2888 <entry>Identifier of the large object that includes this page</entry>
2892 <entry><structfield>pageno</structfield></entry>
2893 <entry><type>int4</type></entry>
2894 <entry>Page number of this page within its large object
2895 (counting from zero)</entry>
2899 <entry><structfield>data</structfield></entry>
2900 <entry><type>bytea</type></entry>
2902 Actual data stored in the large object.
2903 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less
2911 Each row of <structname>pg_largeobject</structname> holds data
2912 for one page of a large object, beginning at
2913 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
2914 allows sparse storage: pages might be missing, and might be shorter than
2915 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
2916 Missing regions within a large object read as zeroes.
2922 <sect1 id="catalog-pg-listener">
2923 <title><structname>pg_listener</structname></title>
2925 <indexterm zone="catalog-pg-listener">
2926 <primary>pg_listener</primary>
2930 The catalog <structname>pg_listener</structname> supports the
2931 <xref linkend="sql-listen" endterm="sql-listen-title"> and
2932 <xref linkend="sql-notify" endterm="sql-notify-title">
2933 commands. A listener creates an entry in
2934 <structname>pg_listener</structname> for each notification name
2935 it is listening for. A notifier scans <structname>pg_listener</structname>
2936 and updates each matching entry to show that a notification has occurred.
2937 The notifier also sends a signal (using the PID recorded in the table)
2938 to awaken the listener from sleep.
2942 <title><structname>pg_listener</> Columns</title>
2949 <entry>References</entry>
2950 <entry>Description</entry>
2956 <entry><structfield>relname</structfield></entry>
2957 <entry><type>name</type></entry>
2959 Notify condition name. (The name need not match any actual
2960 relation in the database; the name <structfield>relname</> is historical.)
2965 <entry><structfield>listenerpid</structfield></entry>
2966 <entry><type>int4</type></entry>
2967 <entry>PID of the server process that created this entry</entry>
2971 <entry><structfield>notification</structfield></entry>
2972 <entry><type>int4</type></entry>
2974 Zero if no event is pending for this listener. If an event is
2975 pending, the PID of the server process that sent the notification
2985 <sect1 id="catalog-pg-namespace">
2986 <title><structname>pg_namespace</structname></title>
2988 <indexterm zone="catalog-pg-namespace">
2989 <primary>pg_namespace</primary>
2993 The catalog <structname>pg_namespace</> stores namespaces.
2994 A namespace is the structure underlying SQL schemas: each namespace
2995 can have a separate collection of relations, types, etc. without name
3000 <title><structname>pg_namespace</> Columns</title>
3007 <entry>References</entry>
3008 <entry>Description</entry>
3014 <entry><structfield>nspname</structfield></entry>
3015 <entry><type>name</type></entry>
3017 <entry>Name of the namespace</entry>
3021 <entry><structfield>nspowner</structfield></entry>
3022 <entry><type>oid</type></entry>
3023 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3024 <entry>Owner of the namespace</entry>
3028 <entry><structfield>nspacl</structfield></entry>
3029 <entry><type>aclitem[]</type></entry>
3032 Access privileges; see
3033 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3034 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3045 <sect1 id="catalog-pg-opclass">
3046 <title><structname>pg_opclass</structname></title>
3048 <indexterm zone="catalog-pg-opclass">
3049 <primary>pg_opclass</primary>
3053 The catalog <structname>pg_opclass</structname> defines
3054 index access method operator classes. Each operator class defines
3055 semantics for index columns of a particular data type and a particular
3056 index access method. An operator class essentially specifies that a
3057 particular operator family is applicable to a particular indexable column
3058 data type. The set of operators from the family that are actually usable
3059 with the indexed column are whichever ones accept the column's data type
3060 as their lefthand input.
3064 Operator classes are described at length in <xref linkend="xindex">.
3068 <title><structname>pg_opclass</> Columns</title>
3075 <entry>References</entry>
3076 <entry>Description</entry>
3082 <entry><structfield>opcmethod</structfield></entry>
3083 <entry><type>oid</type></entry>
3084 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3085 <entry>Index access method operator class is for</entry>
3089 <entry><structfield>opcname</structfield></entry>
3090 <entry><type>name</type></entry>
3092 <entry>Name of this operator class</entry>
3096 <entry><structfield>opcnamespace</structfield></entry>
3097 <entry><type>oid</type></entry>
3098 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3099 <entry>Namespace of this operator class</entry>
3103 <entry><structfield>opcowner</structfield></entry>
3104 <entry><type>oid</type></entry>
3105 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3106 <entry>Owner of the operator class</entry>
3110 <entry><structfield>opcfamily</structfield></entry>
3111 <entry><type>oid</type></entry>
3112 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3113 <entry>Operator family containing the operator class</entry>
3117 <entry><structfield>opcintype</structfield></entry>
3118 <entry><type>oid</type></entry>
3119 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3120 <entry>Data type that the operator class indexes</entry>
3124 <entry><structfield>opcdefault</structfield></entry>
3125 <entry><type>bool</type></entry>
3127 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3131 <entry><structfield>opckeytype</structfield></entry>
3132 <entry><type>oid</type></entry>
3133 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3134 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3142 An operator class's <structfield>opcmethod</> must match the
3143 <structname>opfmethod</> of its containing operator family.
3144 Also, there must be no more than one <structname>pg_opclass</structname>
3145 row having <structname>opcdefault</> true for any given combination of
3146 <structname>opcmethod</> and <structname>opcintype</>.
3152 <sect1 id="catalog-pg-operator">
3153 <title><structname>pg_operator</structname></title>
3155 <indexterm zone="catalog-pg-operator">
3156 <primary>pg_operator</primary>
3160 The catalog <structname>pg_operator</> stores information about operators.
3161 See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
3162 and <xref linkend="xoper"> for more information.
3166 <title><structname>pg_operator</> Columns</title>
3173 <entry>References</entry>
3174 <entry>Description</entry>
3180 <entry><structfield>oprname</structfield></entry>
3181 <entry><type>name</type></entry>
3183 <entry>Name of the operator</entry>
3187 <entry><structfield>oprnamespace</structfield></entry>
3188 <entry><type>oid</type></entry>
3189 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3191 The OID of the namespace that contains this operator
3196 <entry><structfield>oprowner</structfield></entry>
3197 <entry><type>oid</type></entry>
3198 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3199 <entry>Owner of the operator</entry>
3203 <entry><structfield>oprkind</structfield></entry>
3204 <entry><type>char</type></entry>
3207 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3208 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3213 <entry><structfield>oprcanmerge</structfield></entry>
3214 <entry><type>bool</type></entry>
3216 <entry>This operator supports merge joins</entry>
3220 <entry><structfield>oprcanhash</structfield></entry>
3221 <entry><type>bool</type></entry>
3223 <entry>This operator supports hash joins</entry>
3227 <entry><structfield>oprleft</structfield></entry>
3228 <entry><type>oid</type></entry>
3229 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3230 <entry>Type of the left operand</entry>
3234 <entry><structfield>oprright</structfield></entry>
3235 <entry><type>oid</type></entry>
3236 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3237 <entry>Type of the right operand</entry>
3241 <entry><structfield>oprresult</structfield></entry>
3242 <entry><type>oid</type></entry>
3243 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3244 <entry>Type of the result</entry>
3248 <entry><structfield>oprcom</structfield></entry>
3249 <entry><type>oid</type></entry>
3250 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3251 <entry>Commutator of this operator, if any</entry>
3255 <entry><structfield>oprnegate</structfield></entry>
3256 <entry><type>oid</type></entry>
3257 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3258 <entry>Negator of this operator, if any</entry>
3262 <entry><structfield>oprcode</structfield></entry>
3263 <entry><type>regproc</type></entry>
3264 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3265 <entry>Function that implements this operator</entry>
3269 <entry><structfield>oprrest</structfield></entry>
3270 <entry><type>regproc</type></entry>
3271 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3272 <entry>Restriction selectivity estimation function for this operator</entry>
3276 <entry><structfield>oprjoin</structfield></entry>
3277 <entry><type>regproc</type></entry>
3278 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3279 <entry>Join selectivity estimation function for this operator</entry>
3286 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3287 is zero for a prefix operator.
3293 <sect1 id="catalog-pg-opfamily">
3294 <title><structname>pg_opfamily</structname></title>
3296 <indexterm zone="catalog-pg-opfamily">
3297 <primary>pg_opfamily</primary>
3301 The catalog <structname>pg_opfamily</structname> defines operator families.
3302 Each operator family is a collection of operators and associated
3303 support routines that implement the semantics specified for a particular
3304 index access method. Furthermore, the operators in a family are all
3305 <quote>compatible</>, in a way that is specified by the access method.
3306 The operator family concept allows cross-data-type operators to be used
3307 with indexes and to be reasoned about using knowledge of access method
3312 Operator families are described at length in <xref linkend="xindex">.
3316 <title><structname>pg_opfamily</> Columns</title>
3323 <entry>References</entry>
3324 <entry>Description</entry>
3330 <entry><structfield>opfmethod</structfield></entry>
3331 <entry><type>oid</type></entry>
3332 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3333 <entry>Index access method operator family is for</entry>
3337 <entry><structfield>opfname</structfield></entry>
3338 <entry><type>name</type></entry>
3340 <entry>Name of this operator family</entry>
3344 <entry><structfield>opfnamespace</structfield></entry>
3345 <entry><type>oid</type></entry>
3346 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3347 <entry>Namespace of this operator family</entry>
3351 <entry><structfield>opfowner</structfield></entry>
3352 <entry><type>oid</type></entry>
3353 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3354 <entry>Owner of the operator family</entry>
3362 The majority of the information defining an operator family is not in its
3363 <structname>pg_opfamily</structname> row, but in the associated rows in
3364 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3365 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3367 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3373 <sect1 id="catalog-pg-pltemplate">
3374 <title><structname>pg_pltemplate</structname></title>
3376 <indexterm zone="catalog-pg-pltemplate">
3377 <primary>pg_pltemplate</primary>
3381 The catalog <structname>pg_pltemplate</structname> stores
3382 <quote>template</> information for procedural languages.
3383 A template for a language allows the language to be created in a
3384 particular database by a simple <command>CREATE LANGUAGE</> command,
3385 with no need to specify implementation details.
3389 Unlike most system catalogs, <structname>pg_pltemplate</structname>
3390 is shared across all databases of a cluster: there is only one
3391 copy of <structname>pg_pltemplate</structname> per cluster, not
3392 one per database. This allows the information to be accessible in
3393 each database as it is needed.
3397 <title><structname>pg_pltemplate</> Columns</title>
3404 <entry>Description</entry>
3410 <entry><structfield>tmplname</structfield></entry>
3411 <entry><type>name</type></entry>
3412 <entry>Name of the language this template is for</entry>
3416 <entry><structfield>tmpltrusted</structfield></entry>
3417 <entry><type>boolean</type></entry>
3418 <entry>True if language is considered trusted</entry>
3422 <entry><structfield>tmpldbacreate</structfield></entry>
3423 <entry><type>boolean</type></entry>
3424 <entry>True if language may be created by a database owner</entry>
3428 <entry><structfield>tmplhandler</structfield></entry>
3429 <entry><type>text</type></entry>
3430 <entry>Name of call handler function</entry>
3434 <entry><structfield>tmplvalidator</structfield></entry>
3435 <entry><type>text</type></entry>
3436 <entry>Name of validator function, or NULL if none</entry>
3440 <entry><structfield>tmpllibrary</structfield></entry>
3441 <entry><type>text</type></entry>
3442 <entry>Path of shared library that implements language</entry>
3446 <entry><structfield>tmplacl</structfield></entry>
3447 <entry><type>aclitem[]</type></entry>
3448 <entry>Access privileges for template (not yet used)</entry>
3456 There are not currently any commands that manipulate procedural language
3457 templates; to change the built-in information, a superuser must modify
3458 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3459 or <command>UPDATE</command> commands. It is likely that a future
3460 release of <productname>PostgreSQL</productname> will offer
3461 commands to change the entries in a cleaner fashion.
3465 When implemented, the <structfield>tmplacl</structfield> field will provide
3466 access control for the template itself (i.e., the right to create a
3467 language using it), not for the languages created from the template.
3473 <sect1 id="catalog-pg-proc">
3474 <title><structname>pg_proc</structname></title>
3476 <indexterm zone="catalog-pg-proc">
3477 <primary>pg_proc</primary>
3481 The catalog <structname>pg_proc</> stores information about functions (or procedures).
3482 See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
3483 and <xref linkend="xfunc"> for more information.
3487 The table contains data for aggregate functions as well as plain functions.
3488 If <structfield>proisagg</structfield> is true, there should be a matching
3489 row in <structfield>pg_aggregate</structfield>.
3493 <title><structname>pg_proc</> Columns</title>
3500 <entry>References</entry>
3501 <entry>Description</entry>
3507 <entry><structfield>proname</structfield></entry>
3508 <entry><type>name</type></entry>
3510 <entry>Name of the function</entry>
3514 <entry><structfield>pronamespace</structfield></entry>
3515 <entry><type>oid</type></entry>
3516 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3518 The OID of the namespace that contains this function
3523 <entry><structfield>proowner</structfield></entry>
3524 <entry><type>oid</type></entry>
3525 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3526 <entry>Owner of the function</entry>
3530 <entry><structfield>prolang</structfield></entry>
3531 <entry><type>oid</type></entry>
3532 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3533 <entry>Implementation language or call interface of this function</entry>
3537 <entry><structfield>procost</structfield></entry>
3538 <entry><type>float4</type></entry>
3540 <entry>Estimated execution cost (in units of
3541 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3542 this is cost per row returned</entry>
3546 <entry><structfield>prorows</structfield></entry>
3547 <entry><type>float4</type></entry>
3549 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3553 <entry><structfield>proisagg</structfield></entry>
3554 <entry><type>bool</type></entry>
3556 <entry>Function is an aggregate function</entry>
3560 <entry><structfield>prosecdef</structfield></entry>
3561 <entry><type>bool</type></entry>
3563 <entry>Function is a security definer (i.e., a <quote>setuid</>
3568 <entry><structfield>proisstrict</structfield></entry>
3569 <entry><type>bool</type></entry>
3572 Function returns null if any call argument is null. In that
3573 case the function won't actually be called at all. Functions
3574 that are not <quote>strict</quote> must be prepared to handle
3580 <entry><structfield>proretset</structfield></entry>
3581 <entry><type>bool</type></entry>
3583 <entry>Function returns a set (i.e., multiple values of the specified
3588 <entry><structfield>provolatile</structfield></entry>
3589 <entry><type>char</type></entry>
3592 <structfield>provolatile</structfield> tells whether the function's
3593 result depends only on its input arguments, or is affected by outside
3595 It is <literal>i</literal> for <quote>immutable</> functions,
3596 which always deliver the same result for the same inputs.
3597 It is <literal>s</literal> for <quote>stable</> functions,
3598 whose results (for fixed inputs) do not change within a scan.
3599 It is <literal>v</literal> for <quote>volatile</> functions,
3600 whose results might change at any time. (Use <literal>v</literal> also
3601 for functions with side-effects, so that calls to them cannot get
3607 <entry><structfield>pronargs</structfield></entry>
3608 <entry><type>int2</type></entry>
3610 <entry>Number of arguments</entry>
3614 <entry><structfield>prorettype</structfield></entry>
3615 <entry><type>oid</type></entry>
3616 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3617 <entry>Data type of the return value</entry>
3621 <entry><structfield>proargtypes</structfield></entry>
3622 <entry><type>oidvector</type></entry>
3623 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3625 An array with the data types of the function arguments. This includes
3626 only input arguments (including <literal>INOUT</literal> arguments), and thus represents
3627 the call signature of the function
3632 <entry><structfield>proallargtypes</structfield></entry>
3633 <entry><type>oid[]</type></entry>
3634 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3636 An array with the data types of the function arguments. This includes
3637 all arguments (including <literal>OUT</literal> and <literal>INOUT</literal> arguments); however, if all the
3638 arguments are IN arguments, this field will be null.
3639 Note that subscripting is 1-based, whereas for historical reasons
3640 <structfield>proargtypes</> is subscripted from 0
3645 <entry><structfield>proargmodes</structfield></entry>
3646 <entry><type>char[]</type></entry>
3649 An array with the modes of the function arguments, encoded as
3650 <literal>i</literal> for <literal>IN</> arguments,
3651 <literal>o</literal> for <literal>OUT</> arguments,
3652 <literal>b</literal> for <literal>INOUT</> arguments.
3653 If all the arguments are <literal>IN</literal> arguments, this field will be null.
3654 Note that subscripts correspond to positions of
3655 <structfield>proallargtypes</> not <structfield>proargtypes</>
3660 <entry><structfield>proargnames</structfield></entry>
3661 <entry><type>text[]</type></entry>
3664 An array with the names of the function arguments.
3665 Arguments without a name are set to empty strings in the array.
3666 If none of the arguments have a name, this field will be null.
3667 Note that subscripts correspond to positions of
3668 <structfield>proallargtypes</> not <structfield>proargtypes</>
3673 <entry><structfield>prosrc</structfield></entry>
3674 <entry><type>text</type></entry>
3677 This tells the function handler how to invoke the function. It
3678 might be the actual source code of the function for interpreted
3679 languages, a link symbol, a file name, or just about anything
3680 else, depending on the implementation language/call convention
3685 <entry><structfield>probin</structfield></entry>
3686 <entry><type>bytea</type></entry>
3689 Additional information about how to invoke the function.
3690 Again, the interpretation is language-specific
3695 <entry><structfield>proconfig</structfield></entry>
3696 <entry><type>text[]</type></entry>
3698 <entry>Function's local settings for run-time configuration variables</entry>
3702 <entry><structfield>proacl</structfield></entry>
3703 <entry><type>aclitem[]</type></entry>
3706 Access privileges; see
3707 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3708 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3717 For compiled functions, both built-in and dynamically loaded,
3718 <structfield>prosrc</structfield> contains the function's C-language
3719 name (link symbol). For all other currently-known language types,
3720 <structfield>prosrc</structfield> contains the function's source
3721 text. <structfield>probin</structfield> is unused except for
3722 dynamically-loaded C functions, for which it gives the name of the
3723 shared library file containing the function.
3728 <sect1 id="catalog-pg-rewrite">
3729 <title><structname>pg_rewrite</structname></title>
3731 <indexterm zone="catalog-pg-rewrite">
3732 <primary>pg_rewrite</primary>
3736 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
3740 <title><structname>pg_rewrite</> Columns</title>
3747 <entry>References</entry>
3748 <entry>Description</entry>
3754 <entry><structfield>rulename</structfield></entry>
3755 <entry><type>name</type></entry>
3757 <entry>Rule name</entry>
3761 <entry><structfield>ev_class</structfield></entry>
3762 <entry><type>oid</type></entry>
3763 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3764 <entry>The table this rule is for</entry>
3768 <entry><structfield>ev_attr</structfield></entry>
3769 <entry><type>int2</type></entry>
3771 <entry>The column this rule is for (currently, always zero to
3772 indicate the whole table)</entry>
3776 <entry><structfield>ev_type</structfield></entry>
3777 <entry><type>char</type></entry>
3780 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
3781 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
3787 <entry><structfield>ev_enabled</structfield></entry>
3788 <entry><type>char</type></entry>
3791 Controls in which <xref linkend="guc-session-replication-role"> modes
3793 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
3794 <literal>D</> = rule is disabled,
3795 <literal>R</> = rule fires in <quote>replica</> mode,
3796 <literal>A</> = rule fires always.
3801 <entry><structfield>is_instead</structfield></entry>
3802 <entry><type>bool</type></entry>
3804 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
3808 <entry><structfield>ev_qual</structfield></entry>
3809 <entry><type>text</type></entry>
3812 Expression tree (in the form of a
3813 <function>nodeToString()</function> representation) for the
3814 rule's qualifying condition
3819 <entry><structfield>ev_action</structfield></entry>
3820 <entry><type>text</type></entry>
3823 Query tree (in the form of a
3824 <function>nodeToString()</function> representation) for the
3834 <literal>pg_class.relhasrules</literal>
3835 must be true if a table has any rules in this catalog.
3842 <sect1 id="catalog-pg-shdepend">
3843 <title><structname>pg_shdepend</structname></title>
3845 <indexterm zone="catalog-pg-shdepend">
3846 <primary>pg_shdepend</primary>
3850 The catalog <structname>pg_shdepend</structname> records the
3851 dependency relationships between database objects and shared objects,
3852 such as roles. This information allows
3853 <productname>PostgreSQL</productname> to ensure that those objects are
3854 unreferenced before attempting to delete them.
3858 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
3859 which performs a similar function for dependencies involving objects
3860 within a single database.
3864 Unlike most system catalogs, <structname>pg_shdepend</structname>
3865 is shared across all databases of a cluster: there is only one
3866 copy of <structname>pg_shdepend</structname> per cluster, not
3871 <title><structname>pg_shdepend</> Columns</title>
3878 <entry>References</entry>
3879 <entry>Description</entry>
3885 <entry><structfield>dbid</structfield></entry>
3886 <entry><type>oid</type></entry>
3887 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
3888 <entry>The OID of the database the dependent object is in,
3889 or zero for a shared object</entry>
3893 <entry><structfield>classid</structfield></entry>
3894 <entry><type>oid</type></entry>
3895 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3896 <entry>The OID of the system catalog the dependent object is in</entry>
3900 <entry><structfield>objid</structfield></entry>
3901 <entry><type>oid</type></entry>
3902 <entry>any OID column</entry>
3903 <entry>The OID of the specific dependent object</entry>
3907 <entry><structfield>refclassid</structfield></entry>
3908 <entry><type>oid</type></entry>
3909 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3910 <entry>The OID of the system catalog the referenced object is in
3911 (must be a shared catalog)</entry>
3915 <entry><structfield>refobjid</structfield></entry>
3916 <entry><type>oid</type></entry>
3917 <entry>any OID column</entry>
3918 <entry>The OID of the specific referenced object</entry>
3922 <entry><structfield>deptype</structfield></entry>
3923 <entry><type>char</type></entry>
3926 A code defining the specific semantics of this dependency relationship; see text
3935 In all cases, a <structname>pg_shdepend</structname> entry indicates that
3936 the referenced object cannot be dropped without also dropping the dependent
3937 object. However, there are several subflavors identified by
3938 <structfield>deptype</>:
3942 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
3945 The referenced object (which must be a role) is the owner of the
3952 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
3955 The referenced object (which must be a role) is mentioned in the
3956 ACL (access control list, i.e., privileges list) of the
3957 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
3958 not made for the owner of the object, since the owner will have
3959 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
3965 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
3968 There is no dependent object; this type of entry is a signal
3969 that the system itself depends on the referenced object, and so
3970 that object must never be deleted. Entries of this type are
3971 created only by <command>initdb</command>. The columns for the
3972 dependent object contain zeroes.
3978 Other dependency flavors might be needed in future. Note in particular
3979 that the current definition only supports roles as referenced objects.
3984 <sect1 id="catalog-pg-shdescription">
3985 <title><structname>pg_shdescription</structname></title>
3987 <indexterm zone="catalog-pg-shdescription">
3988 <primary>pg_shdescription</primary>
3992 The catalog <structname>pg_shdescription</structname> stores optional
3993 descriptions (comments) for shared database objects. Descriptions can be
3994 manipulated with the <xref linkend="sql-comment"
3995 endterm="sql-comment-title"> command and viewed with
3996 <application>psql</application>'s <literal>\d</literal> commands.
4000 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4001 which performs a similar function for descriptions involving objects
4002 within a single database.
4006 Unlike most system catalogs, <structname>pg_shdescription</structname>
4007 is shared across all databases of a cluster: there is only one
4008 copy of <structname>pg_shdescription</structname> per cluster, not
4013 <title><structname>pg_shdescription</> Columns</title>
4020 <entry>References</entry>
4021 <entry>Description</entry>
4027 <entry><structfield>objoid</structfield></entry>
4028 <entry><type>oid</type></entry>
4029 <entry>any OID column</entry>
4030 <entry>The OID of the object this description pertains to</entry>
4034 <entry><structfield>classoid</structfield></entry>
4035 <entry><type>oid</type></entry>
4036 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4037 <entry>The OID of the system catalog this object appears in</entry>
4041 <entry><structfield>description</structfield></entry>
4042 <entry><type>text</type></entry>
4044 <entry>Arbitrary text that serves as the description of this object</entry>
4053 <sect1 id="catalog-pg-statistic">
4054 <title><structname>pg_statistic</structname></title>
4056 <indexterm zone="catalog-pg-statistic">
4057 <primary>pg_statistic</primary>
4061 The catalog <structname>pg_statistic</structname> stores
4062 statistical data about the contents of the database. Entries are
4063 created by <xref linkend="sql-analyze" endterm="sql-analyze-title">
4064 and subsequently used by the query planner. There is one entry for
4065 each table column that has been analyzed. Note that all the
4066 statistical data is inherently approximate, even assuming that it
4071 <structname>pg_statistic</structname> also stores statistical data about
4072 the values of index expressions. These are described as if they were
4073 actual data columns; in particular, <structfield>starelid</structfield>
4074 references the index. No entry is made for an ordinary non-expression
4075 index column, however, since it would be redundant with the entry
4076 for the underlying table column.
4080 Since different kinds of statistics might be appropriate for different
4081 kinds of data, <structname>pg_statistic</structname> is designed not
4082 to assume very much about what sort of statistics it stores. Only
4083 extremely general statistics (such as nullness) are given dedicated
4084 columns in <structname>pg_statistic</structname>. Everything else
4085 is stored in <quote>slots</quote>, which are groups of associated columns
4086 whose content is identified by a code number in one of the slot's columns.
4087 For more information see
4088 <filename>src/include/catalog/pg_statistic.h</filename>.
4092 <structname>pg_statistic</structname> should not be readable by the
4093 public, since even statistical information about a table's contents
4094 might be considered sensitive. (Example: minimum and maximum values
4095 of a salary column might be quite interesting.)
4096 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4097 is a publicly readable view on
4098 <structname>pg_statistic</structname> that only exposes information
4099 about those tables that are readable by the current user.
4103 <title><structname>pg_statistic</> Columns</title>
4110 <entry>References</entry>
4111 <entry>Description</entry>
4117 <entry><structfield>starelid</structfield></entry>
4118 <entry><type>oid</type></entry>
4119 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4120 <entry>The table or index that the described column belongs to</entry>
4124 <entry><structfield>staattnum</structfield></entry>
4125 <entry><type>int2</type></entry>
4126 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4127 <entry>The number of the described column</entry>
4131 <entry><structfield>stanullfrac</structfield></entry>
4132 <entry><type>float4</type></entry>
4134 <entry>The fraction of the column's entries that are null</entry>
4138 <entry><structfield>stawidth</structfield></entry>
4139 <entry><type>int4</type></entry>
4141 <entry>The average stored width, in bytes, of nonnull entries</entry>
4145 <entry><structfield>stadistinct</structfield></entry>
4146 <entry><type>float4</type></entry>
4148 <entry>The number of distinct nonnull data values in the column.
4149 A value greater than zero is the actual number of distinct values.
4150 A value less than zero is the negative of a fraction of the number
4151 of rows in the table (for example, a column in which values appear about
4152 twice on the average could be represented by <structfield>stadistinct</> = -0.5).
4153 A zero value means the number of distinct values is unknown
4158 <entry><structfield>stakind<replaceable>N</></structfield></entry>
4159 <entry><type>int2</type></entry>
4162 A code number indicating the kind of statistics stored in the
4163 <replaceable>N</>th <quote>slot</quote> of the
4164 <structname>pg_statistic</structname> row
4169 <entry><structfield>staop<replaceable>N</></structfield></entry>
4170 <entry><type>oid</type></entry>
4171 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4173 An operator used to derive the statistics stored in the
4174 <replaceable>N</>th <quote>slot</quote>. For example, a
4175 histogram slot would show the <literal><</literal> operator
4176 that defines the sort order of the data
4181 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4182 <entry><type>float4[]</type></entry>
4185 Numerical statistics of the appropriate kind for the
4186 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4187 kind does not involve numerical values
4192 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4193 <entry><type>anyarray</type></entry>
4196 Column data values of the appropriate kind for the
4197 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4198 kind does not store any data values. Each array's element
4199 values are actually of the specific column's data type, so there
4200 is no way to define these columns' type more specifically than
4211 <sect1 id="catalog-pg-tablespace">
4212 <title><structname>pg_tablespace</structname></title>
4214 <indexterm zone="catalog-pg-tablespace">
4215 <primary>pg_tablespace</primary>
4219 The catalog <structname>pg_tablespace</structname> stores information
4220 about the available tablespaces. Tables can be placed in particular
4221 tablespaces to aid administration of disk layout.
4225 Unlike most system catalogs, <structname>pg_tablespace</structname>
4226 is shared across all databases of a cluster: there is only one
4227 copy of <structname>pg_tablespace</structname> per cluster, not
4232 <title><structname>pg_tablespace</> Columns</title>
4239 <entry>References</entry>
4240 <entry>Description</entry>
4246 <entry><structfield>spcname</structfield></entry>
4247 <entry><type>name</type></entry>
4249 <entry>Tablespace name</entry>
4253 <entry><structfield>spcowner</structfield></entry>
4254 <entry><type>oid</type></entry>
4255 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4256 <entry>Owner of the tablespace, usually the user who created it</entry>
4260 <entry><structfield>spclocation</structfield></entry>
4261 <entry><type>text</type></entry>
4263 <entry>Location (directory path) of the tablespace</entry>
4267 <entry><structfield>spcacl</structfield></entry>
4268 <entry><type>aclitem[]</type></entry>
4271 Access privileges; see
4272 <xref linkend="sql-grant" endterm="sql-grant-title"> and
4273 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4283 <sect1 id="catalog-pg-trigger">
4284 <title><structname>pg_trigger</structname></title>
4286 <indexterm zone="catalog-pg-trigger">
4287 <primary>pg_trigger</primary>
4291 The catalog <structname>pg_trigger</structname> stores triggers on tables.
4292 See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
4293 for more information.
4297 <title><structname>pg_trigger</> Columns</title>
4304 <entry>References</entry>
4305 <entry>Description</entry>
4311 <entry><structfield>tgrelid</structfield></entry>
4312 <entry><type>oid</type></entry>
4313 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4314 <entry>The table this trigger is on</entry>
4318 <entry><structfield>tgname</structfield></entry>
4319 <entry><type>name</type></entry>
4321 <entry>Trigger name (must be unique among triggers of same table)</entry>
4325 <entry><structfield>tgfoid</structfield></entry>
4326 <entry><type>oid</type></entry>
4327 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4328 <entry>The function to be called</entry>
4332 <entry><structfield>tgtype</structfield></entry>
4333 <entry><type>int2</type></entry>
4335 <entry>Bit mask identifying trigger conditions</entry>
4339 <entry><structfield>tgenabled</structfield></entry>
4340 <entry><type>char</type></entry>
4343 Controls in which <xref linkend="guc-session-replication-role"> modes
4345 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4346 <literal>D</> = trigger is disabled,
4347 <literal>R</> = trigger fires in <quote>replica</> mode,
4348 <literal>A</> = trigger fires always.
4353 <entry><structfield>tgisconstraint</structfield></entry>
4354 <entry><type>bool</type></entry>
4356 <entry>True if trigger is a <quote>constraint trigger</></entry>
4360 <entry><structfield>tgconstrname</structfield></entry>
4361 <entry><type>name</type></entry>
4363 <entry>Constraint name, if a constraint trigger</entry>
4367 <entry><structfield>tgconstrrelid</structfield></entry>
4368 <entry><type>oid</type></entry>
4369 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4370 <entry>The table referenced by a referential integrity constraint</entry>
4374 <entry><structfield>tgconstraint</structfield></entry>
4375 <entry><type>oid</type></entry>
4376 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4377 <entry>The <structname>pg_constraint</> entry owning the trigger, if any</entry>
4381 <entry><structfield>tgdeferrable</structfield></entry>
4382 <entry><type>bool</type></entry>
4384 <entry>True if constraint trigger is deferrable</entry>
4388 <entry><structfield>tginitdeferred</structfield></entry>
4389 <entry><type>bool</type></entry>
4391 <entry>True if constraint trigger is initially deferred</entry>
4395 <entry><structfield>tgnargs</structfield></entry>
4396 <entry><type>int2</type></entry>
4398 <entry>Number of argument strings passed to trigger function</entry>
4402 <entry><structfield>tgattr</structfield></entry>
4403 <entry><type>int2vector</type></entry>
4405 <entry>Currently unused</entry>
4409 <entry><structfield>tgargs</structfield></entry>
4410 <entry><type>bytea</type></entry>
4412 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4420 When <structfield>tgconstraint</> is nonzero,
4421 <structfield>tgisconstraint</> must be true, and
4422 <structfield>tgconstrname</>, <structfield>tgconstrrelid</>,
4423 <structfield>tgdeferrable</>, <structfield>tginitdeferred</> are redundant
4424 with the referenced <structname>pg_constraint</> entry. The reason we
4425 keep these fields is that we support <quote>stand-alone</> constraint
4426 triggers with no corresponding <structname>pg_constraint</> entry.
4432 <literal>pg_class.reltriggers</literal> needs to agree with the
4433 number of triggers found in this table for each relation.
4440 <sect1 id="catalog-pg-ts-config">
4441 <title><structname>pg_ts_config</structname></title>
4443 <indexterm zone="catalog-pg-ts-config">
4444 <primary>pg_ts_config</primary>
4448 The <structname>pg_ts_config</structname> catalog contains entries
4449 representing text search configurations. A configuration specifies
4450 a particular text search parser and a list of dictionaries to use
4451 for each of the parser's output token types. The parser is shown
4452 in the <structname>pg_ts_config</structname> entry, but the
4453 token-to-dictionary mapping is defined by subsidiary entries in <link
4454 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4458 <productname>PostgreSQL</productname>'s text search features are
4459 described at length in <xref linkend="textsearch">.
4463 <title><structname>pg_ts_config</> Columns</title>
4470 <entry>References</entry>
4471 <entry>Description</entry>
4477 <entry><structfield>cfgname</structfield></entry>
4478 <entry><type>name</type></entry>
4480 <entry>Text search configuration name</entry>
4484 <entry><structfield>cfgnamespace</structfield></entry>
4485 <entry><type>oid</type></entry>
4486 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4488 The OID of the namespace that contains this configuration
4493 <entry><structfield>cfgowner</structfield></entry>
4494 <entry><type>oid</type></entry>
4495 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4496 <entry>Owner of the configuration</entry>
4500 <entry><structfield>cfgparser</structfield></entry>
4501 <entry><type>oid</type></entry>
4502 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4503 <entry>The OID of the text search parser for this configuration</entry>
4511 <sect1 id="catalog-pg-ts-config-map">
4512 <title><structname>pg_ts_config_map</structname></title>
4514 <indexterm zone="catalog-pg-ts-config-map">
4515 <primary>pg_ts_config_map</primary>
4519 The <structname>pg_ts_config_map</structname> catalog contains entries
4520 showing which text search dictionaries should be consulted, and in
4521 what order, for each output token type of each text search configuration's
4526 <productname>PostgreSQL</productname>'s text search features are
4527 described at length in <xref linkend="textsearch">.
4531 <title><structname>pg_ts_config_map</> Columns</title>
4538 <entry>References</entry>
4539 <entry>Description</entry>
4545 <entry><structfield>mapcfg</structfield></entry>
4546 <entry><type>oid</type></entry>
4547 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4548 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
4552 <entry><structfield>maptokentype</structfield></entry>
4553 <entry><type>integer</type></entry>
4555 <entry>A token type emitted by the configuration's parser</entry>
4559 <entry><structfield>mapseqno</structfield></entry>
4560 <entry><type>integer</type></entry>
4562 <entry>Order in which to consult this entry (lower
4563 <structfield>mapseqno</>s first)</entry>
4567 <entry><structfield>mapdict</structfield></entry>
4568 <entry><type>oid</type></entry>
4569 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
4570 <entry>The OID of the text search dictionary to consult</entry>
4578 <sect1 id="catalog-pg-ts-dict">
4579 <title><structname>pg_ts_dict</structname></title>
4581 <indexterm zone="catalog-pg-ts-dict">
4582 <primary>pg_ts_dict</primary>
4586 The <structname>pg_ts_dict</structname> catalog contains entries
4587 defining text search dictionaries. A dictionary depends on a text
4588 search template, which specifies all the implementation functions
4589 needed; the dictionary itself provides values for the user-settable
4590 parameters supported by the template. This division of labor allows
4591 dictionaries to be created by unprivileged users. The parameters
4592 are specified by a text string <structfield>dictinitoption</>,
4593 whose format and meaning vary depending on the template.
4597 <productname>PostgreSQL</productname>'s text search features are
4598 described at length in <xref linkend="textsearch">.
4602 <title><structname>pg_ts_dict</> Columns</title>
4609 <entry>References</entry>
4610 <entry>Description</entry>
4616 <entry><structfield>dictname</structfield></entry>
4617 <entry><type>name</type></entry>
4619 <entry>Text search dictionary name</entry>
4623 <entry><structfield>dictnamespace</structfield></entry>
4624 <entry><type>oid</type></entry>
4625 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4627 The OID of the namespace that contains this dictionary
4632 <entry><structfield>dictowner</structfield></entry>
4633 <entry><type>oid</type></entry>
4634 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4635 <entry>Owner of the dictionary</entry>
4639 <entry><structfield>dicttemplate</structfield></entry>
4640 <entry><type>oid</type></entry>
4641 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
4642 <entry>The OID of the text search template for this dictionary</entry>
4646 <entry><structfield>dictinitoption</structfield></entry>
4647 <entry><type>text</type></entry>
4649 <entry>Initialization option string for the template</entry>
4657 <sect1 id="catalog-pg-ts-parser">
4658 <title><structname>pg_ts_parser</structname></title>
4660 <indexterm zone="catalog-pg-ts-parser">
4661 <primary>pg_ts_parser</primary>
4665 The <structname>pg_ts_parser</structname> catalog contains entries
4666 defining text search parsers. A parser is responsible for splitting
4667 input text into lexemes and assigning a token type to each lexeme.
4668 Since a parser must be implemented by C-language-level functions,
4669 creation of new parsers is restricted to database superusers.
4673 <productname>PostgreSQL</productname>'s text search features are
4674 described at length in <xref linkend="textsearch">.
4678 <title><structname>pg_ts_parser</> Columns</title>
4685 <entry>References</entry>
4686 <entry>Description</entry>
4692 <entry><structfield>prsname</structfield></entry>
4693 <entry><type>name</type></entry>
4695 <entry>Text search parser name</entry>
4699 <entry><structfield>prsnamespace</structfield></entry>
4700 <entry><type>oid</type></entry>
4701 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4703 The OID of the namespace that contains this parser
4708 <entry><structfield>prsstart</structfield></entry>
4709 <entry><type>regproc</type></entry>
4710 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4711 <entry>OID of the parser's startup function</entry>
4715 <entry><structfield>prstoken</structfield></entry>
4716 <entry><type>regproc</type></entry>
4717 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4718 <entry>OID of the parser's next-token function</entry>
4722 <entry><structfield>prsend</structfield></entry>
4723 <entry><type>regproc</type></entry>
4724 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4725 <entry>OID of the parser's shutdown function</entry>
4729 <entry><structfield>prsheadline</structfield></entry>
4730 <entry><type>regproc</type></entry>
4731 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4732 <entry>OID of the parser's headline function</entry>
4736 <entry><structfield>prslextype</structfield></entry>
4737 <entry><type>regproc</type></entry>
4738 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4739 <entry>OID of the parser's lextype function</entry>
4747 <sect1 id="catalog-pg-ts-template">
4748 <title><structname>pg_ts_template</structname></title>
4750 <indexterm zone="catalog-pg-ts-template">
4751 <primary>pg_ts_template</primary>
4755 The <structname>pg_ts_template</structname> catalog contains entries
4756 defining text search templates. A template is the implementation
4757 skeleton for a class of text search dictionaries.
4758 Since a template must be implemented by C-language-level functions,
4759 creation of new templates is restricted to database superusers.
4763 <productname>PostgreSQL</productname>'s text search features are
4764 described at length in <xref linkend="textsearch">.
4768 <title><structname>pg_ts_template</> Columns</title>
4775 <entry>References</entry>
4776 <entry>Description</entry>
4782 <entry><structfield>tmplname</structfield></entry>
4783 <entry><type>name</type></entry>
4785 <entry>Text search template name</entry>
4789 <entry><structfield>tmplnamespace</structfield></entry>
4790 <entry><type>oid</type></entry>
4791 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4793 The OID of the namespace that contains this template
4798 <entry><structfield>tmplinit</structfield></entry>
4799 <entry><type>regproc</type></entry>
4800 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4801 <entry>OID of the template's initialization function</entry>
4805 <entry><structfield>tmpllexize</structfield></entry>
4806 <entry><type>regproc</type></entry>
4807 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4808 <entry>OID of the template's lexize function</entry>
4816 <sect1 id="catalog-pg-type">
4817 <title><structname>pg_type</structname></title>
4819 <indexterm zone="catalog-pg-type">
4820 <primary>pg_type</primary>
4824 The catalog <structname>pg_type</structname> stores information about data
4825 types. Base types (scalar types) are created with
4826 <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
4828 <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
4829 A composite type is automatically created for each table in the database, to
4830 represent the row structure of the table. It is also possible to create
4831 composite types with <command>CREATE TYPE AS</command>.
4835 <title><structname>pg_type</> Columns</title>
4842 <entry>References</entry>
4843 <entry>Description</entry>
4849 <entry><structfield>typname</structfield></entry>
4850 <entry><type>name</type></entry>
4852 <entry>Data type name</entry>
4856 <entry><structfield>typnamespace</structfield></entry>
4857 <entry><type>oid</type></entry>
4858 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4860 The OID of the namespace that contains this type
4865 <entry><structfield>typowner</structfield></entry>
4866 <entry><type>oid</type></entry>
4867 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4868 <entry>Owner of the type</entry>
4872 <entry><structfield>typlen</structfield></entry>
4873 <entry><type>int2</type></entry>
4876 For a fixed-size type, <structfield>typlen</structfield> is the number
4877 of bytes in the internal representation of the type. But for a
4878 variable-length type, <structfield>typlen</structfield> is negative.
4879 -1 indicates a <quote>varlena</> type (one that has a length word),
4880 -2 indicates a null-terminated C string.
4885 <entry><structfield>typbyval</structfield></entry>
4886 <entry><type>bool</type></entry>
4889 <structfield>typbyval</structfield> determines whether internal
4890 routines pass a value of this type by value or by reference.
4891 <structfield>typbyval</structfield> had better be false if
4892 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
4893 where Datum is 8 bytes).
4894 Variable-length types are always passed by reference. Note that
4895 <structfield>typbyval</structfield> can be false even if the
4896 length would allow pass-by-value; this is currently true for
4897 type <type>float4</type>, for example
4902 <entry><structfield>typtype</structfield></entry>
4903 <entry><type>char</type></entry>
4906 <structfield>typtype</structfield> is
4907 <literal>b</literal> for a base type,
4908 <literal>c</literal> for a composite type (e.g., a table's row type),
4909 <literal>d</literal> for a domain,
4910 <literal>e</literal> for an enum type,
4911 or <literal>p</literal> for a pseudo-type.
4912 See also <structfield>typrelid</structfield> and
4913 <structfield>typbasetype</structfield>
4918 <entry><structfield>typisdefined</structfield></entry>
4919 <entry><type>bool</type></entry>
4922 True if the type is defined, false if this is a placeholder
4923 entry for a not-yet-defined type. When
4924 <structfield>typisdefined</structfield> is false, nothing
4925 except the type name, namespace, and OID can be relied on
4930 <entry><structfield>typdelim</structfield></entry>
4931 <entry><type>char</type></entry>
4934 Character that separates two values of this type when parsing
4935 array input. Note that the delimiter is associated with the array
4936 element data type, not the array data type
4941 <entry><structfield>typrelid</structfield></entry>
4942 <entry><type>oid</type></entry>
4943 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4945 If this is a composite type (see
4946 <structfield>typtype</structfield>), then this column points to
4947 the <structname>pg_class</structname> entry that defines the
4948 corresponding table. (For a free-standing composite type, the
4949 <structname>pg_class</structname> entry doesn't really represent
4950 a table, but it is needed anyway for the type's
4951 <structname>pg_attribute</structname> entries to link to.)
4952 Zero for non-composite types
4957 <entry><structfield>typelem</structfield></entry>
4958 <entry><type>oid</type></entry>
4959 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4961 If <structfield>typelem</structfield> is not 0 then it
4962 identifies another row in <structname>pg_type</structname>.
4963 The current type can then be subscripted like an array yielding
4964 values of type <structfield>typelem</structfield>. A
4965 <quote>true</quote> array type is variable length
4966 (<structfield>typlen</structfield> = -1),
4967 but some fixed-length (<structfield>typlen</structfield> > 0) types
4968 also have nonzero <structfield>typelem</structfield>, for example
4969 <type>name</type> and <type>point</type>.
4970 If a fixed-length type has a <structfield>typelem</structfield> then
4971 its internal representation must be some number of values of the
4972 <structfield>typelem</structfield> data type with no other data.
4973 Variable-length array types have a header defined by the array
4979 <entry><structfield>typarray</structfield></entry>
4980 <entry><type>oid</type></entry>
4981 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4983 If <structfield>typarray</structfield> is not 0 then it
4984 identifies another row in <structname>pg_type</structname>, which
4985 is the <quote>true</quote> array type having this type as element
4990 <entry><structfield>typinput</structfield></entry>
4991 <entry><type>regproc</type></entry>
4992 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4993 <entry>Input conversion function (text format)</entry>
4997 <entry><structfield>typoutput</structfield></entry>
4998 <entry><type>regproc</type></entry>
4999 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5000 <entry>Output conversion function (text format)</entry>
5004 <entry><structfield>typreceive</structfield></entry>
5005 <entry><type>regproc</type></entry>
5006 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5007 <entry>Input conversion function (binary format), or 0 if none</entry>
5011 <entry><structfield>typsend</structfield></entry>
5012 <entry><type>regproc</type></entry>
5013 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5014 <entry>Output conversion function (binary format), or 0 if none</entry>
5018 <entry><structfield>typmodin</structfield></entry>
5019 <entry><type>regproc</type></entry>
5020 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5021 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5025 <entry><structfield>typmodout</structfield></entry>
5026 <entry><type>regproc</type></entry>
5027 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5028 <entry>Type modifier output function, or 0 to use the standard format</entry>
5032 <entry><structfield>typanalyze</structfield></entry>
5033 <entry><type>regproc</type></entry>
5034 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5035 <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
5039 <entry><structfield>typalign</structfield></entry>
5040 <entry><type>char</type></entry>
5044 <structfield>typalign</structfield> is the alignment required
5045 when storing a value of this type. It applies to storage on
5046 disk as well as most representations of the value inside
5047 <productname>PostgreSQL</>.
5048 When multiple values are stored consecutively, such
5049 as in the representation of a complete row on disk, padding is
5050 inserted before a datum of this type so that it begins on the
5051 specified boundary. The alignment reference is the beginning
5052 of the first datum in the sequence.
5054 Possible values are:
5057 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5060 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5063 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5066 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5071 For types used in system tables, it is critical that the size
5072 and alignment defined in <structname>pg_type</structname>
5073 agree with the way that the compiler will lay out the column in
5074 a structure representing a table row.
5080 <entry><structfield>typstorage</structfield></entry>
5081 <entry><type>char</type></entry>
5084 <structfield>typstorage</structfield> tells for varlena
5085 types (those with <structfield>typlen</structfield> = -1) if
5086 the type is prepared for toasting and what the default strategy
5087 for attributes of this type should be.
5091 <para><literal>p</>: Value must always be stored plain.</para>
5095 <literal>e</>: Value can be stored in a <quote>secondary</quote>
5096 relation (if relation has one, see
5097 <literal>pg_class.reltoastrelid</literal>).
5101 <para><literal>m</>: Value can be stored compressed inline.</para>
5104 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5107 Note that <literal>m</> columns can also be moved out to secondary
5108 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5114 <entry><structfield>typnotnull</structfield></entry>
5115 <entry><type>bool</type></entry>
5118 <structfield>typnotnull</structfield> represents a not-null
5119 constraint on a type. Used for domains only
5124 <entry><structfield>typbasetype</structfield></entry>
5125 <entry><type>oid</type></entry>
5126 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5128 If this is a domain (see <structfield>typtype</structfield>), then
5129 <structfield>typbasetype</structfield> identifies the type that this
5130 one is based on. Zero if this type is not a domain
5135 <entry><structfield>typtypmod</structfield></entry>
5136 <entry><type>int4</type></entry>
5139 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5140 to be applied to their base type (-1 if base type does not use a
5141 <literal>typmod</>). -1 if this type is not a domain
5146 <entry><structfield>typndims</structfield></entry>
5147 <entry><type>int4</type></entry>
5150 <structfield>typndims</structfield> is the number of array dimensions
5151 for a domain that is an array (that is, <structfield>typbasetype</> is
5152 an array type; the domain's <structfield>typelem</> will match the base
5153 type's <structfield>typelem</structfield>).
5154 Zero for types other than domains over array types
5159 <entry><structfield>typdefaultbin</structfield></entry>
5160 <entry><type>text</type></entry>
5163 If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5164 representation of a default expression for the type. This is
5165 only used for domains
5170 <entry><structfield>typdefault</structfield></entry>
5171 <entry><type>text</type></entry>
5174 <structfield>typdefault</> is null if the type has no associated
5175 default value. If <structfield>typdefaultbin</> is not null,
5176 <structfield>typdefault</> must contain a human-readable version of the
5177 default expression represented by <structfield>typdefaultbin</>. If
5178 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5179 not, then <structfield>typdefault</> is the external representation of
5180 the type's default value, which might be fed to the type's input
5181 converter to produce a constant
5189 <sect1 id="views-overview">
5190 <title>System Views</title>
5193 In addition to the system catalogs, <productname>PostgreSQL</productname>
5194 provides a number of built-in views. Some system views provide convenient
5195 access to some commonly used queries on the system catalogs. Other views
5196 provide access to internal server state.
5200 The information schema (<xref linkend="information-schema">) provides
5201 an alternative set of views which overlap the functionality of the system
5202 views. Since the information schema is SQL-standard whereas the views
5203 described here are <productname>PostgreSQL</productname>-specific,
5204 it's usually better to use the information schema if it provides all
5205 the information you need.
5209 <xref linkend="view-table"> lists the system views described here.
5210 More detailed documentation of each view follows below.
5211 There are some additional views that provide access to the results of
5212 the statistics collector; they are described in <xref
5213 linkend="monitoring-stats-views-table">.
5217 Except where noted, all the views described here are read-only.
5220 <table id="view-table">
5221 <title>System Views</title>
5226 <entry>View Name</entry>
5227 <entry>Purpose</entry>
5233 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5234 <entry>open cursors</entry>
5238 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5239 <entry>groups of database users</entry>
5243 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5244 <entry>indexes</entry>
5248 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5249 <entry>currently held locks</entry>
5253 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5254 <entry>prepared statements</entry>
5258 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5259 <entry>prepared transactions</entry>
5263 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5264 <entry>database roles</entry>
5268 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5269 <entry>rules</entry>
5273 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5274 <entry>parameter settings</entry>
5278 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5279 <entry>database users</entry>
5283 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5284 <entry>planner statistics</entry>
5288 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5289 <entry>tables</entry>
5293 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5294 <entry>time zone abbreviations</entry>
5298 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5299 <entry>time zone names</entry>
5303 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5304 <entry>database users</entry>
5308 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5309 <entry>views</entry>
5317 <sect1 id="view-pg-cursors">
5318 <title><structname>pg_cursors</structname></title>
5320 <indexterm zone="view-pg-cursors">
5321 <primary>pg_cursors</primary>
5325 The <structname>pg_cursors</structname> view lists the cursors that
5326 are currently available. Cursors can be defined in several ways:
5330 via the <xref linkend="sql-declare" endterm="sql-declare-title">
5337 via the Bind message in the frontend/backend protocol, as
5338 described in <xref linkend="protocol-flow-ext-query">
5344 via the Server Programming Interface (SPI), as described in
5345 <xref linkend="spi-interface">
5350 The <structname>pg_cursors</structname> view displays cursors
5351 created by any of these means. Cursors only exist for the duration
5352 of the transaction that defines them, unless they have been
5353 declared <literal>WITH HOLD</literal>. Therefore non-holdable
5354 cursors are only present in the view until the end of their
5355 creating transaction.
5359 Cursors are used internally to implement some of the components
5360 of <productname>PostgreSQL</>, such as procedural languages.
5361 Therefore, the <structname>pg_cursors</> view might include cursors
5362 that have not been explicitly created by the user.
5368 <title><structname>pg_cursors</> Columns</title>
5375 <entry>Description</entry>
5381 <entry><structfield>name</structfield></entry>
5382 <entry><type>text</type></entry>
5383 <entry>The name of the cursor</entry>
5387 <entry><structfield>statement</structfield></entry>
5388 <entry><type>text</type></entry>
5389 <entry>The verbatim query string submitted to declare this cursor</entry>
5393 <entry><structfield>is_holdable</structfield></entry>
5394 <entry><type>boolean</type></entry>
5396 <literal>true</literal> if the cursor is holdable (that is, it
5397 can be accessed after the transaction that declared the cursor
5398 has committed); <literal>false</literal> otherwise
5403 <entry><structfield>is_binary</structfield></entry>
5404 <entry><type>boolean</type></entry>
5406 <literal>true</literal> if the cursor was declared
5407 <literal>BINARY</literal>; <literal>false</literal>
5413 <entry><structfield>is_scrollable</structfield></entry>
5414 <entry><type>boolean</type></entry>
5416 <literal>true</> if the cursor is scrollable (that is, it
5417 allows rows to be retrieved in a nonsequential manner);
5418 <literal>false</literal> otherwise
5423 <entry><structfield>creation_time</structfield></entry>
5424 <entry><type>timestamptz</type></entry>
5425 <entry>The time at which the cursor was declared</entry>
5432 The <structname>pg_cursors</structname> view is read only.
5437 <sect1 id="view-pg-group">
5438 <title><structname>pg_group</structname></title>
5440 <indexterm zone="view-pg-group">
5441 <primary>pg_group</primary>
5445 The view <structname>pg_group</structname> exists for backwards
5446 compatibility: it emulates a catalog that existed in
5447 <productname>PostgreSQL</productname> before version 8.1.
5448 It shows the names and members of all roles that are marked as not
5449 <structfield>rolcanlogin</>, which is an approximation to the set
5450 of roles that are being used as groups.
5454 <title><structname>pg_group</> Columns</title>
5461 <entry>References</entry>
5462 <entry>Description</entry>
5468 <entry><structfield>groname</structfield></entry>
5469 <entry><type>name</type></entry>
5470 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5471 <entry>Name of the group</entry>
5475 <entry><structfield>grosysid</structfield></entry>
5476 <entry><type>oid</type></entry>
5477 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5478 <entry>ID of this group</entry>
5482 <entry><structfield>grolist</structfield></entry>
5483 <entry><type>oid[]</type></entry>
5484 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5485 <entry>An array containing the IDs of the roles in this group</entry>
5493 <sect1 id="view-pg-indexes">
5494 <title><structname>pg_indexes</structname></title>
5496 <indexterm zone="view-pg-indexes">
5497 <primary>pg_indexes</primary>
5501 The view <structname>pg_indexes</structname> provides access to
5502 useful information about each index in the database.
5506 <title><structname>pg_indexes</> Columns</title>
5513 <entry>References</entry>
5514 <entry>Description</entry>
5519 <entry><structfield>schemaname</structfield></entry>
5520 <entry><type>name</type></entry>
5521 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
5522 <entry>Name of schema containing table and index</entry>
5525 <entry><structfield>tablename</structfield></entry>
5526 <entry><type>name</type></entry>
5527 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5528 <entry>Name of table the index is for</entry>
5531 <entry><structfield>indexname</structfield></entry>
5532 <entry><type>name</type></entry>
5533 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5534 <entry>Name of index</entry>
5537 <entry><structfield>tablespace</structfield></entry>
5538 <entry><type>name</type></entry>
5539 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
5540 <entry>Name of tablespace containing index (NULL if default for database)</entry>
5543 <entry><structfield>indexdef</structfield></entry>
5544 <entry><type>text</type></entry>
5546 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
5555 <sect1 id="view-pg-locks">
5556 <title><structname>pg_locks</structname></title>
5558 <indexterm zone="view-pg-locks">
5559 <primary>pg_locks</primary>
5563 The view <structname>pg_locks</structname> provides access to
5564 information about the locks held by open transactions within the
5565 database server. See <xref linkend="mvcc"> for more discussion
5570 <structname>pg_locks</structname> contains one row per active lockable
5571 object, requested lock mode, and relevant transaction. Thus, the same
5572 lockable object might
5573 appear many times, if multiple transactions are holding or waiting
5574 for locks on it. However, an object that currently has no locks on it
5575 will not appear at all.
5579 There are several distinct types of lockable objects:
5580 whole relations (e.g., tables), individual pages of relations,
5581 individual tuples of relations,
5582 transaction IDs (both virtual and permanent IDs),
5583 and general database objects (identified by class OID and object OID,
5584 in the same way as in <structname>pg_description</structname> or
5585 <structname>pg_depend</structname>). Also, the right to extend a
5586 relation is represented as a separate lockable object.
5590 <title><structname>pg_locks</> Columns</title>
5597 <entry>References</entry>
5598 <entry>Description</entry>
5603 <entry><structfield>locktype</structfield></entry>
5604 <entry><type>text</type></entry>
5607 type of the lockable object:
5608 <literal>relation</>,
5612 <literal>transactionid</>,
5613 <literal>virtualxid</>,
5615 <literal>userlock</>, or
5616 <literal>advisory</>
5620 <entry><structfield>database</structfield></entry>
5621 <entry><type>oid</type></entry>
5622 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5624 OID of the database in which the object exists, or
5625 zero if the object is a shared object, or
5626 NULL if the object is a transaction ID
5630 <entry><structfield>relation</structfield></entry>
5631 <entry><type>oid</type></entry>
5632 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5634 OID of the relation, or NULL if the object is not
5635 a relation or part of a relation
5639 <entry><structfield>page</structfield></entry>
5640 <entry><type>integer</type></entry>
5643 Page number within the relation, or NULL if the object
5644 is not a tuple or relation page
5648 <entry><structfield>tuple</structfield></entry>
5649 <entry><type>smallint</type></entry>
5652 Tuple number within the page, or NULL if the object is not a tuple
5656 <entry><structfield>virtualxid</structfield></entry>
5657 <entry><type>text</type></entry>
5660 Virtual ID of a transaction, or NULL if the object is not a
5661 virtual transaction ID
5665 <entry><structfield>transactionid</structfield></entry>
5666 <entry><type>xid</type></entry>
5669 ID of a transaction, or NULL if the object is not a transaction ID
5673 <entry><structfield>classid</structfield></entry>
5674 <entry><type>oid</type></entry>
5675 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5677 OID of the system catalog containing the object, or NULL if the
5678 object is not a general database object
5682 <entry><structfield>objid</structfield></entry>
5683 <entry><type>oid</type></entry>
5684 <entry>any OID column</entry>
5686 OID of the object within its system catalog, or NULL if the
5687 object is not a general database object.
5688 For advisory locks it is used to distinguish the two key
5689 spaces (<literal>1</> for an int8 key, <literal>2</> for two
5694 <entry><structfield>objsubid</structfield></entry>
5695 <entry><type>smallint</type></entry>
5698 For a table column, this is the column number (the
5699 <structfield>classid</> and <structfield>objid</> refer to the
5700 table itself). For all other object types, this column is
5701 zero. NULL if the object is not a general database object
5705 <entry><structfield>virtualtransaction</structfield></entry>
5706 <entry><type>text</type></entry>
5709 Virtual ID of the transaction that is holding or awaiting this lock
5713 <entry><structfield>pid</structfield></entry>
5714 <entry><type>integer</type></entry>
5717 Process ID of the server process holding or awaiting this
5718 lock. NULL if the lock is held by a prepared transaction
5722 <entry><structfield>mode</structfield></entry>
5723 <entry><type>text</type></entry>
5725 <entry>Name of the lock mode held or desired by this process (see <xref
5726 linkend="locking-tables">)</entry>
5729 <entry><structfield>granted</structfield></entry>
5730 <entry><type>boolean</type></entry>
5732 <entry>True if lock is held, false if lock is awaited</entry>
5739 <structfield>granted</structfield> is true in a row representing a lock
5740 held by the indicated transaction. False indicates that this transaction is
5741 currently waiting to acquire this lock, which implies that some other
5742 transaction is holding a conflicting lock mode on the same lockable object.
5743 The waiting transaction will sleep until the other lock is released (or a
5744 deadlock situation is detected). A single transaction can be waiting to
5745 acquire at most one lock at a time.
5749 Every transaction holds an exclusive lock on its virtual transaction ID for
5750 its entire duration. If a permanent ID is assigned to the transaction
5751 (which normally happens only if the transaction changes the state of the
5752 database), it also holds an exclusive lock on its permanent transaction ID
5753 until it ends. When one transaction finds it necessary to wait specifically
5754 for another transaction, it does so by attempting to acquire share lock on
5755 the other transaction ID (either virtual or permanent ID depending on the
5756 situation). That will succeed only when the other transaction
5757 terminates and releases its locks.
5761 Although tuples are a lockable type of object,
5762 information about row-level locks is stored on disk, not in memory,
5763 and therefore row-level locks normally do not appear in this view.
5764 If a transaction is waiting for a
5765 row-level lock, it will usually appear in the view as waiting for the
5766 permanent transaction ID of the current holder of that row lock.
5770 Advisory locks can be acquired on keys consisting of either a single
5771 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
5772 high-order half in the <structfield>classid</> column, its low-order half
5773 in the <structfield>objid</> column, and <structfield>objsubid</> equal
5774 to 1. Integer keys are displayed with the first key in the
5775 <structfield>classid</> column, the second key in the <structfield>objid</>
5776 column, and <structfield>objsubid</> equal to 2. The actual meaning of
5777 the keys is up to the user. Advisory locks are local to each database,
5778 so the <structfield>database</> column is meaningful for an advisory lock.
5782 When the <structname>pg_locks</structname> view is accessed, the
5783 internal lock manager data structures are momentarily locked, and
5784 a copy is made for the view to display. This ensures that the
5785 view produces a consistent set of results, while not blocking
5786 normal lock manager operations longer than necessary. Nonetheless
5787 there could be some impact on database performance if this view is
5788 frequently accessed.
5792 <structname>pg_locks</structname> provides a global view of all locks
5793 in the database cluster, not only those relevant to the current database.
5794 Although its <structfield>relation</structfield> column can be joined
5795 against <structname>pg_class</>.<structfield>oid</> to identify locked
5796 relations, this will only work correctly for relations in the current
5797 database (those for which the <structfield>database</structfield> column
5798 is either the current database's OID or zero).
5802 The <structfield>pid</structfield> column can be joined to the
5803 <structfield>procpid</structfield> column of the
5804 <structname>pg_stat_activity</structname> view to get more
5805 information on the session holding or waiting to hold each lock.
5806 Also, if you are using prepared transactions, the
5807 <structfield>transaction</> column can be joined to the
5808 <structfield>transaction</structfield> column of the
5809 <structname>pg_prepared_xacts</structname> view to get more
5810 information on prepared transactions that hold locks.
5811 (A prepared transaction can never be waiting for a lock,
5812 but it continues to hold the locks it acquired while running.)
5817 <sect1 id="view-pg-prepared-statements">
5818 <title><structname>pg_prepared_statements</structname></title>
5820 <indexterm zone="view-pg-prepared-statements">
5821 <primary>pg_prepared_statements</primary>
5825 The <structname>pg_prepared_statements</structname> view displays
5826 all the prepared statements that are available in the current
5827 session. See <xref linkend="sql-prepare"
5828 endterm="sql-prepare-title"> for more information about prepared
5833 <structname>pg_prepared_statements</structname> contains one row
5834 for each prepared statement. Rows are added to the view when a new
5835 prepared statement is created and removed when a prepared statement
5836 is released (for example, via the <xref linkend="sql-deallocate"
5837 endterm="sql-deallocate-title"> command).
5841 <title><structname>pg_prepared_statements</> Columns</title>
5848 <entry>Description</entry>
5853 <entry><structfield>name</structfield></entry>
5854 <entry><type>text</type></entry>
5856 The identifier of the prepared statement
5860 <entry><structfield>statement</structfield></entry>
5861 <entry><type>text</type></entry>
5863 The query string submitted by the client to create this
5864 prepared statement. For prepared statements created via SQL,
5865 this is the <command>PREPARE</command> statement submitted by
5866 the client. For prepared statements created via the
5867 frontend/backend protocol, this is the text of the prepared
5872 <entry><structfield>prepare_time</structfield></entry>
5873 <entry><type>timestamptz</type></entry>
5875 The time at which the prepared statement was created
5879 <entry><structfield>parameter_types</structfield></entry>
5880 <entry><type>regtype[]</type></entry>
5882 The expected parameter types for the prepared statement in the
5883 form of an array of <type>regtype</type>. The OID corresponding
5884 to an element of this array can be obtained by casting the
5885 <type>regtype</type> value to <type>oid</type>
5889 <entry><structfield>from_sql</structfield></entry>
5890 <entry><type>boolean</type></entry>
5892 <literal>true</literal> if the prepared statement was created
5893 via the <command>PREPARE</command> SQL statement;
5894 <literal>false</literal> if the statement was prepared via the
5895 frontend/backend protocol
5903 The <structname>pg_prepared_statements</structname> view is read only.
5907 <sect1 id="view-pg-prepared-xacts">
5908 <title><structname>pg_prepared_xacts</structname></title>
5910 <indexterm zone="view-pg-prepared-xacts">
5911 <primary>pg_prepared_xacts</primary>
5915 The view <structname>pg_prepared_xacts</structname> displays
5916 information about transactions that are currently prepared for two-phase
5917 commit (see <xref linkend="sql-prepare-transaction"
5918 endterm="sql-prepare-transaction-title"> for details).
5922 <structname>pg_prepared_xacts</structname> contains one row per prepared
5923 transaction. An entry is removed when the transaction is committed or
5928 <title><structname>pg_prepared_xacts</> Columns</title>
5935 <entry>References</entry>
5936 <entry>Description</entry>
5941 <entry><structfield>transaction</structfield></entry>
5942 <entry><type>xid</type></entry>
5945 Numeric transaction identifier of the prepared transaction
5949 <entry><structfield>gid</structfield></entry>
5950 <entry><type>text</type></entry>
5953 Global transaction identifier that was assigned to the transaction
5957 <entry><structfield>prepared</structfield></entry>
5958 <entry><type>timestamp with time zone</type></entry>
5961 Time at which the transaction was prepared for commit
5965 <entry><structfield>owner</structfield></entry>
5966 <entry><type>name</type></entry>
5967 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5969 Name of the user that executed the transaction
5973 <entry><structfield>database</structfield></entry>
5974 <entry><type>name</type></entry>
5975 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5977 Name of the database in which the transaction was executed
5985 When the <structname>pg_prepared_xacts</structname> view is accessed, the
5986 internal transaction manager data structures are momentarily locked, and
5987 a copy is made for the view to display. This ensures that the
5988 view produces a consistent set of results, while not blocking
5989 normal operations longer than necessary. Nonetheless
5990 there could be some impact on database performance if this view is
5991 frequently accessed.
5996 <sect1 id="view-pg-roles">
5997 <title><structname>pg_roles</structname></title>
5999 <indexterm zone="view-pg-roles">
6000 <primary>pg_roles</primary>
6004 The view <structname>pg_roles</structname> provides access to
6005 information about database roles. This is simply a publicly
6007 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6008 that blanks out the password field.
6012 This view explicitly exposes the OID column of the underlying table,
6013 since that is needed to do joins to other catalogs.
6017 <title><structname>pg_roles</> Columns</title>
6024 <entry>References</entry>
6025 <entry>Description</entry>
6031 <entry><structfield>rolname</structfield></entry>
6032 <entry><type>name</type></entry>
6034 <entry>Role name</entry>
6038 <entry><structfield>rolsuper</structfield></entry>
6039 <entry><type>bool</type></entry>
6041 <entry>Role has superuser privileges</entry>
6045 <entry><structfield>rolinherit</structfield></entry>
6046 <entry><type>bool</type></entry>
6048 <entry>Role automatically inherits privileges of roles it is a
6053 <entry><structfield>rolcreaterole</structfield></entry>
6054 <entry><type>bool</type></entry>
6056 <entry>Role can create more roles</entry>
6060 <entry><structfield>rolcreatedb</structfield></entry>
6061 <entry><type>bool</type></entry>
6063 <entry>Role can create databases</entry>
6067 <entry><structfield>rolcatupdate</structfield></entry>
6068 <entry><type>bool</type></entry>
6071 Role can update system catalogs directly. (Even a superuser cannot do
6072 this unless this column is true.)
6077 <entry><structfield>rolcanlogin</structfield></entry>
6078 <entry><type>bool</type></entry>
6081 Role can log in. That is, this role can be given as the initial
6082 session authorization identifier
6087 <entry><structfield>rolconnlimit</structfield></entry>
6088 <entry><type>int4</type></entry>
6091 For roles that can log in, this sets maximum number of concurrent
6092 connections this role can make. -1 means no limit
6097 <entry><structfield>rolpassword</structfield></entry>
6098 <entry><type>text</type></entry>
6100 <entry>Not the password (always reads as <literal>********</>)</entry>
6104 <entry><structfield>rolvaliduntil</structfield></entry>
6105 <entry><type>timestamptz</type></entry>
6107 <entry>Password expiry time (only used for password authentication);
6108 NULL if no expiration</entry>
6112 <entry><structfield>rolconfig</structfield></entry>
6113 <entry><type>text[]</type></entry>
6115 <entry>Session defaults for run-time configuration variables</entry>
6119 <entry><structfield>oid</structfield></entry>
6120 <entry><type>oid</type></entry>
6121 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6122 <entry>ID of role</entry>
6130 <sect1 id="view-pg-rules">
6131 <title><structname>pg_rules</structname></title>
6133 <indexterm zone="view-pg-rules">
6134 <primary>pg_rules</primary>
6138 The view <structname>pg_rules</structname> provides access to
6139 useful information about query rewrite rules.
6143 <title><structname>pg_rules</> Columns</title>
6150 <entry>References</entry>
6151 <entry>Description</entry>
6156 <entry><structfield>schemaname</structfield></entry>
6157 <entry><type>name</type></entry>
6158 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6159 <entry>Name of schema containing table</entry>
6162 <entry><structfield>tablename</structfield></entry>
6163 <entry><type>name</type></entry>
6164 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6165 <entry>Name of table the rule is for</entry>
6168 <entry><structfield>rulename</structfield></entry>
6169 <entry><type>name</type></entry>
6170 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6171 <entry>Name of rule</entry>
6174 <entry><structfield>definition</structfield></entry>
6175 <entry><type>text</type></entry>
6177 <entry>Rule definition (a reconstructed creation command)</entry>
6184 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6185 of views; those can be seen in <structname>pg_views</>.
6190 <sect1 id="view-pg-settings">
6191 <title><structname>pg_settings</structname></title>
6193 <indexterm zone="view-pg-settings">
6194 <primary>pg_settings</primary>
6198 The view <structname>pg_settings</structname> provides access to
6199 run-time parameters of the server. It is essentially an alternative
6200 interface to the <command>SHOW</> and <command>SET</> commands.
6201 It also provides access to some facts about each parameter that are
6202 not directly available from <command>SHOW</>, such as minimum and
6207 <title><structname>pg_settings</> Columns</title>
6214 <entry>Description</entry>
6219 <entry><structfield>name</structfield></entry>
6220 <entry><type>text</type></entry>
6221 <entry>Run-time configuration parameter name</entry>
6224 <entry><structfield>setting</structfield></entry>
6225 <entry><type>text</type></entry>
6226 <entry>Current value of the parameter</entry>
6229 <entry><structfield>unit</structfield></entry>
6230 <entry><type>text</type></entry>
6231 <entry>Implicit unit of the parameter</entry>
6234 <entry><structfield>category</structfield></entry>
6235 <entry><type>text</type></entry>
6236 <entry>Logical group of the parameter</entry>
6239 <entry><structfield>short_desc</structfield></entry>
6240 <entry><type>text</type></entry>
6241 <entry>A brief description of the parameter</entry>
6244 <entry><structfield>extra_desc</structfield></entry>
6245 <entry><type>text</type></entry>
6246 <entry>Additional, more detailed, information about the parameter</entry>
6249 <entry><structfield>context</structfield></entry>
6250 <entry><type>text</type></entry>
6251 <entry>Context required to set the parameter's value</entry>
6254 <entry><structfield>vartype</structfield></entry>
6255 <entry><type>text</type></entry>
6256 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6257 <literal>integer</>, <literal>real</>, or <literal>string</>)
6261 <entry><structfield>source</structfield></entry>
6262 <entry><type>text</type></entry>
6263 <entry>Source of the current parameter value</entry>
6266 <entry><structfield>min_val</structfield></entry>
6267 <entry><type>text</type></entry>
6268 <entry>Minimum allowed value of the parameter (NULL for non-numeric
6272 <entry><structfield>max_val</structfield></entry>
6273 <entry><type>text</type></entry>
6274 <entry>Maximum allowed value of the parameter (NULL for non-numeric
6278 <entry><structfield>enumvals</structfield></entry>
6279 <entry><type>text</type></entry>
6280 <entry>Allowed values in enum parameters (NULL for non-enum
6288 The <structname>pg_settings</structname> view cannot be inserted into or
6289 deleted from, but it can be updated. An <command>UPDATE</command> applied
6290 to a row of <structname>pg_settings</structname> is equivalent to executing
6291 the <xref linkend="sql-set" endterm="sql-set-title"> command on that named
6292 parameter. The change only affects the value used by the current
6293 session. If an <command>UPDATE</command> is issued within a transaction
6294 that is later aborted, the effects of the <command>UPDATE</command> command
6295 disappear when the transaction is rolled back. Once the surrounding
6296 transaction is committed, the effects will persist until the end of the
6297 session, unless overridden by another <command>UPDATE</command> or
6298 <command>SET</command>.
6303 <sect1 id="view-pg-shadow">
6304 <title><structname>pg_shadow</structname></title>
6306 <indexterm zone="view-pg-shadow">
6307 <primary>pg_shadow</primary>
6311 The view <structname>pg_shadow</structname> exists for backwards
6312 compatibility: it emulates a catalog that existed in
6313 <productname>PostgreSQL</productname> before version 8.1.
6314 It shows properties of all roles that are marked as
6315 <structfield>rolcanlogin</>.
6319 The name stems from the fact that this table
6320 should not be readable by the public since it contains passwords.
6321 <link linkend="view-pg-user"><structname>pg_user</structname></link>
6322 is a publicly readable view on
6323 <structname>pg_shadow</structname> that blanks out the password field.
6327 <title><structname>pg_shadow</> Columns</title>
6334 <entry>References</entry>
6335 <entry>Description</entry>
6341 <entry><structfield>usename</structfield></entry>
6342 <entry><type>name</type></entry>
6343 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6344 <entry>User name</entry>
6348 <entry><structfield>usesysid</structfield></entry>
6349 <entry><type>oid</type></entry>
6350 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6351 <entry>ID of this user</entry>
6355 <entry><structfield>usecreatedb</structfield></entry>
6356 <entry><type>bool</type></entry>
6358 <entry>User can create databases</entry>
6362 <entry><structfield>usesuper</structfield></entry>
6363 <entry><type>bool</type></entry>
6365 <entry>User is a superuser</entry>
6369 <entry><structfield>usecatupd</structfield></entry>
6370 <entry><type>bool</type></entry>
6373 User can update system catalogs. (Even a superuser cannot do
6374 this unless this column is true.)
6379 <entry><structfield>passwd</structfield></entry>
6380 <entry><type>text</type></entry>
6382 <entry>Password (possibly encrypted)</entry>
6386 <entry><structfield>valuntil</structfield></entry>
6387 <entry><type>abstime</type></entry>
6389 <entry>Password expiry time (only used for password authentication)</entry>
6393 <entry><structfield>useconfig</structfield></entry>
6394 <entry><type>text[]</type></entry>
6396 <entry>Session defaults for run-time configuration variables</entry>
6404 <sect1 id="view-pg-stats">
6405 <title><structname>pg_stats</structname></title>
6407 <indexterm zone="view-pg-stats">
6408 <primary>pg_stats</primary>
6412 The view <structname>pg_stats</structname> provides access to
6413 the information stored in the <link
6414 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
6415 catalog. This view allows access only to rows of
6416 <structname>pg_statistic</structname> that correspond to tables the
6417 user has permission to read, and therefore it is safe to allow public
6418 read access to this view.
6422 <structname>pg_stats</structname> is also designed to present the
6423 information in a more readable format than the underlying catalog
6424 — at the cost that its schema must be extended whenever new slot types
6425 are defined for <structname>pg_statistic</structname>.
6429 <title><structname>pg_stats</> Columns</title>
6436 <entry>References</entry>
6437 <entry>Description</entry>
6442 <entry><structfield>schemaname</structfield></entry>
6443 <entry><type>name</type></entry>
6444 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6445 <entry>Name of schema containing table</entry>
6449 <entry><structfield>tablename</structfield></entry>
6450 <entry><type>name</type></entry>
6451 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6452 <entry>Name of table</entry>
6456 <entry><structfield>attname</structfield></entry>
6457 <entry><type>name</type></entry>
6458 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
6459 <entry>Name of the column described by this row</entry>
6463 <entry><structfield>null_frac</structfield></entry>
6464 <entry><type>real</type></entry>
6466 <entry>Fraction of column entries that are null</entry>
6470 <entry><structfield>avg_width</structfield></entry>
6471 <entry><type>integer</type></entry>
6473 <entry>Average width in bytes of column's entries</entry>
6477 <entry><structfield>n_distinct</structfield></entry>
6478 <entry><type>real</type></entry>
6481 If greater than zero, the estimated number of distinct values in the
6482 column. If less than zero, the negative of the number of distinct
6483 values divided by the number of rows. (The negated form is used when
6484 <command>ANALYZE</> believes that the number of distinct values is
6485 likely to increase as the table grows; the positive form is used when
6486 the column seems to have a fixed number of possible values.) For
6487 example, -1 indicates a unique column in which the number of distinct
6488 values is the same as the number of rows
6493 <entry><structfield>most_common_vals</structfield></entry>
6494 <entry><type>anyarray</type></entry>
6497 A list of the most common values in the column. (NULL if
6498 no values seem to be more common than any others.)
6503 <entry><structfield>most_common_freqs</structfield></entry>
6504 <entry><type>real[]</type></entry>
6507 A list of the frequencies of the most common values,
6508 i.e., number of occurrences of each divided by total number of rows.
6509 (NULL when <structfield>most_common_vals</structfield> is.)
6514 <entry><structfield>histogram_bounds</structfield></entry>
6515 <entry><type>anyarray</type></entry>
6518 A list of values that divide the column's values into groups of
6519 approximately equal population. The values in
6520 <structfield>most_common_vals</>, if present, are omitted from this
6521 histogram calculation. (This column is NULL if the column data type
6522 does not have a <literal><</> operator or if the
6523 <structfield>most_common_vals</> list accounts for the entire
6529 <entry><structfield>correlation</structfield></entry>
6530 <entry><type>real</type></entry>
6533 Statistical correlation between physical row ordering and
6534 logical ordering of the column values. This ranges from -1 to +1.
6535 When the value is near -1 or +1, an index scan on the column will
6536 be estimated to be cheaper than when it is near zero, due to reduction
6537 of random access to the disk. (This column is NULL if the column data
6538 type does not have a <literal><</> operator.)
6546 The maximum number of entries in the <structfield>most_common_vals</>
6547 and <structfield>histogram_bounds</> arrays can be set on a
6548 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
6549 command, or globally by setting the
6550 <xref linkend="guc-default-statistics-target"> run-time parameter.
6555 <sect1 id="view-pg-tables">
6556 <title><structname>pg_tables</structname></title>
6558 <indexterm zone="view-pg-tables">
6559 <primary>pg_tables</primary>
6563 The view <structname>pg_tables</structname> provides access to
6564 useful information about each table in the database.
6568 <title><structname>pg_tables</> Columns</title>
6575 <entry>References</entry>
6576 <entry>Description</entry>
6581 <entry><structfield>schemaname</structfield></entry>
6582 <entry><type>name</type></entry>
6583 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6584 <entry>Name of schema containing table</entry>
6587 <entry><structfield>tablename</structfield></entry>
6588 <entry><type>name</type></entry>
6589 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6590 <entry>Name of table</entry>
6593 <entry><structfield>tableowner</structfield></entry>
6594 <entry><type>name</type></entry>
6595 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6596 <entry>Name of table's owner</entry>
6599 <entry><structfield>tablespace</structfield></entry>
6600 <entry><type>name</type></entry>
6601 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6602 <entry>Name of tablespace containing table (NULL if default for database)</entry>
6605 <entry><structfield>hasindexes</structfield></entry>
6606 <entry><type>boolean</type></entry>
6607 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
6608 <entry>true if table has (or recently had) any indexes</entry>
6611 <entry><structfield>hasrules</structfield></entry>
6612 <entry><type>boolean</type></entry>
6613 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
6614 <entry>true if table has rules</entry>
6617 <entry><structfield>hastriggers</structfield></entry>
6618 <entry><type>boolean</type></entry>
6619 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.reltriggers</literal></entry>
6620 <entry>true if table has triggers</entry>
6628 <sect1 id="view-pg-timezone-abbrevs">
6629 <title><structname>pg_timezone_abbrevs</structname></title>
6631 <indexterm zone="view-pg-timezone-abbrevs">
6632 <primary>pg_timezone_abbrevs</primary>
6636 The view <structname>pg_timezone_abbrevs</structname> provides a list
6637 of time zone abbreviations that are currently recognized by the datetime
6638 input routines. The contents of this view change when the
6639 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
6643 <title><structname>pg_timezone_abbrevs</> Columns</title>
6650 <entry>Description</entry>
6655 <entry><structfield>abbrev</structfield></entry>
6656 <entry><type>text</type></entry>
6657 <entry>Time zone abbreviation</entry>
6660 <entry><structfield>utc_offset</structfield></entry>
6661 <entry><type>interval</type></entry>
6662 <entry>Offset from UTC (positive means east of Greenwich)</entry>
6665 <entry><structfield>is_dst</structfield></entry>
6666 <entry><type>boolean</type></entry>
6667 <entry>True if this is a daylight-savings abbreviation</entry>
6675 <sect1 id="view-pg-timezone-names">
6676 <title><structname>pg_timezone_names</structname></title>
6678 <indexterm zone="view-pg-timezone-names">
6679 <primary>pg_timezone_names</primary>
6683 The view <structname>pg_timezone_names</structname> provides a list
6684 of time zone names that are recognized by <command>SET TIMEZONE</>,
6685 along with their associated abbreviations, UTC offsets,
6686 and daylight-savings status.
6687 Unlike the abbreviations shown in <link
6688 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
6689 date rules. Therefore, the associated information changes across local DST
6690 boundaries. The displayed information is computed based on the current
6691 value of <function>CURRENT_TIMESTAMP</>.
6695 <title><structname>pg_timezone_names</> Columns</title>
6702 <entry>Description</entry>
6707 <entry><structfield>name</structfield></entry>
6708 <entry><type>text</type></entry>
6709 <entry>Time zone name</entry>
6712 <entry><structfield>abbrev</structfield></entry>
6713 <entry><type>text</type></entry>
6714 <entry>Time zone abbreviation</entry>
6717 <entry><structfield>utc_offset</structfield></entry>
6718 <entry><type>interval</type></entry>
6719 <entry>Offset from UTC (positive means east of Greenwich)</entry>
6722 <entry><structfield>is_dst</structfield></entry>
6723 <entry><type>boolean</type></entry>
6724 <entry>True if currently observing daylight savings</entry>
6732 <sect1 id="view-pg-user">
6733 <title><structname>pg_user</structname></title>
6735 <indexterm zone="view-pg-user">
6736 <primary>pg_user</primary>
6740 The view <structname>pg_user</structname> provides access to
6741 information about database users. This is simply a publicly
6743 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
6744 that blanks out the password field.
6748 <title><structname>pg_user</> Columns</title>
6755 <entry>Description</entry>
6760 <entry><structfield>usename</structfield></entry>
6761 <entry><type>name</type></entry>
6762 <entry>User name</entry>
6766 <entry><structfield>usesysid</structfield></entry>
6767 <entry><type>int4</type></entry>
6768 <entry>User ID (arbitrary number used to reference this user)</entry>
6772 <entry><structfield>usecreatedb</structfield></entry>
6773 <entry><type>bool</type></entry>
6774 <entry>User can create databases</entry>
6778 <entry><structfield>usesuper</structfield></entry>
6779 <entry><type>bool</type></entry>
6780 <entry>User is a superuser</entry>
6784 <entry><structfield>usecatupd</structfield></entry>
6785 <entry><type>bool</type></entry>
6787 User can update system catalogs. (Even a superuser cannot do
6788 this unless this column is true.)
6793 <entry><structfield>passwd</structfield></entry>
6794 <entry><type>text</type></entry>
6795 <entry>Not the password (always reads as <literal>********</>)</entry>
6799 <entry><structfield>valuntil</structfield></entry>
6800 <entry><type>abstime</type></entry>
6801 <entry>Password expiry time (only used for password authentication)</entry>
6805 <entry><structfield>useconfig</structfield></entry>
6806 <entry><type>text[]</type></entry>
6807 <entry>Session defaults for run-time configuration variables</entry>
6815 <sect1 id="view-pg-views">
6816 <title><structname>pg_views</structname></title>
6818 <indexterm zone="view-pg-views">
6819 <primary>pg_views</primary>
6823 The view <structname>pg_views</structname> provides access to
6824 useful information about each view in the database.
6828 <title><structname>pg_views</> Columns</title>
6835 <entry>References</entry>
6836 <entry>Description</entry>
6841 <entry><structfield>schemaname</structfield></entry>
6842 <entry><type>name</type></entry>
6843 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6844 <entry>Name of schema containing view</entry>
6847 <entry><structfield>viewname</structfield></entry>
6848 <entry><type>name</type></entry>
6849 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6850 <entry>Name of view</entry>
6853 <entry><structfield>viewowner</structfield></entry>
6854 <entry><type>name</type></entry>
6855 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6856 <entry>Name of view's owner</entry>
6859 <entry><structfield>definition</structfield></entry>
6860 <entry><type>text</type></entry>
6862 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>