1 <!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.167 2008/07/11 07:02:43 petere 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 coercible (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>conislocal</structfield></entry>
1912 <entry><type>bool</type></entry>
1915 This constraint is defined locally in the relation. Note that a
1916 constraint can be locally defined and inherited simultaneously
1921 <entry><structfield>coninhcount</structfield></entry>
1922 <entry><type>int4</type></entry>
1925 The number of direct ancestors this constraint has. A constraint with
1926 a nonzero number of ancestors cannot be dropped nor renamed
1931 <entry><structfield>conkey</structfield></entry>
1932 <entry><type>int2[]</type></entry>
1933 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1934 <entry>If a table constraint, list of columns which the constraint constrains</entry>
1938 <entry><structfield>confkey</structfield></entry>
1939 <entry><type>int2[]</type></entry>
1940 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1941 <entry>If a foreign key, list of the referenced columns</entry>
1945 <entry><structfield>conpfeqop</structfield></entry>
1946 <entry><type>oid[]</type></entry>
1947 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1948 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
1952 <entry><structfield>conppeqop</structfield></entry>
1953 <entry><type>oid[]</type></entry>
1954 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1955 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
1959 <entry><structfield>conffeqop</structfield></entry>
1960 <entry><type>oid[]</type></entry>
1961 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1962 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
1966 <entry><structfield>conbin</structfield></entry>
1967 <entry><type>text</type></entry>
1969 <entry>If a check constraint, an internal representation of the expression</entry>
1973 <entry><structfield>consrc</structfield></entry>
1974 <entry><type>text</type></entry>
1976 <entry>If a check constraint, a human-readable representation of the expression</entry>
1984 <structfield>consrc</structfield> is not updated when referenced objects
1985 change; for example, it won't track renaming of columns. Rather than
1986 relying on this field, it's best to use <function>pg_get_constraintdef()</>
1987 to extract the definition of a check constraint.
1993 <literal>pg_class.relchecks</literal> needs to agree with the
1994 number of check-constraint entries found in this table for each
2001 <sect1 id="catalog-pg-conversion">
2002 <title><structname>pg_conversion</structname></title>
2004 <indexterm zone="catalog-pg-conversion">
2005 <primary>pg_conversion</primary>
2009 The catalog <structname>pg_conversion</structname> describes the
2010 available encoding conversion procedures. See
2011 <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
2012 for more information.
2016 <title><structname>pg_conversion</> Columns</title>
2023 <entry>References</entry>
2024 <entry>Description</entry>
2030 <entry><structfield>conname</structfield></entry>
2031 <entry><type>name</type></entry>
2033 <entry>Conversion name (unique within a namespace)</entry>
2037 <entry><structfield>connamespace</structfield></entry>
2038 <entry><type>oid</type></entry>
2039 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2041 The OID of the namespace that contains this conversion
2046 <entry><structfield>conowner</structfield></entry>
2047 <entry><type>oid</type></entry>
2048 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2049 <entry>Owner of the conversion</entry>
2053 <entry><structfield>conforencoding</structfield></entry>
2054 <entry><type>int4</type></entry>
2056 <entry>Source encoding ID</entry>
2060 <entry><structfield>contoencoding</structfield></entry>
2061 <entry><type>int4</type></entry>
2063 <entry>Destination encoding ID</entry>
2067 <entry><structfield>conproc</structfield></entry>
2068 <entry><type>regproc</type></entry>
2069 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2070 <entry>Conversion procedure</entry>
2074 <entry><structfield>condefault</structfield></entry>
2075 <entry><type>bool</type></entry>
2077 <entry>True if this is the default conversion</entry>
2086 <sect1 id="catalog-pg-database">
2087 <title><structname>pg_database</structname></title>
2089 <indexterm zone="catalog-pg-database">
2090 <primary>pg_database</primary>
2094 The catalog <structname>pg_database</structname> stores information about
2095 the available databases. Databases are created with the <xref
2096 linkend="sql-createdatabase" endterm="sql-createdatabase-title"> command.
2097 Consult <xref linkend="managing-databases"> for details about the meaning
2098 of some of the parameters.
2102 Unlike most system catalogs, <structname>pg_database</structname>
2103 is shared across all databases of a cluster: there is only one
2104 copy of <structname>pg_database</structname> per cluster, not
2109 <title><structname>pg_database</> Columns</title>
2116 <entry>References</entry>
2117 <entry>Description</entry>
2123 <entry><structfield>datname</structfield></entry>
2124 <entry><type>name</type></entry>
2126 <entry>Database name</entry>
2130 <entry><structfield>datdba</structfield></entry>
2131 <entry><type>oid</type></entry>
2132 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2133 <entry>Owner of the database, usually the user who created it</entry>
2137 <entry><structfield>encoding</structfield></entry>
2138 <entry><type>int4</type></entry>
2140 <entry>Character encoding for this database
2141 (<function>pg_encoding_to_char()</function> can translate
2142 this number to the encoding name)</entry>
2146 <entry><structfield>datistemplate</structfield></entry>
2147 <entry><type>bool</type></entry>
2150 If true then this database can be used in the
2151 <literal>TEMPLATE</literal> clause of <command>CREATE
2152 DATABASE</command> to create a new database as a clone of
2158 <entry><structfield>datallowconn</structfield></entry>
2159 <entry><type>bool</type></entry>
2162 If false then no one can connect to this database. This is
2163 used to protect the <literal>template0</> database from being altered
2168 <entry><structfield>datconnlimit</structfield></entry>
2169 <entry><type>int4</type></entry>
2172 Sets maximum number of concurrent connections that can be made
2173 to this database. -1 means no limit
2178 <entry><structfield>datlastsysoid</structfield></entry>
2179 <entry><type>oid</type></entry>
2182 Last system OID in the database; useful
2183 particularly to <application>pg_dump</application>
2188 <entry><structfield>datfrozenxid</structfield></entry>
2189 <entry><type>xid</type></entry>
2192 All transaction IDs before this one have been replaced with a permanent
2193 (<quote>frozen</>) transaction ID in this database. This is used to
2194 track whether the database needs to be vacuumed in order to prevent
2195 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2196 It is the minimum of the per-table
2197 <structname>pg_class</>.<structfield>relfrozenxid</> values
2202 <entry><structfield>dattablespace</structfield></entry>
2203 <entry><type>oid</type></entry>
2204 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2206 The default tablespace for the database.
2207 Within this database, all tables for which
2208 <structname>pg_class</>.<structfield>reltablespace</> is zero
2209 will be stored in this tablespace; in particular, all the non-shared
2210 system catalogs will be there
2215 <entry><structfield>datconfig</structfield></entry>
2216 <entry><type>text[]</type></entry>
2218 <entry>Session defaults for run-time configuration variables</entry>
2222 <entry><structfield>datacl</structfield></entry>
2223 <entry><type>aclitem[]</type></entry>
2226 Access privileges; see
2227 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2228 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2238 <sect1 id="catalog-pg-depend">
2239 <title><structname>pg_depend</structname></title>
2241 <indexterm zone="catalog-pg-depend">
2242 <primary>pg_depend</primary>
2246 The catalog <structname>pg_depend</structname> records the dependency
2247 relationships between database objects. This information allows
2248 <command>DROP</> commands to find which other objects must be dropped
2249 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2254 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2255 which performs a similar function for dependencies involving objects
2256 that are shared across a database cluster.
2260 <title><structname>pg_depend</> Columns</title>
2267 <entry>References</entry>
2268 <entry>Description</entry>
2274 <entry><structfield>classid</structfield></entry>
2275 <entry><type>oid</type></entry>
2276 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2277 <entry>The OID of the system catalog the dependent object is in</entry>
2281 <entry><structfield>objid</structfield></entry>
2282 <entry><type>oid</type></entry>
2283 <entry>any OID column</entry>
2284 <entry>The OID of the specific dependent object</entry>
2288 <entry><structfield>objsubid</structfield></entry>
2289 <entry><type>int4</type></entry>
2292 For a table column, this is the column number (the
2293 <structfield>objid</> and <structfield>classid</> refer to the
2294 table itself). For all other object types, this column is
2300 <entry><structfield>refclassid</structfield></entry>
2301 <entry><type>oid</type></entry>
2302 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2303 <entry>The OID of the system catalog the referenced object is in</entry>
2307 <entry><structfield>refobjid</structfield></entry>
2308 <entry><type>oid</type></entry>
2309 <entry>any OID column</entry>
2310 <entry>The OID of the specific referenced object</entry>
2314 <entry><structfield>refobjsubid</structfield></entry>
2315 <entry><type>int4</type></entry>
2318 For a table column, this is the column number (the
2319 <structfield>refobjid</> and <structfield>refclassid</> refer
2320 to the table itself). For all other object types, this column
2326 <entry><structfield>deptype</structfield></entry>
2327 <entry><type>char</type></entry>
2330 A code defining the specific semantics of this dependency relationship; see text
2339 In all cases, a <structname>pg_depend</structname> entry indicates that the
2340 referenced object cannot be dropped without also dropping the dependent
2341 object. However, there are several subflavors identified by
2342 <structfield>deptype</>:
2346 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2349 A normal relationship between separately-created objects. The
2350 dependent object can be dropped without affecting the
2351 referenced object. The referenced object can only be dropped
2352 by specifying <literal>CASCADE</>, in which case the dependent
2353 object is dropped, too. Example: a table column has a normal
2354 dependency on its data type.
2360 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2363 The dependent object can be dropped separately from the
2364 referenced object, and should be automatically dropped
2365 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2366 mode) if the referenced object is dropped. Example: a named
2367 constraint on a table is made autodependent on the table, so
2368 that it will go away if the table is dropped.
2374 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2377 The dependent object was created as part of creation of the
2378 referenced object, and is really just a part of its internal
2379 implementation. A <command>DROP</> of the dependent object
2380 will be disallowed outright (we'll tell the user to issue a
2381 <command>DROP</> against the referenced object, instead). A
2382 <command>DROP</> of the referenced object will be propagated
2383 through to drop the dependent object whether
2384 <command>CASCADE</> is specified or not. Example: a trigger
2385 that's created to enforce a foreign-key constraint is made
2386 internally dependent on the constraint's
2387 <structname>pg_constraint</> entry.
2393 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2396 There is no dependent object; this type of entry is a signal
2397 that the system itself depends on the referenced object, and so
2398 that object must never be deleted. Entries of this type are
2399 created only by <command>initdb</command>. The columns for the
2400 dependent object contain zeroes.
2406 Other dependency flavors might be needed in future.
2412 <sect1 id="catalog-pg-description">
2413 <title><structname>pg_description</structname></title>
2415 <indexterm zone="catalog-pg-description">
2416 <primary>pg_description</primary>
2420 The catalog <structname>pg_description</> stores optional descriptions
2421 (comments) for each database object. Descriptions can be manipulated
2422 with the <xref linkend="sql-comment" endterm="sql-comment-title"> command and viewed with
2423 <application>psql</application>'s <literal>\d</literal> commands.
2424 Descriptions of many built-in system objects are provided in the initial
2425 contents of <structname>pg_description</structname>.
2429 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2430 which performs a similar function for descriptions involving objects that
2431 are shared across a database cluster.
2435 <title><structname>pg_description</> Columns</title>
2442 <entry>References</entry>
2443 <entry>Description</entry>
2449 <entry><structfield>objoid</structfield></entry>
2450 <entry><type>oid</type></entry>
2451 <entry>any OID column</entry>
2452 <entry>The OID of the object this description pertains to</entry>
2456 <entry><structfield>classoid</structfield></entry>
2457 <entry><type>oid</type></entry>
2458 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2459 <entry>The OID of the system catalog this object appears in</entry>
2463 <entry><structfield>objsubid</structfield></entry>
2464 <entry><type>int4</type></entry>
2467 For a comment on a table column, this is the column number (the
2468 <structfield>objoid</> and <structfield>classoid</> refer to
2469 the table itself). For all other object types, this column is
2475 <entry><structfield>description</structfield></entry>
2476 <entry><type>text</type></entry>
2478 <entry>Arbitrary text that serves as the description of this object</entry>
2487 <sect1 id="catalog-pg-enum">
2488 <title><structname>pg_enum</structname></title>
2490 <indexterm zone="catalog-pg-enum">
2491 <primary>pg_enum</primary>
2495 The <structname>pg_enum</structname> catalog contains entries
2496 matching enum types to their associated values and labels. The
2497 internal representation of a given enum value is actually the OID
2498 of its associated row in <structname>pg_enum</structname>. The
2499 OIDs for a particular enum type are guaranteed to be ordered in
2500 the way the type should sort, but there is no guarantee about the
2501 ordering of OIDs of unrelated enum types.
2505 <title><structname>pg_enum</> Columns</title>
2512 <entry>References</entry>
2513 <entry>Description</entry>
2519 <entry><structfield>enumtypid</structfield></entry>
2520 <entry><type>oid</type></entry>
2521 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2522 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2526 <entry><structfield>enumlabel</structfield></entry>
2527 <entry><type>name</type></entry>
2529 <entry>The textual label for this enum value</entry>
2537 <sect1 id="catalog-pg-index">
2538 <title><structname>pg_index</structname></title>
2540 <indexterm zone="catalog-pg-index">
2541 <primary>pg_index</primary>
2545 The catalog <structname>pg_index</structname> contains part of the information
2546 about indexes. The rest is mostly in
2547 <structname>pg_class</structname>.
2551 <title><structname>pg_index</> Columns</title>
2558 <entry>References</entry>
2559 <entry>Description</entry>
2565 <entry><structfield>indexrelid</structfield></entry>
2566 <entry><type>oid</type></entry>
2567 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2568 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2572 <entry><structfield>indrelid</structfield></entry>
2573 <entry><type>oid</type></entry>
2574 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2575 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2579 <entry><structfield>indnatts</structfield></entry>
2580 <entry><type>int2</type></entry>
2582 <entry>The number of columns in the index (duplicates
2583 <literal>pg_class.relnatts</literal>)</entry>
2587 <entry><structfield>indisunique</structfield></entry>
2588 <entry><type>bool</type></entry>
2590 <entry>If true, this is a unique index</entry>
2594 <entry><structfield>indisprimary</structfield></entry>
2595 <entry><type>bool</type></entry>
2597 <entry>If true, this index represents the primary key of the table
2598 (<structfield>indisunique</> should always be true when this is true)</entry>
2602 <entry><structfield>indisclustered</structfield></entry>
2603 <entry><type>bool</type></entry>
2605 <entry>If true, the table was last clustered on this index</entry>
2609 <entry><structfield>indisvalid</structfield></entry>
2610 <entry><type>bool</type></entry>
2613 If true, the index is currently valid for queries. False means the
2614 index is possibly incomplete: it must still be modified by
2615 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2616 be used for queries. If it is unique, the uniqueness property is not
2622 <entry><structfield>indcheckxmin</structfield></entry>
2623 <entry><type>bool</type></entry>
2626 If true, queries must not use the index until the <structfield>xmin</>
2627 of this <structname>pg_index</> row is below their TransactionXmin
2628 event horizon, because the table may contain broken HOT chains with
2629 incompatible rows that they can see
2634 <entry><structfield>indisready</structfield></entry>
2635 <entry><type>bool</type></entry>
2638 If true, the index is currently ready for inserts. False means the
2639 index must be ignored by <command>INSERT</>/<command>UPDATE</>
2645 <entry><structfield>indkey</structfield></entry>
2646 <entry><type>int2vector</type></entry>
2647 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2649 This is an array of <structfield>indnatts</structfield> values that
2650 indicate which table columns this index indexes. For example a value
2651 of <literal>1 3</literal> would mean that the first and the third table
2652 columns make up the index key. A zero in this array indicates that the
2653 corresponding index attribute is an expression over the table columns,
2654 rather than a simple column reference
2659 <entry><structfield>indclass</structfield></entry>
2660 <entry><type>oidvector</type></entry>
2661 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2663 For each column in the index key, this contains the OID of
2664 the operator class to use. See
2665 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details
2670 <entry><structfield>indoption</structfield></entry>
2671 <entry><type>int2vector</type></entry>
2674 This is an array of <structfield>indnatts</structfield> values that
2675 store per-column flag bits. The meaning of the bits is defined by
2676 the index's access method
2681 <entry><structfield>indexprs</structfield></entry>
2682 <entry><type>text</type></entry>
2684 <entry>Expression trees (in <function>nodeToString()</function> representation)
2685 for index attributes that are not simple column references. This is a
2686 list with one element for each zero entry in <structfield>indkey</>.
2687 NULL if all index attributes are simple references</entry>
2691 <entry><structfield>indpred</structfield></entry>
2692 <entry><type>text</type></entry>
2694 <entry>Expression tree (in <function>nodeToString()</function> representation)
2695 for partial index predicate. NULL if not a partial index</entry>
2704 <sect1 id="catalog-pg-inherits">
2705 <title><structname>pg_inherits</structname></title>
2707 <indexterm zone="catalog-pg-inherits">
2708 <primary>pg_inherits</primary>
2712 The catalog <structname>pg_inherits</> records information about
2713 table inheritance hierarchies. There is one entry for each direct
2714 child table in the database. (Indirect inheritance can be determined
2715 by following chains of entries.)
2719 <title><structname>pg_inherits</> Columns</title>
2726 <entry>References</entry>
2727 <entry>Description</entry>
2733 <entry><structfield>inhrelid</structfield></entry>
2734 <entry><type>oid</type></entry>
2735 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2737 The OID of the child table
2742 <entry><structfield>inhparent</structfield></entry>
2743 <entry><type>oid</type></entry>
2744 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2746 The OID of the parent table
2751 <entry><structfield>inhseqno</structfield></entry>
2752 <entry><type>int4</type></entry>
2755 If there is more than one direct parent for a child table (multiple
2756 inheritance), this number tells the order in which the
2757 inherited columns are to be arranged. The count starts at 1
2767 <sect1 id="catalog-pg-language">
2768 <title><structname>pg_language</structname></title>
2770 <indexterm zone="catalog-pg-language">
2771 <primary>pg_language</primary>
2775 The catalog <structname>pg_language</structname> registers
2776 languages in which you can write functions or stored procedures.
2777 See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
2778 and <xref linkend="xplang"> for more information about language handlers.
2782 <title><structname>pg_language</> Columns</title>
2789 <entry>References</entry>
2790 <entry>Description</entry>
2796 <entry><structfield>lanname</structfield></entry>
2797 <entry><type>name</type></entry>
2799 <entry>Name of the language</entry>
2803 <entry><structfield>lanowner</structfield></entry>
2804 <entry><type>oid</type></entry>
2805 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2806 <entry>Owner of the language</entry>
2810 <entry><structfield>lanispl</structfield></entry>
2811 <entry><type>bool</type></entry>
2814 This is false for internal languages (such as
2815 <acronym>SQL</acronym>) and true for user-defined languages.
2816 Currently, <application>pg_dump</application> still uses this
2817 to determine which languages need to be dumped, but this might be
2818 replaced by a different mechanism in the future
2823 <entry><structfield>lanpltrusted</structfield></entry>
2824 <entry><type>bool</type></entry>
2827 True if this is a trusted language, which means that it is believed
2828 not to grant access to anything outside the normal SQL execution
2829 environment. Only superusers can create functions in untrusted
2835 <entry><structfield>lanplcallfoid</structfield></entry>
2836 <entry><type>oid</type></entry>
2837 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2839 For noninternal languages this references the language
2840 handler, which is a special function that is responsible for
2841 executing all functions that are written in the particular
2847 <entry><structfield>lanvalidator</structfield></entry>
2848 <entry><type>oid</type></entry>
2849 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2851 This references a language validator function that is responsible
2852 for checking the syntax and validity of new functions when they
2853 are created. Zero if no validator is provided
2858 <entry><structfield>lanacl</structfield></entry>
2859 <entry><type>aclitem[]</type></entry>
2862 Access privileges; see
2863 <xref linkend="sql-grant" endterm="sql-grant-title"> and
2864 <xref linkend="sql-revoke" endterm="sql-revoke-title">
2875 <sect1 id="catalog-pg-largeobject">
2876 <title><structname>pg_largeobject</structname></title>
2878 <indexterm zone="catalog-pg-largeobject">
2879 <primary>pg_largeobject</primary>
2883 The catalog <structname>pg_largeobject</structname> holds the data making up
2884 <quote>large objects</quote>. A large object is identified by an
2885 OID assigned when it is created. Each large object is broken into
2886 segments or <quote>pages</> small enough to be conveniently stored as rows
2887 in <structname>pg_largeobject</structname>.
2888 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
2889 <literal>BLCKSZ/4</>, or typically 2 kB).
2893 <title><structname>pg_largeobject</> Columns</title>
2900 <entry>Description</entry>
2906 <entry><structfield>loid</structfield></entry>
2907 <entry><type>oid</type></entry>
2908 <entry>Identifier of the large object that includes this page</entry>
2912 <entry><structfield>pageno</structfield></entry>
2913 <entry><type>int4</type></entry>
2914 <entry>Page number of this page within its large object
2915 (counting from zero)</entry>
2919 <entry><structfield>data</structfield></entry>
2920 <entry><type>bytea</type></entry>
2922 Actual data stored in the large object.
2923 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less
2931 Each row of <structname>pg_largeobject</structname> holds data
2932 for one page of a large object, beginning at
2933 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
2934 allows sparse storage: pages might be missing, and might be shorter than
2935 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
2936 Missing regions within a large object read as zeroes.
2942 <sect1 id="catalog-pg-listener">
2943 <title><structname>pg_listener</structname></title>
2945 <indexterm zone="catalog-pg-listener">
2946 <primary>pg_listener</primary>
2950 The catalog <structname>pg_listener</structname> supports the
2951 <xref linkend="sql-listen" endterm="sql-listen-title"> and
2952 <xref linkend="sql-notify" endterm="sql-notify-title">
2953 commands. A listener creates an entry in
2954 <structname>pg_listener</structname> for each notification name
2955 it is listening for. A notifier scans <structname>pg_listener</structname>
2956 and updates each matching entry to show that a notification has occurred.
2957 The notifier also sends a signal (using the PID recorded in the table)
2958 to awaken the listener from sleep.
2962 <title><structname>pg_listener</> Columns</title>
2969 <entry>References</entry>
2970 <entry>Description</entry>
2976 <entry><structfield>relname</structfield></entry>
2977 <entry><type>name</type></entry>
2979 Notify condition name. (The name need not match any actual
2980 relation in the database; the name <structfield>relname</> is historical.)
2985 <entry><structfield>listenerpid</structfield></entry>
2986 <entry><type>int4</type></entry>
2987 <entry>PID of the server process that created this entry</entry>
2991 <entry><structfield>notification</structfield></entry>
2992 <entry><type>int4</type></entry>
2994 Zero if no event is pending for this listener. If an event is
2995 pending, the PID of the server process that sent the notification
3005 <sect1 id="catalog-pg-namespace">
3006 <title><structname>pg_namespace</structname></title>
3008 <indexterm zone="catalog-pg-namespace">
3009 <primary>pg_namespace</primary>
3013 The catalog <structname>pg_namespace</> stores namespaces.
3014 A namespace is the structure underlying SQL schemas: each namespace
3015 can have a separate collection of relations, types, etc. without name
3020 <title><structname>pg_namespace</> Columns</title>
3027 <entry>References</entry>
3028 <entry>Description</entry>
3034 <entry><structfield>nspname</structfield></entry>
3035 <entry><type>name</type></entry>
3037 <entry>Name of the namespace</entry>
3041 <entry><structfield>nspowner</structfield></entry>
3042 <entry><type>oid</type></entry>
3043 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3044 <entry>Owner of the namespace</entry>
3048 <entry><structfield>nspacl</structfield></entry>
3049 <entry><type>aclitem[]</type></entry>
3052 Access privileges; see
3053 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3054 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3065 <sect1 id="catalog-pg-opclass">
3066 <title><structname>pg_opclass</structname></title>
3068 <indexterm zone="catalog-pg-opclass">
3069 <primary>pg_opclass</primary>
3073 The catalog <structname>pg_opclass</structname> defines
3074 index access method operator classes. Each operator class defines
3075 semantics for index columns of a particular data type and a particular
3076 index access method. An operator class essentially specifies that a
3077 particular operator family is applicable to a particular indexable column
3078 data type. The set of operators from the family that are actually usable
3079 with the indexed column are whichever ones accept the column's data type
3080 as their lefthand input.
3084 Operator classes are described at length in <xref linkend="xindex">.
3088 <title><structname>pg_opclass</> Columns</title>
3095 <entry>References</entry>
3096 <entry>Description</entry>
3102 <entry><structfield>opcmethod</structfield></entry>
3103 <entry><type>oid</type></entry>
3104 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3105 <entry>Index access method operator class is for</entry>
3109 <entry><structfield>opcname</structfield></entry>
3110 <entry><type>name</type></entry>
3112 <entry>Name of this operator class</entry>
3116 <entry><structfield>opcnamespace</structfield></entry>
3117 <entry><type>oid</type></entry>
3118 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3119 <entry>Namespace of this operator class</entry>
3123 <entry><structfield>opcowner</structfield></entry>
3124 <entry><type>oid</type></entry>
3125 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3126 <entry>Owner of the operator class</entry>
3130 <entry><structfield>opcfamily</structfield></entry>
3131 <entry><type>oid</type></entry>
3132 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3133 <entry>Operator family containing the operator class</entry>
3137 <entry><structfield>opcintype</structfield></entry>
3138 <entry><type>oid</type></entry>
3139 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3140 <entry>Data type that the operator class indexes</entry>
3144 <entry><structfield>opcdefault</structfield></entry>
3145 <entry><type>bool</type></entry>
3147 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3151 <entry><structfield>opckeytype</structfield></entry>
3152 <entry><type>oid</type></entry>
3153 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3154 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3162 An operator class's <structfield>opcmethod</> must match the
3163 <structname>opfmethod</> of its containing operator family.
3164 Also, there must be no more than one <structname>pg_opclass</structname>
3165 row having <structname>opcdefault</> true for any given combination of
3166 <structname>opcmethod</> and <structname>opcintype</>.
3172 <sect1 id="catalog-pg-operator">
3173 <title><structname>pg_operator</structname></title>
3175 <indexterm zone="catalog-pg-operator">
3176 <primary>pg_operator</primary>
3180 The catalog <structname>pg_operator</> stores information about operators.
3181 See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
3182 and <xref linkend="xoper"> for more information.
3186 <title><structname>pg_operator</> Columns</title>
3193 <entry>References</entry>
3194 <entry>Description</entry>
3200 <entry><structfield>oprname</structfield></entry>
3201 <entry><type>name</type></entry>
3203 <entry>Name of the operator</entry>
3207 <entry><structfield>oprnamespace</structfield></entry>
3208 <entry><type>oid</type></entry>
3209 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3211 The OID of the namespace that contains this operator
3216 <entry><structfield>oprowner</structfield></entry>
3217 <entry><type>oid</type></entry>
3218 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3219 <entry>Owner of the operator</entry>
3223 <entry><structfield>oprkind</structfield></entry>
3224 <entry><type>char</type></entry>
3227 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3228 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3233 <entry><structfield>oprcanmerge</structfield></entry>
3234 <entry><type>bool</type></entry>
3236 <entry>This operator supports merge joins</entry>
3240 <entry><structfield>oprcanhash</structfield></entry>
3241 <entry><type>bool</type></entry>
3243 <entry>This operator supports hash joins</entry>
3247 <entry><structfield>oprleft</structfield></entry>
3248 <entry><type>oid</type></entry>
3249 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3250 <entry>Type of the left operand</entry>
3254 <entry><structfield>oprright</structfield></entry>
3255 <entry><type>oid</type></entry>
3256 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3257 <entry>Type of the right operand</entry>
3261 <entry><structfield>oprresult</structfield></entry>
3262 <entry><type>oid</type></entry>
3263 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3264 <entry>Type of the result</entry>
3268 <entry><structfield>oprcom</structfield></entry>
3269 <entry><type>oid</type></entry>
3270 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3271 <entry>Commutator of this operator, if any</entry>
3275 <entry><structfield>oprnegate</structfield></entry>
3276 <entry><type>oid</type></entry>
3277 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3278 <entry>Negator of this operator, if any</entry>
3282 <entry><structfield>oprcode</structfield></entry>
3283 <entry><type>regproc</type></entry>
3284 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3285 <entry>Function that implements this operator</entry>
3289 <entry><structfield>oprrest</structfield></entry>
3290 <entry><type>regproc</type></entry>
3291 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3292 <entry>Restriction selectivity estimation function for this operator</entry>
3296 <entry><structfield>oprjoin</structfield></entry>
3297 <entry><type>regproc</type></entry>
3298 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3299 <entry>Join selectivity estimation function for this operator</entry>
3306 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3307 is zero for a prefix operator.
3313 <sect1 id="catalog-pg-opfamily">
3314 <title><structname>pg_opfamily</structname></title>
3316 <indexterm zone="catalog-pg-opfamily">
3317 <primary>pg_opfamily</primary>
3321 The catalog <structname>pg_opfamily</structname> defines operator families.
3322 Each operator family is a collection of operators and associated
3323 support routines that implement the semantics specified for a particular
3324 index access method. Furthermore, the operators in a family are all
3325 <quote>compatible</>, in a way that is specified by the access method.
3326 The operator family concept allows cross-data-type operators to be used
3327 with indexes and to be reasoned about using knowledge of access method
3332 Operator families are described at length in <xref linkend="xindex">.
3336 <title><structname>pg_opfamily</> Columns</title>
3343 <entry>References</entry>
3344 <entry>Description</entry>
3350 <entry><structfield>opfmethod</structfield></entry>
3351 <entry><type>oid</type></entry>
3352 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3353 <entry>Index access method operator family is for</entry>
3357 <entry><structfield>opfname</structfield></entry>
3358 <entry><type>name</type></entry>
3360 <entry>Name of this operator family</entry>
3364 <entry><structfield>opfnamespace</structfield></entry>
3365 <entry><type>oid</type></entry>
3366 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3367 <entry>Namespace of this operator family</entry>
3371 <entry><structfield>opfowner</structfield></entry>
3372 <entry><type>oid</type></entry>
3373 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3374 <entry>Owner of the operator family</entry>
3382 The majority of the information defining an operator family is not in its
3383 <structname>pg_opfamily</structname> row, but in the associated rows in
3384 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3385 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3387 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3393 <sect1 id="catalog-pg-pltemplate">
3394 <title><structname>pg_pltemplate</structname></title>
3396 <indexterm zone="catalog-pg-pltemplate">
3397 <primary>pg_pltemplate</primary>
3401 The catalog <structname>pg_pltemplate</structname> stores
3402 <quote>template</> information for procedural languages.
3403 A template for a language allows the language to be created in a
3404 particular database by a simple <command>CREATE LANGUAGE</> command,
3405 with no need to specify implementation details.
3409 Unlike most system catalogs, <structname>pg_pltemplate</structname>
3410 is shared across all databases of a cluster: there is only one
3411 copy of <structname>pg_pltemplate</structname> per cluster, not
3412 one per database. This allows the information to be accessible in
3413 each database as it is needed.
3417 <title><structname>pg_pltemplate</> Columns</title>
3424 <entry>Description</entry>
3430 <entry><structfield>tmplname</structfield></entry>
3431 <entry><type>name</type></entry>
3432 <entry>Name of the language this template is for</entry>
3436 <entry><structfield>tmpltrusted</structfield></entry>
3437 <entry><type>boolean</type></entry>
3438 <entry>True if language is considered trusted</entry>
3442 <entry><structfield>tmpldbacreate</structfield></entry>
3443 <entry><type>boolean</type></entry>
3444 <entry>True if language may be created by a database owner</entry>
3448 <entry><structfield>tmplhandler</structfield></entry>
3449 <entry><type>text</type></entry>
3450 <entry>Name of call handler function</entry>
3454 <entry><structfield>tmplvalidator</structfield></entry>
3455 <entry><type>text</type></entry>
3456 <entry>Name of validator function, or NULL if none</entry>
3460 <entry><structfield>tmpllibrary</structfield></entry>
3461 <entry><type>text</type></entry>
3462 <entry>Path of shared library that implements language</entry>
3466 <entry><structfield>tmplacl</structfield></entry>
3467 <entry><type>aclitem[]</type></entry>
3468 <entry>Access privileges for template (not yet used)</entry>
3476 There are not currently any commands that manipulate procedural language
3477 templates; to change the built-in information, a superuser must modify
3478 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3479 or <command>UPDATE</command> commands. It is likely that a future
3480 release of <productname>PostgreSQL</productname> will offer
3481 commands to change the entries in a cleaner fashion.
3485 When implemented, the <structfield>tmplacl</structfield> field will provide
3486 access control for the template itself (i.e., the right to create a
3487 language using it), not for the languages created from the template.
3493 <sect1 id="catalog-pg-proc">
3494 <title><structname>pg_proc</structname></title>
3496 <indexterm zone="catalog-pg-proc">
3497 <primary>pg_proc</primary>
3501 The catalog <structname>pg_proc</> stores information about functions (or procedures).
3502 See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
3503 and <xref linkend="xfunc"> for more information.
3507 The table contains data for aggregate functions as well as plain functions.
3508 If <structfield>proisagg</structfield> is true, there should be a matching
3509 row in <structfield>pg_aggregate</structfield>.
3513 <title><structname>pg_proc</> Columns</title>
3520 <entry>References</entry>
3521 <entry>Description</entry>
3527 <entry><structfield>proname</structfield></entry>
3528 <entry><type>name</type></entry>
3530 <entry>Name of the function</entry>
3534 <entry><structfield>pronamespace</structfield></entry>
3535 <entry><type>oid</type></entry>
3536 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3538 The OID of the namespace that contains this function
3543 <entry><structfield>proowner</structfield></entry>
3544 <entry><type>oid</type></entry>
3545 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3546 <entry>Owner of the function</entry>
3550 <entry><structfield>prolang</structfield></entry>
3551 <entry><type>oid</type></entry>
3552 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3553 <entry>Implementation language or call interface of this function</entry>
3557 <entry><structfield>procost</structfield></entry>
3558 <entry><type>float4</type></entry>
3560 <entry>Estimated execution cost (in units of
3561 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3562 this is cost per row returned</entry>
3566 <entry><structfield>prorows</structfield></entry>
3567 <entry><type>float4</type></entry>
3569 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3573 <entry><structfield>proisagg</structfield></entry>
3574 <entry><type>bool</type></entry>
3576 <entry>Function is an aggregate function</entry>
3580 <entry><structfield>prosecdef</structfield></entry>
3581 <entry><type>bool</type></entry>
3583 <entry>Function is a security definer (i.e., a <quote>setuid</>
3588 <entry><structfield>proisstrict</structfield></entry>
3589 <entry><type>bool</type></entry>
3592 Function returns null if any call argument is null. In that
3593 case the function won't actually be called at all. Functions
3594 that are not <quote>strict</quote> must be prepared to handle
3600 <entry><structfield>proretset</structfield></entry>
3601 <entry><type>bool</type></entry>
3603 <entry>Function returns a set (i.e., multiple values of the specified
3608 <entry><structfield>provolatile</structfield></entry>
3609 <entry><type>char</type></entry>
3612 <structfield>provolatile</structfield> tells whether the function's
3613 result depends only on its input arguments, or is affected by outside
3615 It is <literal>i</literal> for <quote>immutable</> functions,
3616 which always deliver the same result for the same inputs.
3617 It is <literal>s</literal> for <quote>stable</> functions,
3618 whose results (for fixed inputs) do not change within a scan.
3619 It is <literal>v</literal> for <quote>volatile</> functions,
3620 whose results might change at any time. (Use <literal>v</literal> also
3621 for functions with side-effects, so that calls to them cannot get
3627 <entry><structfield>pronargs</structfield></entry>
3628 <entry><type>int2</type></entry>
3630 <entry>Number of arguments</entry>
3634 <entry><structfield>prorettype</structfield></entry>
3635 <entry><type>oid</type></entry>
3636 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3637 <entry>Data type of the return value</entry>
3641 <entry><structfield>proargtypes</structfield></entry>
3642 <entry><type>oidvector</type></entry>
3643 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3645 An array with the data types of the function arguments. This includes
3646 only input arguments (including <literal>INOUT</literal> arguments), and thus represents
3647 the call signature of the function
3652 <entry><structfield>proallargtypes</structfield></entry>
3653 <entry><type>oid[]</type></entry>
3654 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3656 An array with the data types of the function arguments. This includes
3657 all arguments (including <literal>OUT</literal> and <literal>INOUT</literal> arguments); however, if all the
3658 arguments are IN arguments, this field will be null.
3659 Note that subscripting is 1-based, whereas for historical reasons
3660 <structfield>proargtypes</> is subscripted from 0
3665 <entry><structfield>proargmodes</structfield></entry>
3666 <entry><type>char[]</type></entry>
3669 An array with the modes of the function arguments, encoded as
3670 <literal>i</literal> for <literal>IN</> arguments,
3671 <literal>o</literal> for <literal>OUT</> arguments,
3672 <literal>b</literal> for <literal>INOUT</> arguments.
3673 If all the arguments are <literal>IN</literal> arguments, this field will be null.
3674 Note that subscripts correspond to positions of
3675 <structfield>proallargtypes</> not <structfield>proargtypes</>
3680 <entry><structfield>proargnames</structfield></entry>
3681 <entry><type>text[]</type></entry>
3684 An array with the names of the function arguments.
3685 Arguments without a name are set to empty strings in the array.
3686 If none of the arguments have a name, this field will be null.
3687 Note that subscripts correspond to positions of
3688 <structfield>proallargtypes</> not <structfield>proargtypes</>
3693 <entry><structfield>prosrc</structfield></entry>
3694 <entry><type>text</type></entry>
3697 This tells the function handler how to invoke the function. It
3698 might be the actual source code of the function for interpreted
3699 languages, a link symbol, a file name, or just about anything
3700 else, depending on the implementation language/call convention
3705 <entry><structfield>probin</structfield></entry>
3706 <entry><type>bytea</type></entry>
3709 Additional information about how to invoke the function.
3710 Again, the interpretation is language-specific
3715 <entry><structfield>proconfig</structfield></entry>
3716 <entry><type>text[]</type></entry>
3718 <entry>Function's local settings for run-time configuration variables</entry>
3722 <entry><structfield>proacl</structfield></entry>
3723 <entry><type>aclitem[]</type></entry>
3726 Access privileges; see
3727 <xref linkend="sql-grant" endterm="sql-grant-title"> and
3728 <xref linkend="sql-revoke" endterm="sql-revoke-title">
3737 For compiled functions, both built-in and dynamically loaded,
3738 <structfield>prosrc</structfield> contains the function's C-language
3739 name (link symbol). For all other currently-known language types,
3740 <structfield>prosrc</structfield> contains the function's source
3741 text. <structfield>probin</structfield> is unused except for
3742 dynamically-loaded C functions, for which it gives the name of the
3743 shared library file containing the function.
3748 <sect1 id="catalog-pg-rewrite">
3749 <title><structname>pg_rewrite</structname></title>
3751 <indexterm zone="catalog-pg-rewrite">
3752 <primary>pg_rewrite</primary>
3756 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
3760 <title><structname>pg_rewrite</> Columns</title>
3767 <entry>References</entry>
3768 <entry>Description</entry>
3774 <entry><structfield>rulename</structfield></entry>
3775 <entry><type>name</type></entry>
3777 <entry>Rule name</entry>
3781 <entry><structfield>ev_class</structfield></entry>
3782 <entry><type>oid</type></entry>
3783 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3784 <entry>The table this rule is for</entry>
3788 <entry><structfield>ev_attr</structfield></entry>
3789 <entry><type>int2</type></entry>
3791 <entry>The column this rule is for (currently, always zero to
3792 indicate the whole table)</entry>
3796 <entry><structfield>ev_type</structfield></entry>
3797 <entry><type>char</type></entry>
3800 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
3801 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
3807 <entry><structfield>ev_enabled</structfield></entry>
3808 <entry><type>char</type></entry>
3811 Controls in which <xref linkend="guc-session-replication-role"> modes
3813 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
3814 <literal>D</> = rule is disabled,
3815 <literal>R</> = rule fires in <quote>replica</> mode,
3816 <literal>A</> = rule fires always.
3821 <entry><structfield>is_instead</structfield></entry>
3822 <entry><type>bool</type></entry>
3824 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
3828 <entry><structfield>ev_qual</structfield></entry>
3829 <entry><type>text</type></entry>
3832 Expression tree (in the form of a
3833 <function>nodeToString()</function> representation) for the
3834 rule's qualifying condition
3839 <entry><structfield>ev_action</structfield></entry>
3840 <entry><type>text</type></entry>
3843 Query tree (in the form of a
3844 <function>nodeToString()</function> representation) for the
3854 <literal>pg_class.relhasrules</literal>
3855 must be true if a table has any rules in this catalog.
3862 <sect1 id="catalog-pg-shdepend">
3863 <title><structname>pg_shdepend</structname></title>
3865 <indexterm zone="catalog-pg-shdepend">
3866 <primary>pg_shdepend</primary>
3870 The catalog <structname>pg_shdepend</structname> records the
3871 dependency relationships between database objects and shared objects,
3872 such as roles. This information allows
3873 <productname>PostgreSQL</productname> to ensure that those objects are
3874 unreferenced before attempting to delete them.
3878 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
3879 which performs a similar function for dependencies involving objects
3880 within a single database.
3884 Unlike most system catalogs, <structname>pg_shdepend</structname>
3885 is shared across all databases of a cluster: there is only one
3886 copy of <structname>pg_shdepend</structname> per cluster, not
3891 <title><structname>pg_shdepend</> Columns</title>
3898 <entry>References</entry>
3899 <entry>Description</entry>
3905 <entry><structfield>dbid</structfield></entry>
3906 <entry><type>oid</type></entry>
3907 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
3908 <entry>The OID of the database the dependent object is in,
3909 or zero for a shared object</entry>
3913 <entry><structfield>classid</structfield></entry>
3914 <entry><type>oid</type></entry>
3915 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3916 <entry>The OID of the system catalog the dependent object is in</entry>
3920 <entry><structfield>objid</structfield></entry>
3921 <entry><type>oid</type></entry>
3922 <entry>any OID column</entry>
3923 <entry>The OID of the specific dependent object</entry>
3927 <entry><structfield>refclassid</structfield></entry>
3928 <entry><type>oid</type></entry>
3929 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3930 <entry>The OID of the system catalog the referenced object is in
3931 (must be a shared catalog)</entry>
3935 <entry><structfield>refobjid</structfield></entry>
3936 <entry><type>oid</type></entry>
3937 <entry>any OID column</entry>
3938 <entry>The OID of the specific referenced object</entry>
3942 <entry><structfield>deptype</structfield></entry>
3943 <entry><type>char</type></entry>
3946 A code defining the specific semantics of this dependency relationship; see text
3955 In all cases, a <structname>pg_shdepend</structname> entry indicates that
3956 the referenced object cannot be dropped without also dropping the dependent
3957 object. However, there are several subflavors identified by
3958 <structfield>deptype</>:
3962 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
3965 The referenced object (which must be a role) is the owner of the
3972 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
3975 The referenced object (which must be a role) is mentioned in the
3976 ACL (access control list, i.e., privileges list) of the
3977 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
3978 not made for the owner of the object, since the owner will have
3979 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
3985 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
3988 There is no dependent object; this type of entry is a signal
3989 that the system itself depends on the referenced object, and so
3990 that object must never be deleted. Entries of this type are
3991 created only by <command>initdb</command>. The columns for the
3992 dependent object contain zeroes.
3998 Other dependency flavors might be needed in future. Note in particular
3999 that the current definition only supports roles as referenced objects.
4004 <sect1 id="catalog-pg-shdescription">
4005 <title><structname>pg_shdescription</structname></title>
4007 <indexterm zone="catalog-pg-shdescription">
4008 <primary>pg_shdescription</primary>
4012 The catalog <structname>pg_shdescription</structname> stores optional
4013 descriptions (comments) for shared database objects. Descriptions can be
4014 manipulated with the <xref linkend="sql-comment"
4015 endterm="sql-comment-title"> command and viewed with
4016 <application>psql</application>'s <literal>\d</literal> commands.
4020 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4021 which performs a similar function for descriptions involving objects
4022 within a single database.
4026 Unlike most system catalogs, <structname>pg_shdescription</structname>
4027 is shared across all databases of a cluster: there is only one
4028 copy of <structname>pg_shdescription</structname> per cluster, not
4033 <title><structname>pg_shdescription</> Columns</title>
4040 <entry>References</entry>
4041 <entry>Description</entry>
4047 <entry><structfield>objoid</structfield></entry>
4048 <entry><type>oid</type></entry>
4049 <entry>any OID column</entry>
4050 <entry>The OID of the object this description pertains to</entry>
4054 <entry><structfield>classoid</structfield></entry>
4055 <entry><type>oid</type></entry>
4056 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4057 <entry>The OID of the system catalog this object appears in</entry>
4061 <entry><structfield>description</structfield></entry>
4062 <entry><type>text</type></entry>
4064 <entry>Arbitrary text that serves as the description of this object</entry>
4073 <sect1 id="catalog-pg-statistic">
4074 <title><structname>pg_statistic</structname></title>
4076 <indexterm zone="catalog-pg-statistic">
4077 <primary>pg_statistic</primary>
4081 The catalog <structname>pg_statistic</structname> stores
4082 statistical data about the contents of the database. Entries are
4083 created by <xref linkend="sql-analyze" endterm="sql-analyze-title">
4084 and subsequently used by the query planner. There is one entry for
4085 each table column that has been analyzed. Note that all the
4086 statistical data is inherently approximate, even assuming that it
4091 <structname>pg_statistic</structname> also stores statistical data about
4092 the values of index expressions. These are described as if they were
4093 actual data columns; in particular, <structfield>starelid</structfield>
4094 references the index. No entry is made for an ordinary non-expression
4095 index column, however, since it would be redundant with the entry
4096 for the underlying table column.
4100 Since different kinds of statistics might be appropriate for different
4101 kinds of data, <structname>pg_statistic</structname> is designed not
4102 to assume very much about what sort of statistics it stores. Only
4103 extremely general statistics (such as nullness) are given dedicated
4104 columns in <structname>pg_statistic</structname>. Everything else
4105 is stored in <quote>slots</quote>, which are groups of associated columns
4106 whose content is identified by a code number in one of the slot's columns.
4107 For more information see
4108 <filename>src/include/catalog/pg_statistic.h</filename>.
4112 <structname>pg_statistic</structname> should not be readable by the
4113 public, since even statistical information about a table's contents
4114 might be considered sensitive. (Example: minimum and maximum values
4115 of a salary column might be quite interesting.)
4116 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4117 is a publicly readable view on
4118 <structname>pg_statistic</structname> that only exposes information
4119 about those tables that are readable by the current user.
4123 <title><structname>pg_statistic</> Columns</title>
4130 <entry>References</entry>
4131 <entry>Description</entry>
4137 <entry><structfield>starelid</structfield></entry>
4138 <entry><type>oid</type></entry>
4139 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4140 <entry>The table or index that the described column belongs to</entry>
4144 <entry><structfield>staattnum</structfield></entry>
4145 <entry><type>int2</type></entry>
4146 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4147 <entry>The number of the described column</entry>
4151 <entry><structfield>stanullfrac</structfield></entry>
4152 <entry><type>float4</type></entry>
4154 <entry>The fraction of the column's entries that are null</entry>
4158 <entry><structfield>stawidth</structfield></entry>
4159 <entry><type>int4</type></entry>
4161 <entry>The average stored width, in bytes, of nonnull entries</entry>
4165 <entry><structfield>stadistinct</structfield></entry>
4166 <entry><type>float4</type></entry>
4168 <entry>The number of distinct nonnull data values in the column.
4169 A value greater than zero is the actual number of distinct values.
4170 A value less than zero is the negative of a fraction of the number
4171 of rows in the table (for example, a column in which values appear about
4172 twice on the average could be represented by <structfield>stadistinct</> = -0.5).
4173 A zero value means the number of distinct values is unknown
4178 <entry><structfield>stakind<replaceable>N</></structfield></entry>
4179 <entry><type>int2</type></entry>
4182 A code number indicating the kind of statistics stored in the
4183 <replaceable>N</>th <quote>slot</quote> of the
4184 <structname>pg_statistic</structname> row
4189 <entry><structfield>staop<replaceable>N</></structfield></entry>
4190 <entry><type>oid</type></entry>
4191 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4193 An operator used to derive the statistics stored in the
4194 <replaceable>N</>th <quote>slot</quote>. For example, a
4195 histogram slot would show the <literal><</literal> operator
4196 that defines the sort order of the data
4201 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4202 <entry><type>float4[]</type></entry>
4205 Numerical statistics of the appropriate kind for the
4206 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4207 kind does not involve numerical values
4212 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4213 <entry><type>anyarray</type></entry>
4216 Column data values of the appropriate kind for the
4217 <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4218 kind does not store any data values. Each array's element
4219 values are actually of the specific column's data type, so there
4220 is no way to define these columns' type more specifically than
4231 <sect1 id="catalog-pg-tablespace">
4232 <title><structname>pg_tablespace</structname></title>
4234 <indexterm zone="catalog-pg-tablespace">
4235 <primary>pg_tablespace</primary>
4239 The catalog <structname>pg_tablespace</structname> stores information
4240 about the available tablespaces. Tables can be placed in particular
4241 tablespaces to aid administration of disk layout.
4245 Unlike most system catalogs, <structname>pg_tablespace</structname>
4246 is shared across all databases of a cluster: there is only one
4247 copy of <structname>pg_tablespace</structname> per cluster, not
4252 <title><structname>pg_tablespace</> Columns</title>
4259 <entry>References</entry>
4260 <entry>Description</entry>
4266 <entry><structfield>spcname</structfield></entry>
4267 <entry><type>name</type></entry>
4269 <entry>Tablespace name</entry>
4273 <entry><structfield>spcowner</structfield></entry>
4274 <entry><type>oid</type></entry>
4275 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4276 <entry>Owner of the tablespace, usually the user who created it</entry>
4280 <entry><structfield>spclocation</structfield></entry>
4281 <entry><type>text</type></entry>
4283 <entry>Location (directory path) of the tablespace</entry>
4287 <entry><structfield>spcacl</structfield></entry>
4288 <entry><type>aclitem[]</type></entry>
4291 Access privileges; see
4292 <xref linkend="sql-grant" endterm="sql-grant-title"> and
4293 <xref linkend="sql-revoke" endterm="sql-revoke-title">
4303 <sect1 id="catalog-pg-trigger">
4304 <title><structname>pg_trigger</structname></title>
4306 <indexterm zone="catalog-pg-trigger">
4307 <primary>pg_trigger</primary>
4311 The catalog <structname>pg_trigger</structname> stores triggers on tables.
4312 See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
4313 for more information.
4317 <title><structname>pg_trigger</> Columns</title>
4324 <entry>References</entry>
4325 <entry>Description</entry>
4331 <entry><structfield>tgrelid</structfield></entry>
4332 <entry><type>oid</type></entry>
4333 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4334 <entry>The table this trigger is on</entry>
4338 <entry><structfield>tgname</structfield></entry>
4339 <entry><type>name</type></entry>
4341 <entry>Trigger name (must be unique among triggers of same table)</entry>
4345 <entry><structfield>tgfoid</structfield></entry>
4346 <entry><type>oid</type></entry>
4347 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4348 <entry>The function to be called</entry>
4352 <entry><structfield>tgtype</structfield></entry>
4353 <entry><type>int2</type></entry>
4355 <entry>Bit mask identifying trigger conditions</entry>
4359 <entry><structfield>tgenabled</structfield></entry>
4360 <entry><type>char</type></entry>
4363 Controls in which <xref linkend="guc-session-replication-role"> modes
4365 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4366 <literal>D</> = trigger is disabled,
4367 <literal>R</> = trigger fires in <quote>replica</> mode,
4368 <literal>A</> = trigger fires always.
4373 <entry><structfield>tgisconstraint</structfield></entry>
4374 <entry><type>bool</type></entry>
4376 <entry>True if trigger is a <quote>constraint trigger</></entry>
4380 <entry><structfield>tgconstrname</structfield></entry>
4381 <entry><type>name</type></entry>
4383 <entry>Constraint name, if a constraint trigger</entry>
4387 <entry><structfield>tgconstrrelid</structfield></entry>
4388 <entry><type>oid</type></entry>
4389 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4390 <entry>The table referenced by a referential integrity constraint</entry>
4394 <entry><structfield>tgconstraint</structfield></entry>
4395 <entry><type>oid</type></entry>
4396 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4397 <entry>The <structname>pg_constraint</> entry owning the trigger, if any</entry>
4401 <entry><structfield>tgdeferrable</structfield></entry>
4402 <entry><type>bool</type></entry>
4404 <entry>True if constraint trigger is deferrable</entry>
4408 <entry><structfield>tginitdeferred</structfield></entry>
4409 <entry><type>bool</type></entry>
4411 <entry>True if constraint trigger is initially deferred</entry>
4415 <entry><structfield>tgnargs</structfield></entry>
4416 <entry><type>int2</type></entry>
4418 <entry>Number of argument strings passed to trigger function</entry>
4422 <entry><structfield>tgattr</structfield></entry>
4423 <entry><type>int2vector</type></entry>
4425 <entry>Currently unused</entry>
4429 <entry><structfield>tgargs</structfield></entry>
4430 <entry><type>bytea</type></entry>
4432 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4440 When <structfield>tgconstraint</> is nonzero,
4441 <structfield>tgisconstraint</> must be true, and
4442 <structfield>tgconstrname</>, <structfield>tgconstrrelid</>,
4443 <structfield>tgdeferrable</>, <structfield>tginitdeferred</> are redundant
4444 with the referenced <structname>pg_constraint</> entry. The reason we
4445 keep these fields is that we support <quote>stand-alone</> constraint
4446 triggers with no corresponding <structname>pg_constraint</> entry.
4452 <literal>pg_class.reltriggers</literal> needs to agree with the
4453 number of triggers found in this table for each relation.
4460 <sect1 id="catalog-pg-ts-config">
4461 <title><structname>pg_ts_config</structname></title>
4463 <indexterm zone="catalog-pg-ts-config">
4464 <primary>pg_ts_config</primary>
4468 The <structname>pg_ts_config</structname> catalog contains entries
4469 representing text search configurations. A configuration specifies
4470 a particular text search parser and a list of dictionaries to use
4471 for each of the parser's output token types. The parser is shown
4472 in the <structname>pg_ts_config</structname> entry, but the
4473 token-to-dictionary mapping is defined by subsidiary entries in <link
4474 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4478 <productname>PostgreSQL</productname>'s text search features are
4479 described at length in <xref linkend="textsearch">.
4483 <title><structname>pg_ts_config</> Columns</title>
4490 <entry>References</entry>
4491 <entry>Description</entry>
4497 <entry><structfield>cfgname</structfield></entry>
4498 <entry><type>name</type></entry>
4500 <entry>Text search configuration name</entry>
4504 <entry><structfield>cfgnamespace</structfield></entry>
4505 <entry><type>oid</type></entry>
4506 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4508 The OID of the namespace that contains this configuration
4513 <entry><structfield>cfgowner</structfield></entry>
4514 <entry><type>oid</type></entry>
4515 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4516 <entry>Owner of the configuration</entry>
4520 <entry><structfield>cfgparser</structfield></entry>
4521 <entry><type>oid</type></entry>
4522 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4523 <entry>The OID of the text search parser for this configuration</entry>
4531 <sect1 id="catalog-pg-ts-config-map">
4532 <title><structname>pg_ts_config_map</structname></title>
4534 <indexterm zone="catalog-pg-ts-config-map">
4535 <primary>pg_ts_config_map</primary>
4539 The <structname>pg_ts_config_map</structname> catalog contains entries
4540 showing which text search dictionaries should be consulted, and in
4541 what order, for each output token type of each text search configuration's
4546 <productname>PostgreSQL</productname>'s text search features are
4547 described at length in <xref linkend="textsearch">.
4551 <title><structname>pg_ts_config_map</> Columns</title>
4558 <entry>References</entry>
4559 <entry>Description</entry>
4565 <entry><structfield>mapcfg</structfield></entry>
4566 <entry><type>oid</type></entry>
4567 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4568 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
4572 <entry><structfield>maptokentype</structfield></entry>
4573 <entry><type>integer</type></entry>
4575 <entry>A token type emitted by the configuration's parser</entry>
4579 <entry><structfield>mapseqno</structfield></entry>
4580 <entry><type>integer</type></entry>
4582 <entry>Order in which to consult this entry (lower
4583 <structfield>mapseqno</>s first)</entry>
4587 <entry><structfield>mapdict</structfield></entry>
4588 <entry><type>oid</type></entry>
4589 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
4590 <entry>The OID of the text search dictionary to consult</entry>
4598 <sect1 id="catalog-pg-ts-dict">
4599 <title><structname>pg_ts_dict</structname></title>
4601 <indexterm zone="catalog-pg-ts-dict">
4602 <primary>pg_ts_dict</primary>
4606 The <structname>pg_ts_dict</structname> catalog contains entries
4607 defining text search dictionaries. A dictionary depends on a text
4608 search template, which specifies all the implementation functions
4609 needed; the dictionary itself provides values for the user-settable
4610 parameters supported by the template. This division of labor allows
4611 dictionaries to be created by unprivileged users. The parameters
4612 are specified by a text string <structfield>dictinitoption</>,
4613 whose format and meaning vary depending on the template.
4617 <productname>PostgreSQL</productname>'s text search features are
4618 described at length in <xref linkend="textsearch">.
4622 <title><structname>pg_ts_dict</> Columns</title>
4629 <entry>References</entry>
4630 <entry>Description</entry>
4636 <entry><structfield>dictname</structfield></entry>
4637 <entry><type>name</type></entry>
4639 <entry>Text search dictionary name</entry>
4643 <entry><structfield>dictnamespace</structfield></entry>
4644 <entry><type>oid</type></entry>
4645 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4647 The OID of the namespace that contains this dictionary
4652 <entry><structfield>dictowner</structfield></entry>
4653 <entry><type>oid</type></entry>
4654 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4655 <entry>Owner of the dictionary</entry>
4659 <entry><structfield>dicttemplate</structfield></entry>
4660 <entry><type>oid</type></entry>
4661 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
4662 <entry>The OID of the text search template for this dictionary</entry>
4666 <entry><structfield>dictinitoption</structfield></entry>
4667 <entry><type>text</type></entry>
4669 <entry>Initialization option string for the template</entry>
4677 <sect1 id="catalog-pg-ts-parser">
4678 <title><structname>pg_ts_parser</structname></title>
4680 <indexterm zone="catalog-pg-ts-parser">
4681 <primary>pg_ts_parser</primary>
4685 The <structname>pg_ts_parser</structname> catalog contains entries
4686 defining text search parsers. A parser is responsible for splitting
4687 input text into lexemes and assigning a token type to each lexeme.
4688 Since a parser must be implemented by C-language-level functions,
4689 creation of new parsers is restricted to database superusers.
4693 <productname>PostgreSQL</productname>'s text search features are
4694 described at length in <xref linkend="textsearch">.
4698 <title><structname>pg_ts_parser</> Columns</title>
4705 <entry>References</entry>
4706 <entry>Description</entry>
4712 <entry><structfield>prsname</structfield></entry>
4713 <entry><type>name</type></entry>
4715 <entry>Text search parser name</entry>
4719 <entry><structfield>prsnamespace</structfield></entry>
4720 <entry><type>oid</type></entry>
4721 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4723 The OID of the namespace that contains this parser
4728 <entry><structfield>prsstart</structfield></entry>
4729 <entry><type>regproc</type></entry>
4730 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4731 <entry>OID of the parser's startup function</entry>
4735 <entry><structfield>prstoken</structfield></entry>
4736 <entry><type>regproc</type></entry>
4737 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4738 <entry>OID of the parser's next-token function</entry>
4742 <entry><structfield>prsend</structfield></entry>
4743 <entry><type>regproc</type></entry>
4744 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4745 <entry>OID of the parser's shutdown function</entry>
4749 <entry><structfield>prsheadline</structfield></entry>
4750 <entry><type>regproc</type></entry>
4751 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4752 <entry>OID of the parser's headline function</entry>
4756 <entry><structfield>prslextype</structfield></entry>
4757 <entry><type>regproc</type></entry>
4758 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4759 <entry>OID of the parser's lextype function</entry>
4767 <sect1 id="catalog-pg-ts-template">
4768 <title><structname>pg_ts_template</structname></title>
4770 <indexterm zone="catalog-pg-ts-template">
4771 <primary>pg_ts_template</primary>
4775 The <structname>pg_ts_template</structname> catalog contains entries
4776 defining text search templates. A template is the implementation
4777 skeleton for a class of text search dictionaries.
4778 Since a template must be implemented by C-language-level functions,
4779 creation of new templates is restricted to database superusers.
4783 <productname>PostgreSQL</productname>'s text search features are
4784 described at length in <xref linkend="textsearch">.
4788 <title><structname>pg_ts_template</> Columns</title>
4795 <entry>References</entry>
4796 <entry>Description</entry>
4802 <entry><structfield>tmplname</structfield></entry>
4803 <entry><type>name</type></entry>
4805 <entry>Text search template name</entry>
4809 <entry><structfield>tmplnamespace</structfield></entry>
4810 <entry><type>oid</type></entry>
4811 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4813 The OID of the namespace that contains this template
4818 <entry><structfield>tmplinit</structfield></entry>
4819 <entry><type>regproc</type></entry>
4820 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4821 <entry>OID of the template's initialization function</entry>
4825 <entry><structfield>tmpllexize</structfield></entry>
4826 <entry><type>regproc</type></entry>
4827 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4828 <entry>OID of the template's lexize function</entry>
4836 <sect1 id="catalog-pg-type">
4837 <title><structname>pg_type</structname></title>
4839 <indexterm zone="catalog-pg-type">
4840 <primary>pg_type</primary>
4844 The catalog <structname>pg_type</structname> stores information about data
4845 types. Base types (scalar types) are created with
4846 <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
4848 <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
4849 A composite type is automatically created for each table in the database, to
4850 represent the row structure of the table. It is also possible to create
4851 composite types with <command>CREATE TYPE AS</command>.
4855 <title><structname>pg_type</> Columns</title>
4862 <entry>References</entry>
4863 <entry>Description</entry>
4869 <entry><structfield>typname</structfield></entry>
4870 <entry><type>name</type></entry>
4872 <entry>Data type name</entry>
4876 <entry><structfield>typnamespace</structfield></entry>
4877 <entry><type>oid</type></entry>
4878 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4880 The OID of the namespace that contains this type
4885 <entry><structfield>typowner</structfield></entry>
4886 <entry><type>oid</type></entry>
4887 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4888 <entry>Owner of the type</entry>
4892 <entry><structfield>typlen</structfield></entry>
4893 <entry><type>int2</type></entry>
4896 For a fixed-size type, <structfield>typlen</structfield> is the number
4897 of bytes in the internal representation of the type. But for a
4898 variable-length type, <structfield>typlen</structfield> is negative.
4899 -1 indicates a <quote>varlena</> type (one that has a length word),
4900 -2 indicates a null-terminated C string.
4905 <entry><structfield>typbyval</structfield></entry>
4906 <entry><type>bool</type></entry>
4909 <structfield>typbyval</structfield> determines whether internal
4910 routines pass a value of this type by value or by reference.
4911 <structfield>typbyval</structfield> had better be false if
4912 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
4913 where Datum is 8 bytes).
4914 Variable-length types are always passed by reference. Note that
4915 <structfield>typbyval</structfield> can be false even if the
4916 length would allow pass-by-value; this is currently true for
4917 type <type>float4</type>, for example
4922 <entry><structfield>typtype</structfield></entry>
4923 <entry><type>char</type></entry>
4926 <structfield>typtype</structfield> is
4927 <literal>b</literal> for a base type,
4928 <literal>c</literal> for a composite type (e.g., a table's row type),
4929 <literal>d</literal> for a domain,
4930 <literal>e</literal> for an enum type,
4931 or <literal>p</literal> for a pseudo-type.
4932 See also <structfield>typrelid</structfield> and
4933 <structfield>typbasetype</structfield>
4938 <entry><structfield>typisdefined</structfield></entry>
4939 <entry><type>bool</type></entry>
4942 True if the type is defined, false if this is a placeholder
4943 entry for a not-yet-defined type. When
4944 <structfield>typisdefined</structfield> is false, nothing
4945 except the type name, namespace, and OID can be relied on
4950 <entry><structfield>typdelim</structfield></entry>
4951 <entry><type>char</type></entry>
4954 Character that separates two values of this type when parsing
4955 array input. Note that the delimiter is associated with the array
4956 element data type, not the array data type
4961 <entry><structfield>typrelid</structfield></entry>
4962 <entry><type>oid</type></entry>
4963 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4965 If this is a composite type (see
4966 <structfield>typtype</structfield>), then this column points to
4967 the <structname>pg_class</structname> entry that defines the
4968 corresponding table. (For a free-standing composite type, the
4969 <structname>pg_class</structname> entry doesn't really represent
4970 a table, but it is needed anyway for the type's
4971 <structname>pg_attribute</structname> entries to link to.)
4972 Zero for non-composite types
4977 <entry><structfield>typelem</structfield></entry>
4978 <entry><type>oid</type></entry>
4979 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4981 If <structfield>typelem</structfield> is not 0 then it
4982 identifies another row in <structname>pg_type</structname>.
4983 The current type can then be subscripted like an array yielding
4984 values of type <structfield>typelem</structfield>. A
4985 <quote>true</quote> array type is variable length
4986 (<structfield>typlen</structfield> = -1),
4987 but some fixed-length (<structfield>typlen</structfield> > 0) types
4988 also have nonzero <structfield>typelem</structfield>, for example
4989 <type>name</type> and <type>point</type>.
4990 If a fixed-length type has a <structfield>typelem</structfield> then
4991 its internal representation must be some number of values of the
4992 <structfield>typelem</structfield> data type with no other data.
4993 Variable-length array types have a header defined by the array
4999 <entry><structfield>typarray</structfield></entry>
5000 <entry><type>oid</type></entry>
5001 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5003 If <structfield>typarray</structfield> is not 0 then it
5004 identifies another row in <structname>pg_type</structname>, which
5005 is the <quote>true</quote> array type having this type as element
5010 <entry><structfield>typinput</structfield></entry>
5011 <entry><type>regproc</type></entry>
5012 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5013 <entry>Input conversion function (text format)</entry>
5017 <entry><structfield>typoutput</structfield></entry>
5018 <entry><type>regproc</type></entry>
5019 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5020 <entry>Output conversion function (text format)</entry>
5024 <entry><structfield>typreceive</structfield></entry>
5025 <entry><type>regproc</type></entry>
5026 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5027 <entry>Input conversion function (binary format), or 0 if none</entry>
5031 <entry><structfield>typsend</structfield></entry>
5032 <entry><type>regproc</type></entry>
5033 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5034 <entry>Output conversion function (binary format), or 0 if none</entry>
5038 <entry><structfield>typmodin</structfield></entry>
5039 <entry><type>regproc</type></entry>
5040 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5041 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5045 <entry><structfield>typmodout</structfield></entry>
5046 <entry><type>regproc</type></entry>
5047 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5048 <entry>Type modifier output function, or 0 to use the standard format</entry>
5052 <entry><structfield>typanalyze</structfield></entry>
5053 <entry><type>regproc</type></entry>
5054 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5055 <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
5059 <entry><structfield>typalign</structfield></entry>
5060 <entry><type>char</type></entry>
5064 <structfield>typalign</structfield> is the alignment required
5065 when storing a value of this type. It applies to storage on
5066 disk as well as most representations of the value inside
5067 <productname>PostgreSQL</>.
5068 When multiple values are stored consecutively, such
5069 as in the representation of a complete row on disk, padding is
5070 inserted before a datum of this type so that it begins on the
5071 specified boundary. The alignment reference is the beginning
5072 of the first datum in the sequence.
5074 Possible values are:
5077 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5080 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5083 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5086 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5091 For types used in system tables, it is critical that the size
5092 and alignment defined in <structname>pg_type</structname>
5093 agree with the way that the compiler will lay out the column in
5094 a structure representing a table row.
5100 <entry><structfield>typstorage</structfield></entry>
5101 <entry><type>char</type></entry>
5104 <structfield>typstorage</structfield> tells for varlena
5105 types (those with <structfield>typlen</structfield> = -1) if
5106 the type is prepared for toasting and what the default strategy
5107 for attributes of this type should be.
5111 <para><literal>p</>: Value must always be stored plain.</para>
5115 <literal>e</>: Value can be stored in a <quote>secondary</quote>
5116 relation (if relation has one, see
5117 <literal>pg_class.reltoastrelid</literal>).
5121 <para><literal>m</>: Value can be stored compressed inline.</para>
5124 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5127 Note that <literal>m</> columns can also be moved out to secondary
5128 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5134 <entry><structfield>typnotnull</structfield></entry>
5135 <entry><type>bool</type></entry>
5138 <structfield>typnotnull</structfield> represents a not-null
5139 constraint on a type. Used for domains only
5144 <entry><structfield>typbasetype</structfield></entry>
5145 <entry><type>oid</type></entry>
5146 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5148 If this is a domain (see <structfield>typtype</structfield>), then
5149 <structfield>typbasetype</structfield> identifies the type that this
5150 one is based on. Zero if this type is not a domain
5155 <entry><structfield>typtypmod</structfield></entry>
5156 <entry><type>int4</type></entry>
5159 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5160 to be applied to their base type (-1 if base type does not use a
5161 <literal>typmod</>). -1 if this type is not a domain
5166 <entry><structfield>typndims</structfield></entry>
5167 <entry><type>int4</type></entry>
5170 <structfield>typndims</structfield> is the number of array dimensions
5171 for a domain that is an array (that is, <structfield>typbasetype</> is
5172 an array type; the domain's <structfield>typelem</> will match the base
5173 type's <structfield>typelem</structfield>).
5174 Zero for types other than domains over array types
5179 <entry><structfield>typdefaultbin</structfield></entry>
5180 <entry><type>text</type></entry>
5183 If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5184 representation of a default expression for the type. This is
5185 only used for domains
5190 <entry><structfield>typdefault</structfield></entry>
5191 <entry><type>text</type></entry>
5194 <structfield>typdefault</> is null if the type has no associated
5195 default value. If <structfield>typdefaultbin</> is not null,
5196 <structfield>typdefault</> must contain a human-readable version of the
5197 default expression represented by <structfield>typdefaultbin</>. If
5198 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5199 not, then <structfield>typdefault</> is the external representation of
5200 the type's default value, which might be fed to the type's input
5201 converter to produce a constant
5209 <sect1 id="views-overview">
5210 <title>System Views</title>
5213 In addition to the system catalogs, <productname>PostgreSQL</productname>
5214 provides a number of built-in views. Some system views provide convenient
5215 access to some commonly used queries on the system catalogs. Other views
5216 provide access to internal server state.
5220 The information schema (<xref linkend="information-schema">) provides
5221 an alternative set of views which overlap the functionality of the system
5222 views. Since the information schema is SQL-standard whereas the views
5223 described here are <productname>PostgreSQL</productname>-specific,
5224 it's usually better to use the information schema if it provides all
5225 the information you need.
5229 <xref linkend="view-table"> lists the system views described here.
5230 More detailed documentation of each view follows below.
5231 There are some additional views that provide access to the results of
5232 the statistics collector; they are described in <xref
5233 linkend="monitoring-stats-views-table">.
5237 Except where noted, all the views described here are read-only.
5240 <table id="view-table">
5241 <title>System Views</title>
5246 <entry>View Name</entry>
5247 <entry>Purpose</entry>
5253 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5254 <entry>open cursors</entry>
5258 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5259 <entry>groups of database users</entry>
5263 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5264 <entry>indexes</entry>
5268 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5269 <entry>currently held locks</entry>
5273 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5274 <entry>prepared statements</entry>
5278 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5279 <entry>prepared transactions</entry>
5283 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5284 <entry>database roles</entry>
5288 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5289 <entry>rules</entry>
5293 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5294 <entry>parameter settings</entry>
5298 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5299 <entry>database users</entry>
5303 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5304 <entry>planner statistics</entry>
5308 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5309 <entry>tables</entry>
5313 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5314 <entry>time zone abbreviations</entry>
5318 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5319 <entry>time zone names</entry>
5323 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5324 <entry>database users</entry>
5328 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5329 <entry>views</entry>
5337 <sect1 id="view-pg-cursors">
5338 <title><structname>pg_cursors</structname></title>
5340 <indexterm zone="view-pg-cursors">
5341 <primary>pg_cursors</primary>
5345 The <structname>pg_cursors</structname> view lists the cursors that
5346 are currently available. Cursors can be defined in several ways:
5350 via the <xref linkend="sql-declare" endterm="sql-declare-title">
5357 via the Bind message in the frontend/backend protocol, as
5358 described in <xref linkend="protocol-flow-ext-query">
5364 via the Server Programming Interface (SPI), as described in
5365 <xref linkend="spi-interface">
5370 The <structname>pg_cursors</structname> view displays cursors
5371 created by any of these means. Cursors only exist for the duration
5372 of the transaction that defines them, unless they have been
5373 declared <literal>WITH HOLD</literal>. Therefore non-holdable
5374 cursors are only present in the view until the end of their
5375 creating transaction.
5379 Cursors are used internally to implement some of the components
5380 of <productname>PostgreSQL</>, such as procedural languages.
5381 Therefore, the <structname>pg_cursors</> view might include cursors
5382 that have not been explicitly created by the user.
5388 <title><structname>pg_cursors</> Columns</title>
5395 <entry>Description</entry>
5401 <entry><structfield>name</structfield></entry>
5402 <entry><type>text</type></entry>
5403 <entry>The name of the cursor</entry>
5407 <entry><structfield>statement</structfield></entry>
5408 <entry><type>text</type></entry>
5409 <entry>The verbatim query string submitted to declare this cursor</entry>
5413 <entry><structfield>is_holdable</structfield></entry>
5414 <entry><type>boolean</type></entry>
5416 <literal>true</literal> if the cursor is holdable (that is, it
5417 can be accessed after the transaction that declared the cursor
5418 has committed); <literal>false</literal> otherwise
5423 <entry><structfield>is_binary</structfield></entry>
5424 <entry><type>boolean</type></entry>
5426 <literal>true</literal> if the cursor was declared
5427 <literal>BINARY</literal>; <literal>false</literal>
5433 <entry><structfield>is_scrollable</structfield></entry>
5434 <entry><type>boolean</type></entry>
5436 <literal>true</> if the cursor is scrollable (that is, it
5437 allows rows to be retrieved in a nonsequential manner);
5438 <literal>false</literal> otherwise
5443 <entry><structfield>creation_time</structfield></entry>
5444 <entry><type>timestamptz</type></entry>
5445 <entry>The time at which the cursor was declared</entry>
5452 The <structname>pg_cursors</structname> view is read only.
5457 <sect1 id="view-pg-group">
5458 <title><structname>pg_group</structname></title>
5460 <indexterm zone="view-pg-group">
5461 <primary>pg_group</primary>
5465 The view <structname>pg_group</structname> exists for backwards
5466 compatibility: it emulates a catalog that existed in
5467 <productname>PostgreSQL</productname> before version 8.1.
5468 It shows the names and members of all roles that are marked as not
5469 <structfield>rolcanlogin</>, which is an approximation to the set
5470 of roles that are being used as groups.
5474 <title><structname>pg_group</> Columns</title>
5481 <entry>References</entry>
5482 <entry>Description</entry>
5488 <entry><structfield>groname</structfield></entry>
5489 <entry><type>name</type></entry>
5490 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5491 <entry>Name of the group</entry>
5495 <entry><structfield>grosysid</structfield></entry>
5496 <entry><type>oid</type></entry>
5497 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5498 <entry>ID of this group</entry>
5502 <entry><structfield>grolist</structfield></entry>
5503 <entry><type>oid[]</type></entry>
5504 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5505 <entry>An array containing the IDs of the roles in this group</entry>
5513 <sect1 id="view-pg-indexes">
5514 <title><structname>pg_indexes</structname></title>
5516 <indexterm zone="view-pg-indexes">
5517 <primary>pg_indexes</primary>
5521 The view <structname>pg_indexes</structname> provides access to
5522 useful information about each index in the database.
5526 <title><structname>pg_indexes</> Columns</title>
5533 <entry>References</entry>
5534 <entry>Description</entry>
5539 <entry><structfield>schemaname</structfield></entry>
5540 <entry><type>name</type></entry>
5541 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
5542 <entry>Name of schema containing table and index</entry>
5545 <entry><structfield>tablename</structfield></entry>
5546 <entry><type>name</type></entry>
5547 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5548 <entry>Name of table the index is for</entry>
5551 <entry><structfield>indexname</structfield></entry>
5552 <entry><type>name</type></entry>
5553 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5554 <entry>Name of index</entry>
5557 <entry><structfield>tablespace</structfield></entry>
5558 <entry><type>name</type></entry>
5559 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
5560 <entry>Name of tablespace containing index (NULL if default for database)</entry>
5563 <entry><structfield>indexdef</structfield></entry>
5564 <entry><type>text</type></entry>
5566 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
5575 <sect1 id="view-pg-locks">
5576 <title><structname>pg_locks</structname></title>
5578 <indexterm zone="view-pg-locks">
5579 <primary>pg_locks</primary>
5583 The view <structname>pg_locks</structname> provides access to
5584 information about the locks held by open transactions within the
5585 database server. See <xref linkend="mvcc"> for more discussion
5590 <structname>pg_locks</structname> contains one row per active lockable
5591 object, requested lock mode, and relevant transaction. Thus, the same
5592 lockable object might
5593 appear many times, if multiple transactions are holding or waiting
5594 for locks on it. However, an object that currently has no locks on it
5595 will not appear at all.
5599 There are several distinct types of lockable objects:
5600 whole relations (e.g., tables), individual pages of relations,
5601 individual tuples of relations,
5602 transaction IDs (both virtual and permanent IDs),
5603 and general database objects (identified by class OID and object OID,
5604 in the same way as in <structname>pg_description</structname> or
5605 <structname>pg_depend</structname>). Also, the right to extend a
5606 relation is represented as a separate lockable object.
5610 <title><structname>pg_locks</> Columns</title>
5617 <entry>References</entry>
5618 <entry>Description</entry>
5623 <entry><structfield>locktype</structfield></entry>
5624 <entry><type>text</type></entry>
5627 type of the lockable object:
5628 <literal>relation</>,
5632 <literal>transactionid</>,
5633 <literal>virtualxid</>,
5635 <literal>userlock</>, or
5636 <literal>advisory</>
5640 <entry><structfield>database</structfield></entry>
5641 <entry><type>oid</type></entry>
5642 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5644 OID of the database in which the object exists, or
5645 zero if the object is a shared object, or
5646 NULL if the object is a transaction ID
5650 <entry><structfield>relation</structfield></entry>
5651 <entry><type>oid</type></entry>
5652 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5654 OID of the relation, or NULL if the object is not
5655 a relation or part of a relation
5659 <entry><structfield>page</structfield></entry>
5660 <entry><type>integer</type></entry>
5663 Page number within the relation, or NULL if the object
5664 is not a tuple or relation page
5668 <entry><structfield>tuple</structfield></entry>
5669 <entry><type>smallint</type></entry>
5672 Tuple number within the page, or NULL if the object is not a tuple
5676 <entry><structfield>virtualxid</structfield></entry>
5677 <entry><type>text</type></entry>
5680 Virtual ID of a transaction, or NULL if the object is not a
5681 virtual transaction ID
5685 <entry><structfield>transactionid</structfield></entry>
5686 <entry><type>xid</type></entry>
5689 ID of a transaction, or NULL if the object is not a transaction ID
5693 <entry><structfield>classid</structfield></entry>
5694 <entry><type>oid</type></entry>
5695 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5697 OID of the system catalog containing the object, or NULL if the
5698 object is not a general database object
5702 <entry><structfield>objid</structfield></entry>
5703 <entry><type>oid</type></entry>
5704 <entry>any OID column</entry>
5706 OID of the object within its system catalog, or NULL if the
5707 object is not a general database object.
5708 For advisory locks it is used to distinguish the two key
5709 spaces (<literal>1</> for an int8 key, <literal>2</> for two
5714 <entry><structfield>objsubid</structfield></entry>
5715 <entry><type>smallint</type></entry>
5718 For a table column, this is the column number (the
5719 <structfield>classid</> and <structfield>objid</> refer to the
5720 table itself). For all other object types, this column is
5721 zero. NULL if the object is not a general database object
5725 <entry><structfield>virtualtransaction</structfield></entry>
5726 <entry><type>text</type></entry>
5729 Virtual ID of the transaction that is holding or awaiting this lock
5733 <entry><structfield>pid</structfield></entry>
5734 <entry><type>integer</type></entry>
5737 Process ID of the server process holding or awaiting this
5738 lock. NULL if the lock is held by a prepared transaction
5742 <entry><structfield>mode</structfield></entry>
5743 <entry><type>text</type></entry>
5745 <entry>Name of the lock mode held or desired by this process (see <xref
5746 linkend="locking-tables">)</entry>
5749 <entry><structfield>granted</structfield></entry>
5750 <entry><type>boolean</type></entry>
5752 <entry>True if lock is held, false if lock is awaited</entry>
5759 <structfield>granted</structfield> is true in a row representing a lock
5760 held by the indicated transaction. False indicates that this transaction is
5761 currently waiting to acquire this lock, which implies that some other
5762 transaction is holding a conflicting lock mode on the same lockable object.
5763 The waiting transaction will sleep until the other lock is released (or a
5764 deadlock situation is detected). A single transaction can be waiting to
5765 acquire at most one lock at a time.
5769 Every transaction holds an exclusive lock on its virtual transaction ID for
5770 its entire duration. If a permanent ID is assigned to the transaction
5771 (which normally happens only if the transaction changes the state of the
5772 database), it also holds an exclusive lock on its permanent transaction ID
5773 until it ends. When one transaction finds it necessary to wait specifically
5774 for another transaction, it does so by attempting to acquire share lock on
5775 the other transaction ID (either virtual or permanent ID depending on the
5776 situation). That will succeed only when the other transaction
5777 terminates and releases its locks.
5781 Although tuples are a lockable type of object,
5782 information about row-level locks is stored on disk, not in memory,
5783 and therefore row-level locks normally do not appear in this view.
5784 If a transaction is waiting for a
5785 row-level lock, it will usually appear in the view as waiting for the
5786 permanent transaction ID of the current holder of that row lock.
5790 Advisory locks can be acquired on keys consisting of either a single
5791 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
5792 high-order half in the <structfield>classid</> column, its low-order half
5793 in the <structfield>objid</> column, and <structfield>objsubid</> equal
5794 to 1. Integer keys are displayed with the first key in the
5795 <structfield>classid</> column, the second key in the <structfield>objid</>
5796 column, and <structfield>objsubid</> equal to 2. The actual meaning of
5797 the keys is up to the user. Advisory locks are local to each database,
5798 so the <structfield>database</> column is meaningful for an advisory lock.
5802 When the <structname>pg_locks</structname> view is accessed, the
5803 internal lock manager data structures are momentarily locked, and
5804 a copy is made for the view to display. This ensures that the
5805 view produces a consistent set of results, while not blocking
5806 normal lock manager operations longer than necessary. Nonetheless
5807 there could be some impact on database performance if this view is
5808 frequently accessed.
5812 <structname>pg_locks</structname> provides a global view of all locks
5813 in the database cluster, not only those relevant to the current database.
5814 Although its <structfield>relation</structfield> column can be joined
5815 against <structname>pg_class</>.<structfield>oid</> to identify locked
5816 relations, this will only work correctly for relations in the current
5817 database (those for which the <structfield>database</structfield> column
5818 is either the current database's OID or zero).
5822 The <structfield>pid</structfield> column can be joined to the
5823 <structfield>procpid</structfield> column of the
5824 <structname>pg_stat_activity</structname> view to get more
5825 information on the session holding or waiting to hold each lock.
5826 Also, if you are using prepared transactions, the
5827 <structfield>transaction</> column can be joined to the
5828 <structfield>transaction</structfield> column of the
5829 <structname>pg_prepared_xacts</structname> view to get more
5830 information on prepared transactions that hold locks.
5831 (A prepared transaction can never be waiting for a lock,
5832 but it continues to hold the locks it acquired while running.)
5837 <sect1 id="view-pg-prepared-statements">
5838 <title><structname>pg_prepared_statements</structname></title>
5840 <indexterm zone="view-pg-prepared-statements">
5841 <primary>pg_prepared_statements</primary>
5845 The <structname>pg_prepared_statements</structname> view displays
5846 all the prepared statements that are available in the current
5847 session. See <xref linkend="sql-prepare"
5848 endterm="sql-prepare-title"> for more information about prepared
5853 <structname>pg_prepared_statements</structname> contains one row
5854 for each prepared statement. Rows are added to the view when a new
5855 prepared statement is created and removed when a prepared statement
5856 is released (for example, via the <xref linkend="sql-deallocate"
5857 endterm="sql-deallocate-title"> command).
5861 <title><structname>pg_prepared_statements</> Columns</title>
5868 <entry>Description</entry>
5873 <entry><structfield>name</structfield></entry>
5874 <entry><type>text</type></entry>
5876 The identifier of the prepared statement
5880 <entry><structfield>statement</structfield></entry>
5881 <entry><type>text</type></entry>
5883 The query string submitted by the client to create this
5884 prepared statement. For prepared statements created via SQL,
5885 this is the <command>PREPARE</command> statement submitted by
5886 the client. For prepared statements created via the
5887 frontend/backend protocol, this is the text of the prepared
5892 <entry><structfield>prepare_time</structfield></entry>
5893 <entry><type>timestamptz</type></entry>
5895 The time at which the prepared statement was created
5899 <entry><structfield>parameter_types</structfield></entry>
5900 <entry><type>regtype[]</type></entry>
5902 The expected parameter types for the prepared statement in the
5903 form of an array of <type>regtype</type>. The OID corresponding
5904 to an element of this array can be obtained by casting the
5905 <type>regtype</type> value to <type>oid</type>
5909 <entry><structfield>from_sql</structfield></entry>
5910 <entry><type>boolean</type></entry>
5912 <literal>true</literal> if the prepared statement was created
5913 via the <command>PREPARE</command> SQL statement;
5914 <literal>false</literal> if the statement was prepared via the
5915 frontend/backend protocol
5923 The <structname>pg_prepared_statements</structname> view is read only.
5927 <sect1 id="view-pg-prepared-xacts">
5928 <title><structname>pg_prepared_xacts</structname></title>
5930 <indexterm zone="view-pg-prepared-xacts">
5931 <primary>pg_prepared_xacts</primary>
5935 The view <structname>pg_prepared_xacts</structname> displays
5936 information about transactions that are currently prepared for two-phase
5937 commit (see <xref linkend="sql-prepare-transaction"
5938 endterm="sql-prepare-transaction-title"> for details).
5942 <structname>pg_prepared_xacts</structname> contains one row per prepared
5943 transaction. An entry is removed when the transaction is committed or
5948 <title><structname>pg_prepared_xacts</> Columns</title>
5955 <entry>References</entry>
5956 <entry>Description</entry>
5961 <entry><structfield>transaction</structfield></entry>
5962 <entry><type>xid</type></entry>
5965 Numeric transaction identifier of the prepared transaction
5969 <entry><structfield>gid</structfield></entry>
5970 <entry><type>text</type></entry>
5973 Global transaction identifier that was assigned to the transaction
5977 <entry><structfield>prepared</structfield></entry>
5978 <entry><type>timestamp with time zone</type></entry>
5981 Time at which the transaction was prepared for commit
5985 <entry><structfield>owner</structfield></entry>
5986 <entry><type>name</type></entry>
5987 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5989 Name of the user that executed the transaction
5993 <entry><structfield>database</structfield></entry>
5994 <entry><type>name</type></entry>
5995 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5997 Name of the database in which the transaction was executed
6005 When the <structname>pg_prepared_xacts</structname> view is accessed, the
6006 internal transaction manager data structures are momentarily locked, and
6007 a copy is made for the view to display. This ensures that the
6008 view produces a consistent set of results, while not blocking
6009 normal operations longer than necessary. Nonetheless
6010 there could be some impact on database performance if this view is
6011 frequently accessed.
6016 <sect1 id="view-pg-roles">
6017 <title><structname>pg_roles</structname></title>
6019 <indexterm zone="view-pg-roles">
6020 <primary>pg_roles</primary>
6024 The view <structname>pg_roles</structname> provides access to
6025 information about database roles. This is simply a publicly
6027 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6028 that blanks out the password field.
6032 This view explicitly exposes the OID column of the underlying table,
6033 since that is needed to do joins to other catalogs.
6037 <title><structname>pg_roles</> Columns</title>
6044 <entry>References</entry>
6045 <entry>Description</entry>
6051 <entry><structfield>rolname</structfield></entry>
6052 <entry><type>name</type></entry>
6054 <entry>Role name</entry>
6058 <entry><structfield>rolsuper</structfield></entry>
6059 <entry><type>bool</type></entry>
6061 <entry>Role has superuser privileges</entry>
6065 <entry><structfield>rolinherit</structfield></entry>
6066 <entry><type>bool</type></entry>
6068 <entry>Role automatically inherits privileges of roles it is a
6073 <entry><structfield>rolcreaterole</structfield></entry>
6074 <entry><type>bool</type></entry>
6076 <entry>Role can create more roles</entry>
6080 <entry><structfield>rolcreatedb</structfield></entry>
6081 <entry><type>bool</type></entry>
6083 <entry>Role can create databases</entry>
6087 <entry><structfield>rolcatupdate</structfield></entry>
6088 <entry><type>bool</type></entry>
6091 Role can update system catalogs directly. (Even a superuser cannot do
6092 this unless this column is true.)
6097 <entry><structfield>rolcanlogin</structfield></entry>
6098 <entry><type>bool</type></entry>
6101 Role can log in. That is, this role can be given as the initial
6102 session authorization identifier
6107 <entry><structfield>rolconnlimit</structfield></entry>
6108 <entry><type>int4</type></entry>
6111 For roles that can log in, this sets maximum number of concurrent
6112 connections this role can make. -1 means no limit
6117 <entry><structfield>rolpassword</structfield></entry>
6118 <entry><type>text</type></entry>
6120 <entry>Not the password (always reads as <literal>********</>)</entry>
6124 <entry><structfield>rolvaliduntil</structfield></entry>
6125 <entry><type>timestamptz</type></entry>
6127 <entry>Password expiry time (only used for password authentication);
6128 NULL if no expiration</entry>
6132 <entry><structfield>rolconfig</structfield></entry>
6133 <entry><type>text[]</type></entry>
6135 <entry>Session defaults for run-time configuration variables</entry>
6139 <entry><structfield>oid</structfield></entry>
6140 <entry><type>oid</type></entry>
6141 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6142 <entry>ID of role</entry>
6150 <sect1 id="view-pg-rules">
6151 <title><structname>pg_rules</structname></title>
6153 <indexterm zone="view-pg-rules">
6154 <primary>pg_rules</primary>
6158 The view <structname>pg_rules</structname> provides access to
6159 useful information about query rewrite rules.
6163 <title><structname>pg_rules</> Columns</title>
6170 <entry>References</entry>
6171 <entry>Description</entry>
6176 <entry><structfield>schemaname</structfield></entry>
6177 <entry><type>name</type></entry>
6178 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6179 <entry>Name of schema containing table</entry>
6182 <entry><structfield>tablename</structfield></entry>
6183 <entry><type>name</type></entry>
6184 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6185 <entry>Name of table the rule is for</entry>
6188 <entry><structfield>rulename</structfield></entry>
6189 <entry><type>name</type></entry>
6190 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6191 <entry>Name of rule</entry>
6194 <entry><structfield>definition</structfield></entry>
6195 <entry><type>text</type></entry>
6197 <entry>Rule definition (a reconstructed creation command)</entry>
6204 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6205 of views; those can be seen in <structname>pg_views</>.
6210 <sect1 id="view-pg-settings">
6211 <title><structname>pg_settings</structname></title>
6213 <indexterm zone="view-pg-settings">
6214 <primary>pg_settings</primary>
6218 The view <structname>pg_settings</structname> provides access to
6219 run-time parameters of the server. It is essentially an alternative
6220 interface to the <command>SHOW</> and <command>SET</> commands.
6221 It also provides access to some facts about each parameter that are
6222 not directly available from <command>SHOW</>, such as minimum and
6227 <title><structname>pg_settings</> Columns</title>
6234 <entry>Description</entry>
6239 <entry><structfield>name</structfield></entry>
6240 <entry><type>text</type></entry>
6241 <entry>Run-time configuration parameter name</entry>
6244 <entry><structfield>setting</structfield></entry>
6245 <entry><type>text</type></entry>
6246 <entry>Current value of the parameter</entry>
6249 <entry><structfield>unit</structfield></entry>
6250 <entry><type>text</type></entry>
6251 <entry>Implicit unit of the parameter</entry>
6254 <entry><structfield>category</structfield></entry>
6255 <entry><type>text</type></entry>
6256 <entry>Logical group of the parameter</entry>
6259 <entry><structfield>short_desc</structfield></entry>
6260 <entry><type>text</type></entry>
6261 <entry>A brief description of the parameter</entry>
6264 <entry><structfield>extra_desc</structfield></entry>
6265 <entry><type>text</type></entry>
6266 <entry>Additional, more detailed, information about the parameter</entry>
6269 <entry><structfield>context</structfield></entry>
6270 <entry><type>text</type></entry>
6271 <entry>Context required to set the parameter's value</entry>
6274 <entry><structfield>vartype</structfield></entry>
6275 <entry><type>text</type></entry>
6276 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6277 <literal>integer</>, <literal>real</>, or <literal>string</>)
6281 <entry><structfield>source</structfield></entry>
6282 <entry><type>text</type></entry>
6283 <entry>Source of the current parameter value</entry>
6286 <entry><structfield>min_val</structfield></entry>
6287 <entry><type>text</type></entry>
6288 <entry>Minimum allowed value of the parameter (NULL for non-numeric
6292 <entry><structfield>max_val</structfield></entry>
6293 <entry><type>text</type></entry>
6294 <entry>Maximum allowed value of the parameter (NULL for non-numeric
6298 <entry><structfield>enumvals</structfield></entry>
6299 <entry><type>text</type></entry>
6300 <entry>Allowed values in enum parameters (NULL for non-enum
6308 The <structname>pg_settings</structname> view cannot be inserted into or
6309 deleted from, but it can be updated. An <command>UPDATE</command> applied
6310 to a row of <structname>pg_settings</structname> is equivalent to executing
6311 the <xref linkend="sql-set" endterm="sql-set-title"> command on that named
6312 parameter. The change only affects the value used by the current
6313 session. If an <command>UPDATE</command> is issued within a transaction
6314 that is later aborted, the effects of the <command>UPDATE</command> command
6315 disappear when the transaction is rolled back. Once the surrounding
6316 transaction is committed, the effects will persist until the end of the
6317 session, unless overridden by another <command>UPDATE</command> or
6318 <command>SET</command>.
6323 <sect1 id="view-pg-shadow">
6324 <title><structname>pg_shadow</structname></title>
6326 <indexterm zone="view-pg-shadow">
6327 <primary>pg_shadow</primary>
6331 The view <structname>pg_shadow</structname> exists for backwards
6332 compatibility: it emulates a catalog that existed in
6333 <productname>PostgreSQL</productname> before version 8.1.
6334 It shows properties of all roles that are marked as
6335 <structfield>rolcanlogin</>.
6339 The name stems from the fact that this table
6340 should not be readable by the public since it contains passwords.
6341 <link linkend="view-pg-user"><structname>pg_user</structname></link>
6342 is a publicly readable view on
6343 <structname>pg_shadow</structname> that blanks out the password field.
6347 <title><structname>pg_shadow</> Columns</title>
6354 <entry>References</entry>
6355 <entry>Description</entry>
6361 <entry><structfield>usename</structfield></entry>
6362 <entry><type>name</type></entry>
6363 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6364 <entry>User name</entry>
6368 <entry><structfield>usesysid</structfield></entry>
6369 <entry><type>oid</type></entry>
6370 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6371 <entry>ID of this user</entry>
6375 <entry><structfield>usecreatedb</structfield></entry>
6376 <entry><type>bool</type></entry>
6378 <entry>User can create databases</entry>
6382 <entry><structfield>usesuper</structfield></entry>
6383 <entry><type>bool</type></entry>
6385 <entry>User is a superuser</entry>
6389 <entry><structfield>usecatupd</structfield></entry>
6390 <entry><type>bool</type></entry>
6393 User can update system catalogs. (Even a superuser cannot do
6394 this unless this column is true.)
6399 <entry><structfield>passwd</structfield></entry>
6400 <entry><type>text</type></entry>
6402 <entry>Password (possibly encrypted)</entry>
6406 <entry><structfield>valuntil</structfield></entry>
6407 <entry><type>abstime</type></entry>
6409 <entry>Password expiry time (only used for password authentication)</entry>
6413 <entry><structfield>useconfig</structfield></entry>
6414 <entry><type>text[]</type></entry>
6416 <entry>Session defaults for run-time configuration variables</entry>
6424 <sect1 id="view-pg-stats">
6425 <title><structname>pg_stats</structname></title>
6427 <indexterm zone="view-pg-stats">
6428 <primary>pg_stats</primary>
6432 The view <structname>pg_stats</structname> provides access to
6433 the information stored in the <link
6434 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
6435 catalog. This view allows access only to rows of
6436 <structname>pg_statistic</structname> that correspond to tables the
6437 user has permission to read, and therefore it is safe to allow public
6438 read access to this view.
6442 <structname>pg_stats</structname> is also designed to present the
6443 information in a more readable format than the underlying catalog
6444 — at the cost that its schema must be extended whenever new slot types
6445 are defined for <structname>pg_statistic</structname>.
6449 <title><structname>pg_stats</> Columns</title>
6456 <entry>References</entry>
6457 <entry>Description</entry>
6462 <entry><structfield>schemaname</structfield></entry>
6463 <entry><type>name</type></entry>
6464 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6465 <entry>Name of schema containing table</entry>
6469 <entry><structfield>tablename</structfield></entry>
6470 <entry><type>name</type></entry>
6471 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6472 <entry>Name of table</entry>
6476 <entry><structfield>attname</structfield></entry>
6477 <entry><type>name</type></entry>
6478 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
6479 <entry>Name of the column described by this row</entry>
6483 <entry><structfield>null_frac</structfield></entry>
6484 <entry><type>real</type></entry>
6486 <entry>Fraction of column entries that are null</entry>
6490 <entry><structfield>avg_width</structfield></entry>
6491 <entry><type>integer</type></entry>
6493 <entry>Average width in bytes of column's entries</entry>
6497 <entry><structfield>n_distinct</structfield></entry>
6498 <entry><type>real</type></entry>
6501 If greater than zero, the estimated number of distinct values in the
6502 column. If less than zero, the negative of the number of distinct
6503 values divided by the number of rows. (The negated form is used when
6504 <command>ANALYZE</> believes that the number of distinct values is
6505 likely to increase as the table grows; the positive form is used when
6506 the column seems to have a fixed number of possible values.) For
6507 example, -1 indicates a unique column in which the number of distinct
6508 values is the same as the number of rows
6513 <entry><structfield>most_common_vals</structfield></entry>
6514 <entry><type>anyarray</type></entry>
6517 A list of the most common values in the column. (NULL if
6518 no values seem to be more common than any others.)
6523 <entry><structfield>most_common_freqs</structfield></entry>
6524 <entry><type>real[]</type></entry>
6527 A list of the frequencies of the most common values,
6528 i.e., number of occurrences of each divided by total number of rows.
6529 (NULL when <structfield>most_common_vals</structfield> is.)
6534 <entry><structfield>histogram_bounds</structfield></entry>
6535 <entry><type>anyarray</type></entry>
6538 A list of values that divide the column's values into groups of
6539 approximately equal population. The values in
6540 <structfield>most_common_vals</>, if present, are omitted from this
6541 histogram calculation. (This column is NULL if the column data type
6542 does not have a <literal><</> operator or if the
6543 <structfield>most_common_vals</> list accounts for the entire
6549 <entry><structfield>correlation</structfield></entry>
6550 <entry><type>real</type></entry>
6553 Statistical correlation between physical row ordering and
6554 logical ordering of the column values. This ranges from -1 to +1.
6555 When the value is near -1 or +1, an index scan on the column will
6556 be estimated to be cheaper than when it is near zero, due to reduction
6557 of random access to the disk. (This column is NULL if the column data
6558 type does not have a <literal><</> operator.)
6566 The maximum number of entries in the <structfield>most_common_vals</>
6567 and <structfield>histogram_bounds</> arrays can be set on a
6568 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
6569 command, or globally by setting the
6570 <xref linkend="guc-default-statistics-target"> run-time parameter.
6575 <sect1 id="view-pg-tables">
6576 <title><structname>pg_tables</structname></title>
6578 <indexterm zone="view-pg-tables">
6579 <primary>pg_tables</primary>
6583 The view <structname>pg_tables</structname> provides access to
6584 useful information about each table in the database.
6588 <title><structname>pg_tables</> Columns</title>
6595 <entry>References</entry>
6596 <entry>Description</entry>
6601 <entry><structfield>schemaname</structfield></entry>
6602 <entry><type>name</type></entry>
6603 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6604 <entry>Name of schema containing table</entry>
6607 <entry><structfield>tablename</structfield></entry>
6608 <entry><type>name</type></entry>
6609 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6610 <entry>Name of table</entry>
6613 <entry><structfield>tableowner</structfield></entry>
6614 <entry><type>name</type></entry>
6615 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6616 <entry>Name of table's owner</entry>
6619 <entry><structfield>tablespace</structfield></entry>
6620 <entry><type>name</type></entry>
6621 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6622 <entry>Name of tablespace containing table (NULL if default for database)</entry>
6625 <entry><structfield>hasindexes</structfield></entry>
6626 <entry><type>boolean</type></entry>
6627 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
6628 <entry>true if table has (or recently had) any indexes</entry>
6631 <entry><structfield>hasrules</structfield></entry>
6632 <entry><type>boolean</type></entry>
6633 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
6634 <entry>true if table has rules</entry>
6637 <entry><structfield>hastriggers</structfield></entry>
6638 <entry><type>boolean</type></entry>
6639 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.reltriggers</literal></entry>
6640 <entry>true if table has triggers</entry>
6648 <sect1 id="view-pg-timezone-abbrevs">
6649 <title><structname>pg_timezone_abbrevs</structname></title>
6651 <indexterm zone="view-pg-timezone-abbrevs">
6652 <primary>pg_timezone_abbrevs</primary>
6656 The view <structname>pg_timezone_abbrevs</structname> provides a list
6657 of time zone abbreviations that are currently recognized by the datetime
6658 input routines. The contents of this view change when the
6659 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
6663 <title><structname>pg_timezone_abbrevs</> Columns</title>
6670 <entry>Description</entry>
6675 <entry><structfield>abbrev</structfield></entry>
6676 <entry><type>text</type></entry>
6677 <entry>Time zone abbreviation</entry>
6680 <entry><structfield>utc_offset</structfield></entry>
6681 <entry><type>interval</type></entry>
6682 <entry>Offset from UTC (positive means east of Greenwich)</entry>
6685 <entry><structfield>is_dst</structfield></entry>
6686 <entry><type>boolean</type></entry>
6687 <entry>True if this is a daylight-savings abbreviation</entry>
6695 <sect1 id="view-pg-timezone-names">
6696 <title><structname>pg_timezone_names</structname></title>
6698 <indexterm zone="view-pg-timezone-names">
6699 <primary>pg_timezone_names</primary>
6703 The view <structname>pg_timezone_names</structname> provides a list
6704 of time zone names that are recognized by <command>SET TIMEZONE</>,
6705 along with their associated abbreviations, UTC offsets,
6706 and daylight-savings status.
6707 Unlike the abbreviations shown in <link
6708 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
6709 date rules. Therefore, the associated information changes across local DST
6710 boundaries. The displayed information is computed based on the current
6711 value of <function>CURRENT_TIMESTAMP</>.
6715 <title><structname>pg_timezone_names</> Columns</title>
6722 <entry>Description</entry>
6727 <entry><structfield>name</structfield></entry>
6728 <entry><type>text</type></entry>
6729 <entry>Time zone name</entry>
6732 <entry><structfield>abbrev</structfield></entry>
6733 <entry><type>text</type></entry>
6734 <entry>Time zone abbreviation</entry>
6737 <entry><structfield>utc_offset</structfield></entry>
6738 <entry><type>interval</type></entry>
6739 <entry>Offset from UTC (positive means east of Greenwich)</entry>
6742 <entry><structfield>is_dst</structfield></entry>
6743 <entry><type>boolean</type></entry>
6744 <entry>True if currently observing daylight savings</entry>
6752 <sect1 id="view-pg-user">
6753 <title><structname>pg_user</structname></title>
6755 <indexterm zone="view-pg-user">
6756 <primary>pg_user</primary>
6760 The view <structname>pg_user</structname> provides access to
6761 information about database users. This is simply a publicly
6763 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
6764 that blanks out the password field.
6768 <title><structname>pg_user</> Columns</title>
6775 <entry>Description</entry>
6780 <entry><structfield>usename</structfield></entry>
6781 <entry><type>name</type></entry>
6782 <entry>User name</entry>
6786 <entry><structfield>usesysid</structfield></entry>
6787 <entry><type>int4</type></entry>
6788 <entry>User ID (arbitrary number used to reference this user)</entry>
6792 <entry><structfield>usecreatedb</structfield></entry>
6793 <entry><type>bool</type></entry>
6794 <entry>User can create databases</entry>
6798 <entry><structfield>usesuper</structfield></entry>
6799 <entry><type>bool</type></entry>
6800 <entry>User is a superuser</entry>
6804 <entry><structfield>usecatupd</structfield></entry>
6805 <entry><type>bool</type></entry>
6807 User can update system catalogs. (Even a superuser cannot do
6808 this unless this column is true.)
6813 <entry><structfield>passwd</structfield></entry>
6814 <entry><type>text</type></entry>
6815 <entry>Not the password (always reads as <literal>********</>)</entry>
6819 <entry><structfield>valuntil</structfield></entry>
6820 <entry><type>abstime</type></entry>
6821 <entry>Password expiry time (only used for password authentication)</entry>
6825 <entry><structfield>useconfig</structfield></entry>
6826 <entry><type>text[]</type></entry>
6827 <entry>Session defaults for run-time configuration variables</entry>
6835 <sect1 id="view-pg-views">
6836 <title><structname>pg_views</structname></title>
6838 <indexterm zone="view-pg-views">
6839 <primary>pg_views</primary>
6843 The view <structname>pg_views</structname> provides access to
6844 useful information about each view in the database.
6848 <title><structname>pg_views</> Columns</title>
6855 <entry>References</entry>
6856 <entry>Description</entry>
6861 <entry><structfield>schemaname</structfield></entry>
6862 <entry><type>name</type></entry>
6863 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6864 <entry>Name of schema containing view</entry>
6867 <entry><structfield>viewname</structfield></entry>
6868 <entry><type>name</type></entry>
6869 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6870 <entry>Name of view</entry>
6873 <entry><structfield>viewowner</structfield></entry>
6874 <entry><type>name</type></entry>
6875 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6876 <entry>Name of view's owner</entry>
6879 <entry><structfield>definition</structfield></entry>
6880 <entry><type>text</type></entry>
6882 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>