1 <!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.225.2.5 2010/09/17 18:50:22 rhaas 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-cast"><structname>pg_cast</structname></link></entry>
93 <entry>casts (data type conversions)</entry>
97 <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
98 <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
102 <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
103 <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
107 <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
108 <entry>encoding conversion information</entry>
112 <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
113 <entry>databases within this database cluster</entry>
117 <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
118 <entry>per-role and per-database settings</entry>
122 <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
123 <entry>default privileges for object types</entry>
127 <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
128 <entry>dependencies between database objects</entry>
132 <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
133 <entry>descriptions or comments on database objects</entry>
137 <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
138 <entry>enum label and value definitions</entry>
142 <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
143 <entry>foreign-data wrapper definitions</entry>
147 <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
148 <entry>foreign server definitions</entry>
152 <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
153 <entry>additional index information</entry>
157 <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
158 <entry>table inheritance hierarchy</entry>
162 <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
163 <entry>languages for writing functions</entry>
167 <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
168 <entry>data pages for large objects</entry>
172 <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
173 <entry>metadata for large objects</entry>
177 <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
178 <entry>schemas</entry>
182 <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
183 <entry>access method operator classes</entry>
187 <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
188 <entry>operators</entry>
192 <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
193 <entry>access method operator families</entry>
197 <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
198 <entry>template data for procedural languages</entry>
202 <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
203 <entry>functions and procedures</entry>
207 <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
208 <entry>query rewrite rules</entry>
212 <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
213 <entry>dependencies on shared objects</entry>
217 <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
218 <entry>comments on shared objects</entry>
222 <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
223 <entry>planner statistics</entry>
227 <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
228 <entry>tablespaces within this database cluster</entry>
232 <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
233 <entry>triggers</entry>
237 <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
238 <entry>text search configurations</entry>
242 <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
243 <entry>text search configurations' token mappings</entry>
247 <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
248 <entry>text search dictionaries</entry>
252 <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
253 <entry>text search parsers</entry>
257 <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
258 <entry>text search templates</entry>
262 <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
263 <entry>data types</entry>
267 <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
268 <entry>mappings of users to foreign servers</entry>
276 <sect1 id="catalog-pg-aggregate">
277 <title><structname>pg_aggregate</structname></title>
279 <indexterm zone="catalog-pg-aggregate">
280 <primary>pg_aggregate</primary>
284 The catalog <structname>pg_aggregate</structname> stores information about
285 aggregate functions. An aggregate function is a function that
286 operates on a set of values (typically one column from each row
287 that matches a query condition) and returns a single value computed
288 from all these values. Typical aggregate functions are
289 <function>sum</function>, <function>count</function>, and
290 <function>max</function>. Each entry in
291 <structname>pg_aggregate</structname> is an extension of an entry
292 in <structname>pg_proc</structname>. The <structname>pg_proc</structname>
293 entry carries the aggregate's name, input and output data types, and
294 other information that is similar to ordinary functions.
298 <title><structname>pg_aggregate</> Columns</title>
305 <entry>References</entry>
306 <entry>Description</entry>
311 <entry><structfield>aggfnoid</structfield></entry>
312 <entry><type>regproc</type></entry>
313 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
314 <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
317 <entry><structfield>aggtransfn</structfield></entry>
318 <entry><type>regproc</type></entry>
319 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
320 <entry>Transition function</entry>
323 <entry><structfield>aggfinalfn</structfield></entry>
324 <entry><type>regproc</type></entry>
325 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
326 <entry>Final function (zero if none)</entry>
329 <entry><structfield>aggsortop</structfield></entry>
330 <entry><type>oid</type></entry>
331 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
332 <entry>Associated sort operator (zero if none)</entry>
335 <entry><structfield>aggtranstype</structfield></entry>
336 <entry><type>oid</type></entry>
337 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
338 <entry>Data type of the aggregate function's internal transition (state) data</entry>
341 <entry><structfield>agginitval</structfield></entry>
342 <entry><type>text</type></entry>
345 The initial value of the transition state. This is a text
346 field containing the initial value in its external string
347 representation. If this field is null, the transition state
348 value starts out null.
356 New aggregate functions are registered with the <xref
357 linkend="sql-createaggregate">
358 command. See <xref linkend="xaggr"> for more information about
359 writing aggregate functions and the meaning of the transition
366 <sect1 id="catalog-pg-am">
367 <title><structname>pg_am</structname></title>
369 <indexterm zone="catalog-pg-am">
370 <primary>pg_am</primary>
374 The catalog <structname>pg_am</structname> stores information about index
375 access methods. There is one row for each index access method supported by
376 the system. The contents of this catalog are discussed in detail in
377 <xref linkend="indexam">.
381 <title><structname>pg_am</> Columns</title>
388 <entry>References</entry>
389 <entry>Description</entry>
395 <entry><structfield>amname</structfield></entry>
396 <entry><type>name</type></entry>
398 <entry>Name of the access method</entry>
402 <entry><structfield>amstrategies</structfield></entry>
403 <entry><type>int2</type></entry>
405 <entry>Number of operator strategies for this access method,
406 or zero if access method does not have a fixed set of operator
411 <entry><structfield>amsupport</structfield></entry>
412 <entry><type>int2</type></entry>
414 <entry>Number of support routines for this access method</entry>
418 <entry><structfield>amcanorder</structfield></entry>
419 <entry><type>bool</type></entry>
421 <entry>Does the access method support ordered scans?</entry>
425 <entry><structfield>amcanbackward</structfield></entry>
426 <entry><type>bool</type></entry>
428 <entry>Does the access method support backward scanning?</entry>
432 <entry><structfield>amcanunique</structfield></entry>
433 <entry><type>bool</type></entry>
435 <entry>Does the access method support unique indexes?</entry>
439 <entry><structfield>amcanmulticol</structfield></entry>
440 <entry><type>bool</type></entry>
442 <entry>Does the access method support multicolumn indexes?</entry>
446 <entry><structfield>amoptionalkey</structfield></entry>
447 <entry><type>bool</type></entry>
449 <entry>Does the access method support a scan without any constraint
450 for the first index column?</entry>
454 <entry><structfield>amindexnulls</structfield></entry>
455 <entry><type>bool</type></entry>
457 <entry>Does the access method support null index entries?</entry>
461 <entry><structfield>amsearchnulls</structfield></entry>
462 <entry><type>bool</type></entry>
464 <entry>Does the access method support <literal>IS NULL</>/<literal>NOT NULL</> searches?</entry>
468 <entry><structfield>amstorage</structfield></entry>
469 <entry><type>bool</type></entry>
471 <entry>Can index storage data type differ from column data type?</entry>
475 <entry><structfield>amclusterable</structfield></entry>
476 <entry><type>bool</type></entry>
478 <entry>Can an index of this type be clustered on?</entry>
482 <entry><structfield>amkeytype</structfield></entry>
483 <entry><type>oid</type></entry>
484 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
485 <entry>Type of data stored in index, or zero if not a fixed type</entry>
489 <entry><structfield>aminsert</structfield></entry>
490 <entry><type>regproc</type></entry>
491 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
492 <entry><quote>Insert this tuple</quote> function</entry>
496 <entry><structfield>ambeginscan</structfield></entry>
497 <entry><type>regproc</type></entry>
498 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
499 <entry><quote>Start new scan</quote> function</entry>
503 <entry><structfield>amgettuple</structfield></entry>
504 <entry><type>regproc</type></entry>
505 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
506 <entry><quote>Next valid tuple</quote> function, or zero if none</entry>
510 <entry><structfield>amgetbitmap</structfield></entry>
511 <entry><type>regproc</type></entry>
512 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
513 <entry><quote>Fetch all valid tuples</quote> function, or zero if none</entry>
517 <entry><structfield>amrescan</structfield></entry>
518 <entry><type>regproc</type></entry>
519 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
520 <entry><quote>Restart this scan</quote> function</entry>
524 <entry><structfield>amendscan</structfield></entry>
525 <entry><type>regproc</type></entry>
526 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
527 <entry><quote>End this scan</quote> function</entry>
531 <entry><structfield>ammarkpos</structfield></entry>
532 <entry><type>regproc</type></entry>
533 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
534 <entry><quote>Mark current scan position</quote> function</entry>
538 <entry><structfield>amrestrpos</structfield></entry>
539 <entry><type>regproc</type></entry>
540 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
541 <entry><quote>Restore marked scan position</quote> function</entry>
545 <entry><structfield>ambuild</structfield></entry>
546 <entry><type>regproc</type></entry>
547 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
548 <entry><quote>Build new index</quote> function</entry>
552 <entry><structfield>ambulkdelete</structfield></entry>
553 <entry><type>regproc</type></entry>
554 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
555 <entry>Bulk-delete function</entry>
559 <entry><structfield>amvacuumcleanup</structfield></entry>
560 <entry><type>regproc</type></entry>
561 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
562 <entry>Post-<command>VACUUM</command> cleanup function</entry>
566 <entry><structfield>amcostestimate</structfield></entry>
567 <entry><type>regproc</type></entry>
568 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
569 <entry>Function to estimate cost of an index scan</entry>
573 <entry><structfield>amoptions</structfield></entry>
574 <entry><type>regproc</type></entry>
575 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
576 <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
586 <sect1 id="catalog-pg-amop">
587 <title><structname>pg_amop</structname></title>
589 <indexterm zone="catalog-pg-amop">
590 <primary>pg_amop</primary>
594 The catalog <structname>pg_amop</structname> stores information about
595 operators associated with access method operator families. There is one
596 row for each operator that is a member of an operator family. An operator
597 can appear in more than one family, but cannot appear in more than one
598 position within a family.
602 <title><structname>pg_amop</> Columns</title>
609 <entry>References</entry>
610 <entry>Description</entry>
616 <entry><structfield>amopfamily</structfield></entry>
617 <entry><type>oid</type></entry>
618 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
619 <entry>The operator family this entry is for</entry>
623 <entry><structfield>amoplefttype</structfield></entry>
624 <entry><type>oid</type></entry>
625 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
626 <entry>Left-hand input data type of operator</entry>
630 <entry><structfield>amoprighttype</structfield></entry>
631 <entry><type>oid</type></entry>
632 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
633 <entry>Right-hand input data type of operator</entry>
637 <entry><structfield>amopstrategy</structfield></entry>
638 <entry><type>int2</type></entry>
640 <entry>Operator strategy number</entry>
644 <entry><structfield>amopopr</structfield></entry>
645 <entry><type>oid</type></entry>
646 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
647 <entry>OID of the operator</entry>
651 <entry><structfield>amopmethod</structfield></entry>
652 <entry><type>oid</type></entry>
653 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
654 <entry>Index access method operator family is for</entry>
662 An entry's <structfield>amopmethod</> must match the
663 <structname>opfmethod</> of its containing operator family (including
664 <structfield>amopmethod</> here is an intentional denormalization of the
665 catalog structure for performance reasons). Also,
666 <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
667 the <structfield>oprleft</> and <structfield>oprright</> fields of the
668 referenced <structname>pg_operator</> entry.
674 <sect1 id="catalog-pg-amproc">
675 <title><structname>pg_amproc</structname></title>
677 <indexterm zone="catalog-pg-amproc">
678 <primary>pg_amproc</primary>
682 The catalog <structname>pg_amproc</structname> stores information about
683 support procedures associated with access method operator families. There
684 is one row for each support procedure belonging to an operator family.
688 <title><structname>pg_amproc</structname> Columns</title>
695 <entry>References</entry>
696 <entry>Description</entry>
702 <entry><structfield>amprocfamily</structfield></entry>
703 <entry><type>oid</type></entry>
704 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
705 <entry>The operator family this entry is for</entry>
709 <entry><structfield>amproclefttype</structfield></entry>
710 <entry><type>oid</type></entry>
711 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
712 <entry>Left-hand input data type of associated operator</entry>
716 <entry><structfield>amprocrighttype</structfield></entry>
717 <entry><type>oid</type></entry>
718 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
719 <entry>Right-hand input data type of associated operator</entry>
723 <entry><structfield>amprocnum</structfield></entry>
724 <entry><type>int2</type></entry>
726 <entry>Support procedure number</entry>
730 <entry><structfield>amproc</structfield></entry>
731 <entry><type>regproc</type></entry>
732 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
733 <entry>OID of the procedure</entry>
741 The usual interpretation of the
742 <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
743 is that they identify the left and right input types of the operator(s)
744 that a particular support procedure supports. For some access methods
745 these match the input data type(s) of the support procedure itself, for
746 others not. There is a notion of <quote>default</> support procedures for
747 an index, which are those with <structfield>amproclefttype</> and
748 <structfield>amprocrighttype</> both equal to the index opclass's
749 <structfield>opcintype</>.
755 <sect1 id="catalog-pg-attrdef">
756 <title><structname>pg_attrdef</structname></title>
758 <indexterm zone="catalog-pg-attrdef">
759 <primary>pg_attrdef</primary>
763 The catalog <structname>pg_attrdef</structname> stores column default values. The main information
764 about columns is stored in <structname>pg_attribute</structname>
765 (see below). Only columns that explicitly specify a default value
766 (when the table is created or the column is added) will have an
771 <title><structname>pg_attrdef</> Columns</title>
778 <entry>References</entry>
779 <entry>Description</entry>
785 <entry><structfield>adrelid</structfield></entry>
786 <entry><type>oid</type></entry>
787 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
788 <entry>The table this column belongs to</entry>
792 <entry><structfield>adnum</structfield></entry>
793 <entry><type>int2</type></entry>
794 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
795 <entry>The number of the column</entry>
799 <entry><structfield>adbin</structfield></entry>
800 <entry><type>text</type></entry>
802 <entry>The internal representation of the column default value</entry>
806 <entry><structfield>adsrc</structfield></entry>
807 <entry><type>text</type></entry>
809 <entry>A human-readable representation of the default value</entry>
816 The <structfield>adsrc</structfield> field is historical, and is best
817 not used, because it does not track outside changes that might affect
818 the representation of the default value. Reverse-compiling the
819 <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
820 example) is a better way to display the default value.
826 <sect1 id="catalog-pg-attribute">
827 <title><structname>pg_attribute</structname></title>
829 <indexterm zone="catalog-pg-attribute">
830 <primary>pg_attribute</primary>
834 The catalog <structname>pg_attribute</structname> stores information about
835 table columns. There will be exactly one
836 <structname>pg_attribute</structname> row for every column in every
837 table in the database. (There will also be attribute entries for
838 indexes, and indeed all objects that have <structname>pg_class</structname>
843 The term attribute is equivalent to column and is used for
848 <title><structname>pg_attribute</> Columns</title>
855 <entry>References</entry>
856 <entry>Description</entry>
862 <entry><structfield>attrelid</structfield></entry>
863 <entry><type>oid</type></entry>
864 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
865 <entry>The table this column belongs to</entry>
869 <entry><structfield>attname</structfield></entry>
870 <entry><type>name</type></entry>
872 <entry>The column name</entry>
876 <entry><structfield>atttypid</structfield></entry>
877 <entry><type>oid</type></entry>
878 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
879 <entry>The data type of this column</entry>
883 <entry><structfield>attstattarget</structfield></entry>
884 <entry><type>int4</type></entry>
887 <structfield>attstattarget</structfield> controls the level of detail
888 of statistics accumulated for this column by
889 <xref linkend="sql-analyze">.
890 A zero value indicates that no statistics should be collected.
891 A negative value says to use the system default statistics target.
892 The exact meaning of positive values is data type-dependent.
893 For scalar data types, <structfield>attstattarget</structfield>
894 is both the target number of <quote>most common values</quote>
895 to collect, and the target number of histogram bins to create.
900 <entry><structfield>attlen</structfield></entry>
901 <entry><type>int2</type></entry>
904 A copy of <literal>pg_type.typlen</literal> of this column's
910 <entry><structfield>attnum</structfield></entry>
911 <entry><type>int2</type></entry>
914 The number of the column. Ordinary columns are numbered from 1
915 up. System columns, such as <structfield>oid</structfield>,
916 have (arbitrary) negative numbers.
921 <entry><structfield>attndims</structfield></entry>
922 <entry><type>int4</type></entry>
925 Number of dimensions, if the column is an array type; otherwise 0.
926 (Presently, the number of dimensions of an array is not enforced,
927 so any nonzero value effectively means <quote>it's an array</>.)
932 <entry><structfield>attcacheoff</structfield></entry>
933 <entry><type>int4</type></entry>
936 Always -1 in storage, but when loaded into a row descriptor
937 in memory this might be updated to cache the offset of the attribute
943 <entry><structfield>atttypmod</structfield></entry>
944 <entry><type>int4</type></entry>
947 <structfield>atttypmod</structfield> records type-specific data
948 supplied at table creation time (for example, the maximum
949 length of a <type>varchar</type> column). It is passed to
950 type-specific input functions and length coercion functions.
951 The value will generally be -1 for types that do not need <structfield>atttypmod</>.
956 <entry><structfield>attbyval</structfield></entry>
957 <entry><type>bool</type></entry>
960 A copy of <literal>pg_type.typbyval</> of this column's type
965 <entry><structfield>attstorage</structfield></entry>
966 <entry><type>char</type></entry>
969 Normally a copy of <literal>pg_type.typstorage</> of this
970 column's type. For TOAST-able data types, this can be altered
971 after column creation to control storage policy.
976 <entry><structfield>attalign</structfield></entry>
977 <entry><type>char</type></entry>
980 A copy of <literal>pg_type.typalign</> of this column's type
985 <entry><structfield>attnotnull</structfield></entry>
986 <entry><type>bool</type></entry>
989 This represents a not-null constraint. It is possible to
990 change this column to enable or disable the constraint.
995 <entry><structfield>atthasdef</structfield></entry>
996 <entry><type>bool</type></entry>
999 This column has a default value, in which case there will be a
1000 corresponding entry in the <structname>pg_attrdef</structname>
1001 catalog that actually defines the value.
1006 <entry><structfield>attisdropped</structfield></entry>
1007 <entry><type>bool</type></entry>
1010 This column has been dropped and is no longer valid. A dropped
1011 column is still physically present in the table, but is
1012 ignored by the parser and so cannot be accessed via SQL.
1017 <entry><structfield>attislocal</structfield></entry>
1018 <entry><type>bool</type></entry>
1021 This column is defined locally in the relation. Note that a column can
1022 be locally defined and inherited simultaneously.
1027 <entry><structfield>attinhcount</structfield></entry>
1028 <entry><type>int4</type></entry>
1031 The number of direct ancestors this column has. A column with a
1032 nonzero number of ancestors cannot be dropped nor renamed.
1037 <entry><structfield>attacl</structfield></entry>
1038 <entry><type>aclitem[]</type></entry>
1041 Column-level access privileges, if any have been granted specifically
1047 <entry><structfield>attoptions</structfield></entry>
1048 <entry><type>text[]</type></entry>
1051 Attribute-level options, as <quote>keyword=value</> strings
1060 In a dropped column's <structname>pg_attribute</structname> entry,
1061 <structfield>atttypid</structfield> is reset to zero, but
1062 <structfield>attlen</structfield> and the other fields copied from
1063 <structname>pg_type</> are still valid. This arrangement is needed
1064 to cope with the situation where the dropped column's data type was
1065 later dropped, and so there is no <structname>pg_type</> row anymore.
1066 <structfield>attlen</structfield> and the other fields can be used
1067 to interpret the contents of a row of the table.
1072 <sect1 id="catalog-pg-authid">
1073 <title><structname>pg_authid</structname></title>
1075 <indexterm zone="catalog-pg-authid">
1076 <primary>pg_authid</primary>
1080 The catalog <structname>pg_authid</structname> contains information about
1081 database authorization identifiers (roles). A role subsumes the concepts
1082 of <quote>users</> and <quote>groups</>. A user is essentially just a
1083 role with the <structfield>rolcanlogin</> flag set. Any role (with or
1084 without <structfield>rolcanlogin</>) can have other roles as members; see
1085 <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1089 Since this catalog contains passwords, it must not be publicly readable.
1090 <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1091 is a publicly readable view on
1092 <structname>pg_authid</structname> that blanks out the password field.
1096 <xref linkend="user-manag"> contains detailed information about user and
1097 privilege management.
1101 Because user identities are cluster-wide,
1102 <structname>pg_authid</structname>
1103 is shared across all databases of a cluster: there is only one
1104 copy of <structname>pg_authid</structname> per cluster, not
1109 <title><structname>pg_authid</> Columns</title>
1116 <entry>Description</entry>
1122 <entry><structfield>rolname</structfield></entry>
1123 <entry><type>name</type></entry>
1124 <entry>Role name</entry>
1128 <entry><structfield>rolsuper</structfield></entry>
1129 <entry><type>bool</type></entry>
1130 <entry>Role has superuser privileges</entry>
1134 <entry><structfield>rolinherit</structfield></entry>
1135 <entry><type>bool</type></entry>
1136 <entry>Role automatically inherits privileges of roles it is a
1141 <entry><structfield>rolcreaterole</structfield></entry>
1142 <entry><type>bool</type></entry>
1143 <entry>Role can create more roles</entry>
1147 <entry><structfield>rolcreatedb</structfield></entry>
1148 <entry><type>bool</type></entry>
1149 <entry>Role can create databases</entry>
1153 <entry><structfield>rolcatupdate</structfield></entry>
1154 <entry><type>bool</type></entry>
1156 Role can update system catalogs directly. (Even a superuser cannot do
1157 this unless this column is true)
1162 <entry><structfield>rolcanlogin</structfield></entry>
1163 <entry><type>bool</type></entry>
1165 Role can log in. That is, this role can be given as the initial
1166 session authorization identifier.
1171 <entry><structfield>rolconnlimit</structfield></entry>
1172 <entry><type>int4</type></entry>
1174 For roles that can log in, this sets maximum number of concurrent
1175 connections this role can make. -1 means no limit.
1180 <entry><structfield>rolpassword</structfield></entry>
1181 <entry><type>text</type></entry>
1183 Password (possibly encrypted); null if none. If the password is
1184 encrypted, this column will contain the string md5 followed by a
1185 32-character hexadecimal MD5 hash. The MD5 hash will be of the
1186 user's password concatenated to their username (for example, if
1187 user joe has password xyzzy, <productname>PostgreSQL</> will store
1188 the md5 hash of xyzzyjoe).
1193 <entry><structfield>rolvaliduntil</structfield></entry>
1194 <entry><type>timestamptz</type></entry>
1195 <entry>Password expiry time (only used for password authentication);
1196 null if no expiration</entry>
1205 <sect1 id="catalog-pg-auth-members">
1206 <title><structname>pg_auth_members</structname></title>
1208 <indexterm zone="catalog-pg-auth-members">
1209 <primary>pg_auth_members</primary>
1213 The catalog <structname>pg_auth_members</structname> shows the membership
1214 relations between roles. Any non-circular set of relationships is allowed.
1218 Because user identities are cluster-wide,
1219 <structname>pg_auth_members</structname>
1220 is shared across all databases of a cluster: there is only one
1221 copy of <structname>pg_auth_members</structname> per cluster, not
1226 <title><structname>pg_auth_members</> Columns</title>
1233 <entry>References</entry>
1234 <entry>Description</entry>
1240 <entry><structfield>roleid</structfield></entry>
1241 <entry><type>oid</type></entry>
1242 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1243 <entry>ID of a role that has a member</entry>
1247 <entry><structfield>member</structfield></entry>
1248 <entry><type>oid</type></entry>
1249 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1250 <entry>ID of a role that is a member of <structfield>roleid</></entry>
1254 <entry><structfield>grantor</structfield></entry>
1255 <entry><type>oid</type></entry>
1256 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1257 <entry>ID of the role that granted this membership</entry>
1261 <entry><structfield>admin_option</structfield></entry>
1262 <entry><type>bool</type></entry>
1264 <entry>True if <structfield>member</> can grant membership in
1265 <structfield>roleid</> to others</entry>
1274 <sect1 id="catalog-pg-cast">
1275 <title><structname>pg_cast</structname></title>
1277 <indexterm zone="catalog-pg-cast">
1278 <primary>pg_cast</primary>
1282 The catalog <structname>pg_cast</structname> stores data type conversion
1283 paths, both built-in paths and those defined with
1284 <xref linkend="sql-createcast">.
1288 It should be noted that <structname>pg_cast</structname> does not represent
1289 every type conversion that the system knows how to perform; only those that
1290 cannot be deduced from some generic rule. For example, casting between a
1291 domain and its base type is not explicitly represented in
1292 <structname>pg_cast</structname>. Another important exception is that
1293 <quote>automatic I/O conversion casts</>, those performed using a data
1294 type's own I/O functions to convert to or from <type>text</> or other
1295 string types, are not explicitly represented in
1296 <structname>pg_cast</structname>.
1300 <title><structname>pg_cast</> Columns</title>
1307 <entry>References</entry>
1308 <entry>Description</entry>
1314 <entry><structfield>castsource</structfield></entry>
1315 <entry><type>oid</type></entry>
1316 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1317 <entry>OID of the source data type</entry>
1321 <entry><structfield>casttarget</structfield></entry>
1322 <entry><type>oid</type></entry>
1323 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1324 <entry>OID of the target data type</entry>
1328 <entry><structfield>castfunc</structfield></entry>
1329 <entry><type>oid</type></entry>
1330 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1332 The OID of the function to use to perform this cast. Zero is
1333 stored if the cast method doesn't require a function.
1338 <entry><structfield>castcontext</structfield></entry>
1339 <entry><type>char</type></entry>
1342 Indicates what contexts the cast can be invoked in.
1343 <literal>e</> means only as an explicit cast (using
1344 <literal>CAST</> or <literal>::</> syntax).
1345 <literal>a</> means implicitly in assignment
1346 to a target column, as well as explicitly.
1347 <literal>i</> means implicitly in expressions, as well as the
1352 <entry><structfield>castmethod</structfield></entry>
1353 <entry><type>char</type></entry>
1356 Indicates how the cast is performed.
1357 <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1358 <literal>i</> means that the input/output functions are used.
1359 <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1367 The cast functions listed in <structname>pg_cast</structname> must
1368 always take the cast source type as their first argument type, and
1369 return the cast destination type as their result type. A cast
1370 function can have up to three arguments. The second argument,
1371 if present, must be type <type>integer</>; it receives the type
1372 modifier associated with the destination type, or <literal>-1</>
1373 if there is none. The third argument,
1374 if present, must be type <type>boolean</>; it receives <literal>true</>
1375 if the cast is an explicit cast, <literal>false</> otherwise.
1379 It is legitimate to create a <structname>pg_cast</structname> entry
1380 in which the source and target types are the same, if the associated
1381 function takes more than one argument. Such entries represent
1382 <quote>length coercion functions</> that coerce values of the type
1383 to be legal for a particular type modifier value.
1387 When a <structname>pg_cast</structname> entry has different source and
1388 target types and a function that takes more than one argument, it
1389 represents converting from one type to another and applying a length
1390 coercion in a single step. When no such entry is available, coercion
1391 to a type that uses a type modifier involves two steps, one to
1392 convert between data types and a second to apply the modifier.
1396 <sect1 id="catalog-pg-class">
1397 <title><structname>pg_class</structname></title>
1399 <indexterm zone="catalog-pg-class">
1400 <primary>pg_class</primary>
1404 The catalog <structname>pg_class</structname> catalogs tables and most
1405 everything else that has columns or is otherwise similar to a
1406 table. This includes indexes (but see also
1407 <structname>pg_index</structname>), sequences, views, composite types,
1408 and TOAST tables; see <structfield>relkind</>.
1409 Below, when we mean all of these
1410 kinds of objects we speak of <quote>relations</quote>. Not all
1411 columns are meaningful for all relation types.
1415 <title><structname>pg_class</> Columns</title>
1422 <entry>References</entry>
1423 <entry>Description</entry>
1429 <entry><structfield>relname</structfield></entry>
1430 <entry><type>name</type></entry>
1432 <entry>Name of the table, index, view, etc.</entry>
1436 <entry><structfield>relnamespace</structfield></entry>
1437 <entry><type>oid</type></entry>
1438 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1440 The OID of the namespace that contains this relation
1445 <entry><structfield>reltype</structfield></entry>
1446 <entry><type>oid</type></entry>
1447 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1449 The OID of the data type that corresponds to this table's row type,
1450 if any (zero for indexes, which have no <structname>pg_type</> entry)
1455 <entry><structfield>reloftype</structfield></entry>
1456 <entry><type>oid</type></entry>
1457 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1459 For typed tables, the OID of the underlying composite type,
1460 zero for all other relations
1465 <entry><structfield>relowner</structfield></entry>
1466 <entry><type>oid</type></entry>
1467 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1468 <entry>Owner of the relation</entry>
1472 <entry><structfield>relam</structfield></entry>
1473 <entry><type>oid</type></entry>
1474 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1475 <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1479 <entry><structfield>relfilenode</structfield></entry>
1480 <entry><type>oid</type></entry>
1482 <entry>Name of the on-disk file of this relation; zero means this
1483 is a <quote>mapped</> relation whose disk file name is determined
1484 by low-level state</entry>
1488 <entry><structfield>reltablespace</structfield></entry>
1489 <entry><type>oid</type></entry>
1490 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1492 The tablespace in which this relation is stored. If zero,
1493 the database's default tablespace is implied. (Not meaningful
1494 if the relation has no on-disk file.)
1499 <entry><structfield>relpages</structfield></entry>
1500 <entry><type>int4</type></entry>
1503 Size of the on-disk representation of this table in pages (of size
1504 <symbol>BLCKSZ</symbol>). This is only an estimate used by the
1505 planner. It is updated by <command>VACUUM</command>,
1506 <command>ANALYZE</command>, and a few DDL commands such as
1507 <command>CREATE INDEX</command>.
1512 <entry><structfield>reltuples</structfield></entry>
1513 <entry><type>float4</type></entry>
1516 Number of rows in the table. This is only an estimate used by the
1517 planner. It is updated by <command>VACUUM</command>,
1518 <command>ANALYZE</command>, and a few DDL commands such as
1519 <command>CREATE INDEX</command>.
1524 <entry><structfield>reltoastrelid</structfield></entry>
1525 <entry><type>oid</type></entry>
1526 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1528 OID of the TOAST table associated with this table, 0 if none. The
1529 TOAST table stores large attributes <quote>out of line</quote> in a
1535 <entry><structfield>reltoastidxid</structfield></entry>
1536 <entry><type>oid</type></entry>
1537 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1539 For a TOAST table, the OID of its index. 0 if not a TOAST table.
1544 <entry><structfield>relhasindex</structfield></entry>
1545 <entry><type>bool</type></entry>
1548 True if this is a table and it has (or recently had) any indexes
1553 <entry><structfield>relisshared</structfield></entry>
1554 <entry><type>bool</type></entry>
1557 True if this table is shared across all databases in the cluster. Only
1558 certain system catalogs (such as <structname>pg_database</structname>)
1564 <entry><structfield>relistemp</structfield></entry>
1565 <entry><type>bool</type></entry>
1568 True if this table is a temporary relation. If so, only the creating
1569 session can safely access its contents.
1574 <entry><structfield>relkind</structfield></entry>
1575 <entry><type>char</type></entry>
1578 <literal>r</> = ordinary table, <literal>i</> = index,
1579 <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1580 composite type, <literal>t</> = TOAST
1586 <entry><structfield>relnatts</structfield></entry>
1587 <entry><type>int2</type></entry>
1590 Number of user columns in the relation (system columns not
1591 counted). There must be this many corresponding entries in
1592 <structname>pg_attribute</structname>. See also
1593 <literal>pg_attribute.attnum</literal>.
1598 <entry><structfield>relchecks</structfield></entry>
1599 <entry><type>int2</type></entry>
1602 Number of <literal>CHECK</> constraints on the table; see
1603 <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1608 <entry><structfield>relhasoids</structfield></entry>
1609 <entry><type>bool</type></entry>
1612 True if we generate an OID for each row of the relation
1617 <entry><structfield>relhaspkey</structfield></entry>
1618 <entry><type>bool</type></entry>
1621 True if the table has (or once had) a primary key
1626 <entry><structfield>relhasexclusion</structfield></entry>
1627 <entry><type>bool</type></entry>
1630 For a table, true if the table has (or once had) any exclusion
1631 constraints; for an index, true if the index supports an exclusion
1637 <entry><structfield>relhasrules</structfield></entry>
1638 <entry><type>bool</type></entry>
1641 True if table has (or once had) rules; see
1642 <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1647 <entry><structfield>relhastriggers</structfield></entry>
1648 <entry><type>bool</type></entry>
1651 True if table has (or once had) triggers; see
1652 <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1657 <entry><structfield>relhassubclass</structfield></entry>
1658 <entry><type>bool</type></entry>
1660 <entry>True if table has (or once had) any inheritance children</entry>
1664 <entry><structfield>relfrozenxid</structfield></entry>
1665 <entry><type>xid</type></entry>
1668 All transaction IDs before this one have been replaced with a permanent
1669 (<quote>frozen</>) transaction ID in this table. This is used to track
1670 whether the table needs to be vacuumed in order to prevent transaction
1671 ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
1672 (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1677 <entry><structfield>relacl</structfield></entry>
1678 <entry><type>aclitem[]</type></entry>
1681 Access privileges; see
1682 <xref linkend="sql-grant"> and
1683 <xref linkend="sql-revoke">
1689 <entry><structfield>reloptions</structfield></entry>
1690 <entry><type>text[]</type></entry>
1693 Access-method-specific options, as <quote>keyword=value</> strings
1701 Several of the Boolean flags in <structname>pg_class</> are maintained
1702 lazily: they are guaranteed to be true if that's the correct state, but
1703 may not be reset to false immediately when the condition is no longer
1704 true. For example, <structfield>relhasindex</> is set by
1705 <command>CREATE INDEX</command>, but it is never cleared by
1706 <command>DROP INDEX</command>. Instead, <command>VACUUM</command> clears
1707 <structfield>relhasindex</> if it finds the table has no indexes. This
1708 arrangement avoids race conditions and improves concurrency.
1712 <sect1 id="catalog-pg-constraint">
1713 <title><structname>pg_constraint</structname></title>
1715 <indexterm zone="catalog-pg-constraint">
1716 <primary>pg_constraint</primary>
1720 The catalog <structname>pg_constraint</structname> stores check, primary
1721 key, unique, foreign key, and exclusion constraints on tables.
1722 (Column constraints are not treated specially. Every column constraint is
1723 equivalent to some table constraint.)
1724 Not-null constraints are represented in the <structname>pg_attribute</>
1729 User-defined constraint triggers (created with <command>CREATE CONSTRAINT
1730 TRIGGER</>) also give rise to an entry in this table.
1734 Check constraints on domains are stored here, too.
1738 <title><structname>pg_constraint</> Columns</title>
1745 <entry>References</entry>
1746 <entry>Description</entry>
1752 <entry><structfield>conname</structfield></entry>
1753 <entry><type>name</type></entry>
1755 <entry>Constraint name (not necessarily unique!)</entry>
1759 <entry><structfield>connamespace</structfield></entry>
1760 <entry><type>oid</type></entry>
1761 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1763 The OID of the namespace that contains this constraint
1768 <entry><structfield>contype</structfield></entry>
1769 <entry><type>char</type></entry>
1772 <literal>c</> = check constraint,
1773 <literal>f</> = foreign key constraint,
1774 <literal>p</> = primary key constraint,
1775 <literal>u</> = unique constraint,
1776 <literal>t</> = constraint trigger,
1777 <literal>x</> = exclusion constraint
1782 <entry><structfield>condeferrable</structfield></entry>
1783 <entry><type>bool</type></entry>
1785 <entry>Is the constraint deferrable?</entry>
1789 <entry><structfield>condeferred</structfield></entry>
1790 <entry><type>bool</type></entry>
1792 <entry>Is the constraint deferred by default?</entry>
1796 <entry><structfield>conrelid</structfield></entry>
1797 <entry><type>oid</type></entry>
1798 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1799 <entry>The table this constraint is on; 0 if not a table constraint</entry>
1803 <entry><structfield>contypid</structfield></entry>
1804 <entry><type>oid</type></entry>
1805 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1806 <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1810 <entry><structfield>conindid</structfield></entry>
1811 <entry><type>oid</type></entry>
1812 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1813 <entry>The index supporting this constraint, if it's a unique, primary
1814 key, foreign key, or exclusion constraint; else 0</entry>
1818 <entry><structfield>confrelid</structfield></entry>
1819 <entry><type>oid</type></entry>
1820 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1821 <entry>If a foreign key, the referenced table; else 0</entry>
1825 <entry><structfield>confupdtype</structfield></entry>
1826 <entry><type>char</type></entry>
1828 <entry>Foreign key update action code:
1829 <literal>a</> = no action,
1830 <literal>r</> = restrict,
1831 <literal>c</> = cascade,
1832 <literal>n</> = set null,
1833 <literal>d</> = set default
1838 <entry><structfield>confdeltype</structfield></entry>
1839 <entry><type>char</type></entry>
1841 <entry>Foreign key deletion action code:
1842 <literal>a</> = no action,
1843 <literal>r</> = restrict,
1844 <literal>c</> = cascade,
1845 <literal>n</> = set null,
1846 <literal>d</> = set default
1851 <entry><structfield>confmatchtype</structfield></entry>
1852 <entry><type>char</type></entry>
1854 <entry>Foreign key match type:
1855 <literal>f</> = full,
1856 <literal>p</> = partial,
1857 <literal>u</> = simple (unspecified)
1862 <entry><structfield>conislocal</structfield></entry>
1863 <entry><type>bool</type></entry>
1866 This constraint is defined locally for the relation. Note that a
1867 constraint can be locally defined and inherited simultaneously.
1872 <entry><structfield>coninhcount</structfield></entry>
1873 <entry><type>int4</type></entry>
1876 The number of direct inheritance ancestors this constraint has.
1878 a nonzero number of ancestors cannot be dropped nor renamed.
1883 <entry><structfield>conkey</structfield></entry>
1884 <entry><type>int2[]</type></entry>
1885 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1886 <entry>If a table constraint (including foreign keys, but not constraint
1887 triggers), list of the constrained columns</entry>
1891 <entry><structfield>confkey</structfield></entry>
1892 <entry><type>int2[]</type></entry>
1893 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1894 <entry>If a foreign key, list of the referenced columns</entry>
1898 <entry><structfield>conpfeqop</structfield></entry>
1899 <entry><type>oid[]</type></entry>
1900 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1901 <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
1905 <entry><structfield>conppeqop</structfield></entry>
1906 <entry><type>oid[]</type></entry>
1907 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1908 <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
1912 <entry><structfield>conffeqop</structfield></entry>
1913 <entry><type>oid[]</type></entry>
1914 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1915 <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
1919 <entry><structfield>conexclop</structfield></entry>
1920 <entry><type>oid[]</type></entry>
1921 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
1922 <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
1926 <entry><structfield>conbin</structfield></entry>
1927 <entry><type>text</type></entry>
1929 <entry>If a check constraint, an internal representation of the expression</entry>
1933 <entry><structfield>consrc</structfield></entry>
1934 <entry><type>text</type></entry>
1936 <entry>If a check constraint, a human-readable representation of the expression</entry>
1943 In the case of an exclusion constraint, <structfield>conkey</structfield>
1944 is only useful for constraint elements that are simple column references.
1945 For other cases, a zero appears in <structfield>conkey</structfield>
1946 and the associated index must be consulted to discover the expression
1947 that is constrained. (<structfield>conkey</structfield> thus has the
1948 same contents as <structname>pg_index</>.<structfield>indkey</> for the
1954 <structfield>consrc</structfield> is not updated when referenced objects
1955 change; for example, it won't track renaming of columns. Rather than
1956 relying on this field, it's best to use <function>pg_get_constraintdef()</>
1957 to extract the definition of a check constraint.
1963 <literal>pg_class.relchecks</literal> needs to agree with the
1964 number of check-constraint entries found in this table for each
1965 relation. Also, <literal>pg_class.relhasexclusion</literal> must
1966 be true if there are any exclusion-constraint entries for the relation.
1972 <sect1 id="catalog-pg-conversion">
1973 <title><structname>pg_conversion</structname></title>
1975 <indexterm zone="catalog-pg-conversion">
1976 <primary>pg_conversion</primary>
1980 The catalog <structname>pg_conversion</structname> describes the
1981 available encoding conversion procedures. See
1982 <xref linkend="sql-createconversion">
1983 for more information.
1987 <title><structname>pg_conversion</> Columns</title>
1994 <entry>References</entry>
1995 <entry>Description</entry>
2001 <entry><structfield>conname</structfield></entry>
2002 <entry><type>name</type></entry>
2004 <entry>Conversion name (unique within a namespace)</entry>
2008 <entry><structfield>connamespace</structfield></entry>
2009 <entry><type>oid</type></entry>
2010 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2012 The OID of the namespace that contains this conversion
2017 <entry><structfield>conowner</structfield></entry>
2018 <entry><type>oid</type></entry>
2019 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2020 <entry>Owner of the conversion</entry>
2024 <entry><structfield>conforencoding</structfield></entry>
2025 <entry><type>int4</type></entry>
2027 <entry>Source encoding ID</entry>
2031 <entry><structfield>contoencoding</structfield></entry>
2032 <entry><type>int4</type></entry>
2034 <entry>Destination encoding ID</entry>
2038 <entry><structfield>conproc</structfield></entry>
2039 <entry><type>regproc</type></entry>
2040 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2041 <entry>Conversion procedure</entry>
2045 <entry><structfield>condefault</structfield></entry>
2046 <entry><type>bool</type></entry>
2048 <entry>True if this is the default conversion</entry>
2057 <sect1 id="catalog-pg-database">
2058 <title><structname>pg_database</structname></title>
2060 <indexterm zone="catalog-pg-database">
2061 <primary>pg_database</primary>
2065 The catalog <structname>pg_database</structname> stores information about
2066 the available databases. Databases are created with the <xref
2067 linkend="sql-createdatabase"> command.
2068 Consult <xref linkend="managing-databases"> for details about the meaning
2069 of some of the parameters.
2073 Unlike most system catalogs, <structname>pg_database</structname>
2074 is shared across all databases of a cluster: there is only one
2075 copy of <structname>pg_database</structname> per cluster, not
2080 <title><structname>pg_database</> Columns</title>
2087 <entry>References</entry>
2088 <entry>Description</entry>
2094 <entry><structfield>datname</structfield></entry>
2095 <entry><type>name</type></entry>
2097 <entry>Database name</entry>
2101 <entry><structfield>datdba</structfield></entry>
2102 <entry><type>oid</type></entry>
2103 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2104 <entry>Owner of the database, usually the user who created it</entry>
2108 <entry><structfield>encoding</structfield></entry>
2109 <entry><type>int4</type></entry>
2111 <entry>Character encoding for this database
2112 (<function>pg_encoding_to_char()</function> can translate
2113 this number to the encoding name)</entry>
2117 <entry><structfield>datcollate</structfield></entry>
2118 <entry><type>name</type></entry>
2120 <entry>LC_COLLATE for this database</entry>
2124 <entry><structfield>datctype</structfield></entry>
2125 <entry><type>name</type></entry>
2127 <entry>LC_CTYPE for this database</entry>
2131 <entry><structfield>datistemplate</structfield></entry>
2132 <entry><type>bool</type></entry>
2135 If true then this database can be used in the
2136 <literal>TEMPLATE</literal> clause of <command>CREATE
2137 DATABASE</command> to create a new database as a clone of
2143 <entry><structfield>datallowconn</structfield></entry>
2144 <entry><type>bool</type></entry>
2147 If false then no one can connect to this database. This is
2148 used to protect the <literal>template0</> database from being altered.
2153 <entry><structfield>datconnlimit</structfield></entry>
2154 <entry><type>int4</type></entry>
2157 Sets maximum number of concurrent connections that can be made
2158 to this database. -1 means no limit.
2163 <entry><structfield>datlastsysoid</structfield></entry>
2164 <entry><type>oid</type></entry>
2167 Last system OID in the database; useful
2168 particularly to <application>pg_dump</application>
2173 <entry><structfield>datfrozenxid</structfield></entry>
2174 <entry><type>xid</type></entry>
2177 All transaction IDs before this one have been replaced with a permanent
2178 (<quote>frozen</>) transaction ID in this database. This is used to
2179 track whether the database needs to be vacuumed in order to prevent
2180 transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2181 It is the minimum of the per-table
2182 <structname>pg_class</>.<structfield>relfrozenxid</> values.
2187 <entry><structfield>dattablespace</structfield></entry>
2188 <entry><type>oid</type></entry>
2189 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2191 The default tablespace for the database.
2192 Within this database, all tables for which
2193 <structname>pg_class</>.<structfield>reltablespace</> is zero
2194 will be stored in this tablespace; in particular, all the non-shared
2195 system catalogs will be there.
2200 <entry><structfield>datacl</structfield></entry>
2201 <entry><type>aclitem[]</type></entry>
2204 Access privileges; see
2205 <xref linkend="sql-grant"> and
2206 <xref linkend="sql-revoke">
2216 <sect1 id="catalog-pg-db-role-setting">
2217 <title><structname>pg_db_role_setting</structname></title>
2219 <indexterm zone="catalog-pg-db-role-setting">
2220 <primary>pg_db_role_setting</primary>
2224 The catalog <structname>pg_db_role_setting</structname> records the default
2225 values that have been set for run-time configuration variables,
2226 for each role and database combination.
2230 Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2231 is shared across all databases of a cluster: there is only one
2232 copy of <structname>pg_db_role_setting</structname> per cluster, not
2237 <title><structname>pg_db_role_setting</> Columns</title>
2244 <entry>References</entry>
2245 <entry>Description</entry>
2251 <entry><structfield>setdatabase</structfield></entry>
2252 <entry><type>oid</type></entry>
2253 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2254 <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2258 <entry><structfield>setrole</structfield></entry>
2259 <entry><type>oid</type></entry>
2260 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2261 <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2265 <entry><structfield>setconfig</structfield></entry>
2266 <entry><type>text[]</type></entry>
2268 <entry>Defaults for run-time configuration variables</entry>
2276 <sect1 id="catalog-pg-default-acl">
2277 <title><structname>pg_default_acl</structname></title>
2279 <indexterm zone="catalog-pg-default-acl">
2280 <primary>pg_default_acl</primary>
2284 The catalog <structname>pg_default_acl</> stores initial
2285 privileges to be assigned to newly created objects.
2289 <title><structname>pg_default_acl</> Columns</title>
2296 <entry>References</entry>
2297 <entry>Description</entry>
2303 <entry><structfield>defaclrole</structfield></entry>
2304 <entry><type>oid</type></entry>
2305 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2306 <entry>The OID of the role associated with this entry</entry>
2310 <entry><structfield>defaclnamespace</structfield></entry>
2311 <entry><type>oid</type></entry>
2312 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2313 <entry>The OID of the namespace associated with this entry,
2314 or 0 if none</entry>
2318 <entry><structfield>defaclobjtype</structfield></entry>
2319 <entry><type>char</type></entry>
2322 Type of object this entry is for:
2323 <literal>r</> = relation (table, view),
2324 <literal>S</> = sequence,
2325 <literal>f</> = function
2330 <entry><structfield>defaclacl</structfield></entry>
2331 <entry><type>aclitem[]</type></entry>
2334 Access privileges that this type of object should have on creation
2342 A <structname>pg_default_acl</> entry shows the initial privileges to
2343 be assigned to an object belonging to the indicated user. There are
2344 currently two types of entry: <quote>global</> entries with
2345 <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2346 that reference a particular schema. If a global entry is present then
2347 it <emphasis>overrides</> the normal hard-wired default privileges
2348 for the object type. A per-schema entry, if present, represents privileges
2349 to be <emphasis>added to</> the global or hard-wired default privileges.
2353 Note that when an ACL entry in another catalog is null, it is taken
2354 to represent the hard-wired default privileges for its object,
2355 <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2356 at the moment. <structname>pg_default_acl</> is only consulted during
2363 <sect1 id="catalog-pg-depend">
2364 <title><structname>pg_depend</structname></title>
2366 <indexterm zone="catalog-pg-depend">
2367 <primary>pg_depend</primary>
2371 The catalog <structname>pg_depend</structname> records the dependency
2372 relationships between database objects. This information allows
2373 <command>DROP</> commands to find which other objects must be dropped
2374 by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2379 See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2380 which performs a similar function for dependencies involving objects
2381 that are shared across a database cluster.
2385 <title><structname>pg_depend</> Columns</title>
2392 <entry>References</entry>
2393 <entry>Description</entry>
2399 <entry><structfield>classid</structfield></entry>
2400 <entry><type>oid</type></entry>
2401 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2402 <entry>The OID of the system catalog the dependent object is in</entry>
2406 <entry><structfield>objid</structfield></entry>
2407 <entry><type>oid</type></entry>
2408 <entry>any OID column</entry>
2409 <entry>The OID of the specific dependent object</entry>
2413 <entry><structfield>objsubid</structfield></entry>
2414 <entry><type>int4</type></entry>
2417 For a table column, this is the column number (the
2418 <structfield>objid</> and <structfield>classid</> refer to the
2419 table itself). For all other object types, this column is
2425 <entry><structfield>refclassid</structfield></entry>
2426 <entry><type>oid</type></entry>
2427 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2428 <entry>The OID of the system catalog the referenced object is in</entry>
2432 <entry><structfield>refobjid</structfield></entry>
2433 <entry><type>oid</type></entry>
2434 <entry>any OID column</entry>
2435 <entry>The OID of the specific referenced object</entry>
2439 <entry><structfield>refobjsubid</structfield></entry>
2440 <entry><type>int4</type></entry>
2443 For a table column, this is the column number (the
2444 <structfield>refobjid</> and <structfield>refclassid</> refer
2445 to the table itself). For all other object types, this column
2451 <entry><structfield>deptype</structfield></entry>
2452 <entry><type>char</type></entry>
2455 A code defining the specific semantics of this dependency relationship; see text
2464 In all cases, a <structname>pg_depend</structname> entry indicates that the
2465 referenced object cannot be dropped without also dropping the dependent
2466 object. However, there are several subflavors identified by
2467 <structfield>deptype</>:
2471 <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2474 A normal relationship between separately-created objects. The
2475 dependent object can be dropped without affecting the
2476 referenced object. The referenced object can only be dropped
2477 by specifying <literal>CASCADE</>, in which case the dependent
2478 object is dropped, too. Example: a table column has a normal
2479 dependency on its data type.
2485 <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2488 The dependent object can be dropped separately from the
2489 referenced object, and should be automatically dropped
2490 (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2491 mode) if the referenced object is dropped. Example: a named
2492 constraint on a table is made autodependent on the table, so
2493 that it will go away if the table is dropped.
2499 <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2502 The dependent object was created as part of creation of the
2503 referenced object, and is really just a part of its internal
2504 implementation. A <command>DROP</> of the dependent object
2505 will be disallowed outright (we'll tell the user to issue a
2506 <command>DROP</> against the referenced object, instead). A
2507 <command>DROP</> of the referenced object will be propagated
2508 through to drop the dependent object whether
2509 <command>CASCADE</> is specified or not. Example: a trigger
2510 that's created to enforce a foreign-key constraint is made
2511 internally dependent on the constraint's
2512 <structname>pg_constraint</> entry.
2518 <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2521 There is no dependent object; this type of entry is a signal
2522 that the system itself depends on the referenced object, and so
2523 that object must never be deleted. Entries of this type are
2524 created only by <command>initdb</command>. The columns for the
2525 dependent object contain zeroes.
2531 Other dependency flavors might be needed in future.
2537 <sect1 id="catalog-pg-description">
2538 <title><structname>pg_description</structname></title>
2540 <indexterm zone="catalog-pg-description">
2541 <primary>pg_description</primary>
2545 The catalog <structname>pg_description</> stores optional descriptions
2546 (comments) for each database object. Descriptions can be manipulated
2547 with the <xref linkend="sql-comment"> command and viewed with
2548 <application>psql</application>'s <literal>\d</literal> commands.
2549 Descriptions of many built-in system objects are provided in the initial
2550 contents of <structname>pg_description</structname>.
2554 See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2555 which performs a similar function for descriptions involving objects that
2556 are shared across a database cluster.
2560 <title><structname>pg_description</> Columns</title>
2567 <entry>References</entry>
2568 <entry>Description</entry>
2574 <entry><structfield>objoid</structfield></entry>
2575 <entry><type>oid</type></entry>
2576 <entry>any OID column</entry>
2577 <entry>The OID of the object this description pertains to</entry>
2581 <entry><structfield>classoid</structfield></entry>
2582 <entry><type>oid</type></entry>
2583 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2584 <entry>The OID of the system catalog this object appears in</entry>
2588 <entry><structfield>objsubid</structfield></entry>
2589 <entry><type>int4</type></entry>
2592 For a comment on a table column, this is the column number (the
2593 <structfield>objoid</> and <structfield>classoid</> refer to
2594 the table itself). For all other object types, this column is
2600 <entry><structfield>description</structfield></entry>
2601 <entry><type>text</type></entry>
2603 <entry>Arbitrary text that serves as the description of this object</entry>
2612 <sect1 id="catalog-pg-enum">
2613 <title><structname>pg_enum</structname></title>
2615 <indexterm zone="catalog-pg-enum">
2616 <primary>pg_enum</primary>
2620 The <structname>pg_enum</structname> catalog contains entries
2621 matching enum types to their associated values and labels. The
2622 internal representation of a given enum value is actually the OID
2623 of its associated row in <structname>pg_enum</structname>. The
2624 OIDs for a particular enum type are guaranteed to be ordered in
2625 the way the type should sort, but there is no guarantee about the
2626 ordering of OIDs of unrelated enum types.
2630 <title><structname>pg_enum</> Columns</title>
2637 <entry>References</entry>
2638 <entry>Description</entry>
2644 <entry><structfield>enumtypid</structfield></entry>
2645 <entry><type>oid</type></entry>
2646 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2647 <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2651 <entry><structfield>enumlabel</structfield></entry>
2652 <entry><type>name</type></entry>
2654 <entry>The textual label for this enum value</entry>
2662 <sect1 id="catalog-pg-foreign-data-wrapper">
2663 <title><structname>pg_foreign_data_wrapper</structname></title>
2665 <indexterm zone="catalog-pg-foreign-data-wrapper">
2666 <primary>pg_foreign_data_wrapper</primary>
2670 The catalog <structname>pg_foreign_data_wrapper</structname> stores
2671 foreign-data wrapper definitions. A foreign-data wrapper is the
2672 mechanism by which external data, residing on foreign servers, is
2677 <title><structname>pg_foreign_data_wrapper</> Columns</title>
2684 <entry>References</entry>
2685 <entry>Description</entry>
2691 <entry><structfield>fdwname</structfield></entry>
2692 <entry><type>name</type></entry>
2694 <entry>Name of the foreign-data wrapper</entry>
2698 <entry><structfield>fdwowner</structfield></entry>
2699 <entry><type>oid</type></entry>
2700 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2701 <entry>Owner of the foreign-data wrapper</entry>
2705 <entry><structfield>fdwvalidator</structfield></entry>
2706 <entry><type>oid</type></entry>
2707 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2709 References a validator function that is responsible for
2710 checking the validity of the generic options given to the
2711 foreign-data wrapper, as well as to foreign servers and user
2712 mappings using the foreign-data wrapper. Zero if no validator
2718 <entry><structfield>fdwacl</structfield></entry>
2719 <entry><type>aclitem[]</type></entry>
2722 Access privileges; see
2723 <xref linkend="sql-grant"> and
2724 <xref linkend="sql-revoke">
2730 <entry><structfield>fdwoptions</structfield></entry>
2731 <entry><type>text[]</type></entry>
2734 Foreign-data wrapper specific options, as <quote>keyword=value</> strings
2743 <sect1 id="catalog-pg-foreign-server">
2744 <title><structname>pg_foreign_server</structname></title>
2746 <indexterm zone="catalog-pg-foreign-server">
2747 <primary>pg_foreign_server</primary>
2751 The catalog <structname>pg_foreign_server</structname> stores
2752 foreign server definitions. A foreign server describes the
2753 connection to a remote server, managing external data. Foreign
2754 servers are accessed via foreign-data wrappers.
2758 <title><structname>pg_foreign_server</> Columns</title>
2765 <entry>References</entry>
2766 <entry>Description</entry>
2772 <entry><structfield>srvname</structfield></entry>
2773 <entry><type>name</type></entry>
2775 <entry>Name of the foreign server</entry>
2779 <entry><structfield>srvowner</structfield></entry>
2780 <entry><type>oid</type></entry>
2781 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2782 <entry>Owner of the foreign server</entry>
2786 <entry><structfield>srvfdw</structfield></entry>
2787 <entry><type>oid</type></entry>
2788 <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
2789 <entry>The OID of the foreign-data wrapper of this foreign server</entry>
2793 <entry><structfield>srvtype</structfield></entry>
2794 <entry><type>text</type></entry>
2796 <entry>Type of the server (optional)</entry>
2800 <entry><structfield>srvversion</structfield></entry>
2801 <entry><type>text</type></entry>
2803 <entry>Version of the server (optional)</entry>
2807 <entry><structfield>srvacl</structfield></entry>
2808 <entry><type>aclitem[]</type></entry>
2811 Access privileges; see
2812 <xref linkend="sql-grant"> and
2813 <xref linkend="sql-revoke">
2819 <entry><structfield>srvoptions</structfield></entry>
2820 <entry><type>text[]</type></entry>
2823 Foreign server specific options, as <quote>keyword=value</> strings
2832 <sect1 id="catalog-pg-index">
2833 <title><structname>pg_index</structname></title>
2835 <indexterm zone="catalog-pg-index">
2836 <primary>pg_index</primary>
2840 The catalog <structname>pg_index</structname> contains part of the information
2841 about indexes. The rest is mostly in
2842 <structname>pg_class</structname>.
2846 <title><structname>pg_index</> Columns</title>
2853 <entry>References</entry>
2854 <entry>Description</entry>
2860 <entry><structfield>indexrelid</structfield></entry>
2861 <entry><type>oid</type></entry>
2862 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2863 <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2867 <entry><structfield>indrelid</structfield></entry>
2868 <entry><type>oid</type></entry>
2869 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2870 <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2874 <entry><structfield>indnatts</structfield></entry>
2875 <entry><type>int2</type></entry>
2877 <entry>The number of columns in the index (duplicates
2878 <literal>pg_class.relnatts</literal>)</entry>
2882 <entry><structfield>indisunique</structfield></entry>
2883 <entry><type>bool</type></entry>
2885 <entry>If true, this is a unique index</entry>
2889 <entry><structfield>indisprimary</structfield></entry>
2890 <entry><type>bool</type></entry>
2892 <entry>If true, this index represents the primary key of the table
2893 (<structfield>indisunique</> should always be true when this is true)</entry>
2897 <entry><structfield>indimmediate</structfield></entry>
2898 <entry><type>bool</type></entry>
2900 <entry>If true, the uniqueness check is enforced immediately on insertion
2901 (<structfield>indisunique</> should always be true when this is true)</entry>
2905 <entry><structfield>indisclustered</structfield></entry>
2906 <entry><type>bool</type></entry>
2908 <entry>If true, the table was last clustered on this index</entry>
2912 <entry><structfield>indisvalid</structfield></entry>
2913 <entry><type>bool</type></entry>
2916 If true, the index is currently valid for queries. False means the
2917 index is possibly incomplete: it must still be modified by
2918 <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2919 be used for queries. If it is unique, the uniqueness property is not
2925 <entry><structfield>indcheckxmin</structfield></entry>
2926 <entry><type>bool</type></entry>
2929 If true, queries must not use the index until the <structfield>xmin</>
2930 of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
2931 event horizon, because the table may contain broken HOT chains with
2932 incompatible rows that they can see
2937 <entry><structfield>indisready</structfield></entry>
2938 <entry><type>bool</type></entry>
2941 If true, the index is currently ready for inserts. False means the
2942 index must be ignored by <command>INSERT</>/<command>UPDATE</>
2948 <entry><structfield>indkey</structfield></entry>
2949 <entry><type>int2vector</type></entry>
2950 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2952 This is an array of <structfield>indnatts</structfield> values that
2953 indicate which table columns this index indexes. For example a value
2954 of <literal>1 3</literal> would mean that the first and the third table
2955 columns make up the index key. A zero in this array indicates that the
2956 corresponding index attribute is an expression over the table columns,
2957 rather than a simple column reference.
2962 <entry><structfield>indclass</structfield></entry>
2963 <entry><type>oidvector</type></entry>
2964 <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2966 For each column in the index key, this contains the OID of
2967 the operator class to use. See
2968 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
2973 <entry><structfield>indoption</structfield></entry>
2974 <entry><type>int2vector</type></entry>
2977 This is an array of <structfield>indnatts</structfield> values that
2978 store per-column flag bits. The meaning of the bits is defined by
2979 the index's access method.
2984 <entry><structfield>indexprs</structfield></entry>
2985 <entry><type>text</type></entry>
2988 Expression trees (in <function>nodeToString()</function>
2989 representation) for index attributes that are not simple column
2990 references. This is a list with one element for each zero
2991 entry in <structfield>indkey</>. Null if all index attributes
2992 are simple references.
2997 <entry><structfield>indpred</structfield></entry>
2998 <entry><type>text</type></entry>
3001 Expression tree (in <function>nodeToString()</function>
3002 representation) for partial index predicate. Null if not a
3013 <sect1 id="catalog-pg-inherits">
3014 <title><structname>pg_inherits</structname></title>
3016 <indexterm zone="catalog-pg-inherits">
3017 <primary>pg_inherits</primary>
3021 The catalog <structname>pg_inherits</> records information about
3022 table inheritance hierarchies. There is one entry for each direct
3023 child table in the database. (Indirect inheritance can be determined
3024 by following chains of entries.)
3028 <title><structname>pg_inherits</> Columns</title>
3035 <entry>References</entry>
3036 <entry>Description</entry>
3042 <entry><structfield>inhrelid</structfield></entry>
3043 <entry><type>oid</type></entry>
3044 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3046 The OID of the child table
3051 <entry><structfield>inhparent</structfield></entry>
3052 <entry><type>oid</type></entry>
3053 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3055 The OID of the parent table
3060 <entry><structfield>inhseqno</structfield></entry>
3061 <entry><type>int4</type></entry>
3064 If there is more than one direct parent for a child table (multiple
3065 inheritance), this number tells the order in which the
3066 inherited columns are to be arranged. The count starts at 1.
3076 <sect1 id="catalog-pg-language">
3077 <title><structname>pg_language</structname></title>
3079 <indexterm zone="catalog-pg-language">
3080 <primary>pg_language</primary>
3084 The catalog <structname>pg_language</structname> registers
3085 languages in which you can write functions or stored procedures.
3086 See <xref linkend="sql-createlanguage">
3087 and <xref linkend="xplang"> for more information about language handlers.
3091 <title><structname>pg_language</> Columns</title>
3098 <entry>References</entry>
3099 <entry>Description</entry>
3105 <entry><structfield>lanname</structfield></entry>
3106 <entry><type>name</type></entry>
3108 <entry>Name of the language</entry>
3112 <entry><structfield>lanowner</structfield></entry>
3113 <entry><type>oid</type></entry>
3114 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3115 <entry>Owner of the language</entry>
3119 <entry><structfield>lanispl</structfield></entry>
3120 <entry><type>bool</type></entry>
3123 This is false for internal languages (such as
3124 <acronym>SQL</acronym>) and true for user-defined languages.
3125 Currently, <application>pg_dump</application> still uses this
3126 to determine which languages need to be dumped, but this might be
3127 replaced by a different mechanism in the future.
3132 <entry><structfield>lanpltrusted</structfield></entry>
3133 <entry><type>bool</type></entry>
3136 True if this is a trusted language, which means that it is believed
3137 not to grant access to anything outside the normal SQL execution
3138 environment. Only superusers can create functions in untrusted
3144 <entry><structfield>lanplcallfoid</structfield></entry>
3145 <entry><type>oid</type></entry>
3146 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3148 For noninternal languages this references the language
3149 handler, which is a special function that is responsible for
3150 executing all functions that are written in the particular
3156 <entry><structfield>laninline</structfield></entry>
3157 <entry><type>oid</type></entry>
3158 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3160 This references a function that is responsible for executing
3161 <quote>inline</> anonymous code blocks
3162 (<xref linkend="sql-do"> blocks).
3163 Zero if inline blocks are not supported.
3168 <entry><structfield>lanvalidator</structfield></entry>
3169 <entry><type>oid</type></entry>
3170 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3172 This references a language validator function that is responsible
3173 for checking the syntax and validity of new functions when they
3174 are created. Zero if no validator is provided.
3179 <entry><structfield>lanacl</structfield></entry>
3180 <entry><type>aclitem[]</type></entry>
3183 Access privileges; see
3184 <xref linkend="sql-grant"> and
3185 <xref linkend="sql-revoke">
3196 <sect1 id="catalog-pg-largeobject">
3197 <title><structname>pg_largeobject</structname></title>
3199 <indexterm zone="catalog-pg-largeobject">
3200 <primary>pg_largeobject</primary>
3204 The catalog <structname>pg_largeobject</structname> holds the data making up
3205 <quote>large objects</quote>. A large object is identified by an OID
3206 assigned when it is created. Each large object is broken into
3207 segments or <quote>pages</> small enough to be conveniently stored as rows
3208 in <structname>pg_largeobject</structname>.
3209 The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
3210 <literal>BLCKSZ/4</>, or typically 2 kB).
3214 Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
3215 associated with large objects. As a result,
3216 <structname>pg_largeobject</structname> was publicly readable and could be
3217 used to obtain the OIDs (and contents) of all large objects in the system.
3218 This is no longer the case; use
3219 <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
3220 to obtain a list of large object OIDs.
3224 <title><structname>pg_largeobject</> Columns</title>
3231 <entry>References</entry>
3232 <entry>Description</entry>
3238 <entry><structfield>loid</structfield></entry>
3239 <entry><type>oid</type></entry>
3240 <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
3241 <entry>Identifier of the large object that includes this page</entry>
3245 <entry><structfield>pageno</structfield></entry>
3246 <entry><type>int4</type></entry>
3248 <entry>Page number of this page within its large object
3249 (counting from zero)</entry>
3253 <entry><structfield>data</structfield></entry>
3254 <entry><type>bytea</type></entry>
3257 Actual data stored in the large object.
3258 This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
3266 Each row of <structname>pg_largeobject</structname> holds data
3267 for one page of a large object, beginning at
3268 byte offset (<literal>pageno * LOBLKSIZE</>) within the object. The implementation
3269 allows sparse storage: pages might be missing, and might be shorter than
3270 <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
3271 Missing regions within a large object read as zeroes.
3276 <sect1 id="catalog-pg-largeobject-metadata">
3277 <title><structname>pg_largeobject_metadata</structname></title>
3279 <indexterm zone="catalog-pg-largeobject-metadata">
3280 <primary>pg_largeobject_metadata</primary>
3284 The catalog <structname>pg_largeobject_metadata</structname>
3285 holds metadata associated with large objects. The actual large object
3287 <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
3291 <title><structname>pg_largeobject_metadata</> Columns</title>
3298 <entry>References</entry>
3299 <entry>Description</entry>
3305 <entry><structfield>lomowner</structfield></entry>
3306 <entry><type>oid</type></entry>
3307 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3308 <entry>Owner of the large object</entry>
3312 <entry><structfield>lomacl</structfield></entry>
3313 <entry><type>aclitem[]</type></entry>
3316 Access privileges; see
3317 <xref linkend="sql-grant"> and
3318 <xref linkend="sql-revoke">
3328 <sect1 id="catalog-pg-namespace">
3329 <title><structname>pg_namespace</structname></title>
3331 <indexterm zone="catalog-pg-namespace">
3332 <primary>pg_namespace</primary>
3336 The catalog <structname>pg_namespace</> stores namespaces.
3337 A namespace is the structure underlying SQL schemas: each namespace
3338 can have a separate collection of relations, types, etc. without name
3343 <title><structname>pg_namespace</> Columns</title>
3350 <entry>References</entry>
3351 <entry>Description</entry>
3357 <entry><structfield>nspname</structfield></entry>
3358 <entry><type>name</type></entry>
3360 <entry>Name of the namespace</entry>
3364 <entry><structfield>nspowner</structfield></entry>
3365 <entry><type>oid</type></entry>
3366 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3367 <entry>Owner of the namespace</entry>
3371 <entry><structfield>nspacl</structfield></entry>
3372 <entry><type>aclitem[]</type></entry>
3375 Access privileges; see
3376 <xref linkend="sql-grant"> and
3377 <xref linkend="sql-revoke">
3388 <sect1 id="catalog-pg-opclass">
3389 <title><structname>pg_opclass</structname></title>
3391 <indexterm zone="catalog-pg-opclass">
3392 <primary>pg_opclass</primary>
3396 The catalog <structname>pg_opclass</structname> defines
3397 index access method operator classes. Each operator class defines
3398 semantics for index columns of a particular data type and a particular
3399 index access method. An operator class essentially specifies that a
3400 particular operator family is applicable to a particular indexable column
3401 data type. The set of operators from the family that are actually usable
3402 with the indexed column are whichever ones accept the column's data type
3403 as their lefthand input.
3407 Operator classes are described at length in <xref linkend="xindex">.
3411 <title><structname>pg_opclass</> Columns</title>
3418 <entry>References</entry>
3419 <entry>Description</entry>
3425 <entry><structfield>opcmethod</structfield></entry>
3426 <entry><type>oid</type></entry>
3427 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3428 <entry>Index access method operator class is for</entry>
3432 <entry><structfield>opcname</structfield></entry>
3433 <entry><type>name</type></entry>
3435 <entry>Name of this operator class</entry>
3439 <entry><structfield>opcnamespace</structfield></entry>
3440 <entry><type>oid</type></entry>
3441 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3442 <entry>Namespace of this operator class</entry>
3446 <entry><structfield>opcowner</structfield></entry>
3447 <entry><type>oid</type></entry>
3448 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3449 <entry>Owner of the operator class</entry>
3453 <entry><structfield>opcfamily</structfield></entry>
3454 <entry><type>oid</type></entry>
3455 <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3456 <entry>Operator family containing the operator class</entry>
3460 <entry><structfield>opcintype</structfield></entry>
3461 <entry><type>oid</type></entry>
3462 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3463 <entry>Data type that the operator class indexes</entry>
3467 <entry><structfield>opcdefault</structfield></entry>
3468 <entry><type>bool</type></entry>
3470 <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3474 <entry><structfield>opckeytype</structfield></entry>
3475 <entry><type>oid</type></entry>
3476 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3477 <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3485 An operator class's <structfield>opcmethod</> must match the
3486 <structname>opfmethod</> of its containing operator family.
3487 Also, there must be no more than one <structname>pg_opclass</structname>
3488 row having <structname>opcdefault</> true for any given combination of
3489 <structname>opcmethod</> and <structname>opcintype</>.
3495 <sect1 id="catalog-pg-operator">
3496 <title><structname>pg_operator</structname></title>
3498 <indexterm zone="catalog-pg-operator">
3499 <primary>pg_operator</primary>
3503 The catalog <structname>pg_operator</> stores information about operators.
3504 See <xref linkend="sql-createoperator">
3505 and <xref linkend="xoper"> for more information.
3509 <title><structname>pg_operator</> Columns</title>
3516 <entry>References</entry>
3517 <entry>Description</entry>
3523 <entry><structfield>oprname</structfield></entry>
3524 <entry><type>name</type></entry>
3526 <entry>Name of the operator</entry>
3530 <entry><structfield>oprnamespace</structfield></entry>
3531 <entry><type>oid</type></entry>
3532 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3534 The OID of the namespace that contains this operator
3539 <entry><structfield>oprowner</structfield></entry>
3540 <entry><type>oid</type></entry>
3541 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3542 <entry>Owner of the operator</entry>
3546 <entry><structfield>oprkind</structfield></entry>
3547 <entry><type>char</type></entry>
3550 <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3551 (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3556 <entry><structfield>oprcanmerge</structfield></entry>
3557 <entry><type>bool</type></entry>
3559 <entry>This operator supports merge joins</entry>
3563 <entry><structfield>oprcanhash</structfield></entry>
3564 <entry><type>bool</type></entry>
3566 <entry>This operator supports hash joins</entry>
3570 <entry><structfield>oprleft</structfield></entry>
3571 <entry><type>oid</type></entry>
3572 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3573 <entry>Type of the left operand</entry>
3577 <entry><structfield>oprright</structfield></entry>
3578 <entry><type>oid</type></entry>
3579 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3580 <entry>Type of the right operand</entry>
3584 <entry><structfield>oprresult</structfield></entry>
3585 <entry><type>oid</type></entry>
3586 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3587 <entry>Type of the result</entry>
3591 <entry><structfield>oprcom</structfield></entry>
3592 <entry><type>oid</type></entry>
3593 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3594 <entry>Commutator of this operator, if any</entry>
3598 <entry><structfield>oprnegate</structfield></entry>
3599 <entry><type>oid</type></entry>
3600 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3601 <entry>Negator of this operator, if any</entry>
3605 <entry><structfield>oprcode</structfield></entry>
3606 <entry><type>regproc</type></entry>
3607 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3608 <entry>Function that implements this operator</entry>
3612 <entry><structfield>oprrest</structfield></entry>
3613 <entry><type>regproc</type></entry>
3614 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3615 <entry>Restriction selectivity estimation function for this operator</entry>
3619 <entry><structfield>oprjoin</structfield></entry>
3620 <entry><type>regproc</type></entry>
3621 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3622 <entry>Join selectivity estimation function for this operator</entry>
3629 Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3630 is zero for a prefix operator.
3636 <sect1 id="catalog-pg-opfamily">
3637 <title><structname>pg_opfamily</structname></title>
3639 <indexterm zone="catalog-pg-opfamily">
3640 <primary>pg_opfamily</primary>
3644 The catalog <structname>pg_opfamily</structname> defines operator families.
3645 Each operator family is a collection of operators and associated
3646 support routines that implement the semantics specified for a particular
3647 index access method. Furthermore, the operators in a family are all
3648 <quote>compatible</>, in a way that is specified by the access method.
3649 The operator family concept allows cross-data-type operators to be used
3650 with indexes and to be reasoned about using knowledge of access method
3655 Operator families are described at length in <xref linkend="xindex">.
3659 <title><structname>pg_opfamily</> Columns</title>
3666 <entry>References</entry>
3667 <entry>Description</entry>
3673 <entry><structfield>opfmethod</structfield></entry>
3674 <entry><type>oid</type></entry>
3675 <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3676 <entry>Index access method operator family is for</entry>
3680 <entry><structfield>opfname</structfield></entry>
3681 <entry><type>name</type></entry>
3683 <entry>Name of this operator family</entry>
3687 <entry><structfield>opfnamespace</structfield></entry>
3688 <entry><type>oid</type></entry>
3689 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3690 <entry>Namespace of this operator family</entry>
3694 <entry><structfield>opfowner</structfield></entry>
3695 <entry><type>oid</type></entry>
3696 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3697 <entry>Owner of the operator family</entry>
3705 The majority of the information defining an operator family is not in its
3706 <structname>pg_opfamily</structname> row, but in the associated rows in
3707 <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3708 <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3710 <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3716 <sect1 id="catalog-pg-pltemplate">
3717 <title><structname>pg_pltemplate</structname></title>
3719 <indexterm zone="catalog-pg-pltemplate">
3720 <primary>pg_pltemplate</primary>
3724 The catalog <structname>pg_pltemplate</structname> stores
3725 <quote>template</> information for procedural languages.
3726 A template for a language allows the language to be created in a
3727 particular database by a simple <command>CREATE LANGUAGE</> command,
3728 with no need to specify implementation details.
3732 Unlike most system catalogs, <structname>pg_pltemplate</structname>
3733 is shared across all databases of a cluster: there is only one
3734 copy of <structname>pg_pltemplate</structname> per cluster, not
3735 one per database. This allows the information to be accessible in
3736 each database as it is needed.
3740 <title><structname>pg_pltemplate</> Columns</title>
3747 <entry>Description</entry>
3753 <entry><structfield>tmplname</structfield></entry>
3754 <entry><type>name</type></entry>
3755 <entry>Name of the language this template is for</entry>
3759 <entry><structfield>tmpltrusted</structfield></entry>
3760 <entry><type>boolean</type></entry>
3761 <entry>True if language is considered trusted</entry>
3765 <entry><structfield>tmpldbacreate</structfield></entry>
3766 <entry><type>boolean</type></entry>
3767 <entry>True if language may be created by a database owner</entry>
3771 <entry><structfield>tmplhandler</structfield></entry>
3772 <entry><type>text</type></entry>
3773 <entry>Name of call handler function</entry>
3777 <entry><structfield>tmplinline</structfield></entry>
3778 <entry><type>text</type></entry>
3779 <entry>Name of anonymous-block handler function, or null if none</entry>
3783 <entry><structfield>tmplvalidator</structfield></entry>
3784 <entry><type>text</type></entry>
3785 <entry>Name of validator function, or null if none</entry>
3789 <entry><structfield>tmpllibrary</structfield></entry>
3790 <entry><type>text</type></entry>
3791 <entry>Path of shared library that implements language</entry>
3795 <entry><structfield>tmplacl</structfield></entry>
3796 <entry><type>aclitem[]</type></entry>
3797 <entry>Access privileges for template (not yet used)</entry>
3805 There are not currently any commands that manipulate procedural language
3806 templates; to change the built-in information, a superuser must modify
3807 the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3808 or <command>UPDATE</command> commands. It is likely that a future
3809 release of <productname>PostgreSQL</productname> will offer
3810 commands to change the entries in a cleaner fashion.
3814 When implemented, the <structfield>tmplacl</structfield> field will provide
3815 access control for the template itself (i.e., the right to create a
3816 language using it), not for the languages created from the template.
3822 <sect1 id="catalog-pg-proc">
3823 <title><structname>pg_proc</structname></title>
3825 <indexterm zone="catalog-pg-proc">
3826 <primary>pg_proc</primary>
3830 The catalog <structname>pg_proc</> stores information about functions (or procedures).
3831 See <xref linkend="sql-createfunction">
3832 and <xref linkend="xfunc"> for more information.
3836 The table contains data for aggregate functions as well as plain functions.
3837 If <structfield>proisagg</structfield> is true, there should be a matching
3838 row in <structfield>pg_aggregate</structfield>.
3842 <title><structname>pg_proc</> Columns</title>
3849 <entry>References</entry>
3850 <entry>Description</entry>
3856 <entry><structfield>proname</structfield></entry>
3857 <entry><type>name</type></entry>
3859 <entry>Name of the function</entry>
3863 <entry><structfield>pronamespace</structfield></entry>
3864 <entry><type>oid</type></entry>
3865 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3867 The OID of the namespace that contains this function
3872 <entry><structfield>proowner</structfield></entry>
3873 <entry><type>oid</type></entry>
3874 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3875 <entry>Owner of the function</entry>
3879 <entry><structfield>prolang</structfield></entry>
3880 <entry><type>oid</type></entry>
3881 <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3882 <entry>Implementation language or call interface of this function</entry>
3886 <entry><structfield>procost</structfield></entry>
3887 <entry><type>float4</type></entry>
3889 <entry>Estimated execution cost (in units of
3890 <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3891 this is cost per row returned</entry>
3895 <entry><structfield>prorows</structfield></entry>
3896 <entry><type>float4</type></entry>
3898 <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3902 <entry><structfield>provariadic</structfield></entry>
3903 <entry><type>oid</type></entry>
3904 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3905 <entry>Data type of the variadic array parameter's elements,
3906 or zero if the function does not have a variadic parameter</entry>
3910 <entry><structfield>proisagg</structfield></entry>
3911 <entry><type>bool</type></entry>
3913 <entry>Function is an aggregate function</entry>
3917 <entry><structfield>proiswindow</structfield></entry>
3918 <entry><type>bool</type></entry>
3920 <entry>Function is a window function</entry>
3924 <entry><structfield>prosecdef</structfield></entry>
3925 <entry><type>bool</type></entry>
3927 <entry>Function is a security definer (i.e., a <quote>setuid</>
3932 <entry><structfield>proisstrict</structfield></entry>
3933 <entry><type>bool</type></entry>
3936 Function returns null if any call argument is null. In that
3937 case the function won't actually be called at all. Functions
3938 that are not <quote>strict</quote> must be prepared to handle
3944 <entry><structfield>proretset</structfield></entry>
3945 <entry><type>bool</type></entry>
3947 <entry>Function returns a set (i.e., multiple values of the specified
3952 <entry><structfield>provolatile</structfield></entry>
3953 <entry><type>char</type></entry>
3956 <structfield>provolatile</structfield> tells whether the function's
3957 result depends only on its input arguments, or is affected by outside
3959 It is <literal>i</literal> for <quote>immutable</> functions,
3960 which always deliver the same result for the same inputs.
3961 It is <literal>s</literal> for <quote>stable</> functions,
3962 whose results (for fixed inputs) do not change within a scan.
3963 It is <literal>v</literal> for <quote>volatile</> functions,
3964 whose results might change at any time. (Use <literal>v</literal> also
3965 for functions with side-effects, so that calls to them cannot get
3971 <entry><structfield>pronargs</structfield></entry>
3972 <entry><type>int2</type></entry>
3974 <entry>Number of input arguments</entry>
3978 <entry><structfield>pronargdefaults</structfield></entry>
3979 <entry><type>int2</type></entry>
3981 <entry>Number of arguments that have defaults</entry>
3985 <entry><structfield>prorettype</structfield></entry>
3986 <entry><type>oid</type></entry>
3987 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3988 <entry>Data type of the return value</entry>
3992 <entry><structfield>proargtypes</structfield></entry>
3993 <entry><type>oidvector</type></entry>
3994 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3996 An array with the data types of the function arguments. This includes
3997 only input arguments (including <literal>INOUT</literal> and
3998 <literal>VARIADIC</> arguments), and thus represents
3999 the call signature of the function.
4004 <entry><structfield>proallargtypes</structfield></entry>
4005 <entry><type>oid[]</type></entry>
4006 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4008 An array with the data types of the function arguments. This includes
4009 all arguments (including <literal>OUT</literal> and
4010 <literal>INOUT</literal> arguments); however, if all the
4011 arguments are <literal>IN</literal> arguments, this field will be null.
4012 Note that subscripting is 1-based, whereas for historical reasons
4013 <structfield>proargtypes</> is subscripted from 0.
4018 <entry><structfield>proargmodes</structfield></entry>
4019 <entry><type>char[]</type></entry>
4022 An array with the modes of the function arguments, encoded as
4023 <literal>i</literal> for <literal>IN</> arguments,
4024 <literal>o</literal> for <literal>OUT</> arguments,
4025 <literal>b</literal> for <literal>INOUT</> arguments,
4026 <literal>v</literal> for <literal>VARIADIC</> arguments,
4027 <literal>t</literal> for <literal>TABLE</> arguments.
4028 If all the arguments are <literal>IN</literal> arguments,
4029 this field will be null.
4030 Note that subscripts correspond to positions of
4031 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4036 <entry><structfield>proargnames</structfield></entry>
4037 <entry><type>text[]</type></entry>
4040 An array with the names of the function arguments.
4041 Arguments without a name are set to empty strings in the array.
4042 If none of the arguments have a name, this field will be null.
4043 Note that subscripts correspond to positions of
4044 <structfield>proallargtypes</> not <structfield>proargtypes</>.
4049 <entry><structfield>proargdefaults</structfield></entry>
4050 <entry><type>text</type></entry>
4053 Expression trees (in <function>nodeToString()</function> representation)
4054 for default values. This is a list with
4055 <structfield>pronargdefaults</> elements, corresponding to the last
4056 <replaceable>N</> <emphasis>input</> arguments (i.e., the last
4057 <replaceable>N</> <structfield>proargtypes</> positions).
4058 If none of the arguments have defaults, this field will be null.
4063 <entry><structfield>prosrc</structfield></entry>
4064 <entry><type>text</type></entry>
4067 This tells the function handler how to invoke the function. It
4068 might be the actual source code of the function for interpreted
4069 languages, a link symbol, a file name, or just about anything
4070 else, depending on the implementation language/call convention.
4075 <entry><structfield>probin</structfield></entry>
4076 <entry><type>text</type></entry>
4079 Additional information about how to invoke the function.
4080 Again, the interpretation is language-specific.
4085 <entry><structfield>proconfig</structfield></entry>
4086 <entry><type>text[]</type></entry>
4088 <entry>Function's local settings for run-time configuration variables</entry>
4092 <entry><structfield>proacl</structfield></entry>
4093 <entry><type>aclitem[]</type></entry>
4096 Access privileges; see
4097 <xref linkend="sql-grant"> and
4098 <xref linkend="sql-revoke">
4107 For compiled functions, both built-in and dynamically loaded,
4108 <structfield>prosrc</structfield> contains the function's C-language
4109 name (link symbol). For all other currently-known language types,
4110 <structfield>prosrc</structfield> contains the function's source
4111 text. <structfield>probin</structfield> is unused except for
4112 dynamically-loaded C functions, for which it gives the name of the
4113 shared library file containing the function.
4118 <sect1 id="catalog-pg-rewrite">
4119 <title><structname>pg_rewrite</structname></title>
4121 <indexterm zone="catalog-pg-rewrite">
4122 <primary>pg_rewrite</primary>
4126 The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
4130 <title><structname>pg_rewrite</> Columns</title>
4137 <entry>References</entry>
4138 <entry>Description</entry>
4144 <entry><structfield>rulename</structfield></entry>
4145 <entry><type>name</type></entry>
4147 <entry>Rule name</entry>
4151 <entry><structfield>ev_class</structfield></entry>
4152 <entry><type>oid</type></entry>
4153 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4154 <entry>The table this rule is for</entry>
4158 <entry><structfield>ev_attr</structfield></entry>
4159 <entry><type>int2</type></entry>
4161 <entry>The column this rule is for (currently, always zero to
4162 indicate the whole table)</entry>
4166 <entry><structfield>ev_type</structfield></entry>
4167 <entry><type>char</type></entry>
4170 Event type that the rule is for: 1 = <command>SELECT</>, 2 =
4171 <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
4177 <entry><structfield>ev_enabled</structfield></entry>
4178 <entry><type>char</type></entry>
4181 Controls in which <xref linkend="guc-session-replication-role"> modes
4183 <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
4184 <literal>D</> = rule is disabled,
4185 <literal>R</> = rule fires in <quote>replica</> mode,
4186 <literal>A</> = rule fires always.
4191 <entry><structfield>is_instead</structfield></entry>
4192 <entry><type>bool</type></entry>
4194 <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
4198 <entry><structfield>ev_qual</structfield></entry>
4199 <entry><type>text</type></entry>
4202 Expression tree (in the form of a
4203 <function>nodeToString()</function> representation) for the
4204 rule's qualifying condition
4209 <entry><structfield>ev_action</structfield></entry>
4210 <entry><type>text</type></entry>
4213 Query tree (in the form of a
4214 <function>nodeToString()</function> representation) for the
4224 <literal>pg_class.relhasrules</literal>
4225 must be true if a table has any rules in this catalog.
4232 <sect1 id="catalog-pg-shdepend">
4233 <title><structname>pg_shdepend</structname></title>
4235 <indexterm zone="catalog-pg-shdepend">
4236 <primary>pg_shdepend</primary>
4240 The catalog <structname>pg_shdepend</structname> records the
4241 dependency relationships between database objects and shared objects,
4242 such as roles. This information allows
4243 <productname>PostgreSQL</productname> to ensure that those objects are
4244 unreferenced before attempting to delete them.
4248 See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
4249 which performs a similar function for dependencies involving objects
4250 within a single database.
4254 Unlike most system catalogs, <structname>pg_shdepend</structname>
4255 is shared across all databases of a cluster: there is only one
4256 copy of <structname>pg_shdepend</structname> per cluster, not
4261 <title><structname>pg_shdepend</> Columns</title>
4268 <entry>References</entry>
4269 <entry>Description</entry>
4275 <entry><structfield>dbid</structfield></entry>
4276 <entry><type>oid</type></entry>
4277 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
4278 <entry>The OID of the database the dependent object is in,
4279 or zero for a shared object</entry>
4283 <entry><structfield>classid</structfield></entry>
4284 <entry><type>oid</type></entry>
4285 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4286 <entry>The OID of the system catalog the dependent object is in</entry>
4290 <entry><structfield>objid</structfield></entry>
4291 <entry><type>oid</type></entry>
4292 <entry>any OID column</entry>
4293 <entry>The OID of the specific dependent object</entry>
4297 <entry><structfield>objsubid</structfield></entry>
4298 <entry><type>int4</type></entry>
4301 For a table column, this is the column number (the
4302 <structfield>objid</> and <structfield>classid</> refer to the
4303 table itself). For all other object types, this column is zero.
4308 <entry><structfield>refclassid</structfield></entry>
4309 <entry><type>oid</type></entry>
4310 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4311 <entry>The OID of the system catalog the referenced object is in
4312 (must be a shared catalog)</entry>
4316 <entry><structfield>refobjid</structfield></entry>
4317 <entry><type>oid</type></entry>
4318 <entry>any OID column</entry>
4319 <entry>The OID of the specific referenced object</entry>
4323 <entry><structfield>deptype</structfield></entry>
4324 <entry><type>char</type></entry>
4327 A code defining the specific semantics of this dependency relationship; see text
4336 In all cases, a <structname>pg_shdepend</structname> entry indicates that
4337 the referenced object cannot be dropped without also dropping the dependent
4338 object. However, there are several subflavors identified by
4339 <structfield>deptype</>:
4343 <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
4346 The referenced object (which must be a role) is the owner of the
4353 <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
4356 The referenced object (which must be a role) is mentioned in the
4357 ACL (access control list, i.e., privileges list) of the
4358 dependent object. (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
4359 not made for the owner of the object, since the owner will have
4360 a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
4366 <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
4369 There is no dependent object; this type of entry is a signal
4370 that the system itself depends on the referenced object, and so
4371 that object must never be deleted. Entries of this type are
4372 created only by <command>initdb</command>. The columns for the
4373 dependent object contain zeroes.
4379 Other dependency flavors might be needed in future. Note in particular
4380 that the current definition only supports roles as referenced objects.
4385 <sect1 id="catalog-pg-shdescription">
4386 <title><structname>pg_shdescription</structname></title>
4388 <indexterm zone="catalog-pg-shdescription">
4389 <primary>pg_shdescription</primary>
4393 The catalog <structname>pg_shdescription</structname> stores optional
4394 descriptions (comments) for shared database objects. Descriptions can be
4395 manipulated with the <xref linkend="sql-comment"> command and viewed with
4396 <application>psql</application>'s <literal>\d</literal> commands.
4400 See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4401 which performs a similar function for descriptions involving objects
4402 within a single database.
4406 Unlike most system catalogs, <structname>pg_shdescription</structname>
4407 is shared across all databases of a cluster: there is only one
4408 copy of <structname>pg_shdescription</structname> per cluster, not
4413 <title><structname>pg_shdescription</> Columns</title>
4420 <entry>References</entry>
4421 <entry>Description</entry>
4427 <entry><structfield>objoid</structfield></entry>
4428 <entry><type>oid</type></entry>
4429 <entry>any OID column</entry>
4430 <entry>The OID of the object this description pertains to</entry>
4434 <entry><structfield>classoid</structfield></entry>
4435 <entry><type>oid</type></entry>
4436 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4437 <entry>The OID of the system catalog this object appears in</entry>
4441 <entry><structfield>description</structfield></entry>
4442 <entry><type>text</type></entry>
4444 <entry>Arbitrary text that serves as the description of this object</entry>
4453 <sect1 id="catalog-pg-statistic">
4454 <title><structname>pg_statistic</structname></title>
4456 <indexterm zone="catalog-pg-statistic">
4457 <primary>pg_statistic</primary>
4461 The catalog <structname>pg_statistic</structname> stores
4462 statistical data about the contents of the database. Entries are
4463 created by <xref linkend="sql-analyze">
4464 and subsequently used by the query planner. Note that all the
4465 statistical data is inherently approximate, even assuming that it
4470 Normally there is one entry, with <structfield>stainherit</> =
4471 <literal>false</>, for each table column that has been analyzed.
4472 If the table has inheritance children, a second entry with
4473 <structfield>stainherit</> = <literal>true</> is also created. This row
4474 represents the column's statistics over the inheritance tree, i.e.,
4475 statistics for the data you'd see with
4476 <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
4477 whereas the <structfield>stainherit</> = <literal>false</> row represents
4479 <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
4483 <structname>pg_statistic</structname> also stores statistical data about
4484 the values of index expressions. These are described as if they were
4485 actual data columns; in particular, <structfield>starelid</structfield>
4486 references the index. No entry is made for an ordinary non-expression
4487 index column, however, since it would be redundant with the entry
4488 for the underlying table column. Currently, entries for index expressions
4489 always have <structfield>stainherit</> = <literal>false</>.
4493 Since different kinds of statistics might be appropriate for different
4494 kinds of data, <structname>pg_statistic</structname> is designed not
4495 to assume very much about what sort of statistics it stores. Only
4496 extremely general statistics (such as nullness) are given dedicated
4497 columns in <structname>pg_statistic</structname>. Everything else
4498 is stored in <quote>slots</quote>, which are groups of associated columns
4499 whose content is identified by a code number in one of the slot's columns.
4500 For more information see
4501 <filename>src/include/catalog/pg_statistic.h</filename>.
4505 <structname>pg_statistic</structname> should not be readable by the
4506 public, since even statistical information about a table's contents
4507 might be considered sensitive. (Example: minimum and maximum values
4508 of a salary column might be quite interesting.)
4509 <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4510 is a publicly readable view on
4511 <structname>pg_statistic</structname> that only exposes information
4512 about those tables that are readable by the current user.
4516 <title><structname>pg_statistic</> Columns</title>
4523 <entry>References</entry>
4524 <entry>Description</entry>
4530 <entry><structfield>starelid</structfield></entry>
4531 <entry><type>oid</type></entry>
4532 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4533 <entry>The table or index that the described column belongs to</entry>
4537 <entry><structfield>staattnum</structfield></entry>
4538 <entry><type>int2</type></entry>
4539 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4540 <entry>The number of the described column</entry>
4544 <entry><structfield>stainherit</structfield></entry>
4545 <entry><type>bool</type></entry>
4547 <entry>If true, the stats include inheritance child columns, not just the
4548 values in the specified relation</entry>
4552 <entry><structfield>stanullfrac</structfield></entry>
4553 <entry><type>float4</type></entry>
4555 <entry>The fraction of the column's entries that are null</entry>
4559 <entry><structfield>stawidth</structfield></entry>
4560 <entry><type>int4</type></entry>
4562 <entry>The average stored width, in bytes, of nonnull entries</entry>
4566 <entry><structfield>stadistinct</structfield></entry>
4567 <entry><type>float4</type></entry>
4569 <entry>The number of distinct nonnull data values in the column.
4570 A value greater than zero is the actual number of distinct values.
4571 A value less than zero is the negative of a multiplier for the number
4572 of rows in the table; for example, a column in which values appear about
4573 twice on the average could be represented by
4574 <structfield>stadistinct</> = -0.5.
4575 A zero value means the number of distinct values is unknown.
4580 <entry><structfield>stakind<replaceable>N</></structfield></entry>
4581 <entry><type>int2</type></entry>
4584 A code number indicating the kind of statistics stored in the
4585 <replaceable>N</>th <quote>slot</quote> of the
4586 <structname>pg_statistic</structname> row.
4591 <entry><structfield>staop<replaceable>N</></structfield></entry>
4592 <entry><type>oid</type></entry>
4593 <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4595 An operator used to derive the statistics stored in the
4596 <replaceable>N</>th <quote>slot</quote>. For example, a
4597 histogram slot would show the <literal><</literal> operator
4598 that defines the sort order of the data.
4603 <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4604 <entry><type>float4[]</type></entry>
4607 Numerical statistics of the appropriate kind for the
4608 <replaceable>N</>th <quote>slot</quote>, or null if the slot
4609 kind does not involve numerical values
4614 <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4615 <entry><type>anyarray</type></entry>
4618 Column data values of the appropriate kind for the
4619 <replaceable>N</>th <quote>slot</quote>, or null if the slot
4620 kind does not store any data values. Each array's element
4621 values are actually of the specific column's data type, so there
4622 is no way to define these columns' type more specifically than
4633 <sect1 id="catalog-pg-tablespace">
4634 <title><structname>pg_tablespace</structname></title>
4636 <indexterm zone="catalog-pg-tablespace">
4637 <primary>pg_tablespace</primary>
4641 The catalog <structname>pg_tablespace</structname> stores information
4642 about the available tablespaces. Tables can be placed in particular
4643 tablespaces to aid administration of disk layout.
4647 Unlike most system catalogs, <structname>pg_tablespace</structname>
4648 is shared across all databases of a cluster: there is only one
4649 copy of <structname>pg_tablespace</structname> per cluster, not
4654 <title><structname>pg_tablespace</> Columns</title>
4661 <entry>References</entry>
4662 <entry>Description</entry>
4668 <entry><structfield>spcname</structfield></entry>
4669 <entry><type>name</type></entry>
4671 <entry>Tablespace name</entry>
4675 <entry><structfield>spcowner</structfield></entry>
4676 <entry><type>oid</type></entry>
4677 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4678 <entry>Owner of the tablespace, usually the user who created it</entry>
4682 <entry><structfield>spclocation</structfield></entry>
4683 <entry><type>text</type></entry>
4685 <entry>Location (directory path) of the tablespace</entry>
4689 <entry><structfield>spcacl</structfield></entry>
4690 <entry><type>aclitem[]</type></entry>
4693 Access privileges; see
4694 <xref linkend="sql-grant"> and
4695 <xref linkend="sql-revoke">
4701 <entry><structfield>spcoptions</structfield></entry>
4702 <entry><type>text[]</type></entry>
4705 Tablespace-level options, as <quote>keyword=value</> strings
4714 <sect1 id="catalog-pg-trigger">
4715 <title><structname>pg_trigger</structname></title>
4717 <indexterm zone="catalog-pg-trigger">
4718 <primary>pg_trigger</primary>
4722 The catalog <structname>pg_trigger</structname> stores triggers on tables.
4723 See <xref linkend="sql-createtrigger">
4724 for more information.
4728 <title><structname>pg_trigger</> Columns</title>
4735 <entry>References</entry>
4736 <entry>Description</entry>
4742 <entry><structfield>tgrelid</structfield></entry>
4743 <entry><type>oid</type></entry>
4744 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4745 <entry>The table this trigger is on</entry>
4749 <entry><structfield>tgname</structfield></entry>
4750 <entry><type>name</type></entry>
4752 <entry>Trigger name (must be unique among triggers of same table)</entry>
4756 <entry><structfield>tgfoid</structfield></entry>
4757 <entry><type>oid</type></entry>
4758 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4759 <entry>The function to be called</entry>
4763 <entry><structfield>tgtype</structfield></entry>
4764 <entry><type>int2</type></entry>
4766 <entry>Bit mask identifying trigger conditions</entry>
4770 <entry><structfield>tgenabled</structfield></entry>
4771 <entry><type>char</type></entry>
4774 Controls in which <xref linkend="guc-session-replication-role"> modes
4776 <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4777 <literal>D</> = trigger is disabled,
4778 <literal>R</> = trigger fires in <quote>replica</> mode,
4779 <literal>A</> = trigger fires always.
4784 <entry><structfield>tgisinternal</structfield></entry>
4785 <entry><type>bool</type></entry>
4787 <entry>True if trigger is internally generated (usually, to enforce
4788 the constraint identified by <structfield>tgconstraint</>)</entry>
4792 <entry><structfield>tgconstrrelid</structfield></entry>
4793 <entry><type>oid</type></entry>
4794 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4795 <entry>The table referenced by a referential integrity constraint</entry>
4799 <entry><structfield>tgconstrindid</structfield></entry>
4800 <entry><type>oid</type></entry>
4801 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4802 <entry>The index supporting a unique, primary key, or referential integrity constraint</entry>
4806 <entry><structfield>tgconstraint</structfield></entry>
4807 <entry><type>oid</type></entry>
4808 <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4809 <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
4813 <entry><structfield>tgdeferrable</structfield></entry>
4814 <entry><type>bool</type></entry>
4816 <entry>True if constraint trigger is deferrable</entry>
4820 <entry><structfield>tginitdeferred</structfield></entry>
4821 <entry><type>bool</type></entry>
4823 <entry>True if constraint trigger is initially deferred</entry>
4827 <entry><structfield>tgnargs</structfield></entry>
4828 <entry><type>int2</type></entry>
4830 <entry>Number of argument strings passed to trigger function</entry>
4834 <entry><structfield>tgattr</structfield></entry>
4835 <entry><type>int2vector</type></entry>
4836 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4837 <entry>Column numbers, if trigger is column-specific; otherwise an
4842 <entry><structfield>tgargs</structfield></entry>
4843 <entry><type>bytea</type></entry>
4845 <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4849 <entry><structfield>tgqual</structfield></entry>
4850 <entry><type>text</type></entry>
4852 <entry>Expression tree (in <function>nodeToString()</function>
4853 representation) for the trigger's <literal>WHEN</> condition, or null
4861 Currently, column-specific triggering is supported only for
4862 <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
4863 only for that event type. <structfield>tgtype</structfield> might
4864 contain bits for other event types as well, but those are presumed
4865 to be table-wide regardless of what is in <structfield>tgattr</>.
4870 When <structfield>tgconstraint</> is nonzero,
4871 <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
4872 <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
4873 largely redundant with the referenced <structname>pg_constraint</> entry.
4874 However, it is possible for a non-deferrable trigger to be associated
4875 with a deferrable constraint: foreign key constraints can have some
4876 deferrable and some non-deferrable triggers.
4882 <literal>pg_class.relhastriggers</literal>
4883 must be true if a table has any triggers in this catalog.
4890 <sect1 id="catalog-pg-ts-config">
4891 <title><structname>pg_ts_config</structname></title>
4893 <indexterm zone="catalog-pg-ts-config">
4894 <primary>pg_ts_config</primary>
4898 The <structname>pg_ts_config</structname> catalog contains entries
4899 representing text search configurations. A configuration specifies
4900 a particular text search parser and a list of dictionaries to use
4901 for each of the parser's output token types. The parser is shown
4902 in the <structname>pg_ts_config</structname> entry, but the
4903 token-to-dictionary mapping is defined by subsidiary entries in <link
4904 linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4908 <productname>PostgreSQL</productname>'s text search features are
4909 described at length in <xref linkend="textsearch">.
4913 <title><structname>pg_ts_config</> Columns</title>
4920 <entry>References</entry>
4921 <entry>Description</entry>
4927 <entry><structfield>cfgname</structfield></entry>
4928 <entry><type>name</type></entry>
4930 <entry>Text search configuration name</entry>
4934 <entry><structfield>cfgnamespace</structfield></entry>
4935 <entry><type>oid</type></entry>
4936 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4938 The OID of the namespace that contains this configuration
4943 <entry><structfield>cfgowner</structfield></entry>
4944 <entry><type>oid</type></entry>
4945 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4946 <entry>Owner of the configuration</entry>
4950 <entry><structfield>cfgparser</structfield></entry>
4951 <entry><type>oid</type></entry>
4952 <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4953 <entry>The OID of the text search parser for this configuration</entry>
4961 <sect1 id="catalog-pg-ts-config-map">
4962 <title><structname>pg_ts_config_map</structname></title>
4964 <indexterm zone="catalog-pg-ts-config-map">
4965 <primary>pg_ts_config_map</primary>
4969 The <structname>pg_ts_config_map</structname> catalog contains entries
4970 showing which text search dictionaries should be consulted, and in
4971 what order, for each output token type of each text search configuration's
4976 <productname>PostgreSQL</productname>'s text search features are
4977 described at length in <xref linkend="textsearch">.
4981 <title><structname>pg_ts_config_map</> Columns</title>
4988 <entry>References</entry>
4989 <entry>Description</entry>
4995 <entry><structfield>mapcfg</structfield></entry>
4996 <entry><type>oid</type></entry>
4997 <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4998 <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
5002 <entry><structfield>maptokentype</structfield></entry>
5003 <entry><type>integer</type></entry>
5005 <entry>A token type emitted by the configuration's parser</entry>
5009 <entry><structfield>mapseqno</structfield></entry>
5010 <entry><type>integer</type></entry>
5012 <entry>Order in which to consult this entry (lower
5013 <structfield>mapseqno</>s first)</entry>
5017 <entry><structfield>mapdict</structfield></entry>
5018 <entry><type>oid</type></entry>
5019 <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
5020 <entry>The OID of the text search dictionary to consult</entry>
5028 <sect1 id="catalog-pg-ts-dict">
5029 <title><structname>pg_ts_dict</structname></title>
5031 <indexterm zone="catalog-pg-ts-dict">
5032 <primary>pg_ts_dict</primary>
5036 The <structname>pg_ts_dict</structname> catalog contains entries
5037 defining text search dictionaries. A dictionary depends on a text
5038 search template, which specifies all the implementation functions
5039 needed; the dictionary itself provides values for the user-settable
5040 parameters supported by the template. This division of labor allows
5041 dictionaries to be created by unprivileged users. The parameters
5042 are specified by a text string <structfield>dictinitoption</>,
5043 whose format and meaning vary depending on the template.
5047 <productname>PostgreSQL</productname>'s text search features are
5048 described at length in <xref linkend="textsearch">.
5052 <title><structname>pg_ts_dict</> Columns</title>
5059 <entry>References</entry>
5060 <entry>Description</entry>
5066 <entry><structfield>dictname</structfield></entry>
5067 <entry><type>name</type></entry>
5069 <entry>Text search dictionary name</entry>
5073 <entry><structfield>dictnamespace</structfield></entry>
5074 <entry><type>oid</type></entry>
5075 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5077 The OID of the namespace that contains this dictionary
5082 <entry><structfield>dictowner</structfield></entry>
5083 <entry><type>oid</type></entry>
5084 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5085 <entry>Owner of the dictionary</entry>
5089 <entry><structfield>dicttemplate</structfield></entry>
5090 <entry><type>oid</type></entry>
5091 <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
5092 <entry>The OID of the text search template for this dictionary</entry>
5096 <entry><structfield>dictinitoption</structfield></entry>
5097 <entry><type>text</type></entry>
5099 <entry>Initialization option string for the template</entry>
5107 <sect1 id="catalog-pg-ts-parser">
5108 <title><structname>pg_ts_parser</structname></title>
5110 <indexterm zone="catalog-pg-ts-parser">
5111 <primary>pg_ts_parser</primary>
5115 The <structname>pg_ts_parser</structname> catalog contains entries
5116 defining text search parsers. A parser is responsible for splitting
5117 input text into lexemes and assigning a token type to each lexeme.
5118 Since a parser must be implemented by C-language-level functions,
5119 creation of new parsers is restricted to database superusers.
5123 <productname>PostgreSQL</productname>'s text search features are
5124 described at length in <xref linkend="textsearch">.
5128 <title><structname>pg_ts_parser</> Columns</title>
5135 <entry>References</entry>
5136 <entry>Description</entry>
5142 <entry><structfield>prsname</structfield></entry>
5143 <entry><type>name</type></entry>
5145 <entry>Text search parser name</entry>
5149 <entry><structfield>prsnamespace</structfield></entry>
5150 <entry><type>oid</type></entry>
5151 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5153 The OID of the namespace that contains this parser
5158 <entry><structfield>prsstart</structfield></entry>
5159 <entry><type>regproc</type></entry>
5160 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5161 <entry>OID of the parser's startup function</entry>
5165 <entry><structfield>prstoken</structfield></entry>
5166 <entry><type>regproc</type></entry>
5167 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5168 <entry>OID of the parser's next-token function</entry>
5172 <entry><structfield>prsend</structfield></entry>
5173 <entry><type>regproc</type></entry>
5174 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5175 <entry>OID of the parser's shutdown function</entry>
5179 <entry><structfield>prsheadline</structfield></entry>
5180 <entry><type>regproc</type></entry>
5181 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5182 <entry>OID of the parser's headline function</entry>
5186 <entry><structfield>prslextype</structfield></entry>
5187 <entry><type>regproc</type></entry>
5188 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5189 <entry>OID of the parser's lextype function</entry>
5197 <sect1 id="catalog-pg-ts-template">
5198 <title><structname>pg_ts_template</structname></title>
5200 <indexterm zone="catalog-pg-ts-template">
5201 <primary>pg_ts_template</primary>
5205 The <structname>pg_ts_template</structname> catalog contains entries
5206 defining text search templates. A template is the implementation
5207 skeleton for a class of text search dictionaries.
5208 Since a template must be implemented by C-language-level functions,
5209 creation of new templates is restricted to database superusers.
5213 <productname>PostgreSQL</productname>'s text search features are
5214 described at length in <xref linkend="textsearch">.
5218 <title><structname>pg_ts_template</> Columns</title>
5225 <entry>References</entry>
5226 <entry>Description</entry>
5232 <entry><structfield>tmplname</structfield></entry>
5233 <entry><type>name</type></entry>
5235 <entry>Text search template name</entry>
5239 <entry><structfield>tmplnamespace</structfield></entry>
5240 <entry><type>oid</type></entry>
5241 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5243 The OID of the namespace that contains this template
5248 <entry><structfield>tmplinit</structfield></entry>
5249 <entry><type>regproc</type></entry>
5250 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5251 <entry>OID of the template's initialization function</entry>
5255 <entry><structfield>tmpllexize</structfield></entry>
5256 <entry><type>regproc</type></entry>
5257 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5258 <entry>OID of the template's lexize function</entry>
5266 <sect1 id="catalog-pg-type">
5267 <title><structname>pg_type</structname></title>
5269 <indexterm zone="catalog-pg-type">
5270 <primary>pg_type</primary>
5274 The catalog <structname>pg_type</structname> stores information about data
5275 types. Base types and enum types (scalar types) are created with
5276 <xref linkend="sql-createtype">, and
5278 <xref linkend="sql-createdomain">.
5279 A composite type is automatically created for each table in the database, to
5280 represent the row structure of the table. It is also possible to create
5281 composite types with <command>CREATE TYPE AS</command>.
5285 <title><structname>pg_type</> Columns</title>
5292 <entry>References</entry>
5293 <entry>Description</entry>
5299 <entry><structfield>typname</structfield></entry>
5300 <entry><type>name</type></entry>
5302 <entry>Data type name</entry>
5306 <entry><structfield>typnamespace</structfield></entry>
5307 <entry><type>oid</type></entry>
5308 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5310 The OID of the namespace that contains this type
5315 <entry><structfield>typowner</structfield></entry>
5316 <entry><type>oid</type></entry>
5317 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5318 <entry>Owner of the type</entry>
5322 <entry><structfield>typlen</structfield></entry>
5323 <entry><type>int2</type></entry>
5326 For a fixed-size type, <structfield>typlen</structfield> is the number
5327 of bytes in the internal representation of the type. But for a
5328 variable-length type, <structfield>typlen</structfield> is negative.
5329 -1 indicates a <quote>varlena</> type (one that has a length word),
5330 -2 indicates a null-terminated C string.
5335 <entry><structfield>typbyval</structfield></entry>
5336 <entry><type>bool</type></entry>
5339 <structfield>typbyval</structfield> determines whether internal
5340 routines pass a value of this type by value or by reference.
5341 <structfield>typbyval</structfield> had better be false if
5342 <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
5343 where Datum is 8 bytes).
5344 Variable-length types are always passed by reference. Note that
5345 <structfield>typbyval</structfield> can be false even if the
5346 length would allow pass-by-value.
5351 <entry><structfield>typtype</structfield></entry>
5352 <entry><type>char</type></entry>
5355 <structfield>typtype</structfield> is
5356 <literal>b</literal> for a base type,
5357 <literal>c</literal> for a composite type (e.g., a table's row type),
5358 <literal>d</literal> for a domain,
5359 <literal>e</literal> for an enum type,
5360 or <literal>p</literal> for a pseudo-type.
5361 See also <structfield>typrelid</structfield> and
5362 <structfield>typbasetype</structfield>.
5367 <entry><structfield>typcategory</structfield></entry>
5368 <entry><type>char</type></entry>
5371 <structfield>typcategory</structfield> is an arbitrary classification
5372 of data types that is used by the parser to determine which implicit
5373 casts should be <quote>preferred</>.
5374 See <xref linkend="catalog-typcategory-table">.
5379 <entry><structfield>typispreferred</structfield></entry>
5380 <entry><type>bool</type></entry>
5383 True if the type is a preferred cast target within its
5384 <structfield>typcategory</structfield>
5389 <entry><structfield>typisdefined</structfield></entry>
5390 <entry><type>bool</type></entry>
5393 True if the type is defined, false if this is a placeholder
5394 entry for a not-yet-defined type. When
5395 <structfield>typisdefined</structfield> is false, nothing
5396 except the type name, namespace, and OID can be relied on.
5401 <entry><structfield>typdelim</structfield></entry>
5402 <entry><type>char</type></entry>
5405 Character that separates two values of this type when parsing
5406 array input. Note that the delimiter is associated with the array
5407 element data type, not the array data type.
5412 <entry><structfield>typrelid</structfield></entry>
5413 <entry><type>oid</type></entry>
5414 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5416 If this is a composite type (see
5417 <structfield>typtype</structfield>), then this column points to
5418 the <structname>pg_class</structname> entry that defines the
5419 corresponding table. (For a free-standing composite type, the
5420 <structname>pg_class</structname> entry doesn't really represent
5421 a table, but it is needed anyway for the type's
5422 <structname>pg_attribute</structname> entries to link to.)
5423 Zero for non-composite types.
5428 <entry><structfield>typelem</structfield></entry>
5429 <entry><type>oid</type></entry>
5430 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5432 If <structfield>typelem</structfield> is not 0 then it
5433 identifies another row in <structname>pg_type</structname>.
5434 The current type can then be subscripted like an array yielding
5435 values of type <structfield>typelem</structfield>. A
5436 <quote>true</quote> array type is variable length
5437 (<structfield>typlen</structfield> = -1),
5438 but some fixed-length (<structfield>typlen</structfield> > 0) types
5439 also have nonzero <structfield>typelem</structfield>, for example
5440 <type>name</type> and <type>point</type>.
5441 If a fixed-length type has a <structfield>typelem</structfield> then
5442 its internal representation must be some number of values of the
5443 <structfield>typelem</structfield> data type with no other data.
5444 Variable-length array types have a header defined by the array
5450 <entry><structfield>typarray</structfield></entry>
5451 <entry><type>oid</type></entry>
5452 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5454 If <structfield>typarray</structfield> is not 0 then it
5455 identifies another row in <structname>pg_type</structname>, which
5456 is the <quote>true</quote> array type having this type as element
5461 <entry><structfield>typinput</structfield></entry>
5462 <entry><type>regproc</type></entry>
5463 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5464 <entry>Input conversion function (text format)</entry>
5468 <entry><structfield>typoutput</structfield></entry>
5469 <entry><type>regproc</type></entry>
5470 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5471 <entry>Output conversion function (text format)</entry>
5475 <entry><structfield>typreceive</structfield></entry>
5476 <entry><type>regproc</type></entry>
5477 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5478 <entry>Input conversion function (binary format), or 0 if none</entry>
5482 <entry><structfield>typsend</structfield></entry>
5483 <entry><type>regproc</type></entry>
5484 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5485 <entry>Output conversion function (binary format), or 0 if none</entry>
5489 <entry><structfield>typmodin</structfield></entry>
5490 <entry><type>regproc</type></entry>
5491 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5492 <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5496 <entry><structfield>typmodout</structfield></entry>
5497 <entry><type>regproc</type></entry>
5498 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5499 <entry>Type modifier output function, or 0 to use the standard format</entry>
5503 <entry><structfield>typanalyze</structfield></entry>
5504 <entry><type>regproc</type></entry>
5505 <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5506 <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
5510 <entry><structfield>typalign</structfield></entry>
5511 <entry><type>char</type></entry>
5515 <structfield>typalign</structfield> is the alignment required
5516 when storing a value of this type. It applies to storage on
5517 disk as well as most representations of the value inside
5518 <productname>PostgreSQL</>.
5519 When multiple values are stored consecutively, such
5520 as in the representation of a complete row on disk, padding is
5521 inserted before a datum of this type so that it begins on the
5522 specified boundary. The alignment reference is the beginning
5523 of the first datum in the sequence.
5527 Possible values are:
5530 <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5533 <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5536 <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5539 <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5544 For types used in system tables, it is critical that the size
5545 and alignment defined in <structname>pg_type</structname>
5546 agree with the way that the compiler will lay out the column in
5547 a structure representing a table row.
5553 <entry><structfield>typstorage</structfield></entry>
5554 <entry><type>char</type></entry>
5557 <structfield>typstorage</structfield> tells for varlena
5558 types (those with <structfield>typlen</structfield> = -1) if
5559 the type is prepared for toasting and what the default strategy
5560 for attributes of this type should be.
5564 <para><literal>p</>: Value must always be stored plain.</para>
5568 <literal>e</>: Value can be stored in a <quote>secondary</quote>
5569 relation (if relation has one, see
5570 <literal>pg_class.reltoastrelid</literal>).
5574 <para><literal>m</>: Value can be stored compressed inline.</para>
5577 <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5580 Note that <literal>m</> columns can also be moved out to secondary
5581 storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5587 <entry><structfield>typnotnull</structfield></entry>
5588 <entry><type>bool</type></entry>
5591 <structfield>typnotnull</structfield> represents a not-null
5592 constraint on a type. Used for domains only.
5597 <entry><structfield>typbasetype</structfield></entry>
5598 <entry><type>oid</type></entry>
5599 <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5601 If this is a domain (see <structfield>typtype</structfield>), then
5602 <structfield>typbasetype</structfield> identifies the type that this
5603 one is based on. Zero if this type is not a domain.
5608 <entry><structfield>typtypmod</structfield></entry>
5609 <entry><type>int4</type></entry>
5612 Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5613 to be applied to their base type (-1 if base type does not use a
5614 <literal>typmod</>). -1 if this type is not a domain.
5619 <entry><structfield>typndims</structfield></entry>
5620 <entry><type>int4</type></entry>
5623 <structfield>typndims</structfield> is the number of array dimensions
5624 for a domain that is an array (that is, <structfield>typbasetype</> is
5625 an array type; the domain's <structfield>typelem</> will match the base
5626 type's <structfield>typelem</structfield>).
5627 Zero for types other than domains over array types.
5632 <entry><structfield>typdefaultbin</structfield></entry>
5633 <entry><type>text</type></entry>
5636 If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5637 representation of a default expression for the type. This is
5638 only used for domains.
5643 <entry><structfield>typdefault</structfield></entry>
5644 <entry><type>text</type></entry>
5647 <structfield>typdefault</> is null if the type has no associated
5648 default value. If <structfield>typdefaultbin</> is not null,
5649 <structfield>typdefault</> must contain a human-readable version of the
5650 default expression represented by <structfield>typdefaultbin</>. If
5651 <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5652 not, then <structfield>typdefault</> is the external representation of
5653 the type's default value, which might be fed to the type's input
5654 converter to produce a constant.
5662 <xref linkend="catalog-typcategory-table"> lists the system-defined values
5663 of <structfield>typcategory</>. Any future additions to this list will
5664 also be upper-case ASCII letters. All other ASCII characters are reserved
5665 for user-defined categories.
5668 <table id="catalog-typcategory-table">
5669 <title><structfield>typcategory</> Codes</title>
5675 <entry>Category</entry>
5681 <entry><literal>A</literal></entry>
5682 <entry>Array types</entry>
5685 <entry><literal>B</literal></entry>
5686 <entry>Boolean types</entry>
5689 <entry><literal>C</literal></entry>
5690 <entry>Composite types</entry>
5693 <entry><literal>D</literal></entry>
5694 <entry>Date/time types</entry>
5697 <entry><literal>E</literal></entry>
5698 <entry>Enum types</entry>
5701 <entry><literal>G</literal></entry>
5702 <entry>Geometric types</entry>
5705 <entry><literal>I</literal></entry>
5706 <entry>Network address types</entry>
5709 <entry><literal>N</literal></entry>
5710 <entry>Numeric types</entry>
5713 <entry><literal>P</literal></entry>
5714 <entry>Pseudo-types</entry>
5717 <entry><literal>S</literal></entry>
5718 <entry>String types</entry>
5721 <entry><literal>T</literal></entry>
5722 <entry>Timespan types</entry>
5725 <entry><literal>U</literal></entry>
5726 <entry>User-defined types</entry>
5729 <entry><literal>V</literal></entry>
5730 <entry>Bit-string types</entry>
5733 <entry><literal>X</literal></entry>
5734 <entry><type>unknown</> type</entry>
5743 <sect1 id="catalog-pg-user-mapping">
5744 <title><structname>pg_user_mapping</structname></title>
5746 <indexterm zone="catalog-pg-user-mapping">
5747 <primary>pg_user_mapping</primary>
5751 The catalog <structname>pg_user_mapping</structname> stores
5752 the mappings from local user to remote. Access to this catalog is
5753 restricted from normal users, use the view
5754 <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
5759 <title><structname>pg_user_mapping</> Columns</title>
5766 <entry>References</entry>
5767 <entry>Description</entry>
5773 <entry><structfield>umuser</structfield></entry>
5774 <entry><type>oid</type></entry>
5775 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5776 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
5780 <entry><structfield>umserver</structfield></entry>
5781 <entry><type>oid</type></entry>
5782 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
5784 The OID of the foreign server that contains this mapping
5789 <entry><structfield>umoptions</structfield></entry>
5790 <entry><type>text[]</type></entry>
5793 User mapping specific options, as <quote>keyword=value</> strings
5802 <sect1 id="views-overview">
5803 <title>System Views</title>
5806 In addition to the system catalogs, <productname>PostgreSQL</productname>
5807 provides a number of built-in views. Some system views provide convenient
5808 access to some commonly used queries on the system catalogs. Other views
5809 provide access to internal server state.
5813 The information schema (<xref linkend="information-schema">) provides
5814 an alternative set of views which overlap the functionality of the system
5815 views. Since the information schema is SQL-standard whereas the views
5816 described here are <productname>PostgreSQL</productname>-specific,
5817 it's usually better to use the information schema if it provides all
5818 the information you need.
5822 <xref linkend="view-table"> lists the system views described here.
5823 More detailed documentation of each view follows below.
5824 There are some additional views that provide access to the results of
5825 the statistics collector; they are described in <xref
5826 linkend="monitoring-stats-views-table">.
5830 Except where noted, all the views described here are read-only.
5833 <table id="view-table">
5834 <title>System Views</title>
5839 <entry>View Name</entry>
5840 <entry>Purpose</entry>
5846 <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5847 <entry>open cursors</entry>
5851 <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5852 <entry>groups of database users</entry>
5856 <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5857 <entry>indexes</entry>
5861 <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5862 <entry>currently held locks</entry>
5866 <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5867 <entry>prepared statements</entry>
5871 <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5872 <entry>prepared transactions</entry>
5876 <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5877 <entry>database roles</entry>
5881 <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5882 <entry>rules</entry>
5886 <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5887 <entry>parameter settings</entry>
5891 <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5892 <entry>database users</entry>
5896 <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5897 <entry>planner statistics</entry>
5901 <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5902 <entry>tables</entry>
5906 <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5907 <entry>time zone abbreviations</entry>
5911 <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5912 <entry>time zone names</entry>
5916 <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5917 <entry>database users</entry>
5921 <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5922 <entry>views</entry>
5930 <sect1 id="view-pg-cursors">
5931 <title><structname>pg_cursors</structname></title>
5933 <indexterm zone="view-pg-cursors">
5934 <primary>pg_cursors</primary>
5938 The <structname>pg_cursors</structname> view lists the cursors that
5939 are currently available. Cursors can be defined in several ways:
5943 via the <xref linkend="sql-declare">
5950 via the Bind message in the frontend/backend protocol, as
5951 described in <xref linkend="protocol-flow-ext-query">
5957 via the Server Programming Interface (SPI), as described in
5958 <xref linkend="spi-interface">
5963 The <structname>pg_cursors</structname> view displays cursors
5964 created by any of these means. Cursors only exist for the duration
5965 of the transaction that defines them, unless they have been
5966 declared <literal>WITH HOLD</literal>. Therefore non-holdable
5967 cursors are only present in the view until the end of their
5968 creating transaction.
5972 Cursors are used internally to implement some of the components
5973 of <productname>PostgreSQL</>, such as procedural languages.
5974 Therefore, the <structname>pg_cursors</> view might include cursors
5975 that have not been explicitly created by the user.
5981 <title><structname>pg_cursors</> Columns</title>
5988 <entry>Description</entry>
5994 <entry><structfield>name</structfield></entry>
5995 <entry><type>text</type></entry>
5996 <entry>The name of the cursor</entry>
6000 <entry><structfield>statement</structfield></entry>
6001 <entry><type>text</type></entry>
6002 <entry>The verbatim query string submitted to declare this cursor</entry>
6006 <entry><structfield>is_holdable</structfield></entry>
6007 <entry><type>boolean</type></entry>
6009 <literal>true</literal> if the cursor is holdable (that is, it
6010 can be accessed after the transaction that declared the cursor
6011 has committed); <literal>false</literal> otherwise
6016 <entry><structfield>is_binary</structfield></entry>
6017 <entry><type>boolean</type></entry>
6019 <literal>true</literal> if the cursor was declared
6020 <literal>BINARY</literal>; <literal>false</literal>
6026 <entry><structfield>is_scrollable</structfield></entry>
6027 <entry><type>boolean</type></entry>
6029 <literal>true</> if the cursor is scrollable (that is, it
6030 allows rows to be retrieved in a nonsequential manner);
6031 <literal>false</literal> otherwise
6036 <entry><structfield>creation_time</structfield></entry>
6037 <entry><type>timestamptz</type></entry>
6038 <entry>The time at which the cursor was declared</entry>
6045 The <structname>pg_cursors</structname> view is read only.
6050 <sect1 id="view-pg-group">
6051 <title><structname>pg_group</structname></title>
6053 <indexterm zone="view-pg-group">
6054 <primary>pg_group</primary>
6058 The view <structname>pg_group</structname> exists for backwards
6059 compatibility: it emulates a catalog that existed in
6060 <productname>PostgreSQL</productname> before version 8.1.
6061 It shows the names and members of all roles that are marked as not
6062 <structfield>rolcanlogin</>, which is an approximation to the set
6063 of roles that are being used as groups.
6067 <title><structname>pg_group</> Columns</title>
6074 <entry>References</entry>
6075 <entry>Description</entry>
6081 <entry><structfield>groname</structfield></entry>
6082 <entry><type>name</type></entry>
6083 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6084 <entry>Name of the group</entry>
6088 <entry><structfield>grosysid</structfield></entry>
6089 <entry><type>oid</type></entry>
6090 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6091 <entry>ID of this group</entry>
6095 <entry><structfield>grolist</structfield></entry>
6096 <entry><type>oid[]</type></entry>
6097 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6098 <entry>An array containing the IDs of the roles in this group</entry>
6106 <sect1 id="view-pg-indexes">
6107 <title><structname>pg_indexes</structname></title>
6109 <indexterm zone="view-pg-indexes">
6110 <primary>pg_indexes</primary>
6114 The view <structname>pg_indexes</structname> provides access to
6115 useful information about each index in the database.
6119 <title><structname>pg_indexes</> Columns</title>
6126 <entry>References</entry>
6127 <entry>Description</entry>
6132 <entry><structfield>schemaname</structfield></entry>
6133 <entry><type>name</type></entry>
6134 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6135 <entry>Name of schema containing table and index</entry>
6138 <entry><structfield>tablename</structfield></entry>
6139 <entry><type>name</type></entry>
6140 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6141 <entry>Name of table the index is for</entry>
6144 <entry><structfield>indexname</structfield></entry>
6145 <entry><type>name</type></entry>
6146 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6147 <entry>Name of index</entry>
6150 <entry><structfield>tablespace</structfield></entry>
6151 <entry><type>name</type></entry>
6152 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6153 <entry>Name of tablespace containing index (null if default for database)</entry>
6156 <entry><structfield>indexdef</structfield></entry>
6157 <entry><type>text</type></entry>
6159 <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
6168 <sect1 id="view-pg-locks">
6169 <title><structname>pg_locks</structname></title>
6171 <indexterm zone="view-pg-locks">
6172 <primary>pg_locks</primary>
6176 The view <structname>pg_locks</structname> provides access to
6177 information about the locks held by open transactions within the
6178 database server. See <xref linkend="mvcc"> for more discussion
6183 <structname>pg_locks</structname> contains one row per active lockable
6184 object, requested lock mode, and relevant transaction. Thus, the same
6185 lockable object might
6186 appear many times, if multiple transactions are holding or waiting
6187 for locks on it. However, an object that currently has no locks on it
6188 will not appear at all.
6192 There are several distinct types of lockable objects:
6193 whole relations (e.g., tables), individual pages of relations,
6194 individual tuples of relations,
6195 transaction IDs (both virtual and permanent IDs),
6196 and general database objects (identified by class OID and object OID,
6197 in the same way as in <structname>pg_description</structname> or
6198 <structname>pg_depend</structname>). Also, the right to extend a
6199 relation is represented as a separate lockable object.
6203 <title><structname>pg_locks</> Columns</title>
6210 <entry>References</entry>
6211 <entry>Description</entry>
6216 <entry><structfield>locktype</structfield></entry>
6217 <entry><type>text</type></entry>
6220 Type of the lockable object:
6221 <literal>relation</>,
6225 <literal>transactionid</>,
6226 <literal>virtualxid</>,
6228 <literal>userlock</>, or
6229 <literal>advisory</>
6233 <entry><structfield>database</structfield></entry>
6234 <entry><type>oid</type></entry>
6235 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6237 OID of the database in which the object exists, or
6238 zero if the object is a shared object, or
6239 null if the object is a transaction ID
6243 <entry><structfield>relation</structfield></entry>
6244 <entry><type>oid</type></entry>
6245 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6247 OID of the relation, or null if the object is not
6248 a relation or part of a relation
6252 <entry><structfield>page</structfield></entry>
6253 <entry><type>integer</type></entry>
6256 Page number within the relation, or null if the object
6257 is not a tuple or relation page
6261 <entry><structfield>tuple</structfield></entry>
6262 <entry><type>smallint</type></entry>
6265 Tuple number within the page, or null if the object is not a tuple
6269 <entry><structfield>virtualxid</structfield></entry>
6270 <entry><type>text</type></entry>
6273 Virtual ID of a transaction, or null if the object is not a
6274 virtual transaction ID
6278 <entry><structfield>transactionid</structfield></entry>
6279 <entry><type>xid</type></entry>
6282 ID of a transaction, or null if the object is not a transaction ID
6286 <entry><structfield>classid</structfield></entry>
6287 <entry><type>oid</type></entry>
6288 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6290 OID of the system catalog containing the object, or null if the
6291 object is not a general database object
6295 <entry><structfield>objid</structfield></entry>
6296 <entry><type>oid</type></entry>
6297 <entry>any OID column</entry>
6299 OID of the object within its system catalog, or null if the
6300 object is not a general database object.
6301 For advisory locks it is used to distinguish the two key
6302 spaces (<literal>1</> for an int8 key, <literal>2</> for two
6307 <entry><structfield>objsubid</structfield></entry>
6308 <entry><type>smallint</type></entry>
6311 For a table column, this is the column number (the
6312 <structfield>classid</> and <structfield>objid</> refer to the
6313 table itself). For all other object types, this column is
6314 zero. Null if the object is not a general database object
6318 <entry><structfield>virtualtransaction</structfield></entry>
6319 <entry><type>text</type></entry>
6322 Virtual ID of the transaction that is holding or awaiting this lock
6326 <entry><structfield>pid</structfield></entry>
6327 <entry><type>integer</type></entry>
6330 Process ID of the server process holding or awaiting this
6331 lock. Null if the lock is held by a prepared transaction.
6335 <entry><structfield>mode</structfield></entry>
6336 <entry><type>text</type></entry>
6338 <entry>Name of the lock mode held or desired by this process (see <xref
6339 linkend="locking-tables">)</entry>
6342 <entry><structfield>granted</structfield></entry>
6343 <entry><type>boolean</type></entry>
6345 <entry>True if lock is held, false if lock is awaited</entry>
6352 <structfield>granted</structfield> is true in a row representing a lock
6353 held by the indicated transaction. False indicates that this transaction is
6354 currently waiting to acquire this lock, which implies that some other
6355 transaction is holding a conflicting lock mode on the same lockable object.
6356 The waiting transaction will sleep until the other lock is released (or a
6357 deadlock situation is detected). A single transaction can be waiting to
6358 acquire at most one lock at a time.
6362 Every transaction holds an exclusive lock on its virtual transaction ID for
6363 its entire duration. If a permanent ID is assigned to the transaction
6364 (which normally happens only if the transaction changes the state of the
6365 database), it also holds an exclusive lock on its permanent transaction ID
6366 until it ends. When one transaction finds it necessary to wait specifically
6367 for another transaction, it does so by attempting to acquire share lock on
6368 the other transaction ID (either virtual or permanent ID depending on the
6369 situation). That will succeed only when the other transaction
6370 terminates and releases its locks.
6374 Although tuples are a lockable type of object,
6375 information about row-level locks is stored on disk, not in memory,
6376 and therefore row-level locks normally do not appear in this view.
6377 If a transaction is waiting for a
6378 row-level lock, it will usually appear in the view as waiting for the
6379 permanent transaction ID of the current holder of that row lock.
6383 Advisory locks can be acquired on keys consisting of either a single
6384 <type>bigint</type> value or two integer values. A <type>bigint</type> key is displayed with its
6385 high-order half in the <structfield>classid</> column, its low-order half
6386 in the <structfield>objid</> column, and <structfield>objsubid</> equal
6387 to 1. Integer keys are displayed with the first key in the
6388 <structfield>classid</> column, the second key in the <structfield>objid</>
6389 column, and <structfield>objsubid</> equal to 2. The actual meaning of
6390 the keys is up to the user. Advisory locks are local to each database,
6391 so the <structfield>database</> column is meaningful for an advisory lock.
6395 When the <structname>pg_locks</structname> view is accessed, the
6396 internal lock manager data structures are momentarily locked, and
6397 a copy is made for the view to display. This ensures that the
6398 view produces a consistent set of results, while not blocking
6399 normal lock manager operations longer than necessary. Nonetheless
6400 there could be some impact on database performance if this view is
6401 frequently accessed.
6405 <structname>pg_locks</structname> provides a global view of all locks
6406 in the database cluster, not only those relevant to the current database.
6407 Although its <structfield>relation</structfield> column can be joined
6408 against <structname>pg_class</>.<structfield>oid</> to identify locked
6409 relations, this will only work correctly for relations in the current
6410 database (those for which the <structfield>database</structfield> column
6411 is either the current database's OID or zero).
6415 The <structfield>pid</structfield> column can be joined to the
6416 <structfield>procpid</structfield> column of the
6417 <structname>pg_stat_activity</structname> view to get more
6418 information on the session holding or waiting to hold each lock.
6419 Also, if you are using prepared transactions, the
6420 <structfield>transaction</> column can be joined to the
6421 <structfield>transaction</structfield> column of the
6422 <structname>pg_prepared_xacts</structname> view to get more
6423 information on prepared transactions that hold locks.
6424 (A prepared transaction can never be waiting for a lock,
6425 but it continues to hold the locks it acquired while running.)
6430 <sect1 id="view-pg-prepared-statements">
6431 <title><structname>pg_prepared_statements</structname></title>
6433 <indexterm zone="view-pg-prepared-statements">
6434 <primary>pg_prepared_statements</primary>
6438 The <structname>pg_prepared_statements</structname> view displays
6439 all the prepared statements that are available in the current
6440 session. See <xref linkend="sql-prepare"> for more information about prepared
6445 <structname>pg_prepared_statements</structname> contains one row
6446 for each prepared statement. Rows are added to the view when a new
6447 prepared statement is created and removed when a prepared statement
6448 is released (for example, via the <xref linkend="sql-deallocate"> command).
6452 <title><structname>pg_prepared_statements</> Columns</title>
6459 <entry>Description</entry>
6464 <entry><structfield>name</structfield></entry>
6465 <entry><type>text</type></entry>
6467 The identifier of the prepared statement
6471 <entry><structfield>statement</structfield></entry>
6472 <entry><type>text</type></entry>
6474 The query string submitted by the client to create this
6475 prepared statement. For prepared statements created via SQL,
6476 this is the <command>PREPARE</command> statement submitted by
6477 the client. For prepared statements created via the
6478 frontend/backend protocol, this is the text of the prepared
6483 <entry><structfield>prepare_time</structfield></entry>
6484 <entry><type>timestamptz</type></entry>
6486 The time at which the prepared statement was created
6490 <entry><structfield>parameter_types</structfield></entry>
6491 <entry><type>regtype[]</type></entry>
6493 The expected parameter types for the prepared statement in the
6494 form of an array of <type>regtype</type>. The OID corresponding
6495 to an element of this array can be obtained by casting the
6496 <type>regtype</type> value to <type>oid</type>.
6500 <entry><structfield>from_sql</structfield></entry>
6501 <entry><type>boolean</type></entry>
6503 <literal>true</literal> if the prepared statement was created
6504 via the <command>PREPARE</command> SQL statement;
6505 <literal>false</literal> if the statement was prepared via the
6506 frontend/backend protocol
6514 The <structname>pg_prepared_statements</structname> view is read only.
6518 <sect1 id="view-pg-prepared-xacts">
6519 <title><structname>pg_prepared_xacts</structname></title>
6521 <indexterm zone="view-pg-prepared-xacts">
6522 <primary>pg_prepared_xacts</primary>
6526 The view <structname>pg_prepared_xacts</structname> displays
6527 information about transactions that are currently prepared for two-phase
6528 commit (see <xref linkend="sql-prepare-transaction"> for details).
6532 <structname>pg_prepared_xacts</structname> contains one row per prepared
6533 transaction. An entry is removed when the transaction is committed or
6538 <title><structname>pg_prepared_xacts</> Columns</title>
6545 <entry>References</entry>
6546 <entry>Description</entry>
6551 <entry><structfield>transaction</structfield></entry>
6552 <entry><type>xid</type></entry>
6555 Numeric transaction identifier of the prepared transaction
6559 <entry><structfield>gid</structfield></entry>
6560 <entry><type>text</type></entry>
6563 Global transaction identifier that was assigned to the transaction
6567 <entry><structfield>prepared</structfield></entry>
6568 <entry><type>timestamp with time zone</type></entry>
6571 Time at which the transaction was prepared for commit
6575 <entry><structfield>owner</structfield></entry>
6576 <entry><type>name</type></entry>
6577 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6579 Name of the user that executed the transaction
6583 <entry><structfield>database</structfield></entry>
6584 <entry><type>name</type></entry>
6585 <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
6587 Name of the database in which the transaction was executed
6595 When the <structname>pg_prepared_xacts</structname> view is accessed, the
6596 internal transaction manager data structures are momentarily locked, and
6597 a copy is made for the view to display. This ensures that the
6598 view produces a consistent set of results, while not blocking
6599 normal operations longer than necessary. Nonetheless
6600 there could be some impact on database performance if this view is
6601 frequently accessed.
6606 <sect1 id="view-pg-roles">
6607 <title><structname>pg_roles</structname></title>
6609 <indexterm zone="view-pg-roles">
6610 <primary>pg_roles</primary>
6614 The view <structname>pg_roles</structname> provides access to
6615 information about database roles. This is simply a publicly
6617 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6618 that blanks out the password field.
6622 This view explicitly exposes the OID column of the underlying table,
6623 since that is needed to do joins to other catalogs.
6627 <title><structname>pg_roles</> Columns</title>
6634 <entry>References</entry>
6635 <entry>Description</entry>
6641 <entry><structfield>rolname</structfield></entry>
6642 <entry><type>name</type></entry>
6644 <entry>Role name</entry>
6648 <entry><structfield>rolsuper</structfield></entry>
6649 <entry><type>bool</type></entry>
6651 <entry>Role has superuser privileges</entry>
6655 <entry><structfield>rolinherit</structfield></entry>
6656 <entry><type>bool</type></entry>
6658 <entry>Role automatically inherits privileges of roles it is a
6663 <entry><structfield>rolcreaterole</structfield></entry>
6664 <entry><type>bool</type></entry>
6666 <entry>Role can create more roles</entry>
6670 <entry><structfield>rolcreatedb</structfield></entry>
6671 <entry><type>bool</type></entry>
6673 <entry>Role can create databases</entry>
6677 <entry><structfield>rolcatupdate</structfield></entry>
6678 <entry><type>bool</type></entry>
6681 Role can update system catalogs directly. (Even a superuser cannot do
6682 this unless this column is true.)
6687 <entry><structfield>rolcanlogin</structfield></entry>
6688 <entry><type>bool</type></entry>
6691 Role can log in. That is, this role can be given as the initial
6692 session authorization identifier
6697 <entry><structfield>rolconnlimit</structfield></entry>
6698 <entry><type>int4</type></entry>
6701 For roles that can log in, this sets maximum number of concurrent
6702 connections this role can make. -1 means no limit.
6707 <entry><structfield>rolpassword</structfield></entry>
6708 <entry><type>text</type></entry>
6710 <entry>Not the password (always reads as <literal>********</>)</entry>
6714 <entry><structfield>rolvaliduntil</structfield></entry>
6715 <entry><type>timestamptz</type></entry>
6717 <entry>Password expiry time (only used for password authentication);
6718 null if no expiration</entry>
6722 <entry><structfield>oid</structfield></entry>
6723 <entry><type>oid</type></entry>
6724 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6725 <entry>ID of role</entry>
6733 <sect1 id="view-pg-rules">
6734 <title><structname>pg_rules</structname></title>
6736 <indexterm zone="view-pg-rules">
6737 <primary>pg_rules</primary>
6741 The view <structname>pg_rules</structname> provides access to
6742 useful information about query rewrite rules.
6746 <title><structname>pg_rules</> Columns</title>
6753 <entry>References</entry>
6754 <entry>Description</entry>
6759 <entry><structfield>schemaname</structfield></entry>
6760 <entry><type>name</type></entry>
6761 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6762 <entry>Name of schema containing table</entry>
6765 <entry><structfield>tablename</structfield></entry>
6766 <entry><type>name</type></entry>
6767 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6768 <entry>Name of table the rule is for</entry>
6771 <entry><structfield>rulename</structfield></entry>
6772 <entry><type>name</type></entry>
6773 <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6774 <entry>Name of rule</entry>
6777 <entry><structfield>definition</structfield></entry>
6778 <entry><type>text</type></entry>
6780 <entry>Rule definition (a reconstructed creation command)</entry>
6787 The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6788 of views; those can be seen in <structname>pg_views</>.
6793 <sect1 id="view-pg-settings">
6794 <title><structname>pg_settings</structname></title>
6796 <indexterm zone="view-pg-settings">
6797 <primary>pg_settings</primary>
6801 The view <structname>pg_settings</structname> provides access to
6802 run-time parameters of the server. It is essentially an alternative
6803 interface to the <xref linkend="sql-show">
6804 and <xref linkend="sql-set"> commands.
6805 It also provides access to some facts about each parameter that are
6806 not directly available from <command>SHOW</>, such as minimum and
6811 <title><structname>pg_settings</> Columns</title>
6818 <entry>Description</entry>
6823 <entry><structfield>name</structfield></entry>
6824 <entry><type>text</type></entry>
6825 <entry>Run-time configuration parameter name</entry>
6828 <entry><structfield>setting</structfield></entry>
6829 <entry><type>text</type></entry>
6830 <entry>Current value of the parameter</entry>
6833 <entry><structfield>unit</structfield></entry>
6834 <entry><type>text</type></entry>
6835 <entry>Implicit unit of the parameter</entry>
6838 <entry><structfield>category</structfield></entry>
6839 <entry><type>text</type></entry>
6840 <entry>Logical group of the parameter</entry>
6843 <entry><structfield>short_desc</structfield></entry>
6844 <entry><type>text</type></entry>
6845 <entry>A brief description of the parameter</entry>
6848 <entry><structfield>extra_desc</structfield></entry>
6849 <entry><type>text</type></entry>
6850 <entry>Additional, more detailed, description of the parameter</entry>
6853 <entry><structfield>context</structfield></entry>
6854 <entry><type>text</type></entry>
6855 <entry>Context required to set the parameter's value</entry>
6858 <entry><structfield>vartype</structfield></entry>
6859 <entry><type>text</type></entry>
6860 <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6861 <literal>integer</>, <literal>real</>, or <literal>string</>)
6865 <entry><structfield>source</structfield></entry>
6866 <entry><type>text</type></entry>
6867 <entry>Source of the current parameter value</entry>
6870 <entry><structfield>min_val</structfield></entry>
6871 <entry><type>text</type></entry>
6872 <entry>Minimum allowed value of the parameter (null for non-numeric
6876 <entry><structfield>max_val</structfield></entry>
6877 <entry><type>text</type></entry>
6878 <entry>Maximum allowed value of the parameter (null for non-numeric
6882 <entry><structfield>enumvals</structfield></entry>
6883 <entry><type>text[]</type></entry>
6884 <entry>Allowed values of an enum parameter (null for non-enum
6888 <entry><structfield>boot_val</structfield></entry>
6889 <entry><type>text</type></entry>
6890 <entry>Parameter value assumed at server startup if the parameter is
6891 not otherwise set</entry>
6894 <entry><structfield>reset_val</structfield></entry>
6895 <entry><type>text</type></entry>
6896 <entry>Value that <command>RESET</command> would reset the parameter to
6897 in the current session</entry>
6900 <entry><structfield>sourcefile</structfield></entry>
6901 <entry><type>text</type></entry>
6902 <entry>Configuration file the current value was set in (null for
6903 values set from sources other than configuration files, or when
6904 examined by a non-superuser);
6905 helpful when using <literal>include</> directives in configuration files</entry>
6908 <entry><structfield>sourceline</structfield></entry>
6909 <entry><type>integer</type></entry>
6910 <entry>Line number within the configuration file the current value was
6911 set at (null for values set from sources other than configuration files,
6912 or when examined by a non-superuser)
6920 The <structname>pg_settings</structname> view cannot be inserted into or
6921 deleted from, but it can be updated. An <command>UPDATE</command> applied
6922 to a row of <structname>pg_settings</structname> is equivalent to executing
6923 the <xref linkend="sql-set"> command on that named
6924 parameter. The change only affects the value used by the current
6925 session. If an <command>UPDATE</command> is issued within a transaction
6926 that is later aborted, the effects of the <command>UPDATE</command> command
6927 disappear when the transaction is rolled back. Once the surrounding
6928 transaction is committed, the effects will persist until the end of the
6929 session, unless overridden by another <command>UPDATE</command> or
6930 <command>SET</command>.
6935 <sect1 id="view-pg-shadow">
6936 <title><structname>pg_shadow</structname></title>
6938 <indexterm zone="view-pg-shadow">
6939 <primary>pg_shadow</primary>
6943 The view <structname>pg_shadow</structname> exists for backwards
6944 compatibility: it emulates a catalog that existed in
6945 <productname>PostgreSQL</productname> before version 8.1.
6946 It shows properties of all roles that are marked as
6947 <structfield>rolcanlogin</> in
6948 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
6952 The name stems from the fact that this table
6953 should not be readable by the public since it contains passwords.
6954 <link linkend="view-pg-user"><structname>pg_user</structname></link>
6955 is a publicly readable view on
6956 <structname>pg_shadow</structname> that blanks out the password field.
6960 <title><structname>pg_shadow</> Columns</title>
6967 <entry>References</entry>
6968 <entry>Description</entry>
6974 <entry><structfield>usename</structfield></entry>
6975 <entry><type>name</type></entry>
6976 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6977 <entry>User name</entry>
6981 <entry><structfield>usesysid</structfield></entry>
6982 <entry><type>oid</type></entry>
6983 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6984 <entry>ID of this user</entry>
6988 <entry><structfield>usecreatedb</structfield></entry>
6989 <entry><type>bool</type></entry>
6991 <entry>User can create databases</entry>
6995 <entry><structfield>usesuper</structfield></entry>
6996 <entry><type>bool</type></entry>
6998 <entry>User is a superuser</entry>
7002 <entry><structfield>usecatupd</structfield></entry>
7003 <entry><type>bool</type></entry>
7006 User can update system catalogs. (Even a superuser cannot do
7007 this unless this column is true.)
7012 <entry><structfield>passwd</structfield></entry>
7013 <entry><type>text</type></entry>
7015 <entry>Password (possibly encrypted); null if none. See
7016 <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
7017 for details of how encrypted passwords are stored.</entry>
7021 <entry><structfield>valuntil</structfield></entry>
7022 <entry><type>abstime</type></entry>
7024 <entry>Password expiry time (only used for password authentication)</entry>
7028 <entry><structfield>useconfig</structfield></entry>
7029 <entry><type>text[]</type></entry>
7031 <entry>Session defaults for run-time configuration variables</entry>
7039 <sect1 id="view-pg-stats">
7040 <title><structname>pg_stats</structname></title>
7042 <indexterm zone="view-pg-stats">
7043 <primary>pg_stats</primary>
7047 The view <structname>pg_stats</structname> provides access to
7048 the information stored in the <link
7049 linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
7050 catalog. This view allows access only to rows of
7051 <structname>pg_statistic</structname> that correspond to tables the
7052 user has permission to read, and therefore it is safe to allow public
7053 read access to this view.
7057 <structname>pg_stats</structname> is also designed to present the
7058 information in a more readable format than the underlying catalog
7059 — at the cost that its schema must be extended whenever new slot types
7060 are defined for <structname>pg_statistic</structname>.
7064 <title><structname>pg_stats</> Columns</title>
7071 <entry>References</entry>
7072 <entry>Description</entry>
7077 <entry><structfield>schemaname</structfield></entry>
7078 <entry><type>name</type></entry>
7079 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7080 <entry>Name of schema containing table</entry>
7084 <entry><structfield>tablename</structfield></entry>
7085 <entry><type>name</type></entry>
7086 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7087 <entry>Name of table</entry>
7091 <entry><structfield>attname</structfield></entry>
7092 <entry><type>name</type></entry>
7093 <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
7094 <entry>Name of the column described by this row</entry>
7098 <entry><structfield>inherited</structfield></entry>
7099 <entry><type>bool</type></entry>
7101 <entry>If true, this row includes inheritance child columns, not just the
7102 values in the specified table</entry>
7106 <entry><structfield>null_frac</structfield></entry>
7107 <entry><type>real</type></entry>
7109 <entry>Fraction of column entries that are null</entry>
7113 <entry><structfield>avg_width</structfield></entry>
7114 <entry><type>integer</type></entry>
7116 <entry>Average width in bytes of column's entries</entry>
7120 <entry><structfield>n_distinct</structfield></entry>
7121 <entry><type>real</type></entry>
7124 If greater than zero, the estimated number of distinct values in the
7125 column. If less than zero, the negative of the number of distinct
7126 values divided by the number of rows. (The negated form is used when
7127 <command>ANALYZE</> believes that the number of distinct values is
7128 likely to increase as the table grows; the positive form is used when
7129 the column seems to have a fixed number of possible values.) For
7130 example, -1 indicates a unique column in which the number of distinct
7131 values is the same as the number of rows.
7136 <entry><structfield>most_common_vals</structfield></entry>
7137 <entry><type>anyarray</type></entry>
7140 A list of the most common values in the column. (Null if
7141 no values seem to be more common than any others.)
7142 For some data types such as <type>tsvector</>, this is a list of
7143 the most common element values rather than values of the type itself.
7148 <entry><structfield>most_common_freqs</structfield></entry>
7149 <entry><type>real[]</type></entry>
7152 A list of the frequencies of the most common values or elements,
7153 i.e., number of occurrences of each divided by total number of rows.
7154 (Null when <structfield>most_common_vals</structfield> is.)
7155 For some data types such as <type>tsvector</>, it can also store some
7156 additional information, making it longer than the
7157 <structfield>most_common_vals</> array.
7162 <entry><structfield>histogram_bounds</structfield></entry>
7163 <entry><type>anyarray</type></entry>
7166 A list of values that divide the column's values into groups of
7167 approximately equal population. The values in
7168 <structfield>most_common_vals</>, if present, are omitted from this
7169 histogram calculation. (This column is null if the column data type
7170 does not have a <literal><</> operator or if the
7171 <structfield>most_common_vals</> list accounts for the entire
7177 <entry><structfield>correlation</structfield></entry>
7178 <entry><type>real</type></entry>
7181 Statistical correlation between physical row ordering and
7182 logical ordering of the column values. This ranges from -1 to +1.
7183 When the value is near -1 or +1, an index scan on the column will
7184 be estimated to be cheaper than when it is near zero, due to reduction
7185 of random access to the disk. (This column is null if the column data
7186 type does not have a <literal><</> operator.)
7194 The maximum number of entries in the <structfield>most_common_vals</>
7195 and <structfield>histogram_bounds</> arrays can be set on a
7196 column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
7197 command, or globally by setting the
7198 <xref linkend="guc-default-statistics-target"> run-time parameter.
7203 <sect1 id="view-pg-tables">
7204 <title><structname>pg_tables</structname></title>
7206 <indexterm zone="view-pg-tables">
7207 <primary>pg_tables</primary>
7211 The view <structname>pg_tables</structname> provides access to
7212 useful information about each table in the database.
7216 <title><structname>pg_tables</> Columns</title>
7223 <entry>References</entry>
7224 <entry>Description</entry>
7229 <entry><structfield>schemaname</structfield></entry>
7230 <entry><type>name</type></entry>
7231 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7232 <entry>Name of schema containing table</entry>
7235 <entry><structfield>tablename</structfield></entry>
7236 <entry><type>name</type></entry>
7237 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7238 <entry>Name of table</entry>
7241 <entry><structfield>tableowner</structfield></entry>
7242 <entry><type>name</type></entry>
7243 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7244 <entry>Name of table's owner</entry>
7247 <entry><structfield>tablespace</structfield></entry>
7248 <entry><type>name</type></entry>
7249 <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7250 <entry>Name of tablespace containing table (null if default for database)</entry>
7253 <entry><structfield>hasindexes</structfield></entry>
7254 <entry><type>boolean</type></entry>
7255 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
7256 <entry>True if table has (or recently had) any indexes</entry>
7259 <entry><structfield>hasrules</structfield></entry>
7260 <entry><type>boolean</type></entry>
7261 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
7262 <entry>True if table has (or once had) rules</entry>
7265 <entry><structfield>hastriggers</structfield></entry>
7266 <entry><type>boolean</type></entry>
7267 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
7268 <entry>True if table has (or once had) triggers</entry>
7276 <sect1 id="view-pg-timezone-abbrevs">
7277 <title><structname>pg_timezone_abbrevs</structname></title>
7279 <indexterm zone="view-pg-timezone-abbrevs">
7280 <primary>pg_timezone_abbrevs</primary>
7284 The view <structname>pg_timezone_abbrevs</structname> provides a list
7285 of time zone abbreviations that are currently recognized by the datetime
7286 input routines. The contents of this view change when the
7287 <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
7291 <title><structname>pg_timezone_abbrevs</> Columns</title>
7298 <entry>Description</entry>
7303 <entry><structfield>abbrev</structfield></entry>
7304 <entry><type>text</type></entry>
7305 <entry>Time zone abbreviation</entry>
7308 <entry><structfield>utc_offset</structfield></entry>
7309 <entry><type>interval</type></entry>
7310 <entry>Offset from UTC (positive means east of Greenwich)</entry>
7313 <entry><structfield>is_dst</structfield></entry>
7314 <entry><type>boolean</type></entry>
7315 <entry>True if this is a daylight-savings abbreviation</entry>
7323 <sect1 id="view-pg-timezone-names">
7324 <title><structname>pg_timezone_names</structname></title>
7326 <indexterm zone="view-pg-timezone-names">
7327 <primary>pg_timezone_names</primary>
7331 The view <structname>pg_timezone_names</structname> provides a list
7332 of time zone names that are recognized by <command>SET TIMEZONE</>,
7333 along with their associated abbreviations, UTC offsets,
7334 and daylight-savings status.
7335 Unlike the abbreviations shown in <link
7336 linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
7337 date rules. Therefore, the associated information changes across local DST
7338 boundaries. The displayed information is computed based on the current
7339 value of <function>CURRENT_TIMESTAMP</>.
7343 <title><structname>pg_timezone_names</> Columns</title>
7350 <entry>Description</entry>
7355 <entry><structfield>name</structfield></entry>
7356 <entry><type>text</type></entry>
7357 <entry>Time zone name</entry>
7360 <entry><structfield>abbrev</structfield></entry>
7361 <entry><type>text</type></entry>
7362 <entry>Time zone abbreviation</entry>
7365 <entry><structfield>utc_offset</structfield></entry>
7366 <entry><type>interval</type></entry>
7367 <entry>Offset from UTC (positive means east of Greenwich)</entry>
7370 <entry><structfield>is_dst</structfield></entry>
7371 <entry><type>boolean</type></entry>
7372 <entry>True if currently observing daylight savings</entry>
7380 <sect1 id="view-pg-user">
7381 <title><structname>pg_user</structname></title>
7383 <indexterm zone="view-pg-user">
7384 <primary>pg_user</primary>
7388 The view <structname>pg_user</structname> provides access to
7389 information about database users. This is simply a publicly
7391 <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
7392 that blanks out the password field.
7396 <title><structname>pg_user</> Columns</title>
7403 <entry>Description</entry>
7408 <entry><structfield>usename</structfield></entry>
7409 <entry><type>name</type></entry>
7410 <entry>User name</entry>
7414 <entry><structfield>usesysid</structfield></entry>
7415 <entry><type>int4</type></entry>
7416 <entry>User ID (arbitrary number used to reference this user)</entry>
7420 <entry><structfield>usecreatedb</structfield></entry>
7421 <entry><type>bool</type></entry>
7422 <entry>User can create databases</entry>
7426 <entry><structfield>usesuper</structfield></entry>
7427 <entry><type>bool</type></entry>
7428 <entry>User is a superuser</entry>
7432 <entry><structfield>usecatupd</structfield></entry>
7433 <entry><type>bool</type></entry>
7435 User can update system catalogs. (Even a superuser cannot do
7436 this unless this column is true.)
7441 <entry><structfield>passwd</structfield></entry>
7442 <entry><type>text</type></entry>
7443 <entry>Not the password (always reads as <literal>********</>)</entry>
7447 <entry><structfield>valuntil</structfield></entry>
7448 <entry><type>abstime</type></entry>
7449 <entry>Password expiry time (only used for password authentication)</entry>
7453 <entry><structfield>useconfig</structfield></entry>
7454 <entry><type>text[]</type></entry>
7455 <entry>Session defaults for run-time configuration variables</entry>
7463 <sect1 id="view-pg-user-mappings">
7464 <title><structname>pg_user_mappings</structname></title>
7466 <indexterm zone="view-pg-user-mappings">
7467 <primary>pg_user_mappings</primary>
7471 The view <structname>pg_user_mappings</structname> provides access
7472 to information about user mappings. This is essentially a publicly
7474 <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
7475 that leaves out the options field if the user has no rights to use
7480 <title><structname>pg_user_mappings</> Columns</title>
7487 <entry>References</entry>
7488 <entry>Description</entry>
7494 <entry><structfield>umid</structfield></entry>
7495 <entry><type>oid</type></entry>
7496 <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
7497 <entry>OID of the user mapping</entry>
7501 <entry><structfield>srvid</structfield></entry>
7502 <entry><type>oid</type></entry>
7503 <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7505 The OID of the foreign server that contains this mapping
7510 <entry><structfield>srvname</structfield></entry>
7511 <entry><type>text</type></entry>
7514 Name of the foreign server
7519 <entry><structfield>umuser</structfield></entry>
7520 <entry><type>oid</type></entry>
7521 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7522 <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7526 <entry><structfield>usename</structfield></entry>
7527 <entry><type>name</type></entry>
7529 <entry>Name of the local user to be mapped</entry>
7533 <entry><structfield>umoptions</structfield></entry>
7534 <entry><type>text[]</type></entry>
7537 User mapping specific options, as <quote>keyword=value</>
7538 strings, if the current user is the owner of the foreign
7548 <sect1 id="view-pg-views">
7549 <title><structname>pg_views</structname></title>
7551 <indexterm zone="view-pg-views">
7552 <primary>pg_views</primary>
7556 The view <structname>pg_views</structname> provides access to
7557 useful information about each view in the database.
7561 <title><structname>pg_views</> Columns</title>
7568 <entry>References</entry>
7569 <entry>Description</entry>
7574 <entry><structfield>schemaname</structfield></entry>
7575 <entry><type>name</type></entry>
7576 <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7577 <entry>Name of schema containing view</entry>
7580 <entry><structfield>viewname</structfield></entry>
7581 <entry><type>name</type></entry>
7582 <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7583 <entry>Name of view</entry>
7586 <entry><structfield>viewowner</structfield></entry>
7587 <entry><type>name</type></entry>
7588 <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7589 <entry>Name of view's owner</entry>
7592 <entry><structfield>definition</structfield></entry>
7593 <entry><type>text</type></entry>
7595 <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>